summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-29 19:08:40 (UTC)
committer zecke <zecke>2002-10-29 19:08:40 (UTC)
commit2957aae1073f4c41dd6783c41d1199be71cd9f4a (patch) (unidiff)
tree2aa5c4f61105aa151867e170601de58511479fd8
parenta575fd4c862693705018902b4482c5135a8cb6a2 (diff)
downloadopie-2957aae1073f4c41dd6783c41d1199be71cd9f4a.zip
opie-2957aae1073f4c41dd6783c41d1199be71cd9f4a.tar.gz
opie-2957aae1073f4c41dd6783c41d1199be71cd9f4a.tar.bz2
the reverse getting of filenames is actually enabled
There will be some code clean ups... but the interfaces should be fine now
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/ofileselector/ofileselector.cpp15
-rw-r--r--libopie/ofileselector/olister.cpp10
-rw-r--r--libopie/ofileselector/olister.h18
-rw-r--r--libopie/ofileselector/olocallister.cpp29
-rw-r--r--libopie/ofileselector/olocallister.h5
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*/ )
263} 263}
264 264
265//void OFileSelector::updateL
266
267QString OFileSelector::selectedName() const 265QString OFileSelector::selectedName() const
268{ 266{
@@ -272,9 +270,5 @@ QString OFileSelector::selectedName() const
272 name = lnk.file(); 270 name = lnk.file();
273 }else { 271 }else {
274 if ( m_shLne ) { 272 name = currentLister()->selectedName();
275 name = m_currentDir + "/" +m_edit->text();
276 }else{
277 name = m_currentDir + "/" + currentView()->selectedName();
278 }
279 } 273 }
280 return name; 274 return name;
@@ -423,5 +417,4 @@ void OFileSelector::slotLocationActivated(const QString &file)
423 else 417 else
424 cd(name ); 418 cd(name );
425 reparse();
426} 419}
427void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count) 420void OFileSelector::slotInsertLocationPath(const QString &currentPath, int count)
@@ -455,6 +448,4 @@ void OFileSelector::locationComboChanged()
455 else 448 else
456 cd( m_location->lineEdit()->text() ); 449 cd( m_location->lineEdit()->text() );
457
458 reparse();
459} 450}
460void OFileSelector::init() 451void OFileSelector::init()
@@ -855,4 +846,6 @@ void OFileSelector::slotDelete()
855void OFileSelector::cdUP() 846void OFileSelector::cdUP()
856{ 847{
848 // FIXME won't work on non filesystem based systems
849 // better call the Olister
857 QDir dir( m_currentDir ); 850 QDir dir( m_currentDir );
858 dir.cdUp(); 851 dir.cdUp();
@@ -863,6 +856,4 @@ void OFileSelector::cdUP()
863 slotInsertLocationPath( m_currentDir, count); 856 slotInsertLocationPath( m_currentDir, count);
864 m_location->setCurrentItem( indexByString( m_location, m_currentDir)); 857 m_location->setCurrentItem( indexByString( m_location, m_currentDir));
865 //this wont work in all instances
866 // FIXME
867 } 858 }
868} 859}
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 @@
1#include <qcombobox.h> 1#include <qcombobox.h>
2#include <qlineedit.h>
2 3
3#include "olister.h" 4#include "olister.h"
@@ -113,4 +114,7 @@ OFileSelector* OLister::view() {
113 return m_view; 114 return m_view;
114} 115}
116OFileSelector* OLister::view()const {
117 return m_view;
118}
115OPixmapProvider* OLister::provider() { 119OPixmapProvider* OLister::provider() {
116 return m_prov; 120 return m_prov;
@@ -170,2 +174,8 @@ QString OListerCmbAccess::currentText()const {
170 return str; 174 return str;
171} 175}
176QString OLister::lineEdit()const {
177 if ( view()->m_shLne )
178 return view()->m_edit->text();
179
180 return QString::null;
181}
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:
24 OLister( OFileSelector* ); 24 OLister( OFileSelector* );
25 virtual ~OLister(); 25 virtual ~OLister();
26 virtual void reparse(const QString& path) = 0; 26
27 /**
28 * if path == QString::null reread current dir
29 */
30 virtual void reparse(const QString& path = QString::null ) = 0;
27 31
28 /** 32 /**
@@ -36,4 +40,6 @@ public:
36 virtual void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0; 40 virtual void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0;
37 virtual void changedDir( const QString& dir, const QString& file, const QString& extra ) = 0; 41 virtual void changedDir( const QString& dir, const QString& file, const QString& extra ) = 0;
42 virtual QString selectedName()const = 0;
43 virtual QStringList selectedNames()const = 0;
38protected: 44protected:
39 /** 45 /**
@@ -78,7 +84,17 @@ protected:
78 bool isSymlink = FALSE ); 84 bool isSymlink = FALSE );
79 OFileSelector* view(); 85 OFileSelector* view();
86 OFileSelector* view()const;
80 OPixmapProvider* provider(); 87 OPixmapProvider* provider();
81 void internFileSelected( const QString& file ); 88 void internFileSelected( const QString& file );
82 void internChangedDir( const QString& dir ); 89 void internChangedDir( const QString& dir );
90
91 /**
92 * try to take
93 * the text from the mainwindows
94 * lineedit
95 * if it's not available QString::null
96 * will be returned
97 */
98 QString lineEdit()const;
83private: 99private:
84 OFileSelector* m_view; 100 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 @@
6 6
7#include "ofileselector.h" 7#include "ofileselector.h"
8#include "ofileview.h"
8#include "olocallister.h" 9#include "olocallister.h"
9 10
@@ -11,4 +12,5 @@ OLocalLister::OLocalLister( OFileSelector* file )
11 : OLister( file ) 12 : OLister( file )
12{ 13{
14 m_dir = QDir::homeDirPath();
13} 15}
14OLocalLister::~OLocalLister() { 16OLocalLister::~OLocalLister() {
@@ -52,7 +54,10 @@ QMap<QString, QStringList> OLocalLister::mimeTypes( const QString& curDir ) {
52 * filter mimetypes 54 * filter mimetypes
53 */ 55 */
54void OLocalLister::reparse( const QString& path ) { 56void OLocalLister::reparse( const QString& pa ) {
57 if (!pa.isEmpty() )
58 m_dir = pa;
59
55 QString currentMimeType; 60 QString currentMimeType;
56 QDir dir( path ); 61 QDir dir( m_dir );
57 62
58 dir.setSorting( view()->sorting() ); 63 dir.setSorting( view()->sorting() );
@@ -124,2 +129,22 @@ void OLocalLister::changedDir( const QString& dir, const QString& file, const QS
124 internChangedDir( dir + "/" + file ); 129 internChangedDir( dir + "/" + file );
125} 130}
131/*
132 * assemble the the Url now
133 */
134QString OLocalLister::selectedName()const {
135 QString str = m_dir;
136 QString name = lineEdit();
137
138 if ( name.isEmpty() )
139 name = view()->currentView()->selectedName();
140
141 str += "/" + name;
142
143 return str;
144}
145QStringList OLocalLister::selectedNames()const {
146 QStringList list;
147 list << selectedName();
148
149 return list;
150}
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:
12 void fileSelected( const QString& dir, const QString& file, const QString& ); 12 void fileSelected( const QString& dir, const QString& file, const QString& );
13 void changedDir( const QString& dir, const QString& file,const QString& ); 13 void changedDir( const QString& dir, const QString& file,const QString& );
14 QString selectedName()const;
15 QStringList selectedNames()const;
16
17private:
18 QString m_dir;
14}; 19};
15 20