[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde4support] /: Remove X11 dependency from kprintutils
From:       Martin_Gräßlin <mgraesslin () kde ! org>
Date:       2014-02-28 13:11:57
Message-ID: E1WJNEL-0002gJ-1u () scm ! kde ! org
[Download RAW message or body]

Git commit c0a9f41328df263f4ea39805957fc93d47cf35ee by Martin Gräßlin.
Committed on 13/02/2014 at 07:37.
Pushed by alexmerry into branch 'master'.

Remove X11 dependency from kprintutils

The availability of XLib was used to test whether Cups is available.
Cups has nothing to do with X11, thus the check is wrong.

The platform specific check is now moved to be for Unix (not Mac)
this is the same as the XLib check intended to be.

REVIEW: 115715

M  +0    -3    CMakeLists.txt
M  +0    -4    src/CMakeLists.txt
D  +0    -1    src/config-kprintutils.h.cmake
M  +1    -3    src/kcupsoptionswidget_p.cpp
M  +3    -4    src/kdeprintdialog.cpp

http://commits.kde.org/kde4support/c0a9f41328df263f4ea39805957fc93d47cf35ee

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 28342d0..bc1eb0d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,9 +12,6 @@ include(KDEInstallDirs)
 include(KDEFrameworkCompilerSettings)
 include(KDECMakeSettings)
 
-find_package(X11)
-set(HAVE_X11 ${X11_FOUND})
-
 include(FeatureSummary)
 include(GenerateExportHeader)
 include(ECMSetupVersion)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9058282..7b65a96 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,5 @@
 remove_definitions(-DQT_NO_CAST_FROM_ASCII)
 
-configure_file(config-kprintutils.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kprintutils.h)
-
 set(kprintutils_LIB_SRCS
     kprintpreview.cpp
 )
@@ -11,7 +9,6 @@ set(kprintutils_LIB_SRCS
   kdeprintdialog.cpp
 )
 
-if (X11_FOUND)
 set(kprintutils_LIB_SRCS
   ${kprintutils_LIB_SRCS}
   kcupsoptionswidget_p.cpp
@@ -22,7 +19,6 @@ set(kprintutils_UI
   ${kprintutils_UI}
   kcupsoptionspageswidget.ui
 )
-endif ()
 
 qt5_wrap_ui(kprintutils_LIB_SRCS ${kprintutils_UI})
 
diff --git a/src/config-kprintutils.h.cmake b/src/config-kprintutils.h.cmake
deleted file mode 100644
index 89858d1..0000000
--- a/src/config-kprintutils.h.cmake
+++ /dev/null
@@ -1 +0,0 @@
-#cmakedefine01 HAVE_X11
diff --git a/src/kcupsoptionswidget_p.cpp b/src/kcupsoptionswidget_p.cpp
index c88e848..52f1c83 100644
--- a/src/kcupsoptionswidget_p.cpp
+++ b/src/kcupsoptionswidget_p.cpp
@@ -20,8 +20,6 @@
 
 #include "kcupsoptionswidget_p.h"
 
-#include <config-kprintutils.h>
-
 #include <QPrinter>
 #include <QPrintEngine>
 #include <QPrintDialog>
@@ -41,7 +39,7 @@ KCupsOptionsWidget::~KCupsOptionsWidget()
 
 bool KCupsOptionsWidget::cupsAvailable()
 {
-#if HAVE_X11
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
     // Ideally we would have access to the private Qt method
     // QCUPSSupport::cupsAvailable() to do this as it is very complex routine.
     // However, if CUPS is available then QPrinter::numCopies() will always return 1
diff --git a/src/kdeprintdialog.cpp b/src/kdeprintdialog.cpp
index a53e198..1613a51 100644
--- a/src/kdeprintdialog.cpp
+++ b/src/kdeprintdialog.cpp
@@ -21,9 +21,8 @@
  **/
 
 #include "kdeprintdialog.h"
-#include <config-kprintutils.h>
 
-#if HAVE_X11
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
 #include "kcupsoptionspageswidget_p.h"
 #include "kcupsoptionssettingswidget_p.h"
 #endif
@@ -45,7 +44,7 @@ QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
     if (pageSelectPolicy == SystemSelectsPages) {
         dialog->setOption(QAbstractPrintDialog::PrintPageRange, false);
     }
-#if HAVE_X11
+#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
     if (KCupsOptionsWidget::cupsAvailable()) {
         KCupsOptionsPagesWidget *cupsOptionsPagesTab = new KCupsOptionsPagesWidget(dialog);
         dialog->setOptionTabs(QList<QWidget *>() << cupsOptionsPagesTab << customTabs);
@@ -55,7 +54,7 @@ QPrintDialog *KdePrint::createPrintDialog(QPrinter *printer,
     } else {
         dialog->setOptionTabs(customTabs);
     }
-#else //Not X11
+#else //Not Unix modulo Mac
     foreach (QWidget *w, customTabs) { // reparent to avoid leaks
         w->setParent(dialog);
     }

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic