add options menu
authorJohn Kern <johnk@symbian.org>
Fri, 13 Aug 2010 15:33:51 -0700
changeset 30 33e489bb7487
parent 29 a9f1d0e21384
child 31 7140311376c0
add options menu
contactengine/mainwindow.cpp
contactengine/mainwindow.h
--- a/contactengine/mainwindow.cpp	Fri Aug 13 13:03:12 2010 -0700
+++ b/contactengine/mainwindow.cpp	Fri Aug 13 15:33:51 2010 -0700
@@ -1,4 +1,5 @@
 #include <QComboBox>
+#include <QMenuBar>
 #include <QMessageBox>
 
 #include <QDebug>
@@ -24,11 +25,29 @@
 
     ui->comboBox->addItems(this->ce->dataSources());
     ui->listView->setModel(this->ce);
+
+    this->createMenus();
+}
+
+void MainWindow::createMenus()
+    {
+        verAction = new QAction(tr("&Version"),this);
+        menuBar()->addAction(verAction);
+        connect(verAction, SIGNAL(triggered()),this, SLOT(displayVersion()));
+
+        exitAction = new QAction(tr("&Exit"),this);
+        menuBar()->addAction(exitAction);
+        connect(exitAction, SIGNAL(triggered()),this, SLOT(close()));
+    }
+
+void MainWindow::displayVersion()
+{
+    QMessageBox::information(this,"Qt Version", qVersion());
 }
 
 void MainWindow::errorOccurred(QString errMsg)
 {
-    QMessageBox::warning(this,"Err Routed",errMsg);
+    QMessageBox::information(this,"Err Routed",errMsg);
     qDebug() << errMsg << endl;
 }
 
--- a/contactengine/mainwindow.h	Fri Aug 13 13:03:12 2010 -0700
+++ b/contactengine/mainwindow.h	Fri Aug 13 15:33:51 2010 -0700
@@ -15,11 +15,16 @@
 public:
     explicit MainWindow(QWidget *parent = 0);
     ~MainWindow();
+    void createMenus();
 
 public slots:
     void errorOccurred(QString errMsg);
+    void displayVersion();
+
 
 private:
+    QAction *verAction;
+    QAction *exitAction;
     Ui::MainWindow *ui;
     ContactsEngine *ce;
 };