From 7583327200ad3f29dbf447a21e2a90600c7ed292 Mon Sep 17 00:00:00 2001
From: Alexander Golubev <fatzer2@gmail.com>
Date: Sat, 1 Nov 2025 17:17:19 +0300
Subject: ksnapshot: minor whitespace fixups

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
---
 ksnapshot/ksnapshot.cpp | 260 ++++++++++++++++++++++++------------------------
 1 file changed, 130 insertions(+), 130 deletions(-)

diff --git a/ksnapshot/ksnapshot.cpp b/ksnapshot/ksnapshot.cpp
index c0ebc1be..605a898a 100644
--- a/ksnapshot/ksnapshot.cpp
+++ b/ksnapshot/ksnapshot.cpp
@@ -61,8 +61,8 @@
 #include <tdeglobal.h>
 
 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 );
@@ -86,11 +86,11 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
     grabber->grabMouse( waitCursor );
 
     if ( !grabCurrent )
-	snapshot = TQPixmap::grabWindow( tqt_xrootwin() );
+        snapshot = TQPixmap::grabWindow( tqt_xrootwin() );
     else {
-	mainWidget->setMode( WindowUnderCursor );
-	mainWidget->setIncludeDecorations( true );
-	performGrab();
+        mainWidget->setMode( WindowUnderCursor );
+        mainWidget->setIncludeDecorations( true );
+        performGrab();
     }
 
     updatePreview();
@@ -106,7 +106,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 +139,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 +168,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 +186,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 +194,36 @@ 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();
+        }
     }
     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;
@@ -281,17 +281,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 +307,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;
-
-	if ( (dw > 0.0) || (dh > 0.0) )
-	    scale = true;
-
-	if ( scale ) {
-
-	    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;
-	    }
-
-	    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;
-
-	    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 );
-	}
+        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 ( scale ) {
+
+            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;
+            }
+
+            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;
+
+            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();
@@ -437,52 +437,52 @@ void KSnapshot::openWithExternalApp(const KService &service) {
 
 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);
-	}
+    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();
-
-	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());
+    for (KTempFile *tmpFile : m_tmpFiles)
+    {
+        tmpFile->unlink();
+        delete tmpFile;
+    }
+    m_tmpFiles.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());
 }
 
 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 +500,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 +518,7 @@ void KSnapshot::autoincFilename()
         }
     }
 
-    //Rebuild the path 
+    // Rebuild the path
     KURL newURL = filename;
     newURL.setFileName( name );
     setURL( newURL.url() );
@@ -537,7 +537,7 @@ void KSnapshot::grabTimerDone()
             TQ_SLOT( slotRegionGrabbed( const TQPixmap & ) ) );
     }
     else {
-	performGrab();
+        performGrab();
     }
     KNotifyClient::beep(i18n("The screen has been successfully grabbed."));
 }
@@ -548,16 +548,16 @@ 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();
-	}
+        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() );
+        snapshot = WindowGrabber::grabCurrent( mainWidget->includeDecorations() );
     }
     else {
-	snapshot = TQPixmap::grabWindow( tqt_xrootwin() );
+        snapshot = TQPixmap::grabWindow( tqt_xrootwin() );
     }
     updatePreview();
     TQApplication::restoreOverrideCursor();
@@ -581,7 +581,7 @@ void KSnapshot::setURL( const TQString &url )
 {
     KURL newURL = KURL::fromPathOrURL( url );
     if ( newURL == filename )
-	return;
+        return;
 
     filename = newURL;
     updateCaption();
-- 
cgit v1.2.3

