[rkward-cvs] SF.net SVN: rkward: [2058] branches/KDE4_port

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Oct 14 16:54:39 UTC 2007


Revision: 2058
          http://rkward.svn.sourceforge.net/rkward/?rev=2058&view=rev
Author:   tfry
Date:     2007-10-14 09:54:39 -0700 (Sun, 14 Oct 2007)

Log Message:
-----------
Ported startupdialog and changed it to be a KDialog, instead of QDialog

Modified Paths:
--------------
    branches/KDE4_port/TODO_KDE4
    branches/KDE4_port/rkward/dialogs/startupdialog.cpp
    branches/KDE4_port/rkward/dialogs/startupdialog.h

Modified: branches/KDE4_port/TODO_KDE4
===================================================================
--- branches/KDE4_port/TODO_KDE4	2007-10-14 16:21:38 UTC (rev 2057)
+++ branches/KDE4_port/TODO_KDE4	2007-10-14 16:54:39 UTC (rev 2058)
@@ -21,6 +21,9 @@
 
 **Everything else**
 
+General:
+	- look out for all failed signal/slot connections
+
 rkcommandeditorwindow
 	- code completion will be broken. Fix after porting.
 	- does the popup-menu still work? See SVN rev. 962.

Modified: branches/KDE4_port/rkward/dialogs/startupdialog.cpp
===================================================================
--- branches/KDE4_port/rkward/dialogs/startupdialog.cpp	2007-10-14 16:21:38 UTC (rev 2057)
+++ branches/KDE4_port/rkward/dialogs/startupdialog.cpp	2007-10-14 16:54:39 UTC (rev 2058)
@@ -16,7 +16,6 @@
  ***************************************************************************/
 #include "startupdialog.h"
 
-#include <qpushbutton.h>
 #include <qradiobutton.h>
 #include <qcheckbox.h>
 #include <q3buttongroup.h>
@@ -29,32 +28,31 @@
 #include <Q3HBoxLayout>
 #include <Q3VBoxLayout>
 
-#include <kdeversion.h>
-#if !KDE_IS_VERSION (3, 2,0)
-	#include <kaction.h>
-#else
-	#include <kactionclasses.h>
-#endif
 #include <klocale.h>
+#include <kvbox.h>
+#include <krecentfilesaction.h>
 
 #include "../settings/rksettingsmodulegeneral.h"
 #include "../misc/rkcommonfunctions.h"
 #include "../debug.h"
 
-StartupDialog::StartupDialog (QWidget *parent, StartupDialogResult *result, KRecentFilesAction *recent_files) : QDialog (parent, 0, true) {
+StartupDialog::StartupDialog (QWidget *parent, StartupDialogResult *result, KRecentFilesAction *recent_files) : KDialog (parent) {
 	RK_TRACE (DIALOGS);
+
+	setModal (true);
+	setButtons (KDialog::Ok | KDialog::Cancel);
+
 	StartupDialog::result = result;
 
 	setCaption (i18n ("What would you like to do?"));
 
-	Q3VBoxLayout *vbox = new Q3VBoxLayout (this);
+	KVBox *vbox = new KVBox (this);
+	setMainWidget (vbox);
 	
-	logo = new QPixmap (RKCommonFunctions::getRKWardDataDir () + "icons/rkward_logo.png");
-	QLabel *pic = new QLabel (this);
-	pic->setPixmap (*logo);
-	vbox->addWidget (pic);
+	QLabel *pic = new QLabel (vbox);
+	pic->setPixmap (QPixmap (RKCommonFunctions::getRKWardDataDir () + "icons/rkward_logo.png"));
 
-	choser = new Q3ButtonGroup (this);
+	choser = new Q3ButtonGroup (vbox);
 	choser->setColumnLayout (0, Qt::Vertical);
 	choser->layout()->setSpacing (6);
 	choser->layout()->setMargin (11);
@@ -62,7 +60,7 @@
 	choser_layout->addWidget (empty_workspace_button = new QRadioButton (i18n ("Start with an empty workspace"), choser));
 	choser_layout->addWidget (empty_table_button = new QRadioButton (i18n ("Start with an empty table"), choser));
 	open_button = new QRadioButton (i18n ("Load an existing workspace:"), choser);
-	connect (open_button, SIGNAL (stateChanged (int)), this, SLOT (openButtonSelected (int)));
+	connect (open_button, SIGNAL (toggled (bool)), this, SLOT (openButtonSelected (bool)));
 	empty_table_button->setChecked (true);
 	choser_layout->addWidget (open_button);
 
@@ -80,25 +78,12 @@
 	connect (file_list, SIGNAL (doubleClicked (Q3ListViewItem *, const QPoint &, int)), this, SLOT (listDoubleClicked (Q3ListViewItem*, const QPoint &, int)));
 	choser_layout->addWidget (file_list);
 	choser_layout->addWidget (remember_box = new QCheckBox (i18n ("Always do this on startup"), choser));
-	
-	vbox->addWidget (choser);
-	
-	Q3HBoxLayout *button_hbox = new Q3HBoxLayout (vbox);
-	ok_button = new QPushButton (i18n ("Ok"), this);
-	connect (ok_button, SIGNAL (clicked ()), this, SLOT (accept ()));
-	button_hbox->addWidget (ok_button);
-	button_hbox->addStretch ();
-	
-	cancel_button = new QPushButton (i18n ("Cancel"), this);
-	connect (cancel_button, SIGNAL (clicked ()), this, SLOT (reject ()));
-	button_hbox->addWidget (cancel_button);
 
 	setFixedWidth (minimumWidth ());
 }
 
 StartupDialog::~StartupDialog() {
 	RK_TRACE (DIALOGS);
-	delete logo;
 }
 
 void StartupDialog::accept () {
@@ -146,14 +131,15 @@
 	
 	if (item) {
 		open_button->setChecked (true);
-		openButtonSelected (QButton::On);		// always do processing
+// KDE4: is this needed, or does it happen automatically via toggled() SIGNAL?
+		openButtonSelected (true);		// always do processing
 	}
 }
 
-void StartupDialog::openButtonSelected (int state) {
+void StartupDialog::openButtonSelected (bool checked) {
 	RK_TRACE (DIALOGS);
 
-	if (state == QButton::On) {
+	if (checked) {
 		if (!file_list->selectedItem ()) {
 			file_list->setSelected (file_list->firstChild (), true);
 		}
@@ -163,7 +149,7 @@
 		} else {
 			remember_box->setEnabled (true);
 		}
-	} else if (state == QButton::Off) {
+	} else if (checked) {
 		remember_box->setEnabled (true);
 	}
 }
@@ -183,7 +169,7 @@
 	dialog->exec ();
 	delete dialog;
 	
-	RK_DO (qDebug ("startup-dialog result: %d, url: %s", result->result, result->open_url.fileName ().toLatin1 ()), DIALOGS, DL_DEBUG);
+	RK_DO (qDebug ("startup-dialog result: %d, url: %s", result->result, result->open_url.fileName ().toLatin1 ().data ()), DIALOGS, DL_DEBUG);
 	
 	return result;
 }

Modified: branches/KDE4_port/rkward/dialogs/startupdialog.h
===================================================================
--- branches/KDE4_port/rkward/dialogs/startupdialog.h	2007-10-14 16:21:38 UTC (rev 2057)
+++ branches/KDE4_port/rkward/dialogs/startupdialog.h	2007-10-14 16:54:39 UTC (rev 2058)
@@ -17,13 +17,12 @@
 #ifndef STARTUPDIALOG_H
 #define STARTUPDIALOG_H
 
-#include <qdialog.h>
+#include <kdialog.h>
+#include <kurl.h>
+
 //Added by qt3to4:
 #include <QPixmap>
 
-#include <kurl.h>
-
-class QPushButton;
 class QCheckBox;
 class Q3ButtonGroup;
 class QRadioButton;
@@ -38,7 +37,7 @@
 @author Thomas Friedrichsmeier
 */
 /// the startup dialog
-class StartupDialog : public QDialog {
+class StartupDialog : public KDialog {
 Q_OBJECT
 public:
 	/** enum to hold result of StartupDialog. WARNING: do not change the numeric values! They are saved as user settings in the config (@see RKSettingsModuleGeneral). */
@@ -64,10 +63,8 @@
 	void reject ();
 	void listDoubleClicked (Q3ListViewItem *item, const QPoint &, int);
 	void listClicked (Q3ListViewItem *item);
-	void openButtonSelected (int state);
+	void openButtonSelected (bool checked);
 private:
-	QPushButton *ok_button;
-	QPushButton *cancel_button;
 	QRadioButton *empty_workspace_button;
 	QRadioButton *empty_table_button;
 	QRadioButton *open_button;
@@ -78,8 +75,6 @@
 	Q3ListView *file_list;
 	Q3ListViewItem *chose_file_item;
 	
-	QPixmap *logo;
-	
 	StartupDialogResult *result;
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list