diff options
-rw-r--r-- | Swift/QtUI/QtLoginWindow.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/QtLoginWindow.h | 3 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Swift/QtUI/QtLoginWindow.cpp b/Swift/QtUI/QtLoginWindow.cpp index 03c6150..8b53499 100644 --- a/Swift/QtUI/QtLoginWindow.cpp +++ b/Swift/QtUI/QtLoginWindow.cpp @@ -79,6 +79,8 @@ QtLoginWindow::QtLoginWindow(const String& defaultJID, const String& defaultPass layout->addWidget(remember_); connect(loginButton_, SIGNAL(clicked()), SLOT(loginClicked())); stack_->addWidget(wrapperWidget); + menuBar_ = new QMenuBar(NULL); + setInitialMenus(); this->show(); } @@ -88,6 +90,7 @@ void QtLoginWindow::loggedOut() { stack_->setCurrentIndex(0); stack_->removeWidget(current); } + setInitialMenus(); setEnabled(true); } @@ -108,14 +111,19 @@ void QtLoginWindow::handleCertficateChecked(bool checked) { } } +void QtLoginWindow::setInitialMenus() { + menuBar_->clear(); +} + void QtLoginWindow::morphInto(MainWindow *mainWindow) { QtMainWindow *qtMainWindow = dynamic_cast<QtMainWindow*>(mainWindow); assert(qtMainWindow); stack_->addWidget(qtMainWindow); stack_->setCurrentWidget(qtMainWindow); setEnabled(true); + setInitialMenus(); foreach (QMenu* menu, qtMainWindow->getMenus()) { - menuBar()->addMenu(menu); + menuBar_->addMenu(menu); } } diff --git a/Swift/QtUI/QtLoginWindow.h b/Swift/QtUI/QtLoginWindow.h index 173a6b9..9b190e9 100644 --- a/Swift/QtUI/QtLoginWindow.h +++ b/Swift/QtUI/QtLoginWindow.h @@ -6,6 +6,7 @@ #include <QPushButton> #include <QCheckBox> #include <QStackedWidget> +#include <QMenuBar> #include "Swift/Controllers/LoginWindow.h" #include "Swift/Controllers/MainWindow.h" @@ -28,6 +29,7 @@ namespace Swift { void handleCertficateChecked(bool); private: + void setInitialMenus(); QLineEdit *username_; QLineEdit *password_; QPushButton *loginButton_; @@ -36,6 +38,7 @@ namespace Swift { QLabel* message_; QString certificateFile_; QToolButton* certificateButton_; + QMenuBar* menuBar_; }; } |