00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "nfcsharewindow.h"
00033 #include "nfcsharewrapper.h"
00034
00035
00036 #include <QMessageBox>
00037
00038
00039
00040
00041
00042
00043
00044 NfcShareWindow::NfcShareWindow(QWidget *parent) : QMainWindow(parent)
00045 {
00046 mNfcShareWrapper = new NfcShareWrapper();
00047 menubar = new QMenuBar(this);
00048 menubar->setObjectName(QString::fromUtf8("menubar"));
00049 menubar->setGeometry(QRect(0, 0, 800, 18));
00050 setMenuBar(menubar);
00051
00052 createMenu();
00053 }
00054
00055
00056
00057
00058 void NfcShareWindow::createMenu()
00059 {
00060
00061 menu_startEasySetup= new QAction(tr("Start Easy setup"), this);
00062 menuBar()->addAction(menu_startEasySetup);
00063 connect(menu_startEasySetup, SIGNAL(triggered()), this, SLOT(startEasySetupService()));
00064
00065
00066 menu_startSharingvCard= new QAction(tr("Start Sharing vCard"), this);
00067 menuBar()->addAction(menu_startSharingvCard);
00068 connect(menu_startSharingvCard , SIGNAL(triggered()), this, SLOT(startSharingvCard()));
00069
00070
00071 menu_startSharingvCal= new QAction(tr("Start Sharing vCal"), this);
00072 menuBar()->addAction(menu_startSharingvCal);
00073 connect(menu_startSharingvCal , SIGNAL(triggered()), this, SLOT(startSharingvCal()));
00074
00075
00076 menu_stopEasySetup = new QAction(tr("Stop Easy setup"), this);
00077 menuBar()->addAction(menu_stopEasySetup);
00078 connect(menu_stopEasySetup, SIGNAL(triggered()), this, SLOT(stopEasySetupService()));
00079
00080
00081 menu_helpAction = new QAction(tr("Help"), this);
00082 menuBar()->addAction(menu_helpAction);
00083 connect(menu_helpAction, SIGNAL(triggered()), this, SLOT(helpAction()));
00084
00085
00086 menu_aboutAction = new QAction(tr("About"), this);
00087 menuBar()->addAction(menu_aboutAction);
00088 connect(menu_aboutAction, SIGNAL(triggered()), this, SLOT(aboutAction()));
00089
00090
00091 menu_exitAction = new QAction(tr("Exit"), this);
00092 menuBar()->addAction(menu_exitAction);
00093 connect(menu_exitAction, SIGNAL(triggered()), this, SLOT(close()));
00094
00095
00096 connect(mNfcShareWrapper, SIGNAL(windowUpdated(QString)), this, SLOT(notifyWindow(QString)));
00097 }
00098
00099
00100
00101 void NfcShareWindow::helpAction()
00102 {
00103 QMessageBox msgBox;
00104
00105 msgBox.setInformativeText("Select \"Start Easy Setup\" menu option, holding the NFC enabled devices close to commuinicate over NFC channel. "
00106 "After pairing over the bearer channel, select \"Start Sharing vCard or vCal \" menu option to transfer vCard or vCal.");
00107 msgBox.exec();
00108 }
00109
00110
00111
00112 void NfcShareWindow::aboutAction()
00113 {
00114 QMessageBox msgBox;
00115
00116 msgBox.setInformativeText("NFC Sharing application, Ver 1.0 Copyright (c) 2010 Nokia. All rights reserved");
00117 msgBox.exec();
00118 }
00119
00120
00121
00122
00123 void NfcShareWindow::startSharingvCard()
00124 {
00125 mNfcShareWrapper->startSharingService(ENfcvCard);
00126 }
00127
00128
00129
00130
00131 void NfcShareWindow::startSharingvCal()
00132 {
00133 mNfcShareWrapper->startSharingService(ENfcvCal);
00134 }
00135
00136
00137
00138 void NfcShareWindow::startEasySetupService()
00139 {
00140 mNfcShareWrapper->startEasySetupService();
00141 }
00142
00143
00144
00145
00146 void NfcShareWindow::stopEasySetupService()
00147 {
00148 mNfcShareWrapper->stopService();
00149 }
00150
00151
00152
00153
00154
00155 void NfcShareWindow::notifyWindow(QString aStrMsg)
00156 {
00157 QMessageBox msgBox;
00158 msgBox.setInformativeText(aStrMsg);
00159 msgBox.exec();
00160 }
00161
00162
00163
00164
00165 NfcShareWindow::~NfcShareWindow()
00166 {
00167 if(mNfcShareWrapper)
00168 {
00169 delete mNfcShareWrapper;
00170 mNfcShareWrapper = NULL;
00171 }
00172 }