[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    PATCH: Default progress dialog
From:       "Dawit A." <adawit () kde ! org>
Date:       2002-08-07 5:27:59
[Download RAW message or body]

Hi,

The attached patch changes the squeezed labels to read-only lineedit
in the progress dialog so that one can copy either URL as needed.
See attached screenshot.

The only thing I have not yet figured out is how to make the=20
selections in the lineedits persistent even when the dialog is being
updated much like what the Mozilla progress dialog does.

Regards,
Dawit A.

["defaultprogress.diff" (text/x-diff)]

Index: kio/defaultprogress.cpp
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/defaultprogress.cpp,v
retrieving revision 1.53
diff -u -p -b -B -w -r1.53 defaultprogress.cpp
--- kio/defaultprogress.cpp	2002/07/13 20:14:43	1.53
+++ kio/defaultprogress.cpp	2002/08/07 05:22:38
@@ -33,6 +33,7 @@
 #include <kpushbutton.h>
 #include <kstandarddirs.h>
 #include <kstdguiitem.h>
+#include <klineedit.h>
 #include <kwin.h>
 
 #include "jobclasses.h"
@@ -93,17 +94,20 @@ void DefaultProgress::init()
   // filenames or action name
   grid->addWidget(new QLabel(i18n("Source:"), this), 0, 0);
 
-  sourceLabel = new KSqueezedTextLabel(this);
-  grid->addWidget(sourceLabel, 0, 2);
+  sourceEdit = new KLineEdit(this);
+  sourceEdit->setReadOnly (true);
+  grid->addWidget(sourceEdit, 0, 2);
 
   destInvite = new QLabel(i18n("Destination:"), this);
   grid->addWidget(destInvite, 1, 0);
 
-  destLabel = new KSqueezedTextLabel(this);
-  grid->addWidget(destLabel, 1, 2);
+  destEdit = new KLineEdit(this);
+  destEdit->setReadOnly (true);
+  grid->addWidget(destEdit, 1, 2);
 
   m_pProgressBar = new KProgress(this);
   topLayout->addWidget( m_pProgressBar );
+  m_pProgressBar->setFocusPolicy( NoFocus );
 
   // processed info
   QHBoxLayout *hBox = new QHBoxLayout();
@@ -111,11 +115,14 @@ void DefaultProgress::init()
 
   sizeLabel = new QLabel(this);
   hBox->addWidget(sizeLabel);
+  sizeLabel->setFocusPolicy( NoFocus );
 
   resumeLabel = new QLabel(this);
   hBox->addWidget(resumeLabel);
+  resumeLabel->setFocusPolicy( NoFocus );
 
   progressLabel = new QLabel( this );
+  progressLabel->setFocusPolicy( NoFocus );
 /*  progressLabel->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding,
                                              QSizePolicy::Preferred ) );*/
   progressLabel->setAlignment( QLabel::AlignRight );
@@ -126,6 +133,7 @@ void DefaultProgress::init()
 
   speedLabel = new QLabel(this);
   hBox->addWidget(speedLabel, 1);
+  speedLabel->setFocusPolicy( NoFocus );
 
   QFrame *line = new QFrame( this );
   line->setFrameShape( QFrame::HLine );
@@ -289,10 +297,12 @@ void DefaultProgress::slotCopying( KIO::
     d->noCaptionYet = false;
   }
   mode = Copy;
-  sourceLabel->setText(from.prettyURL());
+  sourceEdit->setText(from.prettyURL());
+  sourceEdit->home (false);
   setDestVisible( true );
   checkDestination( to );
-  destLabel->setText(to.prettyURL());
+  destEdit->setText(to.prettyURL());
+  destEdit->home (false);
 }
 
 
@@ -303,10 +313,12 @@ void DefaultProgress::slotMoving( KIO::J
     d->noCaptionYet = false;
   }
   mode = Move;
-  sourceLabel->setText(from.prettyURL());
+  sourceEdit->setText(from.prettyURL());
+  sourceEdit->home (false);
   setDestVisible( true );
   checkDestination( to );
-  destLabel->setText(to.prettyURL());
+  destEdit->setText(to.prettyURL());
+  destEdit->home (false);
 }
 
 
@@ -317,7 +329,8 @@ void DefaultProgress::slotCreatingDir( K
     d->noCaptionYet = false;
   }
   mode = Create;
-  sourceLabel->setText(dir.prettyURL());
+  sourceEdit->setText(dir.prettyURL());
+  sourceEdit->home (false);
   setDestVisible( false );
 }
 
@@ -329,7 +342,8 @@ void DefaultProgress::slotDeleting( KIO:
     d->noCaptionYet = false;
   }
   mode = Delete;
-  sourceLabel->setText(url.prettyURL());
+  sourceEdit->setText(url.prettyURL());
+  sourceEdit->home (false);
   setDestVisible( false );
 }
 
@@ -339,28 +353,32 @@ void DefaultProgress::slotTransferring( 
     setCaption(i18n("Loading Progress"));
     d->noCaptionYet = false;
   }
-  sourceLabel->setText(url.prettyURL());
+  sourceEdit->setText(url.prettyURL());
+  sourceEdit->home (false);
   setDestVisible( false );
 }
 
 void DefaultProgress::slotStating( KIO::Job*, const KURL& url )
 {
   setCaption(i18n("Examining File Progress"));
-  sourceLabel->setText(url.prettyURL());
+  sourceEdit->setText(url.prettyURL());
+  sourceEdit->home (false);
   setDestVisible( false );
 }
 
 void DefaultProgress::slotMounting( KIO::Job*, const QString & dev, const QString & point )
 {
   setCaption(i18n("Mounting %1").arg(dev));
-  sourceLabel->setText(point);
+  sourceEdit->setText(point);
+  sourceEdit->home (false);
   setDestVisible( false );
 }
 
 void DefaultProgress::slotUnmounting( KIO::Job*, const QString & point )
 {
   setCaption(i18n("Unmounting"));
-  sourceLabel->setText(point);
+  sourceEdit->setText(point);
+  sourceEdit->home (false);
   setDestVisible( false );
 }
 
@@ -375,7 +393,7 @@ void DefaultProgress::slotCanResume( KIO
 
 void DefaultProgress::setDestVisible( bool visible )
 {
-  // We can't hide the destInvite/destLabel labels,
+  // We can't hide the destInvite/destEdit labels,
   // because it screws up the QGridLayout.
   if (visible)
   {
@@ -384,7 +402,7 @@ void DefaultProgress::setDestVisible( bo
   else
   {
     destInvite->setText( QString::null );
-    destLabel->setText( QString::null );
+    destEdit->setText( QString::null );
   }
 }
 
Index: kio/defaultprogress.h
===================================================================
RCS file: /home/kde/kdelibs/kio/kio/defaultprogress.h,v
retrieving revision 1.30
diff -u -p -b -B -w -r1.30 defaultprogress.h
--- kio/defaultprogress.h	2002/06/19 17:46:00	1.30
+++ kio/defaultprogress.h	2002/08/07 05:22:38
@@ -23,10 +23,11 @@
 #include <kio/global.h>
 
 #include <kprogress.h>
-#include <ksqueezedtextlabel.h>
 
 #include "progressbase.h"
 
+class KLineEdit;
+
 namespace KIO {
 
 /*
@@ -73,8 +74,8 @@ protected:
   void setDestVisible( bool visible );
   void checkDestination( const KURL& dest);
 
-  KSqueezedTextLabel* sourceLabel;
-  KSqueezedTextLabel* destLabel;
+  KLineEdit* sourceEdit;
+  KLineEdit* destEdit;
   QLabel* progressLabel;
   QLabel* destInvite;
   QLabel* speedLabel;

["progressdlg.png" (image/png)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic