From 5159cd2beb2e87806a5b54e9991b7895285c9d3e Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:04:16 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- tdeprint/CMakeLists.txt | 12 +- tdeprint/Makefile.am | 6 +- tdeprint/cups/CMakeLists.txt | 6 +- tdeprint/cups/Makefile.am | 2 +- tdeprint/cups/cupsaddsmb2.cpp | 2 +- tdeprint/cups/cupsdconf2/CMakeLists.txt | 8 +- tdeprint/cups/cupsdconf2/Makefile.am | 2 +- tdeprint/cups/cupsdconf2/cupsdconf.cpp | 2 +- tdeprint/cups/cupsdconf2/cupsddialog.cpp | 2 +- tdeprint/cups/cupsdconf2/cupsdlogpage.cpp | 2 +- tdeprint/cups/cupsdconf2/qdirlineedit.cpp | 2 +- tdeprint/cups/cupsdconf2/qdirmultilineedit.cpp | 2 +- tdeprint/cups/cupsinfos.cpp | 6 +- tdeprint/cups/kmconfigcups.cpp | 2 +- tdeprint/cups/kmconfigcupsdir.cpp | 2 +- tdeprint/cups/kmcupsconfigwidget.cpp | 2 +- tdeprint/cups/kmcupsmanager.cpp | 2 +- tdeprint/ext/kextprinterimpl.cpp | 2 +- tdeprint/kfilelist.cpp | 326 ------------------------- tdeprint/kfilelist.h | 62 ----- tdeprint/kmfactory.cpp | 4 +- tdeprint/kmjobmanager.cpp | 2 +- tdeprint/kmmanager.cpp | 2 +- tdeprint/kmprinter.cpp | 2 +- tdeprint/kpfileselectpage.cpp | 2 +- tdeprint/kprintdialog.cpp | 6 +- tdeprint/kprinter.cpp | 2 +- tdeprint/kprinterimpl.cpp | 2 +- tdeprint/kprintpreview.cpp | 2 +- tdeprint/lpd/kmlpdmanager.cpp | 2 +- tdeprint/lpr/kmconfiglpr.cpp | 2 +- tdeprint/lpr/lprsettings.cpp | 2 +- tdeprint/management/CMakeLists.txt | 6 +- tdeprint/management/Makefile.am | 2 +- tdeprint/management/kmconfigdialog.cpp | 2 +- tdeprint/management/kmconfigfilter.cpp | 2 +- tdeprint/management/kmconfigfonts.cpp | 4 +- tdeprint/management/kmconfiggeneral.cpp | 2 +- tdeprint/management/kmconfigjobs.cpp | 2 +- tdeprint/management/kmconfigpreview.cpp | 2 +- tdeprint/management/kmdriverdbwidget.cpp | 4 +- tdeprint/management/kmjobviewer.cpp | 4 +- tdeprint/management/kmmainview.cpp | 2 +- tdeprint/management/kmspecialprinterdlg.cpp | 2 +- tdeprint/management/kmtimer.cpp | 2 +- tdeprint/management/kmwdrivertest.cpp | 2 +- tdeprint/management/kmwfile.cpp | 2 +- tdeprint/management/kxmlcommandselector.cpp | 2 +- tdeprint/printerfilter.cpp | 2 +- tdeprint/rlpr/kmproxywidget.cpp | 2 +- tdeprint/rlpr/krlprprinterimpl.cpp | 2 +- tdeprint/specials.desktop | 2 +- tdeprint/tdefilelist.cpp | 326 +++++++++++++++++++++++++ tdeprint/tdefilelist.h | 62 +++++ tdeprint/tdeprintcheck.h | 2 +- tdeprint/tdeprintd.cpp | 4 +- 56 files changed, 463 insertions(+), 463 deletions(-) delete mode 100644 tdeprint/kfilelist.cpp delete mode 100644 tdeprint/kfilelist.h create mode 100644 tdeprint/tdefilelist.cpp create mode 100644 tdeprint/tdefilelist.h (limited to 'tdeprint') diff --git a/tdeprint/CMakeLists.txt b/tdeprint/CMakeLists.txt index a7a97809f..724b0a0cb 100644 --- a/tdeprint/CMakeLists.txt +++ b/tdeprint/CMakeLists.txt @@ -32,9 +32,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/tdefx ${CMAKE_SOURCE_DIR}/tdecore ${CMAKE_SOURCE_DIR}/tdeui - ${CMAKE_SOURCE_DIR}/kio - ${CMAKE_SOURCE_DIR}/kio/kio - ${CMAKE_SOURCE_DIR}/kio/kfile + ${CMAKE_SOURCE_DIR}/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdefile ${CMAKE_SOURCE_DIR}/kded ) @@ -84,7 +84,7 @@ set( ${target}_SRCS tde_add_kpart( ${target} AUTOMOC SOURCES ${${target}_SRCS} - LINK kio-shared tdeinit_kded-shared + LINK tdeio-shared tdeinit_kded-shared DEPENDENCIES dcopidl dcopidl2cpp DESTINATION ${PLUGIN_INSTALL_DIR} ) @@ -104,7 +104,7 @@ set( ${target}_SRCS kpgeneralpage.cpp kpqtpage.cpp kmthreadjob.cpp kpipeprocess.cpp kpfilterpage.cpp kmspecialmanager.cpp tdeprintcheck.cpp plugincombobox.cpp kpreloadobject.cpp - kfilelist.cpp kprintaction.cpp kpfileselectpage.cpp + tdefilelist.cpp kprintaction.cpp kpfileselectpage.cpp treecombobox.cpp kxmlcommand.cpp util.cpp printerfilter.cpp marginpreview.cpp marginvaluewidget.cpp marginwidget.cpp kpmarginpage.cpp messagewindow.cpp posterpreview.cpp @@ -116,7 +116,7 @@ set( ${target}_SRCS tde_add_library( ${target} SHARED AUTOMOC SOURCES ${${target}_SRCS} VERSION 4.2.0 - LINK kio-shared + LINK tdeio-shared DEPENDENCIES dcopidl dcopidl2cpp DESTINATION ${LIB_INSTALL_DIR} ) diff --git a/tdeprint/Makefile.am b/tdeprint/Makefile.am index b70e46e93..7ea8df12a 100644 --- a/tdeprint/Makefile.am +++ b/tdeprint/Makefile.am @@ -23,7 +23,7 @@ libtdeprint_la_SOURCES = kmfactory.cpp kmjob.cpp kmjobmanager.cpp kmmanager.cpp kprintpreview.cpp kprintdialog.cpp kprinter.cpp kprinterimpl.cpp kprintdialogpage.cpp \ kpcopiespage.cpp kpdriverpage.cpp kprinterpropertydialog.cpp kpgeneralpage.cpp kpqtpage.cpp \ kmthreadjob.cpp kpipeprocess.cpp kpfilterpage.cpp \ - kmspecialmanager.cpp tdeprintcheck.cpp plugincombobox.cpp kpreloadobject.cpp kfilelist.cpp \ + kmspecialmanager.cpp tdeprintcheck.cpp plugincombobox.cpp kpreloadobject.cpp tdefilelist.cpp \ kprintaction.cpp kpfileselectpage.cpp treecombobox.cpp kmfactory.skel kxmlcommand.cpp \ util.cpp printerfilter.cpp marginpreview.cpp marginvaluewidget.cpp marginwidget.cpp \ kpmarginpage.cpp messagewindow.cpp posterpreview.cpp kpposterpage.cpp foomatic2loader.cpp \ @@ -40,7 +40,7 @@ noinst_HEADERS = kmdbentry.h kmfactory.h \ kpcopiespage.h kpdriverpage.h kprinterpropertydialog.h kpgeneralpage.h \ kpqtpage.h kprintprocess.h kmthreadjob.h kpipeprocess.h tdeprintd.h \ kpfilterpage.h kmspecialmanager.h tdeprintcheck.h plugincombobox.h \ - kfilelist.h kpfileselectpage.h treecombobox.h kxmlcommand.h \ + tdefilelist.h kpfileselectpage.h treecombobox.h kxmlcommand.h \ util.h driverparse.h printerfilter.h marginpreview.h marginwidget.h \ marginvaluewidget.h kpmarginpage.h messagewindow.h \ posterpreview.h kpposterpage.h foomatic2loader.h ppdloader.h @@ -104,7 +104,7 @@ noinst_LIBRARIES = libdriverparse.a libdriverparse_a_SOURCES = driverparse.c update_DATA = tdeprintrc.upd -updatedir = $(kde_datadir)/kconf_update +updatedir = $(kde_datadir)/tdeconf_update messages: rc.cpp $(EXTRACTRC) `find . -name "*.rc" -o -name "*.ui" | grep -v /cupsdconf` >> rc.cpp diff --git a/tdeprint/cups/CMakeLists.txt b/tdeprint/cups/CMakeLists.txt index 62c48618c..aa882ca7e 100644 --- a/tdeprint/cups/CMakeLists.txt +++ b/tdeprint/cups/CMakeLists.txt @@ -26,9 +26,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/tdecore ${CMAKE_SOURCE_DIR}/tdecore/network ${CMAKE_SOURCE_DIR}/tdeui - ${CMAKE_SOURCE_DIR}/kio - ${CMAKE_SOURCE_DIR}/kio/kio - ${CMAKE_SOURCE_DIR}/kio/kfile + ${CMAKE_SOURCE_DIR}/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdefile ${CMAKE_SOURCE_DIR}/tdeprint ${CMAKE_SOURCE_DIR}/tdeprint/management ) diff --git a/tdeprint/cups/Makefile.am b/tdeprint/cups/Makefile.am index 64e8b997d..cdbb0b92c 100644 --- a/tdeprint/cups/Makefile.am +++ b/tdeprint/cups/Makefile.am @@ -2,7 +2,7 @@ AM_CPPFLAGS = -D_TDEPRINT_COMPILE SUBDIRS = cupsdconf2 -INCLUDES= -I$(top_srcdir) -I$(top_srcdir)/kio -I$(top_srcdir)/kfile -I$(top_srcdir)/tdeprint -I$(top_srcdir)/tdeprint/management -I$(top_srcdir)/tdecore/network $(all_includes) +INCLUDES= -I$(top_srcdir) -I$(top_srcdir)/tdeio -I$(top_srcdir)/tdefile -I$(top_srcdir)/tdeprint -I$(top_srcdir)/tdeprint/management -I$(top_srcdir)/tdecore/network $(all_includes) kde_module_LTLIBRARIES = tdeprint_cups.la diff --git a/tdeprint/cups/cupsaddsmb2.cpp b/tdeprint/cups/cupsaddsmb2.cpp index f0057235e..685ce6e7e 100644 --- a/tdeprint/cups/cupsaddsmb2.cpp +++ b/tdeprint/cups/cupsaddsmb2.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeprint/cups/cupsdconf2/CMakeLists.txt b/tdeprint/cups/cupsdconf2/CMakeLists.txt index ceee1bc47..749d84182 100644 --- a/tdeprint/cups/cupsdconf2/CMakeLists.txt +++ b/tdeprint/cups/cupsdconf2/CMakeLists.txt @@ -17,9 +17,9 @@ include_directories( ${CMAKE_BINARY_DIR}/tdecore ${CMAKE_SOURCE_DIR}/tdecore ${CMAKE_SOURCE_DIR}/tdeui - ${CMAKE_SOURCE_DIR}/kio - ${CMAKE_SOURCE_DIR}/kio/kio - ${CMAKE_SOURCE_DIR}/kio/kfile + ${CMAKE_SOURCE_DIR}/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdefile ) link_directories( @@ -50,5 +50,5 @@ set( ${target}_SRCS tde_add_tdeinit_executable( ${target} AUTOMOC SOURCES ${${target}_SRCS} - LINK kio-shared ${CUPS_LIBRARIES} + LINK tdeio-shared ${CUPS_LIBRARIES} ) diff --git a/tdeprint/cups/cupsdconf2/Makefile.am b/tdeprint/cups/cupsdconf2/Makefile.am index eb7e42159..b0c111bf8 100644 --- a/tdeprint/cups/cupsdconf2/Makefile.am +++ b/tdeprint/cups/cupsdconf2/Makefile.am @@ -1,6 +1,6 @@ #$Id$ -INCLUDES= -I$(top_srcdir) -I$(top_srcdir)/kio -I$(top_srcdir)/kfile $(all_includes) +INCLUDES= -I$(top_srcdir) -I$(top_srcdir)/tdeio -I$(top_srcdir)/tdefile $(all_includes) bin_PROGRAMS = lib_LTLIBRARIES = diff --git a/tdeprint/cups/cupsdconf2/cupsdconf.cpp b/tdeprint/cups/cupsdconf2/cupsdconf.cpp index a05e44d6f..102ead1c8 100644 --- a/tdeprint/cups/cupsdconf2/cupsdconf.cpp +++ b/tdeprint/cups/cupsdconf2/cupsdconf.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include diff --git a/tdeprint/cups/cupsdconf2/cupsddialog.cpp b/tdeprint/cups/cupsdconf2/cupsddialog.cpp index ada83d362..d221f2f04 100644 --- a/tdeprint/cups/cupsdconf2/cupsddialog.cpp +++ b/tdeprint/cups/cupsdconf2/cupsddialog.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include diff --git a/tdeprint/cups/cupsdconf2/cupsdlogpage.cpp b/tdeprint/cups/cupsdconf2/cupsdlogpage.cpp index 61a89f933..00972e368 100644 --- a/tdeprint/cups/cupsdconf2/cupsdlogpage.cpp +++ b/tdeprint/cups/cupsdconf2/cupsdlogpage.cpp @@ -28,7 +28,7 @@ #include #include -#include +#include CupsdLogPage::CupsdLogPage(TQWidget *parent, const char *name) : CupsdPage(parent, name) diff --git a/tdeprint/cups/cupsdconf2/qdirlineedit.cpp b/tdeprint/cups/cupsdconf2/qdirlineedit.cpp index 7cf0ea74e..25c984ec4 100644 --- a/tdeprint/cups/cupsdconf2/qdirlineedit.cpp +++ b/tdeprint/cups/cupsdconf2/qdirlineedit.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include QDirLineEdit::QDirLineEdit(bool file, TQWidget *parent, const char *name) diff --git a/tdeprint/cups/cupsdconf2/qdirmultilineedit.cpp b/tdeprint/cups/cupsdconf2/qdirmultilineedit.cpp index b1bd96ee6..c2fcaab7b 100644 --- a/tdeprint/cups/cupsdconf2/qdirmultilineedit.cpp +++ b/tdeprint/cups/cupsdconf2/qdirmultilineedit.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include QDirMultiLineEdit::QDirMultiLineEdit(TQWidget *parent, const char *name) diff --git a/tdeprint/cups/cupsinfos.cpp b/tdeprint/cups/cupsinfos.cpp index 7962b13ef..5013b57cc 100644 --- a/tdeprint/cups/cupsinfos.cpp +++ b/tdeprint/cups/cupsinfos.cpp @@ -22,10 +22,10 @@ #include "kmtimer.h" #include "messagewindow.h" -#include -#include +#include +#include #include -#include +#include #include #include #include diff --git a/tdeprint/cups/kmconfigcups.cpp b/tdeprint/cups/kmconfigcups.cpp index 55a96d9d5..1b0ccdaea 100644 --- a/tdeprint/cups/kmconfigcups.cpp +++ b/tdeprint/cups/kmconfigcups.cpp @@ -21,7 +21,7 @@ #include "kmcupsconfigwidget.h" #include -#include +#include #include #include diff --git a/tdeprint/cups/kmconfigcupsdir.cpp b/tdeprint/cups/kmconfigcupsdir.cpp index 2fe66d787..6f16f5dfa 100644 --- a/tdeprint/cups/kmconfigcupsdir.cpp +++ b/tdeprint/cups/kmconfigcupsdir.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeprint/cups/kmcupsconfigwidget.cpp b/tdeprint/cups/kmcupsconfigwidget.cpp index ce005fc3b..a62583b1b 100644 --- a/tdeprint/cups/kmcupsconfigwidget.cpp +++ b/tdeprint/cups/kmcupsconfigwidget.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include #include class PortValidator : public TQIntValidator diff --git a/tdeprint/cups/kmcupsmanager.cpp b/tdeprint/cups/kmcupsmanager.cpp index e5d45a42a..d444db1f2 100644 --- a/tdeprint/cups/kmcupsmanager.cpp +++ b/tdeprint/cups/kmcupsmanager.cpp @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeprint/ext/kextprinterimpl.cpp b/tdeprint/ext/kextprinterimpl.cpp index c976f54e0..8959aa3e8 100644 --- a/tdeprint/ext/kextprinterimpl.cpp +++ b/tdeprint/ext/kextprinterimpl.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include KExtPrinterImpl::KExtPrinterImpl(TQObject *parent, const char *name, const TQStringList & /*args*/) diff --git a/tdeprint/kfilelist.cpp b/tdeprint/kfilelist.cpp deleted file mode 100644 index 44bd13a87..000000000 --- a/tdeprint/kfilelist.cpp +++ /dev/null @@ -1,326 +0,0 @@ -/* - * This file is part of the KDE libraries - * Copyright (c) 2001 Michael Goffioul - * - * 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 "kfilelist.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -KFileList::KFileList(TQWidget *parent, const char *name) -: TQWidget(parent, name) -{ - //WhatsThis strings.... (added by pfeifle@kde.org) - TQString whatsThisAddFileButton = i18n( " Add File button" - "

This button calls the 'File Open' dialog to let you" - " select a file for printing. Note, that " - "

  • you can select ASCII or International Text, PDF," - " PostScript, JPEG, TIFF, PNG, GIF and many other graphic" - " formats." - "
  • you can select various files from different paths" - " and send them as one \"multi-file job\" to the printing" - " system." - "
" - "
" ); - - TQString whatsThisRemoveFileButton = i18n(" Remove File button" - "

This button removes the highlighted file from the" - " list of to-be-printed files." - " " ); - - TQString whatsThisMoveFileUpButton = i18n(" Move File Up button" - "

This button moves the highlighted file up in the list" - " of files to be printed.

" - "

In effect, this changes the order" - " of the files' printout.

" - "
" ); - - TQString whatsThisMoveFileDownButton = i18n(" Move File Down button" - "

This button moves the highlighted file down in the list" - " of files to be printed.

" - "

In effect, this changes the order" - " of the files' printout.

" - "
" ); - - TQString whatsThisOpenFileButton = i18n( " File Open button" - "

This button tries to open the highlighted file, so" - " you can view or edit it before you send it to the printing" - " system.

" - "

If you open" - " files, TDEPrint will use the application matching the MIME type of" - " the file.

" - "
" ); - - TQString whatsThisFileSelectionListview = i18n( " File List view" - "

This list displays all the files you selected for printing." - " You can see the file name(s), file path(s) and the file" - " (MIME) type(s) as determined by TDEPrint. You may re-arrange the " - " initial order of the list " - " with the help of the arrow buttons on the right.

" - "

The files will be printed as a single job," - " in the same order as displayed in the list.

" - "

Note: You can select multiple files. The files may be in multiple" - " locations. The files may be of multiple MIME types. The buttons on the right" - " side let you add more files, remove already selected files from the list, " - " re-order the list (by moving files up or down), and open files. If you open" - " files, TDEPrint will use the application matching the MIME type of" - " the file.

" - "
" ); - - m_block = false; - - m_files = new KListView(this); - m_files->addColumn(i18n("Name")); - m_files->addColumn(i18n("Type")); - m_files->addColumn(i18n("Path")); - m_files->setAllColumnsShowFocus(true); - m_files->setSorting(-1); - m_files->setAcceptDrops(false); - m_files->setSelectionMode(TQListView::Extended); - m_files->header()->setStretchEnabled(true, 2); - TQWhatsThis::add(m_files, whatsThisFileSelectionListview); - connect(m_files, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelectionChanged())); - - m_add = new TQToolButton(this); - m_add->setIconSet(SmallIconSet("fileopen")); - connect(m_add, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddFile())); - TQToolTip::add(m_add, i18n("Add file")); - TQWhatsThis::add(m_add, whatsThisAddFileButton); - - m_remove = new TQToolButton(this); - m_remove->setIconSet(SmallIconSet("remove")); - connect(m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveFile())); - TQToolTip::add(m_remove, i18n("Remove file")); - TQWhatsThis::add(m_remove, whatsThisRemoveFileButton); - m_remove->setEnabled(false); - - m_open = new TQToolButton(this); - m_open->setIconSet(SmallIconSet("filefind")); - connect(m_open, TQT_SIGNAL(clicked()), TQT_SLOT(slotOpenFile())); - TQToolTip::add(m_open, i18n("Open file")); - TQWhatsThis::add(m_open, whatsThisOpenFileButton); - m_open->setEnabled(false); - - m_up = new TQToolButton(this); - m_up->setIconSet(SmallIconSet("up")); - connect(m_up, TQT_SIGNAL(clicked()), TQT_SLOT(slotUp())); - TQToolTip::add(m_up, i18n("Move up")); - TQWhatsThis::add(m_up, whatsThisMoveFileUpButton); - m_up->setEnabled(false); - - m_down = new TQToolButton(this); - m_down->setIconSet(SmallIconSet("down")); - connect(m_down, TQT_SIGNAL(clicked()), TQT_SLOT(slotDown())); - TQToolTip::add(m_down, i18n("Move down")); - TQWhatsThis::add(m_down, whatsThisMoveFileDownButton); - m_down->setEnabled(false); - - setAcceptDrops(true); - - TQToolTip::add(m_files, i18n( - "Drag file(s) here or use the button to open a file dialog. " - "Leave empty for <STDIN>.")); - - TQHBoxLayout *l0 = new TQHBoxLayout(this, 0, KDialog::spacingHint()); - TQVBoxLayout *l1 = new TQVBoxLayout(0, 0, 1); - l0->addWidget(m_files); - l0->addLayout(l1); - l1->addWidget(m_add); - l1->addWidget(m_remove); - l1->addWidget(m_open); - l1->addSpacing(10); - l1->addWidget(m_up); - l1->addWidget(m_down); - l1->addStretch(1); -} - -KFileList::~KFileList() -{ -} - -void KFileList::dragEnterEvent(TQDragEnterEvent *e) -{ - e->accept(KURLDrag::canDecode(e)); -} - -void KFileList::dropEvent(TQDropEvent *e) -{ - KURL::List files; - if (KURLDrag::decode(e, files)) - { - addFiles(files); - } -} - -void KFileList::addFiles(const KURL::List& files) -{ - if (files.count() > 0) - { - // search last item in current list, to add new ones at the end - TQListViewItem *item = m_files->firstChild(); - while (item && item->nextSibling()) - item = item->nextSibling(); - - for (KURL::List::ConstIterator it=files.begin(); it!=files.end(); ++it) - { - KMimeType::Ptr mime = KMimeType::findByURL( *it, 0, true, false); - item = new TQListViewItem(m_files, item, (*it).fileName(), mime->comment(), (*it).url()); - item->setPixmap(0, mime->pixmap(*it, KIcon::Small)); - } - - slotSelectionChanged(); - /* - if (m_files->childCount() > 0) - { - m_remove->setEnabled(true); - m_open->setEnabled(true); - if (m_files->currentItem() == 0) - m_files->setSelected(m_files->firstChild(), true); - } - */ - } -} - -void KFileList::setFileList(const TQStringList& files) -{ - m_files->clear(); - TQListViewItem *item = 0; - for (TQStringList::ConstIterator it=files.begin(); it!=files.end(); ++it) - { - KURL url = KURL::fromPathOrURL( *it ); - KMimeType::Ptr mime = KMimeType::findByURL(url, 0, true, false); - item = new TQListViewItem(m_files, item, url.fileName(), mime->comment(), url.url()); - item->setPixmap(0, mime->pixmap(url, KIcon::Small)); - } - slotSelectionChanged(); -} - -TQStringList KFileList::fileList() const -{ - TQStringList l; - TQListViewItem *item = m_files->firstChild(); - while (item) - { - l << item->text(2); - item = item->nextSibling(); - } - return l; -} - -void KFileList::slotAddFile() -{ - KURL::List fnames = KFileDialog::getOpenURLs(TQString::null, TQString::null, this); - if (!fnames.empty()) - addFiles(fnames); -} - -void KFileList::slotRemoveFile() -{ - TQPtrList l; - selection(l); - l.setAutoDelete(true); - m_block = true; - l.clear(); - m_block = false; - slotSelectionChanged(); -} - -void KFileList::slotOpenFile() -{ - TQListViewItem *item = m_files->currentItem(); - if (item) - { - KURL url( item->text( 2 ) ); - new KRun(url); - } -} - -TQSize KFileList::sizeHint() const -{ - return TQSize(100, 100); -} - -void KFileList::selection(TQPtrList& l) -{ - l.setAutoDelete(false); - TQListViewItem *item = m_files->firstChild(); - while (item) - { - if (item->isSelected()) - l.append(item); - item = item->nextSibling(); - } -} - -void KFileList::slotSelectionChanged() -{ - if (m_block) - return; - - TQPtrList l; - selection(l); - m_remove->setEnabled(l.count() > 0); - m_open->setEnabled(l.count() == 1); - m_up->setEnabled(l.count() == 1 && l.first()->itemAbove()); - m_down->setEnabled(l.count() == 1 && l.first()->itemBelow()); -} - -void KFileList::slotUp() -{ - TQPtrList l; - selection(l); - if (l.count() == 1 && l.first()->itemAbove()) - { - TQListViewItem *item(l.first()), *clone; - clone = new TQListViewItem(m_files, item->itemAbove()->itemAbove(), item->text(0), item->text(1), item->text(2)); - clone->setPixmap(0, *(item->pixmap(0))); - delete item; - m_files->setCurrentItem(clone); - m_files->setSelected(clone, true); - } -} - -void KFileList::slotDown() -{ - TQPtrList l; - selection(l); - if (l.count() == 1 && l.first()->itemBelow()) - { - TQListViewItem *item(l.first()), *clone; - clone = new TQListViewItem(m_files, item->itemBelow(), item->text(0), item->text(1), item->text(2)); - clone->setPixmap(0, *(item->pixmap(0))); - delete item; - m_files->setCurrentItem(clone); - m_files->setSelected(clone, true); - } -} - -#include "kfilelist.moc" diff --git a/tdeprint/kfilelist.h b/tdeprint/kfilelist.h deleted file mode 100644 index d5ef3ada1..000000000 --- a/tdeprint/kfilelist.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of the KDE libraries - * Copyright (c) 2001 Michael Goffioul - * - * 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 KFILELIST_H -#define KFILELIST_H - -#include -#include -#include - -class KListView; -class TQToolButton; -class TQListViewItem; - -class KFileList : public TQWidget -{ - Q_OBJECT -public: - KFileList(TQWidget *parent = 0, const char *name = 0); - virtual ~KFileList(); - - void setFileList(const TQStringList&); - TQStringList fileList() const; - TQSize sizeHint() const; - -protected slots: - void slotAddFile(); - void slotRemoveFile(); - void slotOpenFile(); - void slotSelectionChanged(); - void slotUp(); - void slotDown(); - -protected: - void dragEnterEvent(TQDragEnterEvent*); - void dropEvent(TQDropEvent*); - void addFiles(const KURL::List&); - void selection(TQPtrList&); - -private: - KListView *m_files; - TQToolButton *m_add, *m_remove, *m_open, *m_up, *m_down; - bool m_block; -}; - -#endif diff --git a/tdeprint/kmfactory.cpp b/tdeprint/kmfactory.cpp index a1b4ad4ee..7d972cbf8 100644 --- a/tdeprint/kmfactory.cpp +++ b/tdeprint/kmfactory.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include diff --git a/tdeprint/kmjobmanager.cpp b/tdeprint/kmjobmanager.cpp index 3496cdb1d..2a0e2ae50 100644 --- a/tdeprint/kmjobmanager.cpp +++ b/tdeprint/kmjobmanager.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include KMJobManager::KMJobManager(TQObject *parent, const char *name) : TQObject(parent,name) diff --git a/tdeprint/kmmanager.cpp b/tdeprint/kmmanager.cpp index 57e06994d..a597b94b6 100644 --- a/tdeprint/kmmanager.cpp +++ b/tdeprint/kmmanager.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeprint/kmprinter.cpp b/tdeprint/kmprinter.cpp index b18116ef8..22fc9d970 100644 --- a/tdeprint/kmprinter.cpp +++ b/tdeprint/kmprinter.cpp @@ -22,7 +22,7 @@ #include "driver.h" #include -#include +#include KMPrinter::KMPrinter() : KMObject() diff --git a/tdeprint/kpfileselectpage.cpp b/tdeprint/kpfileselectpage.cpp index f3131717a..6847ade2b 100644 --- a/tdeprint/kpfileselectpage.cpp +++ b/tdeprint/kpfileselectpage.cpp @@ -18,7 +18,7 @@ **/ #include "kpfileselectpage.h" -#include "kfilelist.h" +#include "tdefilelist.h" #include #include diff --git a/tdeprint/kprintdialog.cpp b/tdeprint/kprintdialog.cpp index 06a61e1c0..518f544f6 100644 --- a/tdeprint/kprintdialog.cpp +++ b/tdeprint/kprintdialog.cpp @@ -53,16 +53,16 @@ #include #include -#include +#include #include #include #include #include -#include +#include #include #include #include -#include +#include #include diff --git a/tdeprint/kprinter.cpp b/tdeprint/kprinter.cpp index 3664b4157..4d34280a0 100644 --- a/tdeprint/kprinter.cpp +++ b/tdeprint/kprinter.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeprint/kprinterimpl.cpp b/tdeprint/kprinterimpl.cpp index 5c3d840a0..fd05024a3 100644 --- a/tdeprint/kprinterimpl.cpp +++ b/tdeprint/kprinterimpl.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include diff --git a/tdeprint/kprintpreview.cpp b/tdeprint/kprintpreview.cpp index d5102ed3c..e81a23b08 100644 --- a/tdeprint/kprintpreview.cpp +++ b/tdeprint/kprintpreview.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include diff --git a/tdeprint/lpd/kmlpdmanager.cpp b/tdeprint/lpd/kmlpdmanager.cpp index 5251b990a..a11f79304 100644 --- a/tdeprint/lpd/kmlpdmanager.cpp +++ b/tdeprint/lpd/kmlpdmanager.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include diff --git a/tdeprint/lpr/kmconfiglpr.cpp b/tdeprint/lpr/kmconfiglpr.cpp index b5c43ebef..8a6988188 100644 --- a/tdeprint/lpr/kmconfiglpr.cpp +++ b/tdeprint/lpr/kmconfiglpr.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include KMConfigLpr::KMConfigLpr(TQWidget *parent, const char *name) : KMConfigPage(parent, name) diff --git a/tdeprint/lpr/lprsettings.cpp b/tdeprint/lpr/lprsettings.cpp index 30b650c17..a539f4160 100644 --- a/tdeprint/lpr/lprsettings.cpp +++ b/tdeprint/lpr/lprsettings.cpp @@ -21,7 +21,7 @@ #include "kmmanager.h" #include "kmfactory.h" -#include +#include #include #include diff --git a/tdeprint/management/CMakeLists.txt b/tdeprint/management/CMakeLists.txt index ccaf2a70a..47dcda996 100644 --- a/tdeprint/management/CMakeLists.txt +++ b/tdeprint/management/CMakeLists.txt @@ -24,9 +24,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/tdefx ${CMAKE_SOURCE_DIR}/tdecore ${CMAKE_SOURCE_DIR}/tdeui - ${CMAKE_SOURCE_DIR}/kio - ${CMAKE_SOURCE_DIR}/kio/kio - ${CMAKE_SOURCE_DIR}/kio/kfile + ${CMAKE_SOURCE_DIR}/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdeio + ${CMAKE_SOURCE_DIR}/tdeio/tdefile ${CMAKE_SOURCE_DIR}/tdeprint ) diff --git a/tdeprint/management/Makefile.am b/tdeprint/management/Makefile.am index f0d1acd9f..f9f5c0ce4 100644 --- a/tdeprint/management/Makefile.am +++ b/tdeprint/management/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -D_TDEPRINT_COMPILE -INCLUDES= -I$(top_srcdir)/tdefx -I$(top_srcdir)/tdeprint -I$(top_builddir)/tdeprint -I$(top_srcdir)/kio -I$(top_srcdir)/kfile -I$(top_srcdir) $(all_includes) +INCLUDES= -I$(top_srcdir)/tdefx -I$(top_srcdir)/tdeprint -I$(top_builddir)/tdeprint -I$(top_srcdir)/tdeio -I$(top_srcdir)/tdefile -I$(top_srcdir) $(all_includes) lib_LTLIBRARIES = libtdeprint_management.la kde_module_LTLIBRARIES = libtdeprint_management_module.la diff --git a/tdeprint/management/kmconfigdialog.cpp b/tdeprint/management/kmconfigdialog.cpp index ee63e9eeb..b3ef6e329 100644 --- a/tdeprint/management/kmconfigdialog.cpp +++ b/tdeprint/management/kmconfigdialog.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include KMConfigDialog::KMConfigDialog(TQWidget *parent, const char *name) : KDialogBase(IconList,i18n("TDE Print Configuration"),Ok|Cancel,Ok,parent,name,true,true) diff --git a/tdeprint/management/kmconfigfilter.cpp b/tdeprint/management/kmconfigfilter.cpp index 2eea53b0e..bcbe1b0f7 100644 --- a/tdeprint/management/kmconfigfilter.cpp +++ b/tdeprint/management/kmconfigfilter.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include #include diff --git a/tdeprint/management/kmconfigfonts.cpp b/tdeprint/management/kmconfigfonts.cpp index b933cab00..91861f5ca 100644 --- a/tdeprint/management/kmconfigfonts.cpp +++ b/tdeprint/management/kmconfigfonts.cpp @@ -29,10 +29,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/tdeprint/management/kmconfiggeneral.cpp b/tdeprint/management/kmconfiggeneral.cpp index f02cfa854..b7c0a1522 100644 --- a/tdeprint/management/kmconfiggeneral.cpp +++ b/tdeprint/management/kmconfiggeneral.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeprint/management/kmconfigjobs.cpp b/tdeprint/management/kmconfigjobs.cpp index 0fb40fb7b..667b40381 100644 --- a/tdeprint/management/kmconfigjobs.cpp +++ b/tdeprint/management/kmconfigjobs.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include KMConfigJobs::KMConfigJobs(TQWidget *parent, const char *name) diff --git a/tdeprint/management/kmconfigpreview.cpp b/tdeprint/management/kmconfigpreview.cpp index 548968701..3d084f735 100644 --- a/tdeprint/management/kmconfigpreview.cpp +++ b/tdeprint/management/kmconfigpreview.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include #include KMConfigPreview::KMConfigPreview(TQWidget *parent, const char *name) diff --git a/tdeprint/management/kmdriverdbwidget.cpp b/tdeprint/management/kmdriverdbwidget.cpp index 704a20db5..1b05f8e9c 100644 --- a/tdeprint/management/kmdriverdbwidget.cpp +++ b/tdeprint/management/kmdriverdbwidget.cpp @@ -35,9 +35,9 @@ #include #include -#include +#include #include -#include +#include KMDriverDbWidget::KMDriverDbWidget(TQWidget *parent, const char *name) : TQWidget(parent,name) diff --git a/tdeprint/management/kmjobviewer.cpp b/tdeprint/management/kmjobviewer.cpp index da8a98016..5e4561c19 100644 --- a/tdeprint/management/kmjobviewer.cpp +++ b/tdeprint/management/kmjobviewer.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include @@ -52,7 +52,7 @@ #include #include #include -#include +#include #undef m_manager #define m_manager KMFactory::self()->jobManager() diff --git a/tdeprint/management/kmmainview.cpp b/tdeprint/management/kmmainview.cpp index daafbff97..858fca0fc 100644 --- a/tdeprint/management/kmmainview.cpp +++ b/tdeprint/management/kmmainview.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeprint/management/kmspecialprinterdlg.cpp b/tdeprint/management/kmspecialprinterdlg.cpp index 9e3775c14..ba6801769 100644 --- a/tdeprint/management/kmspecialprinterdlg.cpp +++ b/tdeprint/management/kmspecialprinterdlg.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include KMSpecialPrinterDlg::KMSpecialPrinterDlg(TQWidget *parent, const char *name) diff --git a/tdeprint/management/kmtimer.cpp b/tdeprint/management/kmtimer.cpp index 5acc27351..a45a9caa0 100644 --- a/tdeprint/management/kmtimer.cpp +++ b/tdeprint/management/kmtimer.cpp @@ -20,7 +20,7 @@ #include "kmtimer.h" #include "kmfactory.h" -#include +#include KMTimer* KMTimer::m_self = 0; diff --git a/tdeprint/management/kmwdrivertest.cpp b/tdeprint/management/kmwdrivertest.cpp index 0e0cd306b..4f57762aa 100644 --- a/tdeprint/management/kmwdrivertest.cpp +++ b/tdeprint/management/kmwdrivertest.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include KMWDriverTest::KMWDriverTest(TQWidget *parent, const char *name) : KMWizardPage(parent,name) diff --git a/tdeprint/management/kmwfile.cpp b/tdeprint/management/kmwfile.cpp index 1fbaf45ff..f3b54dcdc 100644 --- a/tdeprint/management/kmwfile.cpp +++ b/tdeprint/management/kmwfile.cpp @@ -26,7 +26,7 @@ #include #include -#include +#include KMWFile::KMWFile(TQWidget *parent, const char *name) : KMWizardPage(parent,name) diff --git a/tdeprint/management/kxmlcommandselector.cpp b/tdeprint/management/kxmlcommandselector.cpp index 6f2b4485e..093d2a909 100644 --- a/tdeprint/management/kxmlcommandselector.cpp +++ b/tdeprint/management/kxmlcommandselector.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tdeprint/printerfilter.cpp b/tdeprint/printerfilter.cpp index c30409e66..d1889dd1c 100644 --- a/tdeprint/printerfilter.cpp +++ b/tdeprint/printerfilter.cpp @@ -21,7 +21,7 @@ #include "kmprinter.h" #include "kmfactory.h" -#include +#include #include #include diff --git a/tdeprint/rlpr/kmproxywidget.cpp b/tdeprint/rlpr/kmproxywidget.cpp index 763282ecd..a2a3e6a85 100644 --- a/tdeprint/rlpr/kmproxywidget.cpp +++ b/tdeprint/rlpr/kmproxywidget.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include KMProxyWidget::KMProxyWidget(TQWidget *parent, const char *name) diff --git a/tdeprint/rlpr/krlprprinterimpl.cpp b/tdeprint/rlpr/krlprprinterimpl.cpp index 628205a31..5e927a940 100644 --- a/tdeprint/rlpr/krlprprinterimpl.cpp +++ b/tdeprint/rlpr/krlprprinterimpl.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include KRlprPrinterImpl::KRlprPrinterImpl(TQObject *parent, const char *name, const TQStringList & /*args*/) diff --git a/tdeprint/specials.desktop b/tdeprint/specials.desktop index f6edcea32..467a26d7e 100644 --- a/tdeprint/specials.desktop +++ b/tdeprint/specials.desktop @@ -768,7 +768,7 @@ Extension= Require=exec:/tdeprintfax [Printer 3] -Command=ps2pdf -sPAPERSIZE=%psl %in %out && kmailservice 'mailto:?attachment=file:%out' && sleep 15 && rm -f %out +Command=ps2pdf -sPAPERSIZE=%psl %in %out && tdemailservice 'mailto:?attachment=file:%out' && sleep 15 && rm -f %out Comment=Attachment for KMail Composer Comment[af]=Aanhegsel vir Kpos Saamsteller Comment[ar]=مرفقات كاتب KMail diff --git a/tdeprint/tdefilelist.cpp b/tdeprint/tdefilelist.cpp new file mode 100644 index 000000000..9d02b77f6 --- /dev/null +++ b/tdeprint/tdefilelist.cpp @@ -0,0 +1,326 @@ +/* + * This file is part of the KDE libraries + * Copyright (c) 2001 Michael Goffioul + * + * 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 "tdefilelist.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +KFileList::KFileList(TQWidget *parent, const char *name) +: TQWidget(parent, name) +{ + //WhatsThis strings.... (added by pfeifle@kde.org) + TQString whatsThisAddFileButton = i18n( " Add File button" + "

This button calls the 'File Open' dialog to let you" + " select a file for printing. Note, that " + "

  • you can select ASCII or International Text, PDF," + " PostScript, JPEG, TIFF, PNG, GIF and many other graphic" + " formats." + "
  • you can select various files from different paths" + " and send them as one \"multi-file job\" to the printing" + " system." + "
" + "
" ); + + TQString whatsThisRemoveFileButton = i18n(" Remove File button" + "

This button removes the highlighted file from the" + " list of to-be-printed files." + " " ); + + TQString whatsThisMoveFileUpButton = i18n(" Move File Up button" + "

This button moves the highlighted file up in the list" + " of files to be printed.

" + "

In effect, this changes the order" + " of the files' printout.

" + "
" ); + + TQString whatsThisMoveFileDownButton = i18n(" Move File Down button" + "

This button moves the highlighted file down in the list" + " of files to be printed.

" + "

In effect, this changes the order" + " of the files' printout.

" + "
" ); + + TQString whatsThisOpenFileButton = i18n( " File Open button" + "

This button tries to open the highlighted file, so" + " you can view or edit it before you send it to the printing" + " system.

" + "

If you open" + " files, TDEPrint will use the application matching the MIME type of" + " the file.

" + "
" ); + + TQString whatsThisFileSelectionListview = i18n( " File List view" + "

This list displays all the files you selected for printing." + " You can see the file name(s), file path(s) and the file" + " (MIME) type(s) as determined by TDEPrint. You may re-arrange the " + " initial order of the list " + " with the help of the arrow buttons on the right.

" + "

The files will be printed as a single job," + " in the same order as displayed in the list.

" + "

Note: You can select multiple files. The files may be in multiple" + " locations. The files may be of multiple MIME types. The buttons on the right" + " side let you add more files, remove already selected files from the list, " + " re-order the list (by moving files up or down), and open files. If you open" + " files, TDEPrint will use the application matching the MIME type of" + " the file.

" + "
" ); + + m_block = false; + + m_files = new KListView(this); + m_files->addColumn(i18n("Name")); + m_files->addColumn(i18n("Type")); + m_files->addColumn(i18n("Path")); + m_files->setAllColumnsShowFocus(true); + m_files->setSorting(-1); + m_files->setAcceptDrops(false); + m_files->setSelectionMode(TQListView::Extended); + m_files->header()->setStretchEnabled(true, 2); + TQWhatsThis::add(m_files, whatsThisFileSelectionListview); + connect(m_files, TQT_SIGNAL(selectionChanged()), TQT_SLOT(slotSelectionChanged())); + + m_add = new TQToolButton(this); + m_add->setIconSet(SmallIconSet("fileopen")); + connect(m_add, TQT_SIGNAL(clicked()), TQT_SLOT(slotAddFile())); + TQToolTip::add(m_add, i18n("Add file")); + TQWhatsThis::add(m_add, whatsThisAddFileButton); + + m_remove = new TQToolButton(this); + m_remove->setIconSet(SmallIconSet("remove")); + connect(m_remove, TQT_SIGNAL(clicked()), TQT_SLOT(slotRemoveFile())); + TQToolTip::add(m_remove, i18n("Remove file")); + TQWhatsThis::add(m_remove, whatsThisRemoveFileButton); + m_remove->setEnabled(false); + + m_open = new TQToolButton(this); + m_open->setIconSet(SmallIconSet("filefind")); + connect(m_open, TQT_SIGNAL(clicked()), TQT_SLOT(slotOpenFile())); + TQToolTip::add(m_open, i18n("Open file")); + TQWhatsThis::add(m_open, whatsThisOpenFileButton); + m_open->setEnabled(false); + + m_up = new TQToolButton(this); + m_up->setIconSet(SmallIconSet("up")); + connect(m_up, TQT_SIGNAL(clicked()), TQT_SLOT(slotUp())); + TQToolTip::add(m_up, i18n("Move up")); + TQWhatsThis::add(m_up, whatsThisMoveFileUpButton); + m_up->setEnabled(false); + + m_down = new TQToolButton(this); + m_down->setIconSet(SmallIconSet("down")); + connect(m_down, TQT_SIGNAL(clicked()), TQT_SLOT(slotDown())); + TQToolTip::add(m_down, i18n("Move down")); + TQWhatsThis::add(m_down, whatsThisMoveFileDownButton); + m_down->setEnabled(false); + + setAcceptDrops(true); + + TQToolTip::add(m_files, i18n( + "Drag file(s) here or use the button to open a file dialog. " + "Leave empty for <STDIN>.")); + + TQHBoxLayout *l0 = new TQHBoxLayout(this, 0, KDialog::spacingHint()); + TQVBoxLayout *l1 = new TQVBoxLayout(0, 0, 1); + l0->addWidget(m_files); + l0->addLayout(l1); + l1->addWidget(m_add); + l1->addWidget(m_remove); + l1->addWidget(m_open); + l1->addSpacing(10); + l1->addWidget(m_up); + l1->addWidget(m_down); + l1->addStretch(1); +} + +KFileList::~KFileList() +{ +} + +void KFileList::dragEnterEvent(TQDragEnterEvent *e) +{ + e->accept(KURLDrag::canDecode(e)); +} + +void KFileList::dropEvent(TQDropEvent *e) +{ + KURL::List files; + if (KURLDrag::decode(e, files)) + { + addFiles(files); + } +} + +void KFileList::addFiles(const KURL::List& files) +{ + if (files.count() > 0) + { + // search last item in current list, to add new ones at the end + TQListViewItem *item = m_files->firstChild(); + while (item && item->nextSibling()) + item = item->nextSibling(); + + for (KURL::List::ConstIterator it=files.begin(); it!=files.end(); ++it) + { + KMimeType::Ptr mime = KMimeType::findByURL( *it, 0, true, false); + item = new TQListViewItem(m_files, item, (*it).fileName(), mime->comment(), (*it).url()); + item->setPixmap(0, mime->pixmap(*it, KIcon::Small)); + } + + slotSelectionChanged(); + /* + if (m_files->childCount() > 0) + { + m_remove->setEnabled(true); + m_open->setEnabled(true); + if (m_files->currentItem() == 0) + m_files->setSelected(m_files->firstChild(), true); + } + */ + } +} + +void KFileList::setFileList(const TQStringList& files) +{ + m_files->clear(); + TQListViewItem *item = 0; + for (TQStringList::ConstIterator it=files.begin(); it!=files.end(); ++it) + { + KURL url = KURL::fromPathOrURL( *it ); + KMimeType::Ptr mime = KMimeType::findByURL(url, 0, true, false); + item = new TQListViewItem(m_files, item, url.fileName(), mime->comment(), url.url()); + item->setPixmap(0, mime->pixmap(url, KIcon::Small)); + } + slotSelectionChanged(); +} + +TQStringList KFileList::fileList() const +{ + TQStringList l; + TQListViewItem *item = m_files->firstChild(); + while (item) + { + l << item->text(2); + item = item->nextSibling(); + } + return l; +} + +void KFileList::slotAddFile() +{ + KURL::List fnames = KFileDialog::getOpenURLs(TQString::null, TQString::null, this); + if (!fnames.empty()) + addFiles(fnames); +} + +void KFileList::slotRemoveFile() +{ + TQPtrList l; + selection(l); + l.setAutoDelete(true); + m_block = true; + l.clear(); + m_block = false; + slotSelectionChanged(); +} + +void KFileList::slotOpenFile() +{ + TQListViewItem *item = m_files->currentItem(); + if (item) + { + KURL url( item->text( 2 ) ); + new KRun(url); + } +} + +TQSize KFileList::sizeHint() const +{ + return TQSize(100, 100); +} + +void KFileList::selection(TQPtrList& l) +{ + l.setAutoDelete(false); + TQListViewItem *item = m_files->firstChild(); + while (item) + { + if (item->isSelected()) + l.append(item); + item = item->nextSibling(); + } +} + +void KFileList::slotSelectionChanged() +{ + if (m_block) + return; + + TQPtrList l; + selection(l); + m_remove->setEnabled(l.count() > 0); + m_open->setEnabled(l.count() == 1); + m_up->setEnabled(l.count() == 1 && l.first()->itemAbove()); + m_down->setEnabled(l.count() == 1 && l.first()->itemBelow()); +} + +void KFileList::slotUp() +{ + TQPtrList l; + selection(l); + if (l.count() == 1 && l.first()->itemAbove()) + { + TQListViewItem *item(l.first()), *clone; + clone = new TQListViewItem(m_files, item->itemAbove()->itemAbove(), item->text(0), item->text(1), item->text(2)); + clone->setPixmap(0, *(item->pixmap(0))); + delete item; + m_files->setCurrentItem(clone); + m_files->setSelected(clone, true); + } +} + +void KFileList::slotDown() +{ + TQPtrList l; + selection(l); + if (l.count() == 1 && l.first()->itemBelow()) + { + TQListViewItem *item(l.first()), *clone; + clone = new TQListViewItem(m_files, item->itemBelow(), item->text(0), item->text(1), item->text(2)); + clone->setPixmap(0, *(item->pixmap(0))); + delete item; + m_files->setCurrentItem(clone); + m_files->setSelected(clone, true); + } +} + +#include "tdefilelist.moc" diff --git a/tdeprint/tdefilelist.h b/tdeprint/tdefilelist.h new file mode 100644 index 000000000..d5ef3ada1 --- /dev/null +++ b/tdeprint/tdefilelist.h @@ -0,0 +1,62 @@ +/* + * This file is part of the KDE libraries + * Copyright (c) 2001 Michael Goffioul + * + * 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 KFILELIST_H +#define KFILELIST_H + +#include +#include +#include + +class KListView; +class TQToolButton; +class TQListViewItem; + +class KFileList : public TQWidget +{ + Q_OBJECT +public: + KFileList(TQWidget *parent = 0, const char *name = 0); + virtual ~KFileList(); + + void setFileList(const TQStringList&); + TQStringList fileList() const; + TQSize sizeHint() const; + +protected slots: + void slotAddFile(); + void slotRemoveFile(); + void slotOpenFile(); + void slotSelectionChanged(); + void slotUp(); + void slotDown(); + +protected: + void dragEnterEvent(TQDragEnterEvent*); + void dropEvent(TQDropEvent*); + void addFiles(const KURL::List&); + void selection(TQPtrList&); + +private: + KListView *m_files; + TQToolButton *m_add, *m_remove, *m_open, *m_up, *m_down; + bool m_block; +}; + +#endif diff --git a/tdeprint/tdeprintcheck.h b/tdeprint/tdeprintcheck.h index bb839063f..7ffdf8d6c 100644 --- a/tdeprint/tdeprintcheck.h +++ b/tdeprint/tdeprintcheck.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include class TDEPRINT_EXPORT KdeprintChecker diff --git a/tdeprint/tdeprintd.cpp b/tdeprint/tdeprintd.cpp index 617fddf8f..02d32ab77 100644 --- a/tdeprint/tdeprintd.cpp +++ b/tdeprint/tdeprintd.cpp @@ -26,8 +26,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include -- cgit v1.2.1