summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI')
-rw-r--r--Swift/QtUI/QtChatTabs.cpp11
-rw-r--r--Swift/QtUI/QtChatTabs.h2
-rw-r--r--Swift/QtUI/QtChatWindow.cpp4
-rw-r--r--Swift/QtUI/QtChatWindow.h1
-rw-r--r--Swift/QtUI/QtChatWindowFactory.cpp5
-rw-r--r--Swift/QtUI/QtTabbable.h1
6 files changed, 23 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp
index a896dc9..e79b2ef 100644
--- a/Swift/QtUI/QtChatTabs.cpp
+++ b/Swift/QtUI/QtChatTabs.cpp
@@ -1,6 +1,7 @@
#include "QtChatTabs.h"
#include <QCloseEvent>
+#include <QtGlobal>
#include <QTabWidget>
#include <QLayout>
@@ -36,6 +37,7 @@ void QtChatTabs::addTab(QtTabbable* tab) {
connect(tab, SIGNAL(titleUpdated()), this, SLOT(handleTabTitleUpdated()));
connect(tab, SIGNAL(windowClosing()), this, SLOT(handleTabClosing()));
connect(tab, SIGNAL(windowOpening()), this, SLOT(handleWidgetShown()));
+ connect(tab, SIGNAL(wantsToActivate()), this, SLOT(handleWantsToActivate()));
}
void QtChatTabs::handleWidgetShown() {
@@ -50,6 +52,15 @@ void QtChatTabs::handleWidgetShown() {
show();
}
+void QtChatTabs::handleWantsToActivate() {
+ QtTabbable* widget = qobject_cast<QtTabbable*>(sender());
+ Q_ASSERT(widget);
+ Q_ASSERT(tabs_->indexOf(widget) >= 0);
+ //Un-minimize and bring to front.
+ setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
+ tabs_->setCurrentWidget(widget);
+}
+
void QtChatTabs::handleTabClosing() {
QWidget* widget = qobject_cast<QWidget*>(sender());
if (!widget) {
diff --git a/Swift/QtUI/QtChatTabs.h b/Swift/QtUI/QtChatTabs.h
index 97967c9..87b8b10 100644
--- a/Swift/QtUI/QtChatTabs.h
+++ b/Swift/QtUI/QtChatTabs.h
@@ -10,6 +10,7 @@ namespace Swift {
public:
QtChatTabs();
void addTab(QtTabbable* tab);
+ void minimise();
protected slots:
void closeEvent(QCloseEvent* event);
@@ -19,6 +20,7 @@ namespace Swift {
void handleTabTitleUpdated();
void handleTabCloseRequested(int index);
void handleWidgetShown();
+ void handleWantsToActivate();
private:
QTabWidget* tabs_;
};
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index b7987b9..7e71b7f 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -195,4 +195,8 @@ void QtChatWindow::show() {
emit windowOpening();
}
+void QtChatWindow::activate() {
+ emit wantsToActivate();
+}
+
}
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index ea4983f..80961f8 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -23,6 +23,7 @@ namespace Swift {
void addSystemMessage(const String& message);
void addErrorMessage(const String& errorMessage);
void show();
+ void activate();
void setUnreadMessageCount(int count);
void convertToMUC();
TreeWidget *getTreeWidget();
diff --git a/Swift/QtUI/QtChatWindowFactory.cpp b/Swift/QtUI/QtChatWindowFactory.cpp
index 47c943f..b3efeac 100644
--- a/Swift/QtUI/QtChatWindowFactory.cpp
+++ b/Swift/QtUI/QtChatWindowFactory.cpp
@@ -17,7 +17,10 @@ QtChatWindowFactory::QtChatWindowFactory(QtTreeWidgetFactory *treeWidgetFactory,
ChatWindow* QtChatWindowFactory::createChatWindow(const JID &contact) {
QtChatWindow *chatWindow = new QtChatWindow(P2QSTRING(contact.toString()), treeWidgetFactory_);
tabs_->addTab(chatWindow);
- tabs_->show();
+ if (!tabs_->isVisible()) {
+ tabs_->showMinimized();
+ //tabs_->minimise();
+ }
//chatWindow->show();
return chatWindow;
}
diff --git a/Swift/QtUI/QtTabbable.h b/Swift/QtUI/QtTabbable.h
index ebd495e..e3dd47b 100644
--- a/Swift/QtUI/QtTabbable.h
+++ b/Swift/QtUI/QtTabbable.h
@@ -15,5 +15,6 @@ namespace Swift {
void titleUpdated();
void windowClosing();
void windowOpening();
+ void wantsToActivate();
};
}