diff options
36 files changed, 447 insertions, 243 deletions
diff --git a/kamera/kcontrol/kamera.cpp b/kamera/kcontrol/kamera.cpp index fd9b795c..f3c89149 100644 --- a/kamera/kcontrol/kamera.cpp +++ b/kamera/kcontrol/kamera.cpp @@ -24,7 +24,7 @@ #include <tqlayout.h> #include <kgenericfactory.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <tdeaction.h> #include <kiconloader.h> #include <tdemessagebox.h> @@ -53,7 +53,7 @@ KKameraConfig::KKameraConfig(TQWidget *parent, const char *name, const TQStringL { m_devicePopup = new TDEPopupMenu(this); m_actions = new TDEActionCollection(this); - m_config = new KSimpleConfig(KProtocolInfo::config("camera")); + m_config = new TDESimpleConfig(KProtocolInfo::config("camera")); m_context = gp_context_new(); if (m_context) { diff --git a/kamera/kcontrol/kamera.h b/kamera/kcontrol/kamera.h index 3e92ed1f..ce3b88d4 100644 --- a/kamera/kcontrol/kamera.h +++ b/kamera/kcontrol/kamera.h @@ -38,7 +38,7 @@ class TQIconViewItem; class KCamera; class KameraDeviceSelectDialog; -class KSimpleConfig; +class TDESimpleConfig; class TDEIconView; class TDEActionCollection; class TDEToolBar; @@ -92,7 +92,7 @@ private: private: typedef TQMap<TQString, KCamera *> CameraDevicesMap; - KSimpleConfig *m_config; + TDESimpleConfig *m_config; CameraDevicesMap m_devices; bool m_cancelPending; diff --git a/kamera/tdeioslave/kamera.cpp b/kamera/tdeioslave/kamera.cpp index 0aa8e25d..8810bcc5 100644 --- a/kamera/tdeioslave/kamera.cpp +++ b/kamera/tdeioslave/kamera.cpp @@ -33,10 +33,10 @@ #include <tqtextstream.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdestandarddirs.h> #include <tdeconfig.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <tdelocale.h> #include <kprotocolinfo.h> #include <tdeio/slaveconfig.h> @@ -95,7 +95,7 @@ m_camera(NULL) // (will init m_camera, since the m_camera's configuration is empty) m_camera = 0; m_file = NULL; - m_config = new KSimpleConfig(KProtocolInfo::config("camera")); + m_config = new TDESimpleConfig(KProtocolInfo::config("camera")); m_context = gp_context_new(); actiondone = true; cameraopen = false; diff --git a/kamera/tdeioslave/kamera.h b/kamera/tdeioslave/kamera.h index 1e015d0f..48d38165 100644 --- a/kamera/tdeioslave/kamera.h +++ b/kamera/tdeioslave/kamera.h @@ -27,7 +27,7 @@ #include <tdeio/slavebase.h> #include <gphoto2.h> -class KSimpleConfig; +class TDESimpleConfig; class KameraProtocol : public TDEIO::SlaveBase { @@ -49,7 +49,7 @@ public: private: Camera *m_camera; CameraAbilities m_abilities; - KSimpleConfig *m_config; + TDESimpleConfig *m_config; GPContext *m_context; diff --git a/kdvi/fontpool.cpp b/kdvi/fontpool.cpp index 02d6d58d..3edd31e3 100644 --- a/kdvi/fontpool.cpp +++ b/kdvi/fontpool.cpp @@ -7,7 +7,7 @@ #include <config.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <tdemessagebox.h> #include <tdeprocess.h> diff --git a/kghostview/kgv_miniwidget.cpp b/kghostview/kgv_miniwidget.cpp index 580921f7..e7d391b4 100644 --- a/kghostview/kgv_miniwidget.cpp +++ b/kghostview/kgv_miniwidget.cpp @@ -23,7 +23,7 @@ #include <tdeapplication.h> #include <tdeconfig.h> #include <kdebug.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeversion.h> #include <tdelocale.h> #include <tdemessagebox.h> diff --git a/kghostview/kgv_view.cpp b/kghostview/kgv_view.cpp index 0a4c5e46..c3a7bf6b 100644 --- a/kghostview/kgv_view.cpp +++ b/kghostview/kgv_view.cpp @@ -30,7 +30,7 @@ #include <kdirwatch.h> #include <tdeglobalsettings.h> #include <kiconloader.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <tdepopupmenu.h> #include <kstdaction.h> diff --git a/kghostview/kgvconfigdialog.cpp b/kghostview/kgvconfigdialog.cpp index 624615e3..b1febcee 100644 --- a/kghostview/kgvconfigdialog.cpp +++ b/kghostview/kgvconfigdialog.cpp @@ -25,7 +25,7 @@ #include <kdebug.h> #include <tdeglobal.h> #include <kiconloader.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <tdemessagebox.h> #include <tdeprocess.h> diff --git a/kghostview/kgvdocument.cpp b/kghostview/kgvdocument.cpp index cb0061e3..9d4e06de 100644 --- a/kghostview/kgvdocument.cpp +++ b/kghostview/kgvdocument.cpp @@ -25,7 +25,7 @@ #include <tdeconfig.h> #include <tdefiledialog.h> #include <kfilterdev.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdemessagebox.h> #include <kmimetype.h> #include <kprinter.h> diff --git a/kolourpaint/pics/custom/resize.png b/kolourpaint/pics/custom/resize.png Binary files differindex c80a4177..735f4792 100644 --- a/kolourpaint/pics/custom/resize.png +++ b/kolourpaint/pics/custom/resize.png diff --git a/kolourpaint/pics/custom/scale.png b/kolourpaint/pics/custom/scale.png Binary files differindex a14d3937..a8a0866f 100644 --- a/kolourpaint/pics/custom/scale.png +++ b/kolourpaint/pics/custom/scale.png diff --git a/kolourpaint/pics/custom/smooth_scale.png b/kolourpaint/pics/custom/smooth_scale.png Binary files differindex 121a55e1..963804f1 100644 --- a/kolourpaint/pics/custom/smooth_scale.png +++ b/kolourpaint/pics/custom/smooth_scale.png diff --git a/kpdf/part.cpp b/kpdf/part.cpp index a82707f7..7370a062 100644 --- a/kpdf/part.cpp +++ b/kpdf/part.cpp @@ -37,7 +37,7 @@ #include <tdeapplication.h> #include <tdeaction.h> #include <kdirwatch.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <kprinter.h> #include <tdeprint/kprintdialogpage.h> #include <kstdaction.h> diff --git a/kpdf/shell/shell.cpp b/kpdf/shell/shell.cpp index dd2adf2e..ed9403df 100644 --- a/kpdf/shell/shell.cpp +++ b/kpdf/shell/shell.cpp @@ -50,6 +50,8 @@ Shell::Shell() : DCOPObject("KPDFShellDCOPIface"), KParts::MainWindow(0, "KPDF::Shell"), m_menuBarWasShown(true), m_toolBarWasShown(true), + m_shuttingDown(false), + m_showToolBarAction(nullptr), m_tabs(nullptr), m_tabsContextMenu(nullptr), m_manager(nullptr), @@ -62,6 +64,8 @@ Shell::Shell(const KURL &url) : DCOPObject("KPDFShellDCOPIface"), KParts::MainWindow(0, "KPDF::Shell"), m_menuBarWasShown(true), m_toolBarWasShown(true), + m_shuttingDown(false), + m_showToolBarAction(nullptr), m_tabs(nullptr), m_tabsContextMenu(nullptr), m_manager(nullptr), @@ -99,6 +103,8 @@ void Shell::init() this, TQ_SLOT(createGUI(KParts::Part*))); connect(m_manager, TQ_SIGNAL(activePartChanged(KParts::Part*)), this, TQ_SLOT(slotChangeTab(KParts::Part*))); + connect(tdeApp, TQ_SIGNAL(shutDown()), + this, TQ_SLOT(slotShutDown())); setCentralWidget(m_tabs); setXMLFile("shell.rc"); @@ -106,7 +112,6 @@ void Shell::init() setupActions(); setupGUI(Keys | Save); - readSettings(); if (!TDEGlobal::config()->hasGroup("MainWindow")) { TDEMainWindowInterface kmwi(this); @@ -120,6 +125,7 @@ void Shell::init() TQTimer::singleShot(0, this, TQ_SLOT(delayedOpen())); } + readSettings(); reconfigure(); } @@ -184,15 +190,38 @@ void Shell::readSettings() m_recent->setToolTip( i18n("Click to open a file\nClick and hold to open a recent file") ); TDEGlobal::config()->setDesktopGroup(); + m_menuBarWasShown = TDEGlobal::config()->readBoolEntry( "ShowMenuBar", true ); + m_showMenuBarAction->setChecked(m_menuBarWasShown); + slotShowMenubar(); + + m_toolBarWasShown = TDEGlobal::config()->readBoolEntry( "ShowToolBar", true ); + m_showToolBarAction = static_cast<TDEToggleAction*>(toolBarMenuAction()); + if (m_toolBarWasShown) + { + toolBar()->show(); + } + else + { + toolBar()->hide(); + } + bool fullScreen = TDEGlobal::config()->readBoolEntry( "FullScreen", false ); - setFullScreen( fullScreen ); + setFullScreen(fullScreen); } void Shell::writeSettings() { m_recent->saveEntries( TDEGlobal::config() ); TDEGlobal::config()->setDesktopGroup(); - TDEGlobal::config()->writeEntry( "FullScreen", m_fullScreenAction->isChecked()); + bool fullScreen = m_fullScreenAction->isChecked(); + if (!fullScreen) + { + m_menuBarWasShown = m_showMenuBarAction->isChecked(); + m_toolBarWasShown = m_showToolBarAction->isChecked(); + } + TDEGlobal::config()->writeEntry( "ShowMenuBar", m_menuBarWasShown); + TDEGlobal::config()->writeEntry( "ShowToolBar", m_toolBarWasShown); + TDEGlobal::config()->writeEntry( "FullScreen", fullScreen); TDEGlobal::config()->sync(); } @@ -383,10 +412,6 @@ KParts::ReadOnlyPart* Shell::createTab() part->widget()->show(); m_manager->addPart(part, true); - if (!m_showToolBarAction) - { - m_showToolBarAction = static_cast<TDEToggleAction*>(toolBarMenuAction()); - } return part; } @@ -412,8 +437,18 @@ void Shell::removeTab() m_workingTab = -1; } +void Shell::slotShutDown() +{ + m_shuttingDown = true; +} + void Shell::slotChangeTab(KParts::Part *part) { + if (m_shuttingDown) + { + return; + } + if (!part) { part = createTab(); diff --git a/kpdf/shell/shell.h b/kpdf/shell/shell.h index d1ace108..87d9c93a 100644 --- a/kpdf/shell/shell.h +++ b/kpdf/shell/shell.h @@ -111,6 +111,7 @@ namespace KPDF void slotUpdateFullScreen(); void slotShowMenubar(); void delayedOpen(); + void slotShutDown(); void slotCloseTabRequest(TQWidget *w); void slotChangeTab(KParts::Part *part); @@ -150,6 +151,7 @@ namespace KPDF TQToolButton *m_addTabButton, *m_removeTabButton; TQPopupMenu *m_tabsContextMenu; bool m_menuBarWasShown, m_toolBarWasShown; + bool m_shuttingDown; KURL m_openUrl; // delayed open int m_workingTab; }; diff --git a/kpovmodeler/pmdockwidget.cpp b/kpovmodeler/pmdockwidget.cpp index a318d0c6..3c68f86d 100644 --- a/kpovmodeler/pmdockwidget.cpp +++ b/kpovmodeler/pmdockwidget.cpp @@ -53,7 +53,7 @@ #include <tdeaccel.h> #include <tdeparts/plugin.h> #include <kstatusbar.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <khelpmenu.h> #include <tdestandarddirs.h> #include <tqapplication.h> diff --git a/kpovmodeler/pmfactory.cpp b/kpovmodeler/pmfactory.cpp index 667f0612..001f3698 100644 --- a/kpovmodeler/pmfactory.cpp +++ b/kpovmodeler/pmfactory.cpp @@ -17,7 +17,7 @@ #include <tdelocale.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeaboutdata.h> #include "pmfactory.h" diff --git a/ksnapshot/ksnapshot.cpp b/ksnapshot/ksnapshot.cpp index c0ebc1be..36918c4a 100644 --- a/ksnapshot/ksnapshot.cpp +++ b/ksnapshot/ksnapshot.cpp @@ -22,10 +22,11 @@ #include <kprinter.h> #include <tdeio/netaccess.h> #include <ksavefile.h> +#include <tdestandarddirs.h> #include <tdetempfile.h> +#include <kde_file.h> #include <tqbitmap.h> -#include <tqdragobject.h> #include <tqimage.h> #include <tqclipboard.h> #include <tqvbox.h> @@ -46,8 +47,15 @@ #include <tqpaintdevicemetrics.h> #include <tqwhatsthis.h> +#include <functional> +#include <memory> +#include <utility> + #include <stdlib.h> +#include <fcntl.h> +#include <unistd.h> + #include "ksnapshot.h" #include "regiongrabber.h" #include "windowgrabber.h" @@ -60,9 +68,29 @@ #include <tdeglobal.h> +// A quick and dirty scope guard implementation +class ExitGuard { +public: + template<class Callable> + ExitGuard(Callable && undo_func) : f(std::forward<Callable>(undo_func)) {} + ExitGuard(ExitGuard && other) : f(std::move(other.f)) { + other.f = nullptr; + } + + ~ExitGuard() { + if(f) { f(); f = nullptr; } + } + + ExitGuard(const ExitGuard&) = delete; + void operator= (const ExitGuard&) = delete; + +private: + std::function<void()> f; +}; + KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent) - : DCOPObject("interface"), - KDialogBase(parent, name, true, TQString(), Help|User1, User1, + : DCOPObject("interface"), + KDialogBase(parent, name, true, TQString(), Help|User1, User1, true, KStdGuiItem::quit() ) { grabber = new TQWidget( 0, 0, WStyle_Customize | WX11BypassWM ); @@ -85,12 +113,14 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent) grabber->show(); grabber->grabMouse( waitCursor ); - if ( !grabCurrent ) - snapshot = TQPixmap::grabWindow( tqt_xrootwin() ); - else { - mainWidget->setMode( WindowUnderCursor ); - mainWidget->setIncludeDecorations( true ); - performGrab(); + if ( !grabCurrent ) { + snapshot = TQPixmap::grabWindow( tqt_xrootwin() ); + timestamp = TQDateTime::currentDateTime(); + setLocalFilePath(TQString::null); + } else { + mainWidget->setMode( WindowUnderCursor ); + mainWidget->setIncludeDecorations( true ); + performGrab(); } updatePreview(); @@ -106,7 +136,7 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent) // Make sure the name is not already being used while(TDEIO::NetAccess::exists( filename, false, this )) { - autoincFilename(); + autoincFilename(); } connect( &grabTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( grabTimerDone() ) ); @@ -139,13 +169,13 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent) TDEAccel* accel = new TDEAccel(this); accel->insert(TDEStdAccel::Quit, tdeApp, TQ_SLOT(quit())); accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."), - i18n("Save the snapshot to the file specified by the user without showing the file dialog."), - CTRL+SHIFT+Key_S, this, TQ_SLOT(slotSave())); + i18n("Save the snapshot to the file specified by the user without showing the file dialog."), + CTRL+SHIFT+Key_S, this, TQ_SLOT(slotSave())); accel->insert(TDEStdAccel::Save, this, TQ_SLOT(slotSaveAs())); // accel->insert(TDEShortcut(CTRL+Key_A), this, TQ_SLOT(slotSaveAs())); accel->insert( "SaveAs", i18n("Save Snapshot &As..."), - i18n("Save the snapshot to the file specified by the user."), - CTRL+Key_A, this, TQ_SLOT(slotSaveAs())); + i18n("Save the snapshot to the file specified by the user."), + CTRL+Key_A, this, TQ_SLOT(slotSaveAs())); accel->insert(TDEStdAccel::Print, this, TQ_SLOT(slotPrint())); accel->insert(TDEStdAccel::New, this, TQ_SLOT(slotGrab())); accel->insert(TDEStdAccel::Copy, this, TQ_SLOT(slotCopy())); @@ -168,12 +198,12 @@ KSnapshot::~KSnapshot() { } -void KSnapshot::resizeEvent( TQResizeEvent *event) +void KSnapshot::resizeEvent( TQResizeEvent * /*event*/) { - if( !updateTimer.isActive() ) - updateTimer.start(200, true); - else - updateTimer.changeInterval(200); + if( !updateTimer.isActive() ) + updateTimer.start(200, true); + else + updateTimer.changeInterval(200); } bool KSnapshot::save( const TQString &filename ) @@ -186,7 +216,7 @@ bool KSnapshot::save( const KURL& url ) if ( TDEIO::NetAccess::exists( url, false, this ) ) { const TQString title = i18n( "File Exists" ); const TQString text = i18n( "<qt>Do you really want to overwrite <b>%1</b>?</qt>" ).arg(url.prettyURL()); - if (KMessageBox::Continue != KMessageBox::warningContinueCancel( this, text, title, i18n("Overwrite") ) ) + if (KMessageBox::Continue != KMessageBox::warningContinueCancel( this, text, title, i18n("Overwrite") ) ) { return false; } @@ -194,36 +224,40 @@ bool KSnapshot::save( const KURL& url ) TQString type( KImageIO::type(url.path()) ); if ( type.isNull() ) - type = "PNG"; + type = "PNG"; bool ok = false; if ( url.isLocalFile() ) { - KSaveFile saveFile( url.path() ); - if ( saveFile.status() == 0 ) { - if ( snapshot.save( saveFile.file(), type.latin1() ) ) - ok = saveFile.close(); - } + KSaveFile saveFile( url.path() ); + if ( saveFile.status() == 0 ) { + if ( snapshot.save( saveFile.file(), type.latin1() ) ) { + ok = saveFile.close(); + if (ok) { + setLocalFilePath(saveFile.name()); + } + } + } } else { - KTempFile tmpFile; + KTempFile tmpFile; tmpFile.setAutoDelete( true ); - if ( tmpFile.status() == 0 ) { - if ( snapshot.save( tmpFile.file(), type.latin1() ) ) { - if ( tmpFile.close() ) - ok = TDEIO::NetAccess::upload( tmpFile.name(), url, this ); - } - } + if ( tmpFile.status() == 0 ) { + if ( snapshot.save( tmpFile.file(), type.latin1() ) ) { + if ( tmpFile.close() ) + ok = TDEIO::NetAccess::upload( tmpFile.name(), url, this ); + } + } } TQApplication::restoreOverrideCursor(); if ( !ok ) { - kdWarning() << "KSnapshot was unable to save the snapshot" << endl; + kdWarning() << "KSnapshot was unable to save the snapshot" << endl; - TQString caption = i18n("Unable to save image"); - TQString text = i18n("KSnapshot was unable to save the image to\n%1.") - .arg(url.prettyURL()); - KMessageBox::error(this, text, caption); + TQString caption = i18n("Unable to save image"); + TQString text = i18n("KSnapshot was unable to save the image to\n%1.") + .arg(url.prettyURL()); + KMessageBox::error(this, text, caption); } return ok; @@ -270,7 +304,7 @@ void KSnapshot::slotCopy() void KSnapshot::slotDragSnapshot() { - TQDragObject *drobj = new TQImageDrag(snapshot.convertToImage(), this); + TQDragObject *drobj = new SnapshotDrag(snapshot.convertToImage(), this); drobj->setPixmap(mainWidget->preview()); drobj->dragCopy(); } @@ -281,17 +315,17 @@ void KSnapshot::slotGrab() hide(); if ( mainWidget->delay() ) - grabTimer.start( mainWidget->delay() * 1000, true ); + grabTimer.start( mainWidget->delay() * 1000, true ); else { - if ( mainWidget->mode() == Region ) { - rgnGrab = new RegionGrabber(); - connect( rgnGrab, TQ_SIGNAL( regionGrabbed( const TQPixmap & ) ), - TQ_SLOT( slotRegionGrabbed( const TQPixmap & ) ) ); - } - else { - grabber->show(); - grabber->grabMouse( crossCursor ); - } + if ( mainWidget->mode() == Region ) { + rgnGrab = new RegionGrabber(); + connect( rgnGrab, TQ_SIGNAL( regionGrabbed( const TQPixmap & ) ), + TQ_SLOT( slotRegionGrabbed( const TQPixmap & ) ) ); + } + else { + grabber->show(); + grabber->grabMouse( crossCursor ); + } } } @@ -307,48 +341,48 @@ void KSnapshot::slotPrint() if (printer.setup(this, i18n("Print Screenshot"))) { - tqApp->processEvents(); + tqApp->processEvents(); TQPainter painter(&printer); TQPaintDeviceMetrics metrics(painter.device()); - float w = snapshot.width(); - float dw = w - metrics.width(); - float h = snapshot.height(); - float dh = h - metrics.height(); - bool scale = false; + float w = snapshot.width(); + float dw = w - metrics.width(); + float h = snapshot.height(); + float dh = h - metrics.height(); + bool scale = false; - if ( (dw > 0.0) || (dh > 0.0) ) - scale = true; + if ( (dw > 0.0) || (dh > 0.0) ) + scale = true; - if ( scale ) { + if ( scale ) { - TQImage img = snapshot.convertToImage(); - tqApp->processEvents(); + TQImage img = snapshot.convertToImage(); + tqApp->processEvents(); - float newh, neww; - if ( dw > dh ) { - neww = w-dw; - newh = neww/w*h; - } - else { - newh = h-dh; - neww = newh/h*w; - } + float newh, neww; + if ( dw > dh ) { + neww = w-dw; + newh = neww/w*h; + } + else { + newh = h-dh; + neww = newh/h*w; + } - img = img.smoothScale( int(neww), int(newh), TQImage::ScaleMin ); - tqApp->processEvents(); + img = img.smoothScale( int(neww), int(newh), TQImage::ScaleMin ); + tqApp->processEvents(); - int x = (metrics.width()-img.width())/2; - int y = (metrics.height()-img.height())/2; + int x = (metrics.width()-img.width())/2; + int y = (metrics.height()-img.height())/2; - painter.drawImage( x, y, img); - } - else { - int x = (metrics.width()-snapshot.width())/2; - int y = (metrics.height()-snapshot.height())/2; - painter.drawPixmap( x, y, snapshot ); - } + painter.drawImage( x, y, img); + } + else { + int x = (metrics.width()-snapshot.width())/2; + int y = (metrics.height()-snapshot.height())/2; + painter.drawPixmap( x, y, snapshot ); + } } tqApp->processEvents(); @@ -356,26 +390,18 @@ void KSnapshot::slotPrint() void KSnapshot::slotRegionGrabbed( const TQPixmap &pix ) { - if ( !pix.isNull() ) - { - snapshot = pix; - updatePreview(); - modified = true; - updateCaption(); - } - - delete rgnGrab; - TQApplication::restoreOverrideCursor(); - move(oldWinPos); - show(); + rgnGrab->deleteLater(); + newSnapshot(pix); } -void KSnapshot::slotWindowGrabbed( const TQPixmap &pix ) +void KSnapshot::newSnapshot( const TQPixmap &pix ) { if ( !pix.isNull() ) { snapshot = pix; updatePreview(); + timestamp = TQDateTime::currentDateTime(); + setLocalFilePath(TQString::null); modified = true; updateCaption(); } @@ -397,92 +423,141 @@ void KSnapshot::slotOpenWithKP() { } } -void KSnapshot::openWithExternalApp(const KService &service) { - // Write snapshot to temporary file - bool ok = false; - KTempFile *tmpFile = new KTempFile; - if (tmpFile->status() == 0) { - if (snapshot.save(tmpFile->file(), "PNG")) { - if (tmpFile->close()) { - ok = true; - } +/// Writes the snapshot to a temporary file +TQString KSnapshot::saveTempFile() { + + // construct a pretty name for the temporary file + TQString base_fname = + i18n("A temporary filename; prefer dashes (-) as word separators if required", "snapshot") + .append(timestamp.toString("-yyyyMMdd-hhmmss")); + TQString base_fpath = locateLocal("tmp", base_fname); + TQString fname = base_fpath + ".png"; + + // We want the pretty names; unfortunately KTempFile forces us to use mkstemp-style name; which + // has a random string at the end, which is quite ugly. On the other hand TQFile doesn't + // provide any means to fail if file already exist (i.e. O_EXCL). So in order to have best of + // both worlds we will have to try to open the file manually and if it fails, we will fallback + // to KTempFile. + int fd = -1; + ExitGuard closeGuard { [&fd](){ if (fd>=0) { ::close(fd); } } }; + + std::unique_ptr<KTempFile> tmpFile; // used only if manual open() fails + std::unique_ptr<TQFile> tqfile; // used only if manual open() succeeds + TQFile* file; // either tqfile or tmpFile->file() + + fd = KDE_open(TQFile::encodeName(fname), O_WRONLY | O_CREAT | O_EXCL, 0600); + + if (fd>=0) { + tqfile = std::unique_ptr<TQFile>(new TQFile(fname)); + tqfile->open( IO_WriteOnly, fd ); // according to docs TQFile won't close the fd so there is + // an exit guard above + file = tqfile.get(); + + } else { + tmpFile = std::unique_ptr<KTempFile>(new KTempFile(base_fpath + "-", ".png")); + if (!tmpFile || tmpFile->status() != 0) { + return TQString::null; } + file = tmpFile->file(); + fname = tmpFile->name(); } + // Actually save the image + bool ok = snapshot.save(file, "PNG"); + if (!ok) { + file->remove(); + return TQString::null; + } + + tempFiles.append(fname); + + return fname; +} + +void KSnapshot::setLocalFilePath(TQString fp) { + localFilePath = fp; + if(!fp.isEmpty()) { + TQFileInfo fi(fp); + currentFilePathTimestamp = fi.lastModified (); + } else { + currentFilePathTimestamp = TQDateTime(); + } +} + +/// Returns a local file for the current snapshot. It may be either a file explicitly saved by the +/// user or a temporary one saved internally +TQString KSnapshot::localFile() { + bool needSaveTemp = true; + if(!localFilePath.isEmpty()) { + TQFileInfo fi(localFilePath); + // Checks that nobody have overwritten the file since we saved it + if( fi.exists() && currentFilePathTimestamp == fi.lastModified()) { + needSaveTemp = false; + } + } + + if(needSaveTemp) { + setLocalFilePath( saveTempFile() ); + } + + return localFilePath; +} + +void KSnapshot::openWithExternalApp(const KService &service) { + // Write snapshot to temporary file + TQString file = localFile(); + + if (file.isEmpty()) { KMessageBox::error(this, i18n("KSnapshot was unable to create temporary file."), i18n("Unable to save image")); - delete tmpFile; return; } // Launch application KURL::List list; - list.append(tmpFile->name()); + list.append(file); TQStringList args = KRun::processDesktopExec(service, list, false, false); TDEProcess *externalApp = new TDEProcess; *externalApp << args; - connect(externalApp, TQ_SIGNAL(processExited(TDEProcess*)), - this, TQ_SLOT(slotExternalAppClosed(TDEProcess*))); if (!externalApp->start(TDEProcess::OwnGroup)) { KMessageBox::error(this, i18n("Cannot start %1!").arg(service.name())); - delete tmpFile; - return; } - - m_tmpFiles[externalApp] = tmpFile; -} - -void KSnapshot::slotExternalAppClosed(TDEProcess *process) -{ - if (process && m_tmpFiles.contains(process)) - { - KTempFile *tmpFile = m_tmpFiles[process]; - if (tmpFile) - { - snapshot.load(tmpFile->name()); - updatePreview(); - tmpFile->unlink(); - delete tmpFile; - } - m_tmpFiles.remove(process); - } } void KSnapshot::slotAboutToQuit() { - for (KTempFile *tmpFile : m_tmpFiles) - { - tmpFile->unlink(); - delete tmpFile; - } - m_tmpFiles.clear(); + for(const TQString &file: tempFiles) + { + TQFile::remove(file); + } + tempFiles.clear(); - TDEConfig *conf=TDEGlobal::config(); - conf->setGroup("GENERAL"); - conf->writeEntry("delay",mainWidget->delay()); - conf->writeEntry("mode",mainWidget->mode()); - conf->writeEntry("includeDecorations",mainWidget->includeDecorations()); - KURL url = filename; - url.setPass( TQString() ); - conf->writePathEntry("filename",url.url()); + TDEConfig *conf=TDEGlobal::config(); + conf->setGroup("GENERAL"); + conf->writeEntry("delay",mainWidget->delay()); + conf->writeEntry("mode",mainWidget->mode()); + conf->writeEntry("includeDecorations",mainWidget->includeDecorations()); + KURL url = filename; + url.setPass( TQString() ); + conf->writePathEntry("filename",url.url()); } void KSnapshot::closeEvent( TQCloseEvent * e ) { - e->accept(); + e->accept(); } bool KSnapshot::eventFilter( TQObject* o, TQEvent* e) { if ( o == grabber && e->type() == TQEvent::MouseButtonPress ) { - TQMouseEvent* me = (TQMouseEvent*) e; - if ( TQWidget::mouseGrabber() != grabber ) - return false; - if ( me->button() == TQt::LeftButton ) - performGrab(); + TQMouseEvent* me = (TQMouseEvent*) e; + if ( TQWidget::mouseGrabber() != grabber ) + return false; + if ( me->button() == TQt::LeftButton ) + performGrab(); } return false; } @@ -500,10 +575,10 @@ void KSnapshot::autoincFilename() if (start != -1) { // It has a number, increment it int len = numSearch.matchedLength(); - TQString numAsStr= name.mid(start, len); - TQString number = TQString::number(numAsStr.toInt() + 1); - number = number.rightJustify( len, '0'); - name.replace(start, len, number ); + TQString numAsStr= name.mid(start, len); + TQString number = TQString::number(numAsStr.toInt() + 1); + number = number.rightJustify( len, '0'); + name.replace(start, len, number ); } else { // no number @@ -518,7 +593,7 @@ void KSnapshot::autoincFilename() } } - //Rebuild the path + // Rebuild the path KURL newURL = filename; newURL.setFileName( name ); setURL( newURL.url() ); @@ -537,7 +612,7 @@ void KSnapshot::grabTimerDone() TQ_SLOT( slotRegionGrabbed( const TQPixmap & ) ) ); } else { - performGrab(); + performGrab(); } KNotifyClient::beep(i18n("The screen has been successfully grabbed.")); } @@ -548,23 +623,22 @@ void KSnapshot::performGrab() grabber->hide(); grabTimer.stop(); if ( mainWidget->mode() == ChildWindow ) { - WindowGrabber wndGrab; - connect( &wndGrab, TQ_SIGNAL( windowGrabbed( const TQPixmap & ) ), - TQ_SLOT( slotWindowGrabbed( const TQPixmap & ) ) ); - wndGrab.exec(); - } - else if ( mainWidget->mode() == WindowUnderCursor ) { - snapshot = WindowGrabber::grabCurrent( mainWidget->includeDecorations() ); + WindowGrabber wndGrab; + connect( &wndGrab, TQ_SIGNAL( windowGrabbed( const TQPixmap & ) ), + TQ_SLOT( newSnapshot( const TQPixmap & ) ) ); + wndGrab.exec(); } else { - snapshot = TQPixmap::grabWindow( tqt_xrootwin() ); + TQPixmap pix; + if ( mainWidget->mode() == WindowUnderCursor ) { + pix = WindowGrabber::grabCurrent( mainWidget->includeDecorations() ); + } + else { + pix = TQPixmap::grabWindow( tqt_xrootwin() ); + } + + newSnapshot(pix); } - updatePreview(); - TQApplication::restoreOverrideCursor(); - modified = true; - updateCaption(); - move(oldWinPos); - show(); } void KSnapshot::setTime(int newTime) @@ -581,7 +655,7 @@ void KSnapshot::setURL( const TQString &url ) { KURL newURL = KURL::fromPathOrURL( url ); if ( newURL == filename ) - return; + return; filename = newURL; updateCaption(); @@ -589,6 +663,8 @@ void KSnapshot::setURL( const TQString &url ) void KSnapshot::setPixmap(const TQPixmap &newImage) { snapshot = newImage; + timestamp = TQDateTime::currentDateTime(); + setLocalFilePath(TQString::null); updatePreview(); } @@ -616,4 +692,41 @@ void KSnapshot::exit() { reject(); } + +SnapshotDrag::SnapshotDrag( TQImage image, KSnapshot * dragSource, const char * name ) + :TQImageDrag::TQImageDrag( image, dragSource, name ), ksnap(dragSource) +{ + // TQ*Drop API is a bit quirky, so to append our value to the list of formats we will have + // to iterate over the full list provided by TQImageDrag manually just to determine how many + // formats it supports + + for (int i=0 ; ; i++) { + const char* format = TQImageDrag::format(i); + if (format) { + formats.append(format); + } else { + break; + } + } + formats.append("text/uri-list"); +} + +const char * SnapshotDrag::format(int i) const +{ + if( i < (int) formats.count() ) { + return formats[i]; + } else { + return 0; + } +} + +TQByteArray SnapshotDrag::encodedData(const char* format) const +{ + if( strcmp(format, "text/uri-list") == 0 ) { + return TQUriDrag::localFileToUri( ksnap->localFile() ); + } else { + return TQImageDrag::encodedData(format); + } +} + #include "ksnapshot.moc" diff --git a/ksnapshot/ksnapshot.h b/ksnapshot/ksnapshot.h index 47cbe47e..45734f88 100644 --- a/ksnapshot/ksnapshot.h +++ b/ksnapshot/ksnapshot.h @@ -4,8 +4,9 @@ #include <tqbitmap.h> #include <tqcursor.h> +#include <tqdatetime.h> +#include <tqdragobject.h> #include <tqlabel.h> -#include <tqmap.h> #include <tqpainter.h> #include <tqpixmap.h> #include <tqstyle.h> @@ -102,6 +103,7 @@ public: bool save( const TQString &filename ); TQString url() const { return filename.url(); } + TQString localFile(); protected slots: void slotAboutToQuit(); @@ -112,7 +114,6 @@ protected slots: void slotPrint(); void slotOpenWith(int id); void slotOpenWithKP(); - void slotExternalAppClosed(TDEProcess *process); void slotMovePointer( int x, int y ); void setTime(int newTime); @@ -134,7 +135,7 @@ private slots: void updateCaption(); void updatePreview(); void slotRegionGrabbed( const TQPixmap & ); - void slotWindowGrabbed( const TQPixmap & ); + void newSnapshot( const TQPixmap & ); private: bool save( const KURL& url ); @@ -143,6 +144,8 @@ private: void autoincFilename(); int grabMode(); int timeout(); + TQString saveTempFile(); + void setLocalFilePath(TQString fp); TQPixmap snapshot; TQTimer grabTimer; @@ -151,11 +154,29 @@ private: KURL filename; KSnapshotWidget *mainWidget; RegionGrabber *rgnGrab; + TQDateTime timestamp; bool modified; TDETrader::OfferList openWithOffers; - TQMap<TDEProcess*, KTempFile*> m_tmpFiles; + TQString localFilePath; + TQDateTime currentFilePathTimestamp; + TQValueList<TQString> tempFiles; TQPoint oldWinPos; }; + +/** + * A small wrapper around TQImageDrag that also passes text/uri-list with a + * temporary file as a fallback variant. + */ +class SnapshotDrag : public TQImageDrag { + TQ_OBJECT + KSnapshot *ksnap; + TQValueList<TQCString> formats; +public: + SnapshotDrag( TQImage image, KSnapshot * dragSource, const char * name = 0 ); + const char * format(int i) const; + TQByteArray encodedData(const char* format) const; +}; + #endif // KSNAPSHOT_H diff --git a/ksvg/core/CanvasFactory.cpp b/ksvg/core/CanvasFactory.cpp index 55610a2b..f8b7fc50 100644 --- a/ksvg/core/CanvasFactory.cpp +++ b/ksvg/core/CanvasFactory.cpp @@ -21,7 +21,7 @@ #include <tqfile.h> #include <kdebug.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <tdeparts/componentfactory.h> #include "KSVGCanvas.h" @@ -88,7 +88,7 @@ KSVGCanvas *CanvasFactory::loadCanvas(int width, int height) { queryCanvas(); - KSimpleConfig *config = new KSimpleConfig("ksvgpluginrc", false); + TDESimpleConfig *config = new TDESimpleConfig("ksvgpluginrc", false); config->setGroup("Canvas"); TQString load = config->readEntry("ActiveCanvas", "libart"); delete config; diff --git a/ksvg/core/KSVGReader.cpp b/ksvg/core/KSVGReader.cpp index 3fbbefd3..9b465fa3 100644 --- a/ksvg/core/KSVGReader.cpp +++ b/ksvg/core/KSVGReader.cpp @@ -22,7 +22,7 @@ #include <kdebug.h> #include <tdelocale.h> #include <tqmap.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <KSVGCanvas.h> #include "KSVGReader.moc" #include "SVGSVGElementImpl.h" @@ -167,7 +167,7 @@ bool InputHandler::startDocument() m_currentNode = 0; m_noRendering = false; - KSimpleConfig config("ksvgpluginrc"); + TDESimpleConfig config("ksvgpluginrc"); config.setGroup("Rendering"); m_progressive = config.readBoolEntry("ProgressiveRendering", true); diff --git a/ksvg/plugin/ksvg_factory.cpp b/ksvg/plugin/ksvg_factory.cpp index 3aad1121..43cd12bf 100644 --- a/ksvg/plugin/ksvg_factory.cpp +++ b/ksvg/plugin/ksvg_factory.cpp @@ -19,7 +19,7 @@ */ #include <tdeaboutdata.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <tdeglobal.h> #include <tdestandarddirs.h> diff --git a/ksvg/plugin/ksvg_plugin.cpp b/ksvg/plugin/ksvg_plugin.cpp index aac100f5..94414715 100644 --- a/ksvg/plugin/ksvg_plugin.cpp +++ b/ksvg/plugin/ksvg_plugin.cpp @@ -24,7 +24,7 @@ #include <tdefiledialog.h> #include <tdelocale.h> #include <tdetempfile.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <tdeaboutapplication.h> #include "ksvg_widget.h" @@ -124,7 +124,7 @@ KSVGPlugin::KSVGPlugin(TQWidget *wparent, const char *, TQObject *parent, const ksvgd->fontKerningAction = new TDEToggleAction(i18n("Use Font &Kerning"), "zoom-fit-best", Key_F8, this, TQ_SLOT(slotFontKerning()), actionCollection(), "font_kerning"); ksvgd->progressiveAction = new TDEToggleAction(i18n("Use &Progressive Rendering"), "", Key_F9, this, TQ_SLOT(slotProgressiveRendering()), actionCollection(), "progressive"); - KSimpleConfig config("ksvgpluginrc", true); + TDESimpleConfig config("ksvgpluginrc", true); config.setGroup("Rendering"); ksvgd->fontKerningAction->setChecked(config.readBoolEntry("FontKerning", true)); ksvgd->progressiveAction->setChecked(config.readBoolEntry("ProgressiveRendering", true)); @@ -266,7 +266,7 @@ void KSVGPlugin::slotViewMemory() void KSVGPlugin::slotFontKerning() { - KSimpleConfig config("ksvgpluginrc", false); + TDESimpleConfig config("ksvgpluginrc", false); config.setGroup("Rendering"); config.writeEntry("FontKerning", ksvgd->fontKerningAction->isChecked()); @@ -283,14 +283,14 @@ void KSVGPlugin::slotFontKerning() void KSVGPlugin::slotProgressiveRendering() { - KSimpleConfig config("ksvgpluginrc", false); + TDESimpleConfig config("ksvgpluginrc", false); config.setGroup("Rendering"); config.writeEntry("ProgressiveRendering", ksvgd->progressiveAction->isChecked()); } void KSVGPlugin::slotRenderingBackend() { - KSimpleConfig config("ksvgpluginrc", false); + TDESimpleConfig config("ksvgpluginrc", false); config.setGroup("Canvas"); config.writeEntry("ActiveCanvas", KSVG::CanvasFactory::self()->internalNameFor(ksvgd->renderingBackendAction->currentText())); config.sync(); diff --git a/kuickshow/src/kuickfile.cpp b/kuickshow/src/kuickfile.cpp index 9b5aab44..18c80331 100644 --- a/kuickshow/src/kuickfile.cpp +++ b/kuickshow/src/kuickfile.cpp @@ -2,7 +2,7 @@ #include <kdebug.h> #include <tdeversion.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <kprogress.h> #include <tdeio/job.h> diff --git a/kview/config/plugins/kviewpluginsconfig.cpp b/kview/config/plugins/kviewpluginsconfig.cpp index 73d36b77..248572de 100644 --- a/kview/config/plugins/kviewpluginsconfig.cpp +++ b/kview/config/plugins/kviewpluginsconfig.cpp @@ -22,7 +22,7 @@ #include <kgenericfactory.h> #include <tdelocale.h> #include <tdeglobal.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <kplugininfo.h> typedef KGenericFactory<KViewPluginsConfig, TQWidget> KViewPluginsConfigFactory; @@ -31,7 +31,7 @@ K_EXPORT_COMPONENT_FACTORY( kcm_kviewpluginsconfig, KViewPluginsConfigFactory( " KViewPluginsConfig::KViewPluginsConfig( TQWidget * parent, const char *, const TQStringList & args ) : KSettings::PluginPage( KViewPluginsConfigFactory::instance(), parent, args ) { - m_config = new KSimpleConfig( "kviewrc" ); + m_config = new TDESimpleConfig( "kviewrc" ); pluginSelector()->addPlugins( TQString::fromAscii( "kview" ), i18n( "Application" ), TQString(), m_config ); pluginSelector()->setShowEmptyConfigPage( false ); } diff --git a/kview/kviewcanvas/config/confmodules.cpp b/kview/kviewcanvas/config/confmodules.cpp index d9cf9669..90f443d3 100644 --- a/kview/kviewcanvas/config/confmodules.cpp +++ b/kview/kviewcanvas/config/confmodules.cpp @@ -25,7 +25,7 @@ #include <tqframe.h> #include <tdelocale.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <kcolorbutton.h> #include <tdelistview.h> #include <knuminput.h> diff --git a/kview/kviewviewer/config/kviewviewerpluginsconfig.cpp b/kview/kviewviewer/config/kviewviewerpluginsconfig.cpp index d6d9a2d6..b4693ba0 100644 --- a/kview/kviewviewer/config/kviewviewerpluginsconfig.cpp +++ b/kview/kviewviewer/config/kviewviewerpluginsconfig.cpp @@ -22,7 +22,7 @@ #include <kgenericfactory.h> #include <tdelocale.h> #include <tdeglobal.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <kplugininfo.h> #include <tqstring.h> @@ -33,7 +33,7 @@ K_EXPORT_COMPONENT_FACTORY( kcm_kviewviewerpluginsconfig, KViewViewerPluginsConf KViewViewerPluginsConfig::KViewViewerPluginsConfig( TQWidget * parent, const char *, const TQStringList & args ) : KSettings::PluginPage( KViewViewerPluginsConfigFactory::instance(), parent, args ) { - m_config = new KSimpleConfig( "kviewviewerrc" ); + m_config = new TDESimpleConfig( "kviewviewerrc" ); pluginSelector()->addPlugins( TQString::fromAscii( "kviewviewer" ), i18n( "Viewer" ), TQString(), m_config ); pluginSelector()->setShowEmptyConfigPage( false ); } diff --git a/kview/modules/scanner/kviewscanner.cpp b/kview/modules/scanner/kviewscanner.cpp index ee964d4f..ae621465 100644 --- a/kview/modules/scanner/kviewscanner.cpp +++ b/kview/modules/scanner/kviewscanner.cpp @@ -24,7 +24,7 @@ #include <tqobjectlist.h> #include <tdeaction.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdelocale.h> #include <kgenericfactory.h> #include <kscan.h> diff --git a/kview/photobook/photobook.cpp b/kview/photobook/photobook.cpp index 55903d3c..bde4e8a8 100644 --- a/kview/photobook/photobook.cpp +++ b/kview/photobook/photobook.cpp @@ -172,7 +172,7 @@ PhotoBook::PhotoBook(TQWidget *parent, PhotoBookPart *part, const char *name) // is this the correct way to get the supported mimetypes? if (mViewer) { - KSimpleConfig e(locate("services", service->desktopEntryPath())); + TDESimpleConfig e(locate("services", service->desktopEntryPath())); e.setGroup("Desktop Entry"); mimetypes = TQStringList::split(';', e.readEntry("MimeType")); break; diff --git a/kviewshell/kviewpart.cpp b/kviewshell/kviewpart.cpp index f4eba0fe..794297bc 100644 --- a/kviewshell/kviewpart.cpp +++ b/kviewshell/kviewpart.cpp @@ -20,7 +20,7 @@ #include <kfilterbase.h> #include <kfilterdev.h> #include <tdeglobal.h> -#include <kinstance.h> +#include <tdeinstance.h> #include <tdeio/job.h> #include <tdelocale.h> #include <kiconloader.h> diff --git a/libkscan/devselector.cpp b/libkscan/devselector.cpp index cff05d14..17c6071b 100644 --- a/libkscan/devselector.cpp +++ b/libkscan/devselector.cpp @@ -36,7 +36,7 @@ #include <tdeglobal.h> #include <tdelocale.h> #include <tdemessagebox.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include "devselector.h" diff --git a/libkscan/kscandevice.cpp b/libkscan/kscandevice.cpp index 7a48db4a..e5a89c6e 100644 --- a/libkscan/kscandevice.cpp +++ b/libkscan/kscandevice.cpp @@ -46,7 +46,7 @@ #include "devselector.h" #include "imgscaninfo.h" -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #define MIN_PREVIEW_DPI 75 #define UNDEF_SCANNERNAME I18N_NOOP( "undefined" ) @@ -1504,7 +1504,7 @@ TQString KScanDevice::getConfig( const TQString& key, const TQString& def ) cons { TQString confFile = SCANNER_DB_FILE; - KSimpleConfig scanConfig( confFile, true ); + TDESimpleConfig scanConfig( confFile, true ); scanConfig.setGroup( shortScannerName() ); return scanConfig.readEntry( key, def ); @@ -1523,7 +1523,7 @@ void KScanDevice::slStoreConfig( const TQString& key, const TQString& val ) { kdDebug(29000) << "Storing config " << key << " in Group " << scannerName << endl; - KSimpleConfig scanConfig( confFile ); + TDESimpleConfig scanConfig( confFile ); scanConfig.setGroup( scannerName ); scanConfig.writeEntry( key, val ); scanConfig.sync(); diff --git a/libkscan/scandialog.cpp b/libkscan/scandialog.cpp index 8c852bea..8a0c9e82 100644 --- a/libkscan/scandialog.cpp +++ b/libkscan/scandialog.cpp @@ -31,7 +31,7 @@ #include <tdelocale.h> #include <kdebug.h> #include <tdeconfig.h> -#include <ksimpleconfig.h> +#include <tdesimpleconfig.h> #include <kled.h> #include <tdeglobalsettings.h> #include <kscandevice.h> diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp index 5ed02af6..81c6b04a 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-document.cpp @@ -88,7 +88,10 @@ bool Document::unlock(const TQCString &password) { if (data->locked) { /* racier then it needs to be */ -# if (POPPLER_VERSION_C >= 22003000) +# if (POPPLER_VERSION_C >= 25010000) + DocumentData *doc2 = new DocumentData(data->doc.getFileName()->copy(), + GooString(password.data())); +# elif (POPPLER_VERSION_C >= 22003000) DocumentData *doc2 = new DocumentData(std::make_unique<GooString>(data->doc.getFileName()), GooString(password.data())); # else @@ -225,7 +228,14 @@ TQString Document::getInfo( const TQString & type ) const isUnicode = gFalse; i = 0; } - while ( i < obj.getString()->getLength() ) + while + ( +# if (POPPLER_VERSION_C >= 25010000) + i < obj.getString()->size() +# else + i < obj.getString()->getLength() +# endif + ) { if ( isUnicode ) { diff --git a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp index 42ec0899..d5c028d1 100644 --- a/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp +++ b/tdefile-plugins/dependencies/poppler-tqt/poppler-private.cpp @@ -57,7 +57,14 @@ TQString UnicodeParsedString(CONST_064 GooString *s1) isUnicode = gFalse; i = 0; } - while ( i < s1->getLength() ) + while + ( +# if (POPPLER_VERSION_C >= 25010000) + i < s1->size() +# else + i < s1->getLength() +# endif + ) { if ( isUnicode ) { @@ -129,23 +136,31 @@ void DocumentData::addTocChildren( TQDomDocument * docSyn, TQDomNode * parent, O // get the destination for the page now, but it's VERY time consuming, // so better storing the reference and provide the viewport on demand CONST_064 GooString *s = g->getNamedDest(); - TQChar *charArray = new TQChar[s->getLength()]; - for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->GOO_GET_CSTR()[i]); - TQString aux(charArray, s->getLength()); - item.setAttribute( "DestinationName", aux ); - delete[] charArray; - } - else if ( destination && destination->isOk() ) - { - LinkDestinationData ldd(destination, NULL, this); - item.setAttribute( "Destination", LinkDestination(ldd).toString() ); - } - if ( a->getKind() == actionGoToR ) +# if (POPPLER_VERSION_C >= 25010000) + int sLen = s->size(); +# else + int sLen = s->getLength(); +# endif + TQChar *charArray = new TQChar[sLen]; + for (int i = 0; i < sLen; ++i) { - CONST_064 LinkGoToR * g2 = static_cast< CONST_064 LinkGoToR * >( a ); - item.setAttribute( "ExternalFileName", g2->getFileName()->GOO_GET_CSTR() ); + charArray[i] = TQChar(s->GOO_GET_CSTR()[i]); } + TQString aux(charArray, sLen); + item.setAttribute( "DestinationName", aux ); + delete[] charArray; + } + else if ( destination && destination->isOk() ) + { + LinkDestinationData ldd(destination, NULL, this); + item.setAttribute( "Destination", LinkDestination(ldd).toString() ); + } + if ( a->getKind() == actionGoToR ) + { + CONST_064 LinkGoToR * g2 = static_cast< CONST_064 LinkGoToR * >( a ); + item.setAttribute( "ExternalFileName", g2->getFileName()->GOO_GET_CSTR() ); } + } // 3. recursively descend over children outlineItem->open(); diff --git a/translations/desktop_files/kcoloredit-desktops/es_AR.po b/translations/desktop_files/kcoloredit-desktops/es_AR.po index f6acf727..3b3adfb0 100644 --- a/translations/desktop_files/kcoloredit-desktops/es_AR.po +++ b/translations/desktop_files/kcoloredit-desktops/es_AR.po @@ -1,35 +1,43 @@ # SOME DESCRIPTIVE TITLE. # This file is put in the public domain. # Slávek Banko <slavek.banko@axis.cz>, 2025. +# Alejo Fernández <alejofernandez@hotmail.com.ar>, 2025. msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-08 22:52+0200\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" +"PO-Revision-Date: 2025-05-15 18:33+0000\n" +"Last-Translator: Alejo Fernández <alejofernandez@hotmail.com.ar>\n" +"Language-Team: Spanish (Argentina) <https://mirror.git.trinitydesktop.org/" +"weblate/projects/tdegraphics/kcoloredit-desktop-files/es_AR/>\n" "Language: es_AR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" #. GenericName #: kcolorchooser.desktop:8 +#, fuzzy msgid "Color Chooser" -msgstr "" +msgstr "Selector de colores" #. Name #: kcolorchooser.desktop:9 +#, fuzzy msgid "KColorChooser" -msgstr "" +msgstr "KColorChooser" #. GenericName #: kcoloredit.desktop:8 +#, fuzzy msgid "Color Palette Editor" -msgstr "" +msgstr "Editor de paleta de color" #. Name #: kcoloredit.desktop:9 +#, fuzzy msgid "KColorEdit" -msgstr "" +msgstr "KColorEdit" |
