SVN commit 522683 by djarvie: Allow system tray icon to appear in non-KDE window managers (Bug 123651) M +5 -7 kalarmapp.cpp [UTF-8 ENCODING PROBLEMS] M +3 -3 kalarmapp.h [UTF-8 ENCODING PROBLEMS] M +2 -2 mainwindow.cpp [UTF-8 ENCODING PROBLEMS] --- trunk/KDE/kdepim/kalarm/kalarmapp.cpp #522682:522683 @@ -1,7 +1,7 @@ /* * kalarmapp.cpp - the KAlarm application object * Program: kalarm - * Copyright (c) 2001-2006 by David Jarvie + * Copyright © 2001-2006 by David Jarvie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -115,9 +115,7 @@ KARecurrence::setDefaultFeb29Type(Preferences::defaultFeb29Type()); // Check if it's a KDE desktop by comparing the window manager name to "KWin" - NETRootInfo nri(QX11Info::display(), NET::SupportingWMCheck); - const char* wmname = nri.wmName(); - mKDEDesktop = wmname && !strcmp(wmname, "KWin"); + mHaveSystemTray = true; // assume yes in lieu of a test which works if (AlarmCalendar::initialiseCalendars()) { @@ -305,7 +303,7 @@ // Display only the system tray icon kDebug(5950)<<"KAlarmApp::newInstance(): tray\n"; args->clear(); // free up memory - if (!mKDEDesktop) + if (!mHaveSystemTray) { exitCode = 1; break; @@ -962,7 +960,7 @@ { if (!mTrayWindow && !creating) { - if (!mKDEDesktop) + if (!mHaveSystemTray) return false; if (!MainWindow::count() && wantRunInSystemTray()) { @@ -1146,7 +1144,7 @@ */ bool KAlarmApp::wantRunInSystemTray() const { - return Preferences::runInSystemTray() && mKDEDesktop; + return Preferences::runInSystemTray() && mHaveSystemTray; } /****************************************************************************** --- trunk/KDE/kdepim/kalarm/kalarmapp.h #522682:522683 @@ -1,7 +1,7 @@ /* * kalarmapp.h - the KAlarm application object * Program: kalarm - * Copyright (c) 2001 - 2005 by David Jarvie + * Copyright © 2001 - 2005 by David Jarvie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ virtual int newInstance(); static KAlarmApp* getInstance(); bool checkCalendarDaemon() { return initCheck(); } - bool KDEDesktop() const { return mKDEDesktop; } + bool haveSystemTray() const { return mHaveSystemTray; } bool wantRunInSystemTray() const; bool alarmsDisabledIfStopped() const { return mDisableAlarmsIfStopped; } bool speechEnabled() const { return mSpeechEnabled; } @@ -169,7 +169,7 @@ int mPendingQuitCode; // exit code for a pending quit bool mPendingQuit; // quit once the DCOP command and shell command queues have been processed bool mProcessingQueue; // a mDcopQueue entry is currently being processed - bool mKDEDesktop; // running on KDE desktop + bool mHaveSystemTray; // whether there is a system tray bool mNoSystemTray; // no KDE system tray exists bool mSavedNoSystemTray; // mNoSystemTray before mCheckingSystemTray was true bool mCheckingSystemTray; // the existence of the system tray is being checked --- trunk/KDE/kdepim/kalarm/mainwindow.cpp #522682:522683 @@ -1,7 +1,7 @@ /* * mainwindow.cpp - main application window * Program: kalarm - * Copyright (c) 2001-2006 by David Jarvie + * Copyright © 2001-2006 by David Jarvie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -854,7 +854,7 @@ */ void MainWindow::updateTrayIconAction() { - mActionToggleTrayIcon->setEnabled(theApp()->KDEDesktop() && !theApp()->wantRunInSystemTray()); + mActionToggleTrayIcon->setEnabled(theApp()->haveSystemTray() && !theApp()->wantRunInSystemTray()); mActionToggleTrayIcon->setChecked(theApp()->trayIconDisplayed()); }