#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <Qtx.h>
#include <QtxAction.h>
#include <QtxMultiAction.h>
if ( !myViewFrame )
return;
+#ifndef WIN32
+#if QT_VERSION < 0x040303
+ if ( !Qtx::hasAnyPrinters() ) {
+ SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
+ tr( "WRN_NO_PRINTERS" ) );
+ return;
+ }
+#endif
+#endif
+
// stored settings for further starts
static QString aPrinterName;
static int aColorMode = -1;
}
return success;
}
+
+/**
+ * Cheque for existing any system printers
+ */
+
+#ifndef WIN32
+#if QT_VERSION < 0x040303
+#include <QLibrary>
+#include <cups/cups.h>
+
+typedef int (*CupsGetDests)(cups_dest_t **dests);
+static CupsGetDests _cupsGetDests = 0;
+#endif
+#endif
+bool Qtx::hasAnyPrinters()
+{
+ bool aRes = true;
+#ifndef WIN32
+#if QT_VERSION < 0x040303
+ QLibrary aCupsLib( QString( "cups" ) );
+ if ( !aCupsLib.load() )
+ aRes = false;
+ else {
+ cups_dest_t *printers;
+ _cupsGetDests = (CupsGetDests) aCupsLib.resolve("cupsGetDests");
+ int prnCount = _cupsGetDests(&printers);
+ aRes = prnCount > 0;
+ }
+#endif
+#endif
+ return aRes;
+}
static bool stringToLinearGradient( const QString&, QLinearGradient& );
static bool stringToRadialGradient( const QString&, QRadialGradient& );
static bool stringToConicalGradient( const QString&, QConicalGradient& );
+
+ static bool hasAnyPrinters();
};
#endif
#include "SUIT_Application.h"
#include "SUIT_ViewManager.h"
+#include "Qtx.h"
+
#include <QEvent>
#include <QIcon>
#include <QApplication>
if ( theImage.isNull() )
return;
+#ifndef WIN32
+#if QT_VERSION < 0x040303
+ if ( !Qtx::hasAnyPrinters() ) {
+ SUIT_MessageBox::warning( this, tr( "WRN_WARNING" ),
+ tr( "WRN_NO_PRINTERS" ) );
+ return;
+ }
+#endif
+#endif
+
// stored settings for further starts
static QString aPrinterName;
static int anOrientation = -1;
<source>NAME_COLUMN</source>
<translation>Name</translation>
</message>
+ <message>
+ <source>WRN_NO_PRINTERS</source>
+ <translation>You have no printers.</translation>
+ </message>
</context>
<context>
<name>SUIT_Study</name>