1.1 --- a/main.cpp Fri Oct 02 14:31:03 2009 +0000
1.2 +++ b/main.cpp Fri Nov 13 08:32:03 2009 +0000
1.3 @@ -16,6 +16,9 @@
1.4 #include <windows.h>
1.5 #endif
1.6
1.7 +#include <sys/types.h> // To retrieve PID for use in DBUS
1.8 +#include <unistd.h>
1.9 +
1.10 // Global variables
1.11 TextEditor *textEditor; // used in Constr. of LinkableMapObj
1.12 // initialized in mainwindow
1.13 @@ -25,8 +28,10 @@
1.14 QString vymCodeName;
1.15
1.16 Main *mainWindow; // used in BranchObj::select()
1.17 +
1.18 QDBusConnection dbusConnection= QDBusConnection::sessionBus();
1.19
1.20 +
1.21 QString tmpVymDir; // All temp files go there, created in mainwindow
1.22 QString clipboardDir; // Clipboard used in all mapEditors
1.23 QString clipboardFile; // Clipboard used in all mapEditors
1.24 @@ -61,7 +66,6 @@
1.25 vymBuildDate=__VYM_BUILD_DATE;
1.26 vymCodeName=__VYM_CODENAME;
1.27
1.28 -
1.29 // Reading and initializing options commandline options
1.30 options.add ("debug", Option::Switch, "d", "debug");
1.31 options.add ("version", Option::Switch, "v","version");
1.32 @@ -87,7 +91,7 @@
1.33
1.34 if (options.isOn ("version"))
1.35 {
1.36 - cout << "VYM - View Your Mind (c) 2004-2007 Uwe Drechsel " << endl
1.37 + cout << "VYM - View Your Mind (c) 2004-2009 Uwe Drechsel " << endl
1.38 <<" Version: "<<__VYM_VERSION <<endl
1.39 <<"Build date: "<<__VYM_BUILD_DATE << endl
1.40 <<" "<<__VYM_CODENAME<<endl;
1.41 @@ -95,6 +99,10 @@
1.42 return 0;
1.43 }
1.44
1.45 + // Register for DBUS
1.46 + if (debug) cout << "PID="<<getpid()<<endl;
1.47 + dbusConnection.registerService (QString ("org.insilmaril.vym-%1").arg(getpid()));
1.48 +
1.49 // Use /usr/share/vym or /usr/local/share/vym or . ?
1.50 // First try options
1.51 if (options.isOn ("local"))
1.52 @@ -186,14 +194,6 @@
1.53 // Paint Mainwindow first time
1.54 qApp->processEvents();
1.55
1.56 - // FIXME-3 playing around with dbus
1.57 - /*
1.58 - new Adaptor (&app);
1.59 - dbusConnection.registerService("org.insilmaril.MainWindow");
1.60 - QDBusConnection::sessionBus().registerObject("/MainApplication", &app);
1.61 - */
1.62 -
1.63 -
1.64 m.loadCmdLine();
1.65
1.66 // Run script