mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
knotify: use KApplication instead of KUniqueApplication
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
d18be9c04f
commit
38621bba32
2 changed files with 18 additions and 13 deletions
|
@ -39,8 +39,6 @@
|
|||
#include "notifybytaskbar.h"
|
||||
#include "notifybyktts.h"
|
||||
|
||||
|
||||
|
||||
KNotify::KNotify( QObject *parent )
|
||||
: QObject( parent ),
|
||||
m_counter(0)
|
||||
|
@ -48,6 +46,7 @@ KNotify::KNotify( QObject *parent )
|
|||
loadConfig();
|
||||
(void)new KNotifyAdaptor(this);
|
||||
(void)new KSolidNotify(this);
|
||||
QDBusConnection::sessionBus().registerService("org.kde.knotify");
|
||||
QDBusConnection::sessionBus().registerObject("/Notify", this, QDBusConnection::ExportAdaptors
|
||||
/*| QDBusConnection::ExportScriptableSlots | QDBusConnection::ExportScriptableSignals*/ );
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <kuniqueapplication.h>
|
||||
#include <kapplication.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kcmdlineargs.h>
|
||||
#include <kdebug.h>
|
||||
|
@ -28,6 +28,8 @@
|
|||
#include <kmessage.h>
|
||||
#include <kpassivepopupmessagehandler.h>
|
||||
#include <kdeversion.h>
|
||||
#include <QDBusConnectionInterface>
|
||||
#include <QDBusReply>
|
||||
|
||||
#include "knotify.h"
|
||||
|
||||
|
@ -45,21 +47,25 @@ int main(int argc, char **argv)
|
|||
aboutdata.addAuthor(ki18n("Allan Sandfeld Jensen"),ki18n("Porting to KDE 4"),"kde@carewolf.com");
|
||||
|
||||
KCmdLineArgs::init( argc, argv, &aboutdata );
|
||||
KUniqueApplication::addCmdLineOptions();
|
||||
|
||||
// initialize application
|
||||
if ( !KUniqueApplication::start() ) {
|
||||
kDebug() << "Running knotify found";
|
||||
return 0;
|
||||
}
|
||||
|
||||
KApplication app;
|
||||
// do not connect to ksmserver at all, knotify is launched on demand and doesn't need
|
||||
// to know about logout, and moreover it may be ksmserver who tries to launch knotify,
|
||||
// in which case there is a deadlock with ksmserver waiting for knotify to finish
|
||||
// startup and knotify waiting to register with ksmserver
|
||||
unsetenv( "SESSION_MANAGER" );
|
||||
KUniqueApplication app;
|
||||
|
||||
app.disableSessionManagement();
|
||||
|
||||
QDBusConnection session = QDBusConnection::sessionBus();
|
||||
if (!session.isConnected()) {
|
||||
kWarning() << "No DBUS session-bus found. Check if you have started the DBUS server.";
|
||||
return 1;
|
||||
}
|
||||
QDBusReply<bool> sessionReply = session.interface()->isServiceRegistered("org.kde.knotify");
|
||||
if (sessionReply.isValid() && sessionReply.value() == true) {
|
||||
kWarning() << "Another instance of knotify is already running!";
|
||||
return 2;
|
||||
}
|
||||
|
||||
/*
|
||||
* the default KMessageBoxMessageHandler will do messagesbox that notify
|
||||
* so we have a deadlock if one debug message is shown as messagebox.
|
||||
|
|
Loading…
Add table
Reference in a new issue