author | zecke <zecke> | 2002-10-28 19:55:18 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-28 19:55:18 (UTC) |
commit | 3ba494eb02e72e1f9a732c46ec8085e843f01eca (patch) (unidiff) | |
tree | cdc0e7af342cd0e205ed4ae1c1da92ced3fd5774 | |
parent | e9d8023028b7c996d8ff2a68b87dfde19fcfa892 (diff) | |
download | opie-3ba494eb02e72e1f9a732c46ec8085e843f01eca.zip opie-3ba494eb02e72e1f9a732c46ec8085e843f01eca.tar.gz opie-3ba494eb02e72e1f9a732c46ec8085e843f01eca.tar.bz2 |
This will probably not compile.. i did not even try to compile it
on my machine
I changed the data flow to be more extandable the Olister class
is now playing a bigger role it's dependant on
doing some assembly of the filepath and changedirs.
It now has also to take care of the location bar
-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 20 | ||||
-rw-r--r-- | libopie/ofileselector/ofilelistview.h | 15 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 25 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselectoritem.cpp | 5 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselectoritem.h | 5 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.cpp | 14 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.h | 33 | ||||
-rw-r--r-- | libopie/ofileselector/olister.cpp | 58 | ||||
-rw-r--r-- | libopie/ofileselector/olister.h | 61 | ||||
-rw-r--r-- | libopie/ofileselector/olocallister.cpp | 3 |
10 files changed, 199 insertions, 40 deletions
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp index 691bf42..9cfdc48 100644 --- a/libopie/ofileselector/ofilelistview.cpp +++ b/libopie/ofileselector/ofilelistview.cpp | |||
@@ -46,6 +46,7 @@ void OFileListView::clear() { | |||
46 | void OFileListView::addFile( const QPixmap& pix, | 46 | void OFileListView::addFile( const QPixmap& pix, |
47 | const QString&, | 47 | const QString&, |
48 | QFileInfo* info, | 48 | QFileInfo* info, |
49 | const QString& /*extra*/, | ||
49 | bool isSymlink ) { | 50 | bool isSymlink ) { |
50 | QString dir; | 51 | QString dir; |
51 | QString name; | 52 | QString name; |
@@ -70,11 +71,15 @@ void OFileListView::addFile( const QPixmap& pix, | |||
70 | } | 71 | } |
71 | void OFileListView::addFile( const QPixmap&, | 72 | void OFileListView::addFile( const QPixmap&, |
72 | const QString& /*mime*/, const QString& /*dir*/, | 73 | const QString& /*mime*/, const QString& /*dir*/, |
73 | const QString& /*file*/, bool /*isSyml*/ ) { | 74 | const QString& /*file*/, |
75 | const QString& /*extra*/, | ||
76 | bool /*isSyml*/ ) { | ||
74 | 77 | ||
75 | } | 78 | } |
76 | void OFileListView::addDir( const QPixmap& pix, const QString&, | 79 | void OFileListView::addDir( const QPixmap& pix, const QString&, |
77 | QFileInfo* info, bool symlink ) { | 80 | QFileInfo* info, |
81 | const QString& /*extra */, | ||
82 | bool symlink ) { | ||
78 | 83 | ||
79 | bool locked = false; | 84 | bool locked = false; |
80 | QString name; | 85 | QString name; |
@@ -90,18 +95,23 @@ void OFileListView::addDir( const QPixmap& pix, const QString&, | |||
90 | } | 95 | } |
91 | void OFileListView::addDir( const QPixmap&, | 96 | void OFileListView::addDir( const QPixmap&, |
92 | const QString& /*mime*/, const QString& /*dir*/, | 97 | const QString& /*mime*/, const QString& /*dir*/, |
93 | const QString& /*file*/, bool ) { | 98 | const QString& /*file*/, |
99 | const QString& /*extra*/, | ||
100 | bool ) { | ||
94 | 101 | ||
95 | } | 102 | } |
96 | void OFileListView::addSymlink( const QPixmap&, | 103 | void OFileListView::addSymlink( const QPixmap&, |
97 | const QString& /*mime*/, | 104 | const QString& /*mime*/, |
98 | QFileInfo* /*info*/, | 105 | QFileInfo* /*info*/, |
106 | const QString& /*extra*/, | ||
99 | bool /*isSym*/ ) { | 107 | bool /*isSym*/ ) { |
100 | 108 | ||
101 | } | 109 | } |
102 | void OFileListView::addSymlink(const QPixmap&, | 110 | void OFileListView::addSymlink(const QPixmap&, |
103 | const QString& /*m*/, const QString& /*path*/, | 111 | const QString& /*m*/, const QString& /*path*/, |
104 | const QString& /*file*/, bool /*isSym*/ ) { | 112 | const QString& /*file*/, |
113 | const QString& /*extra*/, | ||
114 | bool /*isSym*/ ) { | ||
105 | 115 | ||
106 | } | 116 | } |
107 | void OFileListView::cd( const QString& ) { | 117 | void OFileListView::cd( const QString& ) { |
@@ -127,7 +137,7 @@ QString OFileListView::selectedPath()const { | |||
127 | } | 137 | } |
128 | QStringList OFileListView::selectedPaths()const { | 138 | QStringList OFileListView::selectedPaths()const { |
129 | QStringList list; | 139 | QStringList list; |
130 | list << selectedPath(); | 140 | b list << selectedPath(); |
131 | return list; | 141 | return list; |
132 | } | 142 | } |
133 | int OFileListView::fileCount() { | 143 | int OFileListView::fileCount() { |
diff --git a/libopie/ofileselector/ofilelistview.h b/libopie/ofileselector/ofilelistview.h index c8cdfd1..0f625ec 100644 --- a/libopie/ofileselector/ofilelistview.h +++ b/libopie/ofileselector/ofilelistview.h | |||
@@ -16,28 +16,37 @@ public: | |||
16 | void addFile( const QPixmap&, | 16 | void addFile( const QPixmap&, |
17 | const QString& mine, | 17 | const QString& mine, |
18 | QFileInfo* info, | 18 | QFileInfo* info, |
19 | const QString& extra = QString::null, | ||
19 | bool isSymlink = FALSE ); | 20 | bool isSymlink = FALSE ); |
20 | 21 | ||
21 | void addFile( const QPixmap&, | 22 | void addFile( const QPixmap&, |
22 | const QString& mime, | 23 | const QString& mime, |
23 | const QString& dir, | 24 | const QString& dir, |
24 | const QString& file, | 25 | const QString& file, |
26 | const QString& extra = QString::null, | ||
25 | bool = false ); | 27 | bool = false ); |
26 | 28 | ||
27 | void addDir( const QPixmap&, | 29 | void addDir( const QPixmap&, |
28 | const QString& mime, | 30 | const QString& mime, |
31 | const QString& extra = QString::null, | ||
29 | QFileInfo* info, bool = FALSE ); | 32 | QFileInfo* info, bool = FALSE ); |
30 | 33 | ||
31 | void addDir( const QPixmap&, | 34 | void addDir( const QPixmap&, |
32 | const QString& mime, const QString& dir, | 35 | const QString& mime, const QString& dir, |
33 | const QString& file, bool = FALSE ); | 36 | const QString& file, |
37 | const QString& extra = QString::null, | ||
38 | bool = FALSE ); | ||
34 | 39 | ||
35 | void addSymlink( const QPixmap&, | 40 | void addSymlink( const QPixmap&, |
36 | const QString& mime, | 41 | const QString& mime, |
37 | QFileInfo* info, bool = FALSE ); | 42 | QFileInfo* info, |
43 | const QString& extra = QString::null, | ||
44 | bool = FALSE ); | ||
38 | void addSymlink( const QPixmap&, | 45 | void addSymlink( const QPixmap&, |
39 | const QString& mine, const QString& path, | 46 | const QString& mine, const QString& path, |
40 | const QString& file, bool isSymlink = FALSE ); | 47 | const QString& file, |
48 | const QString& extra, | ||
49 | bool isSymlink = FALSE ); | ||
41 | void cd( const QString& path ); | 50 | void cd( const QString& path ); |
42 | QWidget* widget(); | 51 | QWidget* widget(); |
43 | void sort(); | 52 | void sort(); |
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index 4ab744c..0ccb3cb 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp | |||
@@ -393,21 +393,20 @@ QString OFileSelector::currentMimeType() const{ | |||
393 | } | 393 | } |
394 | void OFileSelector::slotMimeCheck(const QString &mime) | 394 | void OFileSelector::slotMimeCheck(const QString &mime) |
395 | { | 395 | { |
396 | if( m_selector == Normal ){ | 396 | if( m_selector == Normal ){ |
397 | initializeOldSelector(); | 397 | initializeOldSelector(); |
398 | 398 | ||
399 | updateMimes(); | 399 | updateMimes(); |
400 | updateMimeCheck(); | 400 | updateMimeCheck(); |
401 | m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); | 401 | m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); |
402 | }else{ // others | 402 | }else{ // others |
403 | qWarning("Mime %s", mime.latin1() ); | 403 | qWarning("Mime %s", mime.latin1() ); |
404 | if(m_shChooser ){ | 404 | if(m_shChooser ){ |
405 | qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); | 405 | qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); |
406 | //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); | 406 | //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); |
407 | } | ||
408 | reparse(); | ||
407 | } | 409 | } |
408 | reparse(); | ||
409 | } | ||
410 | |||
411 | } | 410 | } |
412 | /* | 411 | /* |
413 | * Ok if a non dir gets inserted into this combobox | 412 | * Ok if a non dir gets inserted into this combobox |
diff --git a/libopie/ofileselector/ofileselectoritem.cpp b/libopie/ofileselector/ofileselectoritem.cpp index 1e745a1..d31046b 100644 --- a/libopie/ofileselector/ofileselectoritem.cpp +++ b/libopie/ofileselector/ofileselectoritem.cpp | |||
@@ -6,6 +6,7 @@ OFileSelectorItem::OFileSelectorItem( QListView*view, | |||
6 | const QString& date, | 6 | const QString& date, |
7 | const QString& size, | 7 | const QString& size, |
8 | const QString& dir, | 8 | const QString& dir, |
9 | const QString& extra, | ||
9 | bool isLocked, | 10 | bool isLocked, |
10 | bool isDir ) | 11 | bool isDir ) |
11 | : QListViewItem( view ) | 12 | : QListViewItem( view ) |
@@ -17,6 +18,7 @@ OFileSelectorItem::OFileSelectorItem( QListView*view, | |||
17 | m_dir = isDir; | 18 | m_dir = isDir; |
18 | m_locked = isLocked; | 19 | m_locked = isLocked; |
19 | m_dirStr = dir; | 20 | m_dirStr = dir; |
21 | m_extra = extra; | ||
20 | } | 22 | } |
21 | OFileSelectorItem::~OFileSelectorItem() { | 23 | OFileSelectorItem::~OFileSelectorItem() { |
22 | } | 24 | } |
@@ -51,3 +53,6 @@ QString OFileSelectorItem::key( int id, bool ) { | |||
51 | 53 | ||
52 | return ke; | 54 | return ke; |
53 | } | 55 | } |
56 | QString OFileSelector::extra()const { | ||
57 | return m_extra; | ||
58 | } | ||
diff --git a/libopie/ofileselector/ofileselectoritem.h b/libopie/ofileselector/ofileselectoritem.h index 21460c4..81966ae 100644 --- a/libopie/ofileselector/ofileselectoritem.h +++ b/libopie/ofileselector/ofileselectoritem.h | |||
@@ -12,6 +12,7 @@ public: | |||
12 | const QString& size, | 12 | const QString& size, |
13 | const QString& dir, | 13 | const QString& dir, |
14 | bool isLocked, | 14 | bool isLocked, |
15 | const QString& extra, | ||
15 | bool isDir = false); | 16 | bool isDir = false); |
16 | ~OFileSelectorItem(); | 17 | ~OFileSelectorItem(); |
17 | bool isLocked() const; | 18 | bool isLocked() const; |
@@ -19,12 +20,16 @@ public: | |||
19 | bool isDir()const; | 20 | bool isDir()const; |
20 | QString path()const; | 21 | QString path()const; |
21 | QString key(int id, bool ); | 22 | QString key(int id, bool ); |
23 | QString extra()const; | ||
22 | 24 | ||
23 | private: | 25 | private: |
24 | bool m_locked : 1; | 26 | bool m_locked : 1; |
25 | bool m_dir : 1; | 27 | bool m_dir : 1; |
26 | QString m_dirStr; | 28 | QString m_dirStr; |
29 | QString m_extra; | ||
27 | 30 | ||
31 | class Private; | ||
32 | Private* d; | ||
28 | }; | 33 | }; |
29 | 34 | ||
30 | #endif | 35 | #endif |
diff --git a/libopie/ofileselector/ofileview.cpp b/libopie/ofileselector/ofileview.cpp index 38f722c..72d2f60 100644 --- a/libopie/ofileselector/ofileview.cpp +++ b/libopie/ofileselector/ofileview.cpp | |||
@@ -12,20 +12,14 @@ OFileView::OFileView( OFileSelector* sel) | |||
12 | } | 12 | } |
13 | OFileView::~OFileView() { | 13 | OFileView::~OFileView() { |
14 | } | 14 | } |
15 | void OFileView::fileSelected( const QString& s ) { | 15 | void OFileView::fileSelected( const QString& dir,const QString& file,const QString& extra ) { |
16 | m_sel->internFileSelected( s ); | 16 | m_sel->currentLister()->fileSelected( dir,file,extra ); |
17 | } | ||
18 | void OFileView::fileSelected( const DocLnk& s) { | ||
19 | m_sel->internFileSelected( s ); | ||
20 | } | 17 | } |
21 | void OFileView::contextMenu() { | 18 | void OFileView::contextMenu() { |
22 | m_sel->internContextMenu(); | 19 | m_sel->internContextMenu(); |
23 | } | 20 | } |
24 | void OFileView::changedDir( const QString& s) { | 21 | void OFileView::changedDir( const QString& s, const QString& file, const QString& extra) { |
25 | m_sel->internChangedDir( s ); | 22 | m_sel->currentLister()->changedDir( s, file,extra ); |
26 | } | ||
27 | void OFileView::changedDir( const QDir& d ) { | ||
28 | m_sel->internChangedDir( d ); | ||
29 | } | 23 | } |
30 | OFileSelector* OFileView::selector() const { | 24 | OFileSelector* OFileView::selector() const { |
31 | return m_sel; | 25 | return m_sel; |
diff --git a/libopie/ofileselector/ofileview.h b/libopie/ofileselector/ofileview.h index d7ea4a2..808587f 100644 --- a/libopie/ofileselector/ofileview.h +++ b/libopie/ofileselector/ofileview.h | |||
@@ -56,29 +56,37 @@ public: | |||
56 | virtual void addFile(const QPixmap&, | 56 | virtual void addFile(const QPixmap&, |
57 | const QString &mine, | 57 | const QString &mine, |
58 | QFileInfo *info, | 58 | QFileInfo *info, |
59 | const QString& extra = QString::null, | ||
59 | bool isSymlink = FALSE ) = 0; | 60 | bool isSymlink = FALSE ) = 0; |
60 | 61 | ||
61 | virtual void addFile(const QPixmap&, | 62 | virtual void addFile(const QPixmap&, |
62 | const QString& mine, const QString& dir, | 63 | const QString& mine, const QString& dir, |
63 | const QString& file, bool = FALSE ) = 0; | 64 | const QString& file, |
65 | const QString& extra = QString::null, | ||
66 | bool = FALSE ) = 0; | ||
64 | 67 | ||
65 | virtual void addDir (const QPixmap&, | 68 | virtual void addDir (const QPixmap&, |
66 | const QString &mine, | 69 | const QString &mine, |
67 | QFileInfo *info, | 70 | QFileInfo *info, |
71 | const QString& extra = QString::null, | ||
68 | bool isSymlink = FALSE ) = 0; | 72 | bool isSymlink = FALSE ) = 0; |
69 | virtual void addDir (const QPixmap&, | 73 | virtual void addDir (const QPixmap&, |
70 | const QString& mine, const QString& dir, | 74 | const QString& mine, const QString& dir, |
71 | const QString& file, bool = FALSE) = 0; | 75 | const QString& file, |
76 | const QString& extra = QString::null, | ||
77 | bool = FALSE) = 0; | ||
72 | 78 | ||
73 | virtual void addSymlink(const QPixmap&, | 79 | virtual void addSymlink(const QPixmap&, |
74 | const QString &mime, | 80 | const QString &mime, |
75 | QFileInfo *info, | 81 | QFileInfo *info, |
82 | const QString& extra = QString::null, | ||
76 | bool isSymlink = FALSE ) = 0; | 83 | bool isSymlink = FALSE ) = 0; |
77 | 84 | ||
78 | virtual void addSymlink(const QPixmap&, | 85 | virtual void addSymlink(const QPixmap&, |
79 | const QString& mine, | 86 | const QString& mine, |
80 | const QString& path, | 87 | const QString& path, |
81 | const QString& file, | 88 | const QString& file, |
89 | const QString& extra = QString::null, | ||
82 | bool isSymlink = FALSE ) = 0; | 90 | bool isSymlink = FALSE ) = 0; |
83 | 91 | ||
84 | virtual void cd(const QString &path ) = 0; | 92 | virtual void cd(const QString &path ) = 0; |
@@ -94,11 +102,22 @@ public: | |||
94 | /*signals:*/ | 102 | /*signals:*/ |
95 | protected: | 103 | protected: |
96 | 104 | ||
97 | void fileSelected(const QString &); | 105 | /** |
98 | void fileSelected(const DocLnk & ); | 106 | * @param dir The dir name |
99 | void contextMenu(); | 107 | * @param file The file name |
100 | void changedDir(const QString &); | 108 | * @param extra The extra information |
101 | void changedDir(const QDir & ); | 109 | */ |
110 | void fileSelected(const QString &dir, const QString& file, const QString& extra = QString::nulll); | ||
111 | void contextMenu(); | ||
112 | |||
113 | /** | ||
114 | * | ||
115 | * @param dir The dir name | ||
116 | * @param file The file name | ||
117 | * @param extra The extra informations | ||
118 | */ | ||
119 | void changedDir(const QString &dir, const QString& file, const QString& extra = QString::null); | ||
120 | void changedDir(const QDir & ); | ||
102 | 121 | ||
103 | /* updates the file name line of the FileSelector */ | 122 | /* updates the file name line of the FileSelector */ |
104 | void updateLine( const QString& ); | 123 | void updateLine( const QString& ); |
diff --git a/libopie/ofileselector/olister.cpp b/libopie/ofileselector/olister.cpp index b6b03cd..378c69d 100644 --- a/libopie/ofileselector/olister.cpp +++ b/libopie/ofileselector/olister.cpp | |||
@@ -1,3 +1,5 @@ | |||
1 | #include <qcombobox.h> | ||
2 | |||
1 | #include "olister.h" | 3 | #include "olister.h" |
2 | #include "ofileview.h" | 4 | #include "ofileview.h" |
3 | #include "opixmapprovider.h" | 5 | #include "opixmapprovider.h" |
@@ -5,7 +7,7 @@ | |||
5 | 7 | ||
6 | 8 | ||
7 | OLister::OLister( OFileSelector* view) | 9 | OLister::OLister( OFileSelector* view) |
8 | : m_view( view ) | 10 | : m_view( view ), m_acc( 0l ) |
9 | { | 11 | { |
10 | m_prov = new OPixmapProvider( view ); | 12 | m_prov = new OPixmapProvider( view ); |
11 | } | 13 | } |
@@ -24,6 +26,7 @@ bool OLister::showDirs()const { | |||
24 | } | 26 | } |
25 | void OLister::addFile( const QString& mine, | 27 | void OLister::addFile( const QString& mine, |
26 | QFileInfo* info, | 28 | QFileInfo* info, |
29 | const QString& extra, | ||
27 | bool isSymlink ) { | 30 | bool isSymlink ) { |
28 | int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : | 31 | int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : |
29 | OPixmapProvider::File; | 32 | OPixmapProvider::File; |
@@ -32,11 +35,13 @@ void OLister::addFile( const QString& mine, | |||
32 | view()->currentView()->addFile( pix, | 35 | view()->currentView()->addFile( pix, |
33 | mine, | 36 | mine, |
34 | info, | 37 | info, |
38 | extra, | ||
35 | isSymlink ); | 39 | isSymlink ); |
36 | } | 40 | } |
37 | void OLister::addFile( const QString& mine, | 41 | void OLister::addFile( const QString& mine, |
38 | const QString& path, | 42 | const QString& path, |
39 | const QString& file, | 43 | const QString& file, |
44 | const QString& extra, | ||
40 | bool isSymlink ) { | 45 | bool isSymlink ) { |
41 | int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : | 46 | int t = isSymlink ? OPixmapProvider::File | OPixmapProvider::Symlink : |
42 | OPixmapProvider::File; | 47 | OPixmapProvider::File; |
@@ -46,10 +51,12 @@ void OLister::addFile( const QString& mine, | |||
46 | mine, | 51 | mine, |
47 | path, | 52 | path, |
48 | file, | 53 | file, |
54 | extra, | ||
49 | isSymlink ); | 55 | isSymlink ); |
50 | } | 56 | } |
51 | void OLister::addDir( const QString& mine, | 57 | void OLister::addDir( const QString& mine, |
52 | QFileInfo* info, | 58 | QFileInfo* info, |
59 | const QString& extra, | ||
53 | bool isSymlink ) { | 60 | bool isSymlink ) { |
54 | int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : | 61 | int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : |
55 | OPixmapProvider::Dir; | 62 | OPixmapProvider::Dir; |
@@ -57,11 +64,13 @@ void OLister::addDir( const QString& mine, | |||
57 | view()->currentView()->addDir( pix, | 64 | view()->currentView()->addDir( pix, |
58 | mine, | 65 | mine, |
59 | info, | 66 | info, |
67 | extra, | ||
60 | isSymlink ); | 68 | isSymlink ); |
61 | } | 69 | } |
62 | void OLister::addDir( const QString& mine, | 70 | void OLister::addDir( const QString& mine, |
63 | const QString& path, | 71 | const QString& path, |
64 | const QString& dir, | 72 | const QString& dir, |
73 | const QString& extra, | ||
65 | bool isSymlink ) { | 74 | bool isSymlink ) { |
66 | 75 | ||
67 | int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : | 76 | int t = isSymlink ? OPixmapProvider::Dir | OPixmapProvider::Symlink : |
@@ -72,20 +81,24 @@ void OLister::addDir( const QString& mine, | |||
72 | mine, | 81 | mine, |
73 | path, | 82 | path, |
74 | dir, | 83 | dir, |
84 | extra, | ||
75 | isSymlink ); | 85 | isSymlink ); |
76 | } | 86 | } |
77 | void OLister::addSymlink( const QString& mine, | 87 | void OLister::addSymlink( const QString& mine, |
78 | QFileInfo* info, | 88 | QFileInfo* info, |
89 | const QString& extra, | ||
79 | bool isSymlink ) { | 90 | bool isSymlink ) { |
80 | QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, info ); | 91 | QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, info ); |
81 | view()->currentView()->addSymlink( pix, | 92 | view()->currentView()->addSymlink( pix, |
82 | mine, | 93 | mine, |
83 | info, | 94 | info, |
95 | extra, | ||
84 | isSymlink ); | 96 | isSymlink ); |
85 | } | 97 | } |
86 | void OLister::addSymlink( const QString& mine, | 98 | void OLister::addSymlink( const QString& mine, |
87 | const QString& path, | 99 | const QString& path, |
88 | const QString& name, | 100 | const QString& name, |
101 | const QString& extra, | ||
89 | bool isSymlink ) { | 102 | bool isSymlink ) { |
90 | QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, | 103 | QPixmap pix = provider()->pixmap( OPixmapProvider::Symlink, mine, |
91 | path, name ); | 104 | path, name ); |
@@ -93,6 +106,7 @@ void OLister::addSymlink( const QString& mine, | |||
93 | mine, | 106 | mine, |
94 | path, | 107 | path, |
95 | name, | 108 | name, |
109 | extra, | ||
96 | isSymlink ); | 110 | isSymlink ); |
97 | } | 111 | } |
98 | OFileSelector* OLister::view() { | 112 | OFileSelector* OLister::view() { |
@@ -104,3 +118,45 @@ OPixmapProvider* OLister::provider() { | |||
104 | bool OLister::compliesMime( const QString& mime ) { | 118 | bool OLister::compliesMime( const QString& mime ) { |
105 | return view()->compliesMime( mime ); | 119 | return view()->compliesMime( mime ); |
106 | } | 120 | } |
121 | OListerCmbAccess* OLister::comboBox() { | ||
122 | if (!m_acc ) | ||
123 | m_acc = new OListerCmbAccess( view()->m_location ); | ||
124 | |||
125 | return m_acc; | ||
126 | } | ||
127 | |||
128 | |||
129 | OListerCmbAccess::OListerCmbAccess(QComboBox* box ) | ||
130 | : m_cmb( cmb ) | ||
131 | {} | ||
132 | OListerCmbAccess::~OListerCmbAccess() { | ||
133 | } | ||
134 | void OListerCmbAccess::clear() { | ||
135 | if ( m_cmb ) | ||
136 | m_cmb->clear(); | ||
137 | } | ||
138 | void OListerCmbAccess::setCurrentItem( const QString& add, bool FORCE_ADD) { | ||
139 | if ( !m_cmb ) return; | ||
140 | |||
141 | |||
142 | int c = m_cmb->count(); | ||
143 | for ( int i = 0; i < m_cmb->count(); i++ ) { | ||
144 | if ( m_cmb->text(i) == add ) { | ||
145 | bo->setCurrentItem( i ); | ||
146 | return; | ||
147 | } | ||
148 | } | ||
149 | m_cmb->insertItem(add ); | ||
150 | m_cmb->setCurrentItem( c ); | ||
151 | } | ||
152 | void OListerCmbAccess::insert( const QString& str ) { | ||
153 | if ( m_cmb ) | ||
154 | m_cmb->insertItem( str ); | ||
155 | } | ||
156 | QString OListerCmbAccess::currentText()const { | ||
157 | QString str; | ||
158 | if (m_cmb ) | ||
159 | str = m_cmb->currentText(); | ||
160 | |||
161 | return str; | ||
162 | } | ||
diff --git a/libopie/ofileselector/olister.h b/libopie/ofileselector/olister.h index 0885525..79d5409 100644 --- a/libopie/ofileselector/olister.h +++ b/libopie/ofileselector/olister.h | |||
@@ -6,8 +6,11 @@ | |||
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qstringlist.h> | 7 | #include <qstringlist.h> |
8 | 8 | ||
9 | class QComboBox; | ||
9 | class OPixmapProvider; | 10 | class OPixmapProvider; |
10 | class OFileSelector; | 11 | class OFileSelector; |
12 | |||
13 | class OListerCmbAccess; | ||
11 | /** | 14 | /** |
12 | * lister is something like KIO but very | 15 | * lister is something like KIO but very |
13 | * very basic and currently only for | 16 | * very basic and currently only for |
@@ -15,6 +18,7 @@ class OFileSelector; | |||
15 | * This is a base class which needs to be implemented. | 18 | * This is a base class which needs to be implemented. |
16 | * @see OLocalLister for a filesystem based implementation | 19 | * @see OLocalLister for a filesystem based implementation |
17 | */ | 20 | */ |
21 | |||
18 | class OLister { | 22 | class OLister { |
19 | public: | 23 | public: |
20 | OLister( OFileSelector* ); | 24 | OLister( OFileSelector* ); |
@@ -27,16 +31,32 @@ public: | |||
27 | virtual QMap<QString, QStringList> mimeTypes( const QString& dir ) = 0; | 31 | virtual QMap<QString, QStringList> mimeTypes( const QString& dir ) = 0; |
28 | void setPixmapProvider( OPixmapProvider* ); | 32 | void setPixmapProvider( OPixmapProvider* ); |
29 | 33 | ||
34 | |||
35 | /* some way a slot */ | ||
36 | void fileSelected( const QString& dir, const QString& file, const QString& extra ) = 0; | ||
37 | void changeDir( const QString& dir, const QString& file, const QString& extra ) = 0; | ||
30 | protected: | 38 | protected: |
39 | /** | ||
40 | * I hate too big classes | ||
41 | * this is a way to group | ||
42 | * access to a ComboBox | ||
43 | * which might exist or | ||
44 | * not in a secure way | ||
45 | */ | ||
46 | OListerCmbAccess* comboBox(); | ||
47 | |||
31 | bool showFiles()const; | 48 | bool showFiles()const; |
32 | bool showDirs()const; | 49 | bool showDirs()const; |
33 | bool compliesMime( const QString& mime ); | 50 | bool compliesMime( const QString& mime ); |
34 | void addFile( const QString& mine, | 51 | void addFile( const QString& mine, |
35 | QFileInfo*, | 52 | QFileInfo*, |
53 | const QString& extra = QString::null, | ||
36 | bool isSymlink = FALSE ); | 54 | bool isSymlink = FALSE ); |
55 | |||
37 | void addFile( const QString& mine, | 56 | void addFile( const QString& mine, |
38 | const QString& path, | 57 | const QString& path, |
39 | const QString& file, | 58 | const QString& file, |
59 | const QString& extra = QString::null, | ||
40 | bool isSymlink = FALSE ); | 60 | bool isSymlink = FALSE ); |
41 | void addDir( const QString& mine, | 61 | void addDir( const QString& mine, |
42 | QFileInfo*, | 62 | QFileInfo*, |
@@ -44,20 +64,61 @@ protected: | |||
44 | void addDir( const QString& mine, | 64 | void addDir( const QString& mine, |
45 | const QString& path, | 65 | const QString& path, |
46 | const QString& dir, | 66 | const QString& dir, |
67 | const QString& extra = QString::null, | ||
47 | bool isSymlink = FALSE ); | 68 | bool isSymlink = FALSE ); |
48 | void addSymlink( const QString& mine, | 69 | void addSymlink( const QString& mine, |
49 | QFileInfo* info, | 70 | QFileInfo* info, |
71 | const QString& extra = QString::null, | ||
50 | bool isSymlink = FALSE); | 72 | bool isSymlink = FALSE); |
51 | void addSymlink( const QString& mine, | 73 | void addSymlink( const QString& mine, |
52 | const QString& path, | 74 | const QString& path, |
53 | const QString& name, | 75 | const QString& name, |
76 | const QString& extra = QString::null, | ||
54 | bool isSymlink = FALSE ); | 77 | bool isSymlink = FALSE ); |
55 | OFileSelector* view(); | 78 | OFileSelector* view(); |
56 | OPixmapProvider* provider(); | 79 | OPixmapProvider* provider(); |
57 | private: | 80 | private: |
58 | OFileSelector* m_view; | 81 | OFileSelector* m_view; |
59 | OPixmapProvider* m_prov; | 82 | OPixmapProvider* m_prov; |
83 | OListerCmbAccess* m_acc; | ||
84 | |||
85 | class Private; | ||
86 | Private *d; | ||
87 | }; | ||
88 | |||
89 | class OListerCmbAccess { | ||
90 | friend class OLister; | ||
91 | public: | ||
92 | OListerCmbAccess( QComboBox* = 0l); | ||
93 | ~OListerCmbAccess(); | ||
94 | |||
95 | /** | ||
96 | * clears the combobox | ||
97 | */ | ||
98 | void clear(); | ||
99 | |||
100 | /** | ||
101 | * set's @param add to be the current Item | ||
102 | * if the item is not present it'll be removed | ||
103 | */ | ||
104 | void setCurrentItem( const QString& add, bool FORECE_ADD = TRUE ); | ||
105 | |||
106 | /** | ||
107 | * inserts the the String at | ||
108 | * a non predictable position... The position is determined | ||
109 | * by the QComboBox code | ||
110 | */ | ||
111 | void insert( const QString& ); | ||
112 | |||
113 | /** | ||
114 | * | ||
115 | */ | ||
116 | QString currentText()const; | ||
60 | 117 | ||
118 | private: | ||
119 | class Private; | ||
120 | Private* d; | ||
121 | QComboBox* m_cmb; | ||
61 | 122 | ||
62 | }; | 123 | }; |
63 | 124 | ||
diff --git a/libopie/ofileselector/olocallister.cpp b/libopie/ofileselector/olocallister.cpp index 6ffcf1e..2306b14 100644 --- a/libopie/ofileselector/olocallister.cpp +++ b/libopie/ofileselector/olocallister.cpp | |||
@@ -43,7 +43,8 @@ QMap<QString, QStringList> OLocalLister::mimeTypes( const QString& curDir ) { | |||
43 | 43 | ||
44 | return mimes; | 44 | return mimes; |
45 | } | 45 | } |
46 | /* FIXME mimecheck | 46 | /** |
47 | * FIXME mimecheck | ||
47 | * use mime check for that | 48 | * use mime check for that |
48 | * filter dirs | 49 | * filter dirs |
49 | * filter filters | 50 | * filter filters |