summaryrefslogtreecommitdiffstats
path: root/tdeprint/kjobviewer
diff options
context:
space:
mode:
Diffstat (limited to 'tdeprint/kjobviewer')
-rw-r--r--tdeprint/kjobviewer/CMakeLists.txt37
-rw-r--r--tdeprint/kjobviewer/Makefile.am24
-rw-r--r--tdeprint/kjobviewer/hi128-app-kjobviewer.pngbin0 -> 8472 bytes
-rw-r--r--tdeprint/kjobviewer/hi16-app-kjobviewer.pngbin0 -> 684 bytes
-rw-r--r--tdeprint/kjobviewer/hi22-app-kjobviewer.pngbin0 -> 1003 bytes
-rw-r--r--tdeprint/kjobviewer/hi32-app-kjobviewer.pngbin0 -> 1633 bytes
-rw-r--r--tdeprint/kjobviewer/hi48-app-kjobviewer.pngbin0 -> 2588 bytes
-rw-r--r--tdeprint/kjobviewer/hi64-app-kjobviewer.pngbin0 -> 3720 bytes
-rw-r--r--tdeprint/kjobviewer/hisc-app-kjobviewer.svgzbin0 -> 17679 bytes
-rw-r--r--tdeprint/kjobviewer/kjobviewer.cpp233
-rw-r--r--tdeprint/kjobviewer/kjobviewer.desktop92
-rw-r--r--tdeprint/kjobviewer/kjobviewer.h57
-rw-r--r--tdeprint/kjobviewer/kjobviewerui.rc35
-rw-r--r--tdeprint/kjobviewer/main.cpp49
14 files changed, 527 insertions, 0 deletions
diff --git a/tdeprint/kjobviewer/CMakeLists.txt b/tdeprint/kjobviewer/CMakeLists.txt
new file mode 100644
index 000000000..332fa7fc4
--- /dev/null
+++ b/tdeprint/kjobviewer/CMakeLists.txt
@@ -0,0 +1,37 @@
+#################################################
+#
+# (C) 2010-2011 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+add_definitions( -D_KDEPRINT_COMPILE )
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+tde_install_icons( kjobviewer )
+install( FILES kjobviewer.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
+install( FILES kjobviewerui.rc DESTINATION ${DATA_INSTALL_DIR}/kjobviewer )
+
+
+##### kjobviewer (tdeinit) ######################
+
+tde_add_tdeinit_executable( kjobviewer AUTOMOC
+ SOURCES kjobviewer.cpp main.cpp
+ LINK tdeprint_management-shared
+)
diff --git a/tdeprint/kjobviewer/Makefile.am b/tdeprint/kjobviewer/Makefile.am
new file mode 100644
index 000000000..5362ad033
--- /dev/null
+++ b/tdeprint/kjobviewer/Makefile.am
@@ -0,0 +1,24 @@
+AM_CPPFLAGS = -D_KDEPRINT_COMPILE
+
+INCLUDES = $(all_includes)
+
+bin_PROGRAMS=
+lib_LTLIBRARIES=
+tdeinit_LTLIBRARIES = kjobviewer.la
+
+kjobviewer_la_SOURCES = kjobviewer.cpp main.cpp
+kjobviewer_la_METASOURCES = AUTO
+kjobviewer_la_LIBADD = -ltdeprint_management $(LIB_KDEUI)
+kjobviewer_la_LDFLAGS = -module -avoid-version $(all_libraries) $(KDE_RPATH)
+
+noinst_HEADERS = kjobviewer.h
+
+KDE_ICON = kjobviewer
+
+rc_DATA = kjobviewerui.rc
+rcdir = $(kde_datadir)/kjobviewer
+
+xdg_apps_DATA = kjobviewer.desktop
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/kjobviewer.pot
diff --git a/tdeprint/kjobviewer/hi128-app-kjobviewer.png b/tdeprint/kjobviewer/hi128-app-kjobviewer.png
new file mode 100644
index 000000000..7db5f56b1
--- /dev/null
+++ b/tdeprint/kjobviewer/hi128-app-kjobviewer.png
Binary files differ
diff --git a/tdeprint/kjobviewer/hi16-app-kjobviewer.png b/tdeprint/kjobviewer/hi16-app-kjobviewer.png
new file mode 100644
index 000000000..d6defce21
--- /dev/null
+++ b/tdeprint/kjobviewer/hi16-app-kjobviewer.png
Binary files differ
diff --git a/tdeprint/kjobviewer/hi22-app-kjobviewer.png b/tdeprint/kjobviewer/hi22-app-kjobviewer.png
new file mode 100644
index 000000000..a71ee2817
--- /dev/null
+++ b/tdeprint/kjobviewer/hi22-app-kjobviewer.png
Binary files differ
diff --git a/tdeprint/kjobviewer/hi32-app-kjobviewer.png b/tdeprint/kjobviewer/hi32-app-kjobviewer.png
new file mode 100644
index 000000000..d554b554f
--- /dev/null
+++ b/tdeprint/kjobviewer/hi32-app-kjobviewer.png
Binary files differ
diff --git a/tdeprint/kjobviewer/hi48-app-kjobviewer.png b/tdeprint/kjobviewer/hi48-app-kjobviewer.png
new file mode 100644
index 000000000..13adbd006
--- /dev/null
+++ b/tdeprint/kjobviewer/hi48-app-kjobviewer.png
Binary files differ
diff --git a/tdeprint/kjobviewer/hi64-app-kjobviewer.png b/tdeprint/kjobviewer/hi64-app-kjobviewer.png
new file mode 100644
index 000000000..5d22d215e
--- /dev/null
+++ b/tdeprint/kjobviewer/hi64-app-kjobviewer.png
Binary files differ
diff --git a/tdeprint/kjobviewer/hisc-app-kjobviewer.svgz b/tdeprint/kjobviewer/hisc-app-kjobviewer.svgz
new file mode 100644
index 000000000..f40b4bdfa
--- /dev/null
+++ b/tdeprint/kjobviewer/hisc-app-kjobviewer.svgz
Binary files differ
diff --git a/tdeprint/kjobviewer/kjobviewer.cpp b/tdeprint/kjobviewer/kjobviewer.cpp
new file mode 100644
index 000000000..0fb23e7ba
--- /dev/null
+++ b/tdeprint/kjobviewer/kjobviewer.cpp
@@ -0,0 +1,233 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#include "kjobviewer.h"
+#include <tdeprint/kmjobviewer.h>
+#include <tdeprint/kmtimer.h>
+#include <tdeprint/kmmanager.h>
+
+#include <stdlib.h>
+#include <tqpixmap.h>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <ksystemtray.h>
+#include <kdebug.h>
+#include <kiconloader.h>
+#include <kpopupmenu.h>
+#include <kwin.h>
+#include <kstartupinfo.h>
+
+class JobTray : public KSystemTray
+{
+public:
+ JobTray(KJobViewerApp *parent, const char *name = 0)
+ : KSystemTray(0, name), m_app(parent) { connect( this, TQT_SIGNAL( quitSelected() ), kapp, TQT_SLOT( quit() ) ); }
+protected:
+ void mousePressEvent(TQMouseEvent*);
+private:
+ KJobViewerApp *m_app;
+};
+
+void JobTray::mousePressEvent(TQMouseEvent *e)
+{
+ if (e->button() == Qt::RightButton)
+ KSystemTray::mousePressEvent(e);
+ else if (m_app->m_views.count() > 0)
+ {
+ KPopupMenu menu;
+ TQDictIterator<KMJobViewer> it(m_app->m_views);
+ TQPtrList<KMJobViewer> list;
+ list.setAutoDelete(false);
+ for (; it.current(); ++it)
+ {
+ menu.insertItem(KWin::icon(it.current()->winId(), 16, 16), it.currentKey(), list.count());
+ if (it.current()->isVisible())
+ menu.setItemChecked(list.count(), true);
+ list.append(it.current());
+ }
+
+ if (list.count() == 1)
+ {
+ // special case, old behavior
+ if (list.first()->isVisible())
+ list.first()->hide();
+ else
+ list.first()->show();
+ }
+ else
+ {
+ int choice = menu.exec(mapToGlobal(e->pos()));
+ if (choice != -1)
+ {
+ KMJobViewer *view = list.tqat(choice);
+ if (view->isVisible())
+ KWin::activateWindow(view->winId());
+ else
+ view->show();
+ }
+ }
+ }
+}
+
+//-------------------------------------------------------------
+
+KJobViewerApp::KJobViewerApp() : KUniqueApplication()
+{
+ m_views.setAutoDelete(true);
+ m_tray = 0;
+ m_timer = 0;
+}
+
+KJobViewerApp::~KJobViewerApp()
+{
+}
+
+int KJobViewerApp::newInstance()
+{
+ initialize();
+ return 0;
+}
+
+void KJobViewerApp::initialize()
+{
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ bool showIt = args->isSet("show");
+ bool all = args->isSet("all");
+ QString prname = args->getOption("d");
+ KMJobViewer *view(0);
+
+ if (!m_timer)
+ {
+ m_timer = KMTimer::self();
+ connect(m_timer,TQT_SIGNAL(timeout()),TQT_SLOT(slotTimer()));
+ }
+
+ if (prname.isEmpty() && all)
+ prname = i18n("All Printers");
+
+ if (prname.isEmpty()) {
+ KMPrinter *prt = KMManager::self()->defaultPrinter();
+ if (prt)
+ prname = prt->printerName();
+ else {
+ KMessageBox::error(0, i18n("There is no default printer. Start with --all to see all printers."), i18n("Print Error"));
+ exit(1);
+ return;
+ }
+ }
+
+ if (!m_tray)
+ {
+ m_tray = new JobTray(this);
+ m_tray->setPixmap(m_tray->loadIcon("fileprint"));
+
+ }
+
+ view = m_views.find(prname);
+ if (!view)
+ {
+ kdDebug() << "creating new view: " << TQString(prname) << endl;
+ view = new KMJobViewer();
+ connect(view, TQT_SIGNAL(jobsShown(KMJobViewer*,bool)), TQT_SLOT(slotJobsShown(KMJobViewer*,bool)));
+ connect(view, TQT_SIGNAL(printerChanged(KMJobViewer*,const TQString&)), TQT_SLOT(slotPrinterChanged(KMJobViewer*,const TQString&)));
+ connect(view, TQT_SIGNAL(refreshClicked()), TQT_SLOT(slotTimer()));
+ connect(view, TQT_SIGNAL(viewerDestroyed(KMJobViewer*)), TQT_SLOT(slotViewerDestroyed(KMJobViewer*)));
+ m_views.insert(prname, view);
+ }
+
+ if (showIt)
+ {
+ view->show();
+ m_tray->show();
+ }
+ view->setPrinter(prname);
+
+ //m_timer->release(true);
+ m_timer->delay(10);
+}
+
+void KJobViewerApp::slotJobsShown(KMJobViewer *view, bool hasJobs)
+{
+ if (!hasJobs && !view->isVisible() && !view->isSticky())
+ {
+ kdDebug() << "removing view: " << view->printer() << endl;
+ // the window is hidden and doesn't have any job shown -> destroy it
+ // closing won't have any effect as the KMJobViewer overload closeEvent()
+ m_views.remove(view->printer());
+ }
+
+ if (m_views.count() > 0)
+ {
+ if (!m_tray->isVisible())
+ m_tray->show();
+ }
+ else {
+ KStartupInfo::appStarted();
+ kapp->quit();
+ }
+}
+
+void KJobViewerApp::slotTimer()
+{
+ // Update printer list
+ KMManager::self()->printerList(true);
+
+ // Refresh views. The first time, job list is reloaded,
+ // other views will simply use reloaded job list
+ bool trigger(true);
+ TQDictIterator<KMJobViewer> it(m_views);
+ for (; it.current(); ++it, trigger=false)
+ it.current()->refresh(trigger);
+}
+
+void KJobViewerApp::slotPrinterChanged(KMJobViewer *view, const TQString& prname)
+{
+ KMJobViewer *other = m_views.find(prname);
+ if (other)
+ {
+ if (other->isVisible())
+ KWin::activateWindow(other->winId());
+ else
+ other->show();
+ }
+ else
+ {
+ m_views.take(view->printer());
+ m_views.insert(prname, view);
+ view->setPrinter(prname);
+ }
+}
+
+void KJobViewerApp::reload()
+{
+ // trigger delayed refresh in all views
+ m_timer->delay(10);
+}
+
+void KJobViewerApp::slotViewerDestroyed(KMJobViewer *view)
+{
+ if (view)
+ m_views.take(view->printer());
+ if (m_views.count() == 0)
+ kapp->quit();
+}
+
+#include "kjobviewer.moc"
diff --git a/tdeprint/kjobviewer/kjobviewer.desktop b/tdeprint/kjobviewer/kjobviewer.desktop
new file mode 100644
index 000000000..965ed49bf
--- /dev/null
+++ b/tdeprint/kjobviewer/kjobviewer.desktop
@@ -0,0 +1,92 @@
+[Desktop Entry]
+Exec=kjobviewer --all --show %i %m
+Icon=kjobviewer
+Terminal=false
+Type=Application
+X-KDE-StartupNotify=true
+
+Name=KJobViewer
+Name[bn]=কে-জব-ভিউয়ার
+Name[csb]=Przezérnik pòlétów drëkera
+Name[cy]=KGwelyddSwyddi
+Name[ja]=K ジョブビューア
+Name[nds]=Opgavenkieker
+Name[ne]=KJob दर्शक
+Name[pl]=Przeglądarka zadań drukowania
+Name[pt_BR]=Trabalhos de Impressão
+Name[ro]=Vizualizor lucrări de tipărit
+Name[rw]=K-IkigaragazaUmurimo
+Name[sk]=Prehliadač úloh
+Name[sv]=K-jobbvisare
+Name[ta]=கேபணி காட்சியாளன்
+Name[tg]=Намоишгари корҳо
+Name[vi]=Trình theo dõi Tác vụ In ấn
+GenericName=Print Jobs
+GenericName[af]=Drukker Werke
+GenericName[be]=Заданні друку
+GenericName[bg]=Задания за печат
+GenericName[bn]=মুদ্রণ তালিকা
+GenericName[bs]=Zadaci štampe
+GenericName[ca]=Treballs d'impressió
+GenericName[cs]=Tiskové úlohy
+GenericName[csb]=Pòlétë drëkera
+GenericName[cy]=Swyddi Argraffu
+GenericName[da]=Udskriv job
+GenericName[de]=Druckaufträge
+GenericName[el]=Εργασίες εκτύπωσης
+GenericName[eo]=Printtaskoj
+GenericName[es]=Trabajos de impresión
+GenericName[et]=Printeri tööd
+GenericName[eu]=Inprimaketa lanak
+GenericName[fa]=چاپ کارها
+GenericName[fi]=Tulostustyöt
+GenericName[fr]=Tâches d'impressions
+GenericName[fy]=printtaken
+GenericName[ga]=Jabanna Priontála
+GenericName[gl]=Traballos de Impresión
+GenericName[he]=עבודות הדפסה
+GenericName[hr]=Zadaci ispisivanja
+GenericName[hu]=Nyomtatási feladatok
+GenericName[is]=Prentverk
+GenericName[it]=Lavori di stampa
+GenericName[ja]=印刷ジョブ
+GenericName[ka]=ბეჭდვის დავალება
+GenericName[kk]=Басып шығару тапсырмалары
+GenericName[km]=ការងារ​បោះពុម្ព
+GenericName[lt]=Spausdinimo užduotys
+GenericName[mk]=Задачи за печатење
+GenericName[ms]=Cetak Kerja
+GenericName[nb]=Utskriftsjobber
+GenericName[nds]=Druckopgaven
+GenericName[ne]=मुद्रण कार्य
+GenericName[nl]=Afdruktaken
+GenericName[nn]=Utskriftsjobbar
+GenericName[pa]=ਛਪਾਈ ਕੰਮ
+GenericName[pl]=Zadania drukowania
+GenericName[pt]=Tarefas de Impressão
+GenericName[pt_BR]=Tarefas de Impressão
+GenericName[ro]=Lucrări de tipărit
+GenericName[ru]=Задания печати
+GenericName[rw]=Gucapa Imirimo
+GenericName[se]=Čálihanbarggut
+GenericName[sk]=Tlačové úlohy
+GenericName[sl]=Tiskalniška opravila
+GenericName[sr]=Послови штампе
+GenericName[sr@Latn]=Poslovi štampe
+GenericName[sv]=Skrivarjobb
+GenericName[ta]=அச்சுப் பணிகள்
+GenericName[te]=ప్రచురణ పనులు
+GenericName[tg]=Корҳои чопгар
+GenericName[th]=งานพิมพ์
+GenericName[tr]=Yazdırma Görevleri
+GenericName[tt]=Bastıru Eşläre
+GenericName[uk]=Задачі друку
+GenericName[uz]=Bosib chiqarish vazifalari
+GenericName[uz@cyrillic]=Босиб чиқариш вазифалари
+GenericName[vi]=Tác vụ In ấn
+GenericName[wa]=Bouyes d' imprimaedje
+GenericName[zh_CN]=打印任务
+GenericName[zh_TW]=列印工作
+
+X-DCOP-ServiceType=Unique
+Categories=Qt;KDE;Utility;X-KDE-Utilities-Peripherals;
diff --git a/tdeprint/kjobviewer/kjobviewer.h b/tdeprint/kjobviewer/kjobviewer.h
new file mode 100644
index 000000000..967262de2
--- /dev/null
+++ b/tdeprint/kjobviewer/kjobviewer.h
@@ -0,0 +1,57 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#ifndef KJOBVIEWER_H
+#define KJOBVIEWER_H
+
+#include <kuniqueapplication.h>
+#include <tdeprint/kpreloadobject.h>
+#include <tqdict.h>
+
+class KMJobViewer;
+class KMTimer;
+class JobTray;
+
+class KJobViewerApp : public KUniqueApplication, public KPReloadObject
+{
+ Q_OBJECT
+ friend class JobTray;
+public:
+ KJobViewerApp();
+ virtual ~KJobViewerApp();
+
+ virtual int newInstance();
+
+protected:
+ void initialize();
+ void reload();
+
+protected slots:
+ void slotJobsShown(KMJobViewer*, bool);
+ void slotTimer();
+ void slotPrinterChanged(KMJobViewer*, const TQString&);
+ void slotViewerDestroyed(KMJobViewer*);
+
+private:
+ TQDict<KMJobViewer> m_views;
+ JobTray *m_tray;
+ KMTimer *m_timer;
+};
+
+#endif
diff --git a/tdeprint/kjobviewer/kjobviewerui.rc b/tdeprint/kjobviewer/kjobviewerui.rc
new file mode 100644
index 000000000..83592dfc6
--- /dev/null
+++ b/tdeprint/kjobviewer/kjobviewerui.rc
@@ -0,0 +1,35 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="kjobviewer">
+<MenuBar>
+ <Menu name="jobs"><text>&amp;Jobs</text>
+ <Action name="job_hold" />
+ <Action name="job_resume" />
+ <Separator />
+ <Action name="job_remove" />
+ <Action name="job_move" />
+ <Separator />
+ <Action name="job_restart" />
+ </Menu>
+ <Menu name="filter"><text>F&amp;ilter</text>
+ <Action name="filter_modify" />
+ <Action name="view_completed" />
+ <Action name="view_user_jobs" />
+ </Menu>
+</MenuBar>
+<ToolBar name="mainToolBar">
+ <Action name="job_hold" />
+ <Action name="job_resume" />
+ <Separator />
+ <Action name="job_remove" />
+ <Action name="job_move" />
+ <Separator />
+ <Action name="job_restart" />
+ <Separator />
+ <Action name="filter_modify" />
+ <Action name="view_completed" />
+ <Action name="view_user_jobs" />
+ <Action name="view_username" />
+ <Separator />
+ <Action name="refresh" />
+</ToolBar>
+</kpartgui>
diff --git a/tdeprint/kjobviewer/main.cpp b/tdeprint/kjobviewer/main.cpp
new file mode 100644
index 000000000..e75a00e13
--- /dev/null
+++ b/tdeprint/kjobviewer/main.cpp
@@ -0,0 +1,49 @@
+/*
+ * This file is part of the KDE libraries
+ * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ **/
+
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kaboutdata.h>
+
+#include "kjobviewer.h"
+#include <klocale.h>
+#include <stdlib.h>
+
+static KCmdLineOptions options[] = {
+ { "d <printer-name>", I18N_NOOP("The printer for which jobs are requested"), 0 },
+ { "noshow", I18N_NOOP("Show job viewer at startup"), 0},
+ { "all", I18N_NOOP("Show jobs for all printers"), 0},
+ KCmdLineLastOption
+};
+
+
+extern "C" int KDE_EXPORT kdemain(int argc, char *argv[])
+{
+ KAboutData aboutData("kjobviewer",I18N_NOOP("KJobViewer"),"0.1",I18N_NOOP("A print job viewer"),KAboutData::License_GPL,"(c) 2001, Michael Goffioul", 0, "http://printing.kde.org");
+ aboutData.addAuthor("Michael Goffioul",0,"tdeprint@swing.be");
+ KCmdLineArgs::init(argc,argv,&aboutData);
+ KCmdLineArgs::addCmdLineOptions(options);
+ KJobViewerApp::addCmdLineOptions();
+
+ if (!KJobViewerApp::start())
+ exit(0);
+
+ KJobViewerApp a;
+ return a.exec();
+}