+#else /* HAVE_KDE */
+
+ setDataDirPaths(findDataDirPaths());
+
+#endif /* HAVE_KDE */
+
+ setRunMode(Quassel::ClientOnly);
+
+ qInstallMsgHandler(Client::logMessage);
+}
+
+bool QtUiApplication::init() {
+ if(Quassel::init()) {
+
+ // FIXME: MIGRATION 0.3 -> 0.4: Move database and core config to new location
+ // Move settings, note this does not delete the old files
+#ifdef Q_WS_WIN
+ QSettings::Format format = QSettings::IniFormat;
+#else
+ QSettings::Format format = QSettings::NativeFormat;
+#endif
+ QString newFilePath = Quassel::configDirPath() + "quasselclient"
+ + ((format == QSettings::NativeFormat) ? QLatin1String(".conf") : QLatin1String(".ini"));
+ QSettings newSettings(newFilePath, format);
+
+ if(newSettings.value("Config/Version").toUInt() != 1) {
+ qWarning() << "\n\n*** IMPORTANT: Config and data file locations have changed. Attempting to auto-migrate your client settings...";
+# ifdef Q_WS_MAC
+ QString org = "quassel-irc.org";
+# else
+ QString org = "Quassel Project";
+# endif
+ QSettings oldSettings(org, "Quassel Client");
+ if(oldSettings.allKeys().count()) {
+ foreach(QString key, oldSettings.allKeys())
+ newSettings.setValue(key, oldSettings.value(key));
+ newSettings.setValue("Config/Version", 1);
+ qWarning() << "* Your client settings have been migrated to" << newFilePath;
+ }
+ qWarning() << "*** Migration completed.\n\n";
+ }
+
+ // MIGRATION end
+
+ // session resume
+ QtUi *gui = new QtUi();
+ Client::init(gui);
+ // init gui only after the event loop has started
+ // QTimer::singleShot(0, gui, SLOT(init()));
+ gui->init();
+ resumeSessionIfPossible();
+ return true;
+ }
+ return false;
+}
+
+QtUiApplication::~QtUiApplication() {
+ Client::destroy();
+}
+
+void QtUiApplication::commitData(QSessionManager &manager) {
+ _aboutToQuit = true;