~ubuntu-branches/ubuntu/precise/konversation/precise-updates

« back to all changes in this revision

Viewing changes to src/mainwindow.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2009-12-17 09:50:41 UTC
  • mfrom: (1.10.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091217095041-k5ssvxm2u8wgf0ll
Tags: 1.2.1+git20091217-0ubuntu1
* New upstream git snapshot:
  - Refresh all patches
  - Update initial Indicator patch to apply properly.
  - Remove docs and locale files from the install manifest; they aren't
    present in git snapshots. We will uncomment them for official (pre)
    releases with tarballs from upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
    m_hasDirtySettings = false;
59
59
    m_closeApp = false;
60
60
    m_serverListDialog = 0;
 
61
    m_trayIcon = 0;
61
62
    m_settingsDialog = NULL;
62
63
 
63
64
    m_viewContainer = new ViewContainer(this);
112
113
    KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());
113
114
 
114
115
    KStandardAction::keyBindings(this, SLOT(openKeyBindings()), actionCollection());
115
 
    KAction *preferencesAction = KStandardAction::preferences(this, SLOT(openPrefsDialog()), actionCollection());
 
116
    KStandardAction::preferences(this, SLOT(openPrefsDialog()), actionCollection());
116
117
 
117
 
    KAction *configureNotificationsAction = KStandardAction::configureNotifications(this,SLOT(openNotifications()), actionCollection());
 
118
    KStandardAction::configureNotifications(this, SLOT(openNotifications()), actionCollection());
118
119
 
119
120
    KAction* action;
120
121
 
478
479
    connect(toggleChannelNickListsAction, SIGNAL(triggered()), m_viewContainer, SLOT(toggleChannelNicklists()));
479
480
    actionCollection()->addAction("hide_nicknamelist", toggleChannelNickListsAction);
480
481
 
481
 
    // set up system tray
482
 
    m_trayIcon = new Konversation::TrayIcon(this);
483
 
    connect(this, SIGNAL(endNotification()), m_trayIcon, SLOT(endNotification()));
484
 
    connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), m_trayIcon, SLOT(updateAppearance()));
485
 
    connect(m_trayIcon, SIGNAL(quitSelected()), this, SLOT(quitProgram()));
486
 
    KMenu *trayMenu = qobject_cast<KMenu*>(m_trayIcon->contextMenu());
487
 
    trayMenu->addAction(configureNotificationsAction);
488
 
    trayMenu->addAction(preferencesAction);
489
 
    trayMenu->addAction(awayAction);
490
 
 
491
 
 
492
482
    // Bookmarks
493
483
    KActionMenu *bookmarkMenu = new KActionMenu(i18n("Bookmarks"), actionCollection());
494
484
    new KonviBookmarkHandler(bookmarkMenu->menu(), this);
663
653
 
664
654
void MainWindow::updateTrayIcon()
665
655
{
666
 
    m_trayIcon->setNotificationEnabled(Preferences::self()->trayNotify());
667
 
 
668
656
    if (Preferences::self()->showTrayIcon())
669
 
        m_trayIcon->show();
 
657
    {
 
658
        if (!m_trayIcon)
 
659
        {
 
660
            // set up system tray
 
661
            m_trayIcon = new Konversation::TrayIcon(this);
 
662
            connect(this, SIGNAL(endNotification()), m_trayIcon, SLOT(endNotification()));
 
663
            connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), m_trayIcon, SLOT(updateAppearance()));
 
664
            connect(m_trayIcon, SIGNAL(quitSelected()), this, SLOT(quitProgram()));
 
665
                      
 
666
            KMenu *trayMenu = qobject_cast<KMenu*>(m_trayIcon->contextMenu());
 
667
            trayMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Preferences)));
 
668
            trayMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::ConfigureNotifications)));
 
669
            trayMenu->addAction(actionCollection()->action("toggle_away"));
 
670
        }
 
671
 
 
672
        m_trayIcon->setNotificationEnabled(Preferences::self()->trayNotify());    
 
673
    }
670
674
    else
671
 
        m_trayIcon->hide();
 
675
    {
 
676
        if (m_trayIcon)
 
677
        {
 
678
            delete m_trayIcon;
 
679
            m_trayIcon = 0;
 
680
        }
 
681
    }
672
682
}
673
683
 
674
684
void MainWindow::toggleMenubar(bool dontShowWarning)