-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 15 | ||||
-rw-r--r-- | libopie/ofileselector/olister.cpp | 10 | ||||
-rw-r--r-- | libopie/ofileselector/olister.h | 18 | ||||
-rw-r--r-- | libopie/ofileselector/olocallister.cpp | 29 | ||||
-rw-r--r-- | libopie/ofileselector/olocallister.h | 5 |
5 files changed, 62 insertions, 15 deletions
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index 255e79e..9ce07dd 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp @@ -263,6 +263,4 @@ void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ ) } -//void OFileSelector::updateL - QString OFileSelector::selectedName() const { @@ -272,9 +270,5 @@ QString OFileSelector::selectedName() const name = lnk.file(); }else { - if ( m_shLne ) { - name = m_currentDir + "/" +m_edit->text(); - }else{ - name = m_currentDir + "/" + currentView()->selectedName(); - } + name = currentLister()->selectedName(); } return name; @@ -423,5 +417,4 @@ void OFileSelector::slotLocationActivated(const QString &file) else cd(name ); - reparse(); } void OFileSelector::slotInsertLocationPath(const QString ¤tPath, int count) @@ -455,6 +448,4 @@ void OFileSelector::locationComboChanged() else cd( m_location->lineEdit()->text() ); - - reparse(); } void OFileSelector::init() @@ -855,4 +846,6 @@ void OFileSelector::slotDelete() void OFileSelector::cdUP() { + // FIXME won't work on non filesystem based systems + // better call the Olister QDir dir( m_currentDir ); dir.cdUp(); @@ -863,6 +856,4 @@ void OFileSelector::cdUP() slotInsertLocationPath( m_currentDir, count); m_location->setCurrentItem( indexByString( m_location, m_currentDir)); - //this wont work in all instances - // FIXME } } diff --git a/libopie/ofileselector/olister.cpp b/libopie/ofileselector/olister.cpp index ea09940..aaaf6a2 100644 --- a/libopie/ofileselector/olister.cpp +++ b/libopie/ofileselector/olister.cpp @@ -1,3 +1,4 @@ #include <qcombobox.h> +#include <qlineedit.h> #include "olister.h" @@ -113,4 +114,7 @@ OFileSelector* OLister::view() { return m_view; } +OFileSelector* OLister::view()const { + return m_view; +} OPixmapProvider* OLister::provider() { return m_prov; @@ -170,2 +174,8 @@ QString OListerCmbAccess::currentText()const { return str; } +QString OLister::lineEdit()const { + if ( view()->m_shLne ) + return view()->m_edit->text(); + + return QString::null; +} diff --git a/libopie/ofileselector/olister.h b/libopie/ofileselector/olister.h index cd84316..4adb9f8 100644 --- a/libopie/ofileselector/olister.h +++ b/libopie/ofileselector/olister.h @@ -24,5 +24,9 @@ public: OLister( OFileSelector* ); virtual ~OLister(); - virtual void reparse(const QString& path) = 0; + + /** + * if path == QString::null reread current dir + */ + virtual void reparse(const QString& path = QString::null ) = 0; /** @@ -36,4 +40,6 @@ public: virtual void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0; virtual void changedDir( const QString& dir, const QString& file, const QString& extra ) = 0; + virtual QString selectedName()const = 0; + virtual QStringList selectedNames()const = 0; protected: /** @@ -78,7 +84,17 @@ protected: bool isSymlink = FALSE ); OFileSelector* view(); + OFileSelector* view()const; OPixmapProvider* provider(); void internFileSelected( const QString& file ); void internChangedDir( const QString& dir ); + + /** + * try to take + * the text from the mainwindows + * lineedit + * if it's not available QString::null + * will be returned + */ + QString lineEdit()const; private: OFileSelector* m_view; diff --git a/libopie/ofileselector/olocallister.cpp b/libopie/ofileselector/olocallister.cpp index 5d7884d..4d36d64 100644 --- a/libopie/ofileselector/olocallister.cpp +++ b/libopie/ofileselector/olocallister.cpp @@ -6,4 +6,5 @@ #include "ofileselector.h" +#include "ofileview.h" #include "olocallister.h" @@ -11,4 +12,5 @@ OLocalLister::OLocalLister( OFileSelector* file ) : OLister( file ) { + m_dir = QDir::homeDirPath(); } OLocalLister::~OLocalLister() { @@ -52,7 +54,10 @@ QMap<QString, QStringList> OLocalLister::mimeTypes( const QString& curDir ) { * filter mimetypes */ -void OLocalLister::reparse( const QString& path ) { +void OLocalLister::reparse( const QString& pa ) { + if (!pa.isEmpty() ) + m_dir = pa; + QString currentMimeType; - QDir dir( path ); + QDir dir( m_dir ); dir.setSorting( view()->sorting() ); @@ -124,2 +129,22 @@ void OLocalLister::changedDir( const QString& dir, const QString& file, const QS internChangedDir( dir + "/" + file ); } +/* + * assemble the the Url now + */ +QString OLocalLister::selectedName()const { + QString str = m_dir; + QString name = lineEdit(); + + if ( name.isEmpty() ) + name = view()->currentView()->selectedName(); + + str += "/" + name; + + return str; +} +QStringList OLocalLister::selectedNames()const { + QStringList list; + list << selectedName(); + + return list; +} diff --git a/libopie/ofileselector/olocallister.h b/libopie/ofileselector/olocallister.h index 01e6f3c..0cdf51f 100644 --- a/libopie/ofileselector/olocallister.h +++ b/libopie/ofileselector/olocallister.h @@ -12,4 +12,9 @@ public: void fileSelected( const QString& dir, const QString& file, const QString& ); void changedDir( const QString& dir, const QString& file,const QString& ); + QString selectedName()const; + QStringList selectedNames()const; + +private: + QString m_dir; }; |