X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=32a59dff0f1cd9c5c0537f0e408e26a56bd1ec36;hp=1b7380413bb56bde99ec68fbb043bf4a501698c4;hb=620882e248fafe97a736e545d8e3eb72569a078b;hpb=1aef6bf0d3d2a7ef469b9a9f68ceb891cc8a896c diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 1b738041..32a59dff 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -254,6 +254,8 @@ void MainWin::setupTopicWidget() { VerticalDock *dock = new VerticalDock(tr("Topic"), this); dock->setObjectName("TopicDock"); TopicWidget *topicwidget = new TopicWidget(dock); + connect(topicwidget, SIGNAL(topicChanged(const QString &)), this, SLOT(changeTopic(const QString &))); + dock->setWidget(topicwidget); Client::bufferModel()->mapProperty(1, Qt::DisplayRole, topicwidget, "topic"); @@ -266,9 +268,8 @@ void MainWin::setupTopicWidget() { void MainWin::setupSystray() { systray = new QSystemTrayIcon(this); systray->setIcon(QIcon(":/icons/quassel-icon.png")); - - QString toolTip("left click to minimize the quassel client to tray"); - systray->setToolTip(toolTip); +// systray->setToolTip("left click to minimize the quassel client to tray"); +// systray->setToolTip(toolTip); systrayMenu = new QMenu(this); systrayMenu->addAction(ui.actionAboutQuassel); @@ -280,8 +281,8 @@ void MainWin::setupSystray() { systray->setContextMenu(systrayMenu); - QtUiSettings s; - if(s.value("UseSystemTrayIcon").toBool()) { + UiSettings s; + if(s.value("UseSystemTrayIcon", QVariant(true)).toBool()) { systray->show(); } @@ -295,14 +296,23 @@ void MainWin::setupSystray() { void MainWin::changeEvent(QEvent *event) { if(event->type() == QEvent::WindowStateChange) { if(windowState() & Qt::WindowMinimized) { - QtUiSettings s; + UiSettings s; if(s.value("UseSystemTrayIcon").toBool() && s.value("MinimizeOnMinimize").toBool()) { toggleVisibility(); + event->ignore(); } } } } +// FIXME this should be made prettier... +void MainWin::changeTopic(const QString &topic) { + BufferId id = ui.bufferWidget->currentBuffer(); + if(!id.isValid()) return; + Buffer *buffer = Client::buffer(id); + if(buffer) Client::userInput(buffer->bufferInfo(), QString("/topic %1").arg(topic)); +} + void MainWin::connectedToCore() { foreach(BufferInfo id, Client::allBufferInfos()) { emit requestBacklog(id, 1000, -1); @@ -358,7 +368,7 @@ void MainWin::showAboutDlg() { } void MainWin::closeEvent(QCloseEvent *event) { - QtUiSettings s; + UiSettings s; if(s.value("UseSystemTrayIcon").toBool() && s.value("MinimizeOnClose").toBool()) { toggleVisibility(); event->ignore(); @@ -374,7 +384,7 @@ void MainWin::systrayActivated( QSystemTrayIcon::ActivationReason activationReas } void MainWin::toggleVisibility() { - if(isHidden() || !isActiveWindow()) { + if(isHidden() /*|| !isActiveWindow()*/) { show(); if(isMinimized()) if (isMaximized()) @@ -383,9 +393,11 @@ void MainWin::toggleVisibility() { showNormal(); raise(); - activateWindow(); + setFocus(Qt::ActiveWindowFocusReason); + // activateWindow(); } else { if(systray->isSystemTrayAvailable ()) { + clearFocus(); hide(); if(!systray->isVisible()) { systray->show(); @@ -430,13 +442,13 @@ void MainWin::clientNetworkUpdated() { a->setText(net->networkName()); if(net->connectionState() == Network::Initialized) { a->setIcon(QIcon(":/16x16/actions/network-connect")); - a->setEnabled(true); + //a->setEnabled(true); } else if(net->connectionState() == Network::Disconnected) { a->setIcon(QIcon(":/16x16/actions/network-disconnect")); - a->setEnabled(true); + //a->setEnabled(true); } else { a->setIcon(QIcon(":/16x16/actions/gear")); - a->setEnabled(false); + //a->setEnabled(false); } return; }