From 2d5c9bcc2bac541199a081e032cf68a81607856e Mon Sep 17 00:00:00 2001 From: nowrep Date: Tue, 10 Jul 2012 11:56:24 +0200 Subject: [PATCH] Building: Option to build without QtDBUS module. - more info in BUILDING - desktop notifications will be disabled with this option --- BUILDING | 7 ++++++- CHANGELOG | 3 +++ src/defines.pri | 2 ++ src/lib/app/commandlineoptions.cpp | 5 +++-- .../desktopnotificationsfactory.cpp | 15 ++++++++++++--- .../desktopnotificationsfactory.h | 2 ++ src/lib/lib.pro | 3 ++- src/lib/preferences/preferences.cpp | 7 +++---- src/main/main.pro | 3 ++- 9 files changed, 35 insertions(+), 12 deletions(-) diff --git a/BUILDING b/BUILDING index 1c8bac93f..daaa9348b 100644 --- a/BUILDING +++ b/BUILDING @@ -8,7 +8,7 @@ General from git to specific directory by your system you compiled for. On Linux, you can easily do it by running make install. If you are unsure where is the right place, you can check it directly from - QupZilla by clicking from Help Menu to Informations about program, then in + QupZilla by clicking from Help Menu on Configuration Information, then in Path section. You may want to build QupZilla with debugging symbols (for generating @@ -161,3 +161,8 @@ Available Defines example: $ export QUPZILLA_PREFIX="/usr/" + DISABLE_DBUS Build without QtDBUS module. Native desktop notifications will be disabled. + + example: + $ export DISABLE_DBUS="true" + diff --git a/CHANGELOG b/CHANGELOG index c1257a2c1..2e440799c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ Version 1.3.0 * not released yet * new Ukrainian translation + * new plugins: GreaseMonkey and PIM (Personal Information Manager) + * new command line option to open new window with url * can now open .xhtml files from open file dialog * added animated tab previews with option to turn animations off * possibility to change icon of bookmarks @@ -21,6 +23,7 @@ Version 1.3.0 * better support for Content-Disposition header (downloads) * Linux: middle clicking on add tab button will open new tab with global mouse selection's contents * Linux: generating backtrace and saving it into file upon application crash + * Windows: fixed theme loading delay (showing ugly interface for a second when starting app) * fixed saving passwords on some sites (parsing WebKit's data format) * fixed "go to web address" action when newlines were in string * fixed excessive ssl warnings when rejecting untrusted certificate diff --git a/src/defines.pri b/src/defines.pri index d95aca109..8ff773ec4 100644 --- a/src/defines.pri +++ b/src/defines.pri @@ -28,6 +28,7 @@ d_portable = $$(PORTABLE_BUILD) d_nonblock_dialogs = $$(NONBLOCK_JS_DIALOGS) d_use_qtwebkit_2_2 = $$(USE_QTWEBKIT_2_2) d_use_lib_path = $$(USE_LIBPATH) +d_disable_dbus = $$(DISABLE_DBUS) equals(d_no_system_datapath, "true") { DEFINES *= NO_SYSTEM_DATAPATH } equals(d_use_webgl, "true") { DEFINES *= USE_WEBGL } @@ -36,6 +37,7 @@ equals(d_kde, "true") { DEFINES *= KDE } equals(d_portable, "true") { DEFINES *= PORTABLE_BUILD } equals(d_nonblock_dialogs, "true") { DEFINES *= NONBLOCK_JS_DIALOGS } equals(d_use_qtwebkit_2_2, "true") { DEFINES *= USE_QTWEBKIT_2_2 } +equals(d_disable_dbus, "true") { DEFINES *= DISABLE_DBUS } !mac:unix { d_prefix = $$(QUPZILLA_PREFIX) diff --git a/src/lib/app/commandlineoptions.cpp b/src/lib/app/commandlineoptions.cpp index dd332e8be..5ab86c375 100644 --- a/src/lib/app/commandlineoptions.cpp +++ b/src/lib/app/commandlineoptions.cpp @@ -108,11 +108,12 @@ void CommandLineOptions::parseActions() if (arg.startsWith("-p=") || arg.startsWith("--profile=")) { int index = arg.indexOf('='); if (index != -1) { - cout << "QupZilla: Starting with profile " << arg.toUtf8().data() << endl; + const QString profileName = arg.mid(index + 1); + cout << "QupZilla: Starting with profile '" << profileName.toUtf8().data() << "'" << endl; ActionPair pair; pair.action = Qz::CL_StartWithProfile; - pair.text = arg.mid(index + 1); + pair.text = profileName; m_actions.append(pair); } } diff --git a/src/lib/desktopnotifications/desktopnotificationsfactory.cpp b/src/lib/desktopnotifications/desktopnotificationsfactory.cpp index 140770e7e..aa8220bc9 100644 --- a/src/lib/desktopnotifications/desktopnotificationsfactory.cpp +++ b/src/lib/desktopnotifications/desktopnotificationsfactory.cpp @@ -23,7 +23,7 @@ #include #include -#ifdef Q_WS_X11 +#if defined(Q_WS_X11) && !defined(DISABLE_DBUS) #include #endif @@ -49,6 +49,15 @@ void DesktopNotificationsFactory::loadSettings() settings.endGroup(); } +bool DesktopNotificationsFactory::supportsNativeNotifications() const +{ +#if defined(Q_WS_X11) && !defined(DISABLE_DBUS) + return true; +#else + return false; +#endif +} + void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QString &heading, const QString &text) { if (!m_enabled) { @@ -68,7 +77,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS m_desktopNotif.data()->show(); break; case DesktopNative: -#ifdef Q_WS_X11 +#if defined(Q_WS_X11) && !defined(DISABLE_DBUS) QFile tmp(QDir::tempPath() + "/qupzilla_notif.png"); tmp.open(QFile::WriteOnly); icon.save(tmp.fileName()); @@ -95,7 +104,7 @@ void DesktopNotificationsFactory::showNotification(const QPixmap &icon, const QS void DesktopNotificationsFactory::nativeNotificationPreview() { -#ifdef Q_WS_X11 +#if defined(Q_WS_X11) && !defined(DISABLE_DBUS) QFile tmp(QDir::tempPath() + "/qupzilla_notif.png"); tmp.open(QFile::WriteOnly); QPixmap(":icons/preferences/stock_dialog-question.png").save(tmp.fileName()); diff --git a/src/lib/desktopnotifications/desktopnotificationsfactory.h b/src/lib/desktopnotifications/desktopnotificationsfactory.h index a27f384bb..83a127af0 100644 --- a/src/lib/desktopnotifications/desktopnotificationsfactory.h +++ b/src/lib/desktopnotifications/desktopnotificationsfactory.h @@ -37,6 +37,8 @@ public: void loadSettings(); + bool supportsNativeNotifications() const; + void showNotification(const QPixmap &icon, const QString &heading, const QString &text); void nativeNotificationPreview(); diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 9e5f70ff1..576083934 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -1,5 +1,4 @@ QT += core gui webkit sql network script -unix:QT += dbus TARGET = QupZilla TEMPLATE = lib @@ -10,6 +9,8 @@ include(../defines.pri) include(../../translations/translations.pri) #include(../../tests/modeltest/modeltest.pri) +unix:!contains(DEFINES, "DISABLE_DBUS") QT += dbus + INCLUDEPATH += 3rdparty\ app\ autofill\ diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp index 97c490fc2..85dc69e96 100644 --- a/src/lib/preferences/preferences.cpp +++ b/src/lib/preferences/preferences.cpp @@ -320,9 +320,8 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) ui->pluginsFrame->addWidget(m_pluginsList); //NOTIFICATIONS -#ifdef Q_WS_X11 - ui->useNativeSystemNotifications->setEnabled(true); -#endif + ui->useNativeSystemNotifications->setEnabled(mApp->desktopNotifications()->supportsNativeNotifications()); + DesktopNotificationsFactory::Type notifyType; settings.beginGroup("Notifications"); ui->notificationTimeout->setValue(settings.value("Timeout", 6000).toInt() / 1000); @@ -331,7 +330,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent) #else notifyType = DesktopNotificationsFactory::PopupWidget; #endif - if (notifyType == DesktopNotificationsFactory::DesktopNative) { + if (ui->useNativeSystemNotifications->isChecked() && notifyType == DesktopNotificationsFactory::DesktopNative) { ui->useNativeSystemNotifications->setChecked(true); } else { diff --git a/src/main/main.pro b/src/main/main.pro index fe3aff985..bd4c0d074 100644 --- a/src/main/main.pro +++ b/src/main/main.pro @@ -1,5 +1,4 @@ QT += core gui webkit sql network script -unix: QT += dbus TARGET = qupzilla mac: TARGET = QupZilla @@ -12,6 +11,8 @@ TEMPLATE = app include(../defines.pri) include(../install.pri) +unix:!contains(DEFINES, "DISABLE_DBUS") QT += dbus + INCLUDEPATH += ../lib/app\ ../lib/3rdparty