[rkward-cvs] SF.net SVN: rkward: [1856] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Fri Apr 27 13:56:15 UTC 2007
Revision: 1856
http://svn.sourceforge.net/rkward/?rev=1856&view=rev
Author: tfry
Date: 2007-04-27 06:56:14 -0700 (Fri, 27 Apr 2007)
Log Message:
-----------
change GetFileNameWidget to use KURLRequester.
This simplifies the code, and additionally provide file-name completion
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/TODO
trunk/rkward/rkward/misc/getfilenamewidget.cpp
trunk/rkward/rkward/misc/getfilenamewidget.h
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2007-04-27 13:32:43 UTC (rev 1855)
+++ trunk/rkward/ChangeLog 2007-04-27 13:56:14 UTC (rev 1856)
@@ -1,3 +1,5 @@
+- all file selection line edits gain filename-completion
+- add a basic file selector window
- fixed: starting the scatterplot plugin in wizard mode would crash rkward
- show the focus indication (thin red border) also for detached windows
- tool windows can be closed and detached in the same way as regular windows
Modified: trunk/rkward/TODO
===================================================================
--- trunk/rkward/TODO 2007-04-27 13:32:43 UTC (rev 1855)
+++ trunk/rkward/TODO 2007-04-27 13:56:14 UTC (rev 1856)
@@ -119,8 +119,7 @@
- save attach/detach status of the windows
- project/session handling: files, workspace, current working directory.
- file system browser tab
- - open .R (.RData, .r, .S, .s ....) files within RKWard
- - some way to open pdf/ps/jpg/png files directly using viewer applications externally (like Kile?).
+ - a way to inline pdf/ps/jpg/png files like in KDevelop?
- provide a menu action / shortcut to switch to the directory of the current script file.
- Quitting:
- instead of closing windows one by one, and asking to save changes if necessary, first list all windows that might need to be saved, let the user chose to save them, then close all windows without further questions.
Modified: trunk/rkward/rkward/misc/getfilenamewidget.cpp
===================================================================
--- trunk/rkward/rkward/misc/getfilenamewidget.cpp 2007-04-27 13:32:43 UTC (rev 1855)
+++ trunk/rkward/rkward/misc/getfilenamewidget.cpp 2007-04-27 13:56:14 UTC (rev 1856)
@@ -17,12 +17,11 @@
#include "getfilenamewidget.h"
#include <qlayout.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
#include <qlabel.h>
#include <klocale.h>
-#include <kfiledialog.h>
+#include <klineedit.h>
+#include <kurlrequester.h>
#include "../debug.h"
@@ -33,34 +32,40 @@
vbox->addWidget (new QLabel (label, this));
- QHBoxLayout *hbox = new QHBoxLayout (vbox, 6);
+ edit = new KURLRequester (this);
+ connect (edit, SIGNAL (textChanged (const QString &)), this, SLOT (locationEditChanged (const QString &)));
+ vbox->addWidget (edit);
- location_edit = new QLineEdit (this);
- location_edit->setText (initial);
- connect (location_edit, SIGNAL (textChanged (const QString &)), this, SLOT (locationEditChanged (const QString &)));
- hbox->addWidget (location_edit);
-
- browse_button = new QPushButton (i18n ("Browse"), this);
- connect (browse_button, SIGNAL (clicked ()), this, SLOT (browseButtonClicked ()));
- hbox->addWidget (browse_button);
-
- GetFileNameWidget::mode = mode;
-
- if (caption.isEmpty ()) {
- GetFileNameWidget::caption = label;
+ edit->setURL (initial);
+ if (mode == ExistingDirectory) {
+ edit->setMode (KFile::Directory | KFile::ExistingOnly);
+ } else if (mode == ExistingFile) {
+ edit->setMode (KFile::File | KFile::ExistingOnly);
+ } else if (mode == SaveFile) {
+ edit->setMode (KFile::File);
} else {
- GetFileNameWidget::caption = caption;
+ RK_ASSERT (false);
}
+
+ if (caption.isEmpty ()) edit->setCaption (label);
+ else edit->setCaption (caption);
}
GetFileNameWidget::~GetFileNameWidget () {
RK_TRACE (MISC);
}
+void GetFileNameWidget::setFilter (const QString &filter) {
+ RK_TRACE (MISC);
+
+ RK_ASSERT (edit);
+ edit->setFilter (filter);
+}
+
void GetFileNameWidget::setLocation (const QString &new_location) {
RK_TRACE (MISC);
- location_edit->setText (new_location);
+ edit->setURL (new_location);
}
void GetFileNameWidget::locationEditChanged (const QString &) {
@@ -68,32 +73,14 @@
emit (locationChanged ());
}
-void GetFileNameWidget::browseButtonClicked () {
- RK_TRACE (MISC);
- QString temp;
- if (mode == ExistingDirectory) {
- temp = KFileDialog::getExistingDirectory (location_edit->text (), this, caption);
- } else if (mode == ExistingFile) {
- temp = KFileDialog::getOpenFileName (location_edit->text (), _filter, this, caption);
- } else if (mode == SaveFile) {
- temp = KFileDialog::getSaveFileName (location_edit->text (), _filter, this, caption);
- } else {
- RK_ASSERT (false);
- }
-
- if (!temp.isEmpty ()) {
- location_edit->setText (temp);
- }
-}
-
QString GetFileNameWidget::getLocation () {
- return location_edit->text ();
+ return edit->url ();
}
void GetFileNameWidget::setBackgroundColor (const QColor & color) {
RK_TRACE (MISC);
- location_edit->setBackgroundColor (color);
+ edit->lineEdit ()->setBackgroundColor (color);
}
#include "getfilenamewidget.moc"
Modified: trunk/rkward/rkward/misc/getfilenamewidget.h
===================================================================
--- trunk/rkward/rkward/misc/getfilenamewidget.h 2007-04-27 13:32:43 UTC (rev 1855)
+++ trunk/rkward/rkward/misc/getfilenamewidget.h 2007-04-27 13:56:14 UTC (rev 1856)
@@ -20,11 +20,10 @@
#include <qwidget.h>
#include <qstring.h>
-class QLineEdit;
-class QPushButton;
+class KURLRequester;
/**
-Simple convenience class used to get a file/directoryname from the user. Basically provides a line-edit and a "browse"-button.
+Simple convenience class used to get a file/directoryname from the user. Basically provides a wrapper around KURLRequester.
@author Thomas Friedrichsmeier
*/
@@ -37,7 +36,7 @@
~GetFileNameWidget ();
/** set filename pattern filter, e.g. "*.cpp *.cc *.C|C++ Source Files\n*.h *.H|Header files" */
- void setFilter (const QString &filter) { _filter = filter; };
+ void setFilter (const QString &filter);
/** set the filename/location from outside */
void setLocation (const QString &new_location);
@@ -47,15 +46,10 @@
QString getLocation ();
public slots:
void locationEditChanged (const QString &);
- void browseButtonClicked ();
signals:
void locationChanged ();
private:
- QLineEdit *location_edit;
- QPushButton *browse_button;
- QString caption;
- QString _filter;
- FileType mode;
+ KURLRequester *edit;
};
#endif
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