[rkward-cvs] SF.net SVN: rkward: [2222] branches/KDE4_port/rkward/dialogs
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Nov 14 21:49:51 UTC 2007
Revision: 2222
http://rkward.svn.sourceforge.net/rkward/?rev=2222&view=rev
Author: tfry
Date: 2007-11-14 13:49:51 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
More Qt3 support code removed
Modified Paths:
--------------
branches/KDE4_port/rkward/dialogs/rkimportdialog.cpp
branches/KDE4_port/rkward/dialogs/rkimportdialog.h
branches/KDE4_port/rkward/dialogs/startupdialog.cpp
branches/KDE4_port/rkward/dialogs/startupdialog.h
Modified: branches/KDE4_port/rkward/dialogs/rkimportdialog.cpp
===================================================================
--- branches/KDE4_port/rkward/dialogs/rkimportdialog.cpp 2007-11-14 20:34:01 UTC (rev 2221)
+++ branches/KDE4_port/rkward/dialogs/rkimportdialog.cpp 2007-11-14 21:49:51 UTC (rev 2222)
@@ -30,7 +30,7 @@
#include "../debug.h"
-RKImportDialogFormatSelector::RKImportDialogFormatSelector () {
+RKImportDialogFormatSelector::RKImportDialogFormatSelector () : KHBox () {
RK_TRACE (DIALOGS);
new QLabel (i18n ("File format: "), this);
Modified: branches/KDE4_port/rkward/dialogs/rkimportdialog.h
===================================================================
--- branches/KDE4_port/rkward/dialogs/rkimportdialog.h 2007-11-14 20:34:01 UTC (rev 2221)
+++ branches/KDE4_port/rkward/dialogs/rkimportdialog.h 2007-11-14 21:49:51 UTC (rev 2222)
@@ -21,8 +21,9 @@
#include <kfiledialog.h>
#include <qstringlist.h>
-#include <q3hbox.h>
+#include <khbox.h>
+
class QComboBox;
class RKContextMap;
class RKImportDialogFormatSelector;
@@ -56,7 +57,7 @@
};
/** Internal helper class to RKImportDialog. Needed solely to work around a design flaw in the KFileDialog API */
-class RKImportDialogFormatSelector : public Q3HBox {
+class RKImportDialogFormatSelector : public KHBox {
friend class RKImportDialog;
private:
RKImportDialogFormatSelector ();
Modified: branches/KDE4_port/rkward/dialogs/startupdialog.cpp
===================================================================
--- branches/KDE4_port/rkward/dialogs/startupdialog.cpp 2007-11-14 20:34:01 UTC (rev 2221)
+++ branches/KDE4_port/rkward/dialogs/startupdialog.cpp 2007-11-14 21:49:51 UTC (rev 2222)
@@ -18,15 +18,14 @@
#include <qradiobutton.h>
#include <qcheckbox.h>
-#include <q3buttongroup.h>
-#include <qlayout.h>
+#include <qbuttongroup.h>
+#include <QGroupBox>
#include <qlabel.h>
-#include <q3listview.h>
+#include <QListWidget>
#include <qstringlist.h>
#include <qpixmap.h>
-//Added by qt3to4:
-#include <Q3HBoxLayout>
-#include <Q3VBoxLayout>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
#include <klocale.h>
#include <kvbox.h>
@@ -52,32 +51,34 @@
QLabel *pic = new QLabel (vbox);
pic->setPixmap (QPixmap (RKCommonFunctions::getRKWardDataDir () + "icons/rkward_logo.png"));
- choser = new Q3ButtonGroup (vbox);
- choser->setColumnLayout (0, Qt::Vertical);
- choser->layout()->setSpacing (6);
- choser->layout()->setMargin (11);
- Q3VBoxLayout *choser_layout = new Q3VBoxLayout(choser->layout());
- 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);
+ choser = new QButtonGroup (this);
+ QGroupBox* choser_box = new QGroupBox (vbox);
+ QVBoxLayout*choser_layout = new QVBoxLayout(choser_box);
+
+ choser_layout->addWidget (empty_workspace_button = new QRadioButton (i18n ("Start with an empty workspace"), choser_box));
+ choser->addButton (empty_workspace_button);
+ choser_layout->addWidget (empty_table_button = new QRadioButton (i18n ("Start with an empty table"), choser_box));
+ choser->addButton (empty_table_button);
+ choser_layout->addWidget (open_button = new QRadioButton (i18n ("Load an existing workspace:"), choser_box));
+ choser->addButton (open_button);
connect (open_button, SIGNAL (toggled (bool)), this, SLOT (openButtonSelected (bool)));
empty_table_button->setChecked (true);
- choser_layout->addWidget (open_button);
- file_list = new Q3ListView (choser);
- file_list->addColumn (i18n ("Filename"));
- file_list->setSorting (-1);
- chose_file_item = new Q3ListViewItem (file_list, i18n ("<<Open another file>>"));
+ file_list = new QListWidget (choser_box);
+ file_list->setSelectionMode (QAbstractItemView::SingleSelection);
+ file_list->setSortingEnabled (false);
+ chose_file_item = new QListWidgetItem (i18n ("<<Open another file>>"), file_list);
if (recent_files) {
QStringList items = recent_files->items ();
for (QStringList::iterator it = items.begin (); it != items.end (); ++it) {
- if (!(*it).isEmpty ()) new Q3ListViewItem (file_list, (*it));
+#warning this is no longer correct, as the text is a label + url, not only the url
+ if (!(*it).isEmpty ()) new QListWidgetItem ((*it), file_list);
}
}
- connect (file_list, SIGNAL (selectionChanged (Q3ListViewItem *)), this, SLOT (listClicked (Q3ListViewItem*)));
- connect (file_list, SIGNAL (doubleClicked (Q3ListViewItem *, const QPoint &, int)), this, SLOT (listDoubleClicked (Q3ListViewItem*, const QPoint &, int)));
+ connect (file_list, SIGNAL (itemClicked (QListWidgetItem*)), this, SLOT (listClicked (QListWidgetItem*)));
+ connect (file_list, SIGNAL (itemDoubleClicked (QListWidgetItem*)), this, SLOT (listDoubleClicked (QListWidgetItem*)));
choser_layout->addWidget (file_list);
- choser_layout->addWidget (remember_box = new QCheckBox (i18n ("Always do this on startup"), choser));
+ choser_layout->addWidget (remember_box = new QCheckBox (i18n ("Always do this on startup"), choser_box));
}
StartupDialog::~StartupDialog() {
@@ -92,12 +93,12 @@
} else if (empty_table_button->isChecked ()) {
result->result = EmptyTable;
} else if (open_button->isChecked ()) {
- Q3ListViewItem *item = file_list->selectedItem ();
+ QListWidgetItem *item = file_list->currentItem ();
if (item == chose_file_item) {
result->result = ChoseFile;
} else {
result->result = OpenFile;
- result->open_url = KUrl (item->text (0));
+ result->open_url = KUrl (item->text ());
}
} else {
RK_ASSERT (false);
@@ -114,22 +115,22 @@
QDialog::reject ();
}
-void StartupDialog::listDoubleClicked (Q3ListViewItem *item, const QPoint &, int) {
+void StartupDialog::listDoubleClicked (QListWidgetItem *item) {
RK_TRACE (DIALOGS);
if (item) {
open_button->setChecked (true);
+ file_list->setCurrentItem (item);
item->setSelected (true);
accept ();
}
}
-void StartupDialog::listClicked (Q3ListViewItem *item) {
+void StartupDialog::listClicked (QListWidgetItem *item) {
RK_TRACE (DIALOGS);
if (item) {
open_button->setChecked (true);
-// KDE4: is this needed, or does it happen automatically via toggled() SIGNAL?
openButtonSelected (true); // always do processing
}
}
@@ -138,16 +139,16 @@
RK_TRACE (DIALOGS);
if (checked) {
- if (!file_list->selectedItem ()) {
- file_list->setSelected (file_list->firstChild (), true);
+ if (!file_list->currentItem ()) {
+ file_list->setCurrentRow (0);
}
- if (file_list->selectedItem () != chose_file_item) {
+ if (file_list->currentItem () != chose_file_item) {
remember_box->setChecked (false);
remember_box->setEnabled (false);
} else {
remember_box->setEnabled (true);
}
- } else if (checked) {
+ } else {
remember_box->setEnabled (true);
}
}
Modified: branches/KDE4_port/rkward/dialogs/startupdialog.h
===================================================================
--- branches/KDE4_port/rkward/dialogs/startupdialog.h 2007-11-14 20:34:01 UTC (rev 2221)
+++ branches/KDE4_port/rkward/dialogs/startupdialog.h 2007-11-14 21:49:51 UTC (rev 2222)
@@ -20,15 +20,11 @@
#include <kdialog.h>
#include <kurl.h>
-//Added by qt3to4:
-#include <QPixmap>
-
class QCheckBox;
-class Q3ButtonGroup;
+class QButtonGroup;
class QRadioButton;
-class Q3ListView;
-class Q3ListViewItem;
-class QPixmap;
+class QListWidget;
+class QListWidgetItem;
class KRecentFilesAction;
/**
@@ -61,8 +57,8 @@
public slots:
void accept ();
void reject ();
- void listDoubleClicked (Q3ListViewItem *item, const QPoint &, int);
- void listClicked (Q3ListViewItem *item);
+ void listDoubleClicked (QListWidgetItem* item);
+ void listClicked (QListWidgetItem* item);
void openButtonSelected (bool checked);
protected:
/** reimplemented from QWidget to achieve fixed width */
@@ -73,10 +69,10 @@
QRadioButton *open_button;
QCheckBox *remember_box;
- Q3ButtonGroup *choser;
+ QButtonGroup *choser;
- Q3ListView *file_list;
- Q3ListViewItem *chose_file_item;
+ QListWidget *file_list;
+ QListWidgetItem *chose_file_item;
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