Bug 146414 - usability: "check data integrity" window buttons
Summary: usability: "check data integrity" window buttons
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-05 19:40 UTC by Maciej Pilichowski
Modified: 2007-06-08 20:37 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Pilichowski 2007-06-05 19:40:52 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    SuSE RPMs

1) after checking you cannot close ([x] widget) the dialog -- bug
2) two buttons "ok" and "cancel" which are mutually exclusive for this dialog is an overkill -- please, use only one button "close", which would nicely fit with (1) fix
Comment 1 Joris Guisson 2007-06-07 18:26:55 UTC
SVN commit 672601 by guisson:

Make sure scan dialog has proper size, it seems that changing the text of a QLabel does not force the dialog to be resized, 
so manually call adjustSize() so that the scan dialog has the proper size.

BUG: 146414



 M  +1 -0      scandialog.cpp  
 M  +10 -2     scandlgbase.ui  


--- branches/extragear/kde3/network/ktorrent/apps/ktorrent/scandialog.cpp #672600:672601
@@ -76,6 +76,7 @@
 void ScanDialog::execute(kt::TorrentInterface* tc,bool silently)
 {
 	m_torrent_label->setText(i18n("Scanning data of <b>%1</b> :").arg(tc->getStats().torrent_name));
+	adjustSize();
 	m_ok->setEnabled(false);
 	m_cancel->setEnabled(true);
 	this->silently = silently;
--- branches/extragear/kde3/network/ktorrent/apps/ktorrent/scandlgbase.ui #672600:672601
@@ -9,9 +9,17 @@
             <x>0</x>
             <y>0</y>
             <width>441</width>
-            <height>187</height>
+            <height>182</height>
         </rect>
     </property>
+    <property name="sizePolicy">
+        <sizepolicy>
+            <hsizetype>5</hsizetype>
+            <vsizetype>5</vsizetype>
+            <horstretch>0</horstretch>
+            <verstretch>0</verstretch>
+        </sizepolicy>
+    </property>
     <property name="caption">
         <string>Scanning data</string>
     </property>
@@ -168,7 +176,7 @@
                         <cstring>m_ok</cstring>
                     </property>
                     <property name="text">
-                        <string>OK</string>
+                        <string>&amp;OK</string>
                     </property>
                 </widget>
                 <widget class="KPushButton">
Comment 2 Joris Guisson 2007-06-07 18:29:59 UTC
Crap, this is the fix for bug 146414, better reopen this bug.
Comment 3 Joris Guisson 2007-06-08 20:37:30 UTC
SVN commit 672998 by guisson:

Scan dialog now has only one button cancel, which becomes close when the
scan is finished.

Also fixed bug with non functioning x button on scan dialog.

BUG: 146414



 M  +2 -0      ChangeLog  
 M  +26 -9     apps/ktorrent/scandialog.cpp  
 M  +5 -0      apps/ktorrent/scandialog.h  
 M  +3 -9      apps/ktorrent/scandlgbase.ui  


--- branches/extragear/kde3/network/ktorrent/ChangeLog #672997:672998
@@ -1,5 +1,7 @@
 Changes in 2.2dev
 - Revamped plugin settings page, looks much nicer now.
+- Scan dialog now has only one button cancel, which becomes close when the
+scan is finished
 
 Changes in 2.2beta1
 - Ditch KMDI in favor of KDevelop IDEA code
--- branches/extragear/kde3/network/ktorrent/apps/ktorrent/scandialog.cpp #672997:672998
@@ -39,16 +39,14 @@
 					   QWidget* parent, const char* name, bool modal, WFlags fl)
 	: ScanDlgBase(parent,name, modal,fl),DataCheckerListener(auto_import),mutex(true),core(core)
 {
-	m_ok->setGuiItem(KStdGuiItem::ok());
-	m_ok->setDisabled(true);
 	m_cancel->setGuiItem(KStdGuiItem::cancel());
-	connect(m_ok,SIGNAL(clicked()),this,SLOT(accept()));
-	connect(m_cancel,SIGNAL(clicked()),this,SLOT(reject()));
+	connect(m_cancel,SIGNAL(clicked()),this,SLOT(onCancelPressed()));
 	connect(&timer,SIGNAL(timeout()),this,SLOT(update()));
 	tc = 0;
 	silently = false;
 	restart = false;
 	qm_controlled = false;
+	scanning = false;
 	num_chunks = 0;
 	total_chunks = 0;
 	num_downloaded = 0;
@@ -65,6 +63,7 @@
 	{
 		tc->startDataCheck(this,auto_import);
 		timer.start(500);
+		scanning = true;
 	}
 	catch (bt::Error & err)
 	{
@@ -77,7 +76,6 @@
 {
 	m_torrent_label->setText(i18n("Scanning data of <b>%1</b> :").arg(tc->getStats().torrent_name));
 	adjustSize();
-	m_ok->setEnabled(false);
 	m_cancel->setEnabled(true);
 	this->silently = silently;
 	this->tc = tc;
@@ -106,13 +104,12 @@
 void ScanDialog::finished()
 {
 	QMutexLocker lock(&mutex);
+	scanning = false;
 	timer.stop();
 	progress(100,100);
 	update();
 	if (!isStopped())
 	{
-		m_ok->setEnabled(true);
-		m_cancel->setEnabled(false);
 		if (restart)
 		{
 			if (!qm_controlled)
@@ -126,6 +123,13 @@
 		
 		if (silently)
 			accept();
+		else
+		{
+			// cancel now becomes a close button
+			m_cancel->setGuiItem(KStdGuiItem::close()); 
+			disconnect(m_cancel,SIGNAL(clicked()),this,SLOT(onCancelPressed()));
+			connect(m_cancel,SIGNAL(clicked()),this,SLOT(accept()));
+		}
 	}
 	else
 	{
@@ -170,7 +174,14 @@
 
 void ScanDialog::reject()
 {
-	//QDialog::reject();
+	if (scanning)
+		stop();
+	else
+		QDialog::reject();
+}
+
+void ScanDialog::onCancelPressed()
+{
 	stop();
 }
 
@@ -179,7 +190,13 @@
 	QDialog::accept();
 }
 
+void ScanDialog::closeEvent(QCloseEvent* e)
+{
+	if (scanning)
+		reject();
+	else
+		accept();
+}
 
-
 #include "scandialog.moc"
 
--- branches/extragear/kde3/network/ktorrent/apps/ktorrent/scandialog.h #672997:672998
@@ -54,10 +54,14 @@
 	/// Scan finished, runs in app thread
 	virtual void finished();
 	
+	/// Handle the close event
+	virtual void closeEvent(QCloseEvent* e);
+	
 
 protected slots:
 	virtual void reject();
 	virtual void accept();
+	void onCancelPressed();
 	/// Updates the GUI in app thread
 	void update();
 	void scan();
@@ -74,6 +78,7 @@
 	bool restart;
 	bool qm_controlled;
 	int qm_priority;
+	bool scanning;
 	KTorrentCore* core;
 };
 
--- branches/extragear/kde3/network/ktorrent/apps/ktorrent/scandlgbase.ui #672997:672998
@@ -173,19 +173,14 @@
                 </spacer>
                 <widget class="KPushButton">
                     <property name="name">
-                        <cstring>m_ok</cstring>
-                    </property>
-                    <property name="text">
-                        <string>&amp;OK</string>
-                    </property>
-                </widget>
-                <widget class="KPushButton">
-                    <property name="name">
                         <cstring>m_cancel</cstring>
                     </property>
                     <property name="text">
                         <string>C&amp;ancel</string>
                     </property>
+                    <property name="accel">
+                        <string>Alt+A</string>
+                    </property>
                 </widget>
             </hbox>
         </widget>
@@ -197,6 +192,5 @@
 <includehints>
     <includehint>kprogress.h</includehint>
     <includehint>kpushbutton.h</includehint>
-    <includehint>kpushbutton.h</includehint>
 </includehints>
 </UI>