summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2009-08-28 17:39:54 (GMT)
committerKevin Smith <git@kismith.co.uk>2009-08-28 17:39:54 (GMT)
commit451279c7debea59517dae1fa5c99f036b31f2199 (patch)
tree4b80a1e0ada78bf324f8f8b892d518f56e7c49b4
parenta7d991706247db6b279a0c049d0b094632c7ec7d (diff)
downloadswift-451279c7debea59517dae1fa5c99f036b31f2199.zip
swift-451279c7debea59517dae1fa5c99f036b31f2199.tar.bz2
Don't duplicate menus on reconnect, make menubar global on Mac.
-rw-r--r--Swift/QtUI/QtLoginWindow.cpp10
-rw-r--r--Swift/QtUI/QtLoginWindow.h3
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_;
};
}