-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 85 | ||||
-rw-r--r-- | libopie/ofileselector/ofilelistview.h | 7 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 283 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.h | 39 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.cpp | 7 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.h | 2 |
6 files changed, 153 insertions, 270 deletions
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp index 7108a5b..bb15764 100644 --- a/libopie/ofileselector/ofilelistview.cpp +++ b/libopie/ofileselector/ofilelistview.cpp | |||
@@ -1,125 +1,208 @@ | |||
1 | 1 | ||
2 | #include <qheader.h> | ||
3 | |||
2 | #include <qpe/mimetype.h> | 4 | #include <qpe/mimetype.h> |
3 | #include <qpe/resource.h> | 5 | #include <qpe/resource.h> |
6 | #include <qpe/qpeapplication.h> | ||
4 | 7 | ||
5 | #include "ofileselector.h" | 8 | #include "ofileselector.h" |
6 | #include "ofileselectoritem.h" | 9 | #include "ofileselectoritem.h" |
7 | #include "ofilelistview.h" | 10 | #include "ofilelistview.h" |
8 | 11 | ||
9 | 12 | ||
10 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) | 13 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) |
11 | : QListView( parent ), OFileView( sel ) | 14 | : QListView( parent ), OFileView( sel ) |
12 | { | 15 | { |
13 | 16 | QPEApplication::setStylusOperation( viewport(), | |
17 | QPEApplication::RightOnHold); | ||
18 | addColumn(" " ); | ||
19 | addColumn(tr("Name"), 135 ); | ||
20 | addColumn(tr("Size"), -1 ); | ||
21 | addColumn(tr("Date"), 60 ); | ||
22 | addColumn(tr("Mime Type"), -1 ); | ||
23 | QHeader *head = header(); | ||
24 | head->hide(); | ||
25 | setSorting( 1 ); | ||
26 | setAllColumnsShowFocus( TRUE ); | ||
27 | |||
28 | connect(this, SIGNAL(selectionChanged() ), | ||
29 | this, SLOT(slotSelectionChanged() ) ); | ||
30 | |||
31 | connect(this, SIGNAL(currentChanged(QListViewItem *) ), | ||
32 | this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); | ||
33 | |||
34 | connect(this, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), | ||
35 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); | ||
36 | |||
37 | connect(this, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), | ||
38 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); | ||
14 | } | 39 | } |
15 | OFileListView::~OFileListView() { | 40 | OFileListView::~OFileListView() { |
16 | 41 | ||
17 | } | 42 | } |
18 | void OFileListView::clear() { | 43 | void OFileListView::clear() { |
19 | QListView::clear(); | 44 | QListView::clear(); |
20 | } | 45 | } |
21 | void OFileListView::addFile( const QString&, | 46 | void OFileListView::addFile( const QString&, |
22 | QFileInfo* info, | 47 | QFileInfo* info, |
23 | bool isSymlink ) { | 48 | bool isSymlink ) { |
24 | MimeType type( info->absFilePath() ); | 49 | MimeType type( info->absFilePath() ); |
25 | QPixmap pix = type.pixmap(); | 50 | QPixmap pix = type.pixmap(); |
26 | QString dir; | 51 | QString dir; |
27 | QString name; | 52 | QString name; |
28 | bool locked = false; | 53 | bool locked = false; |
29 | 54 | ||
30 | if( pix.isNull() ) | 55 | if( pix.isNull() ) |
31 | pix = Resource::loadPixmap( "UnknownDocument-14"); | 56 | pix = Resource::loadPixmap( "UnknownDocument-14"); |
32 | 57 | ||
33 | dir = info->dirPath( true ); | 58 | dir = info->dirPath( true ); |
34 | 59 | ||
35 | if( isSymlink ) | 60 | if( isSymlink ) |
36 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); | 61 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); |
37 | else { | 62 | else { |
38 | name = info->fileName(); | 63 | name = info->fileName(); |
39 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || | 64 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || |
40 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ | 65 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ |
41 | 66 | ||
42 | locked = true; pix = Resource::loadPixmap("locked"); | 67 | locked = true; pix = Resource::loadPixmap("locked"); |
43 | } | 68 | } |
44 | } | 69 | } |
45 | new OFileSelectorItem( this, pix, name, | 70 | new OFileSelectorItem( this, pix, name, |
46 | info->lastModified().toString(), | 71 | info->lastModified().toString(), |
47 | QString::number( info->size() ), | 72 | QString::number( info->size() ), |
48 | dir, locked ); | 73 | dir, locked ); |
49 | } | 74 | } |
50 | void OFileListView::addFile( const QString& /*mime*/, const QString& /*dir*/, | 75 | void OFileListView::addFile( const QString& /*mime*/, const QString& /*dir*/, |
51 | const QString& /*file*/, bool /*isSyml*/ ) { | 76 | const QString& /*file*/, bool /*isSyml*/ ) { |
52 | 77 | ||
53 | } | 78 | } |
54 | void OFileListView::addDir( const QString&, | 79 | void OFileListView::addDir( const QString&, |
55 | QFileInfo* info, bool symlink ) { | 80 | QFileInfo* info, bool symlink ) { |
56 | 81 | ||
57 | bool locked = false; | 82 | bool locked = false; |
58 | QString name; | 83 | QString name; |
59 | QPixmap pix; | 84 | QPixmap pix; |
60 | 85 | ||
61 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || | 86 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || |
62 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ | 87 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ |
63 | 88 | ||
64 | locked = true; | 89 | locked = true; |
65 | 90 | ||
66 | if( symlink ) | 91 | if( symlink ) |
67 | pix = selector()->pixmap("symlinkedlocked"); | 92 | pix = selector()->pixmap("symlinkedlocked"); |
68 | else | 93 | else |
69 | pix = Resource::loadPixmap("lockedfolder"); | 94 | pix = Resource::loadPixmap("lockedfolder"); |
70 | 95 | ||
71 | }else { // readable | 96 | }else { // readable |
72 | pix = symlink ? selector()->pixmap("dirsymlink") : Resource::loadPixmap("folder") ; | 97 | pix = symlink ? selector()->pixmap("dirsymlink") : Resource::loadPixmap("folder") ; |
73 | } | 98 | } |
74 | 99 | ||
75 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; | 100 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; |
76 | 101 | ||
77 | new OFileSelectorItem( this, pix, name, | 102 | new OFileSelectorItem( this, pix, name, |
78 | info->lastModified().toString(), | 103 | info->lastModified().toString(), |
79 | QString::number( info->size() ), | 104 | QString::number( info->size() ), |
80 | info->dirPath( true ), locked, | 105 | info->dirPath( true ), locked, |
81 | true ); | 106 | true ); |
82 | 107 | ||
83 | } | 108 | } |
84 | void OFileListView::addDir( const QString& /*mime*/, const QString& /*dir*/, | 109 | void OFileListView::addDir( const QString& /*mime*/, const QString& /*dir*/, |
85 | const QString& /*file*/, bool ) { | 110 | const QString& /*file*/, bool ) { |
86 | 111 | ||
87 | } | 112 | } |
88 | void OFileListView::addSymlink( const QString& /*mime*/, | 113 | void OFileListView::addSymlink( const QString& /*mime*/, |
89 | QFileInfo* /*info*/, | 114 | QFileInfo* /*info*/, |
90 | bool /*isSym*/ ) { | 115 | bool /*isSym*/ ) { |
91 | 116 | ||
92 | } | 117 | } |
93 | void OFileListView::addSymlink( const QString& /*mime*/, const QString& /*path*/, | 118 | void OFileListView::addSymlink( const QString& /*mime*/, const QString& /*path*/, |
94 | const QString& /*file*/, bool /*isSym*/ ) { | 119 | const QString& /*file*/, bool /*isSym*/ ) { |
95 | 120 | ||
96 | } | 121 | } |
97 | void OFileListView::cd( const QString& ) { | 122 | void OFileListView::cd( const QString& ) { |
98 | 123 | ||
99 | } | 124 | } |
100 | QWidget* OFileListView::widget() { | 125 | QWidget* OFileListView::widget() { |
101 | return this; | 126 | return this; |
102 | } | 127 | } |
103 | QString OFileListView::selectedName()const{ | 128 | QString OFileListView::selectedName()const{ |
104 | QListViewItem *item = currentItem(); | 129 | QListViewItem *item = currentItem(); |
105 | if (!item ) | 130 | if (!item ) |
106 | return QString::null; | 131 | return QString::null; |
107 | 132 | ||
108 | return item->text( 1 ); | 133 | return item->text( 1 ); |
109 | } | 134 | } |
110 | QStringList OFileListView::selectedNames()const { | 135 | QStringList OFileListView::selectedNames()const { |
111 | QStringList list; | 136 | QStringList list; |
112 | list << selectedName(); | 137 | list << selectedName(); |
113 | return list; | 138 | return list; |
114 | } | 139 | } |
115 | QString OFileListView::selectedPath()const { | 140 | QString OFileListView::selectedPath()const { |
116 | return QString::null; | 141 | return QString::null; |
117 | } | 142 | } |
118 | QStringList OFileListView::selectedPaths()const { | 143 | QStringList OFileListView::selectedPaths()const { |
119 | QStringList list; | 144 | QStringList list; |
120 | list << selectedPath(); | 145 | list << selectedPath(); |
121 | return list; | 146 | return list; |
122 | } | 147 | } |
123 | int OFileListView::fileCount() { | 148 | int OFileListView::fileCount() { |
124 | return childCount(); | 149 | return childCount(); |
125 | } | 150 | } |
151 | void OFileListView::sort() { | ||
152 | QListView::sort(); | ||
153 | } | ||
154 | void OFileListView::slotSelectionChanged() { | ||
155 | |||
156 | } | ||
157 | void OFileListView::slotCurrentChanged( QListViewItem* item) { | ||
158 | if (!item ) | ||
159 | return; | ||
160 | |||
161 | OFileSelectorItem* sel = (OFileSelectorItem*) item; | ||
162 | |||
163 | qWarning("current changed"); | ||
164 | if(!sel->isDir() ){ | ||
165 | updateLine( sel->text(1) ); | ||
166 | |||
167 | if (selector()->mode() == OFileSelector::Fileselector ) { | ||
168 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
169 | QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); | ||
170 | DocLnk lnk( path ); | ||
171 | fileSelected(lnk ); | ||
172 | fileSelected( path ); | ||
173 | } | ||
174 | } | ||
175 | } | ||
176 | void OFileListView::slotClicked( int button, QListViewItem* item, | ||
177 | const QPoint&, int ) { | ||
178 | if ( !item ) | ||
179 | return; | ||
180 | |||
181 | if( button != Qt::LeftButton ) | ||
182 | return; | ||
183 | |||
184 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | ||
185 | |||
186 | if(!sel->isLocked() ){ | ||
187 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
188 | if( sel->isDir() ){ | ||
189 | changedDir( sel->directory() + "/" + str[0].stripWhiteSpace() ); | ||
190 | }else{ | ||
191 | updateLine( str[0].stripWhiteSpace() ); | ||
192 | QString path = sel->directory(); | ||
193 | path += "/"; | ||
194 | path += str[0].stripWhiteSpace(); | ||
195 | |||
196 | DocLnk lnk( path ); | ||
197 | fileSelected( path ); | ||
198 | fileSelected( lnk ); | ||
199 | } | ||
200 | } | ||
201 | } | ||
202 | void OFileListView::slotRightButton( int button, QListViewItem* item, | ||
203 | const QPoint&, int ) { | ||
204 | if (!item || (button != Qt::RightButton )) | ||
205 | return; | ||
206 | |||
207 | /* raise contextmenu */ | ||
208 | } | ||
diff --git a/libopie/ofileselector/ofilelistview.h b/libopie/ofileselector/ofilelistview.h index c7e9223..a83d70d 100644 --- a/libopie/ofileselector/ofilelistview.h +++ b/libopie/ofileselector/ofilelistview.h | |||
@@ -1,45 +1,50 @@ | |||
1 | #ifndef OPIE_FILE_LIST_VIEW_H | 1 | #ifndef OPIE_FILE_LIST_VIEW_H |
2 | #define OPIE_FILE_LIST_VIEW_H | 2 | #define OPIE_FILE_LIST_VIEW_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | 5 | ||
6 | #include "ofileview.h" | 6 | #include "ofileview.h" |
7 | 7 | ||
8 | class OFileListView : public QListView, public OFileView { | 8 | class OFileListView : public QListView, public OFileView { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | public: | 10 | public: |
11 | OFileListView( QWidget* parent, OFileSelector* ); | 11 | OFileListView( QWidget* parent, OFileSelector* ); |
12 | ~OFileListView(); | 12 | ~OFileListView(); |
13 | 13 | ||
14 | void clear(); | 14 | void clear(); |
15 | void addFile( const QString& mine, | 15 | void addFile( const QString& mine, |
16 | QFileInfo* info, | 16 | QFileInfo* info, |
17 | bool isSymlink = FALSE ); | 17 | bool isSymlink = FALSE ); |
18 | 18 | ||
19 | void addFile( const QString& mime, | 19 | void addFile( const QString& mime, |
20 | const QString& dir, | 20 | const QString& dir, |
21 | const QString& file, | 21 | const QString& file, |
22 | bool = false ); | 22 | bool = false ); |
23 | 23 | ||
24 | void addDir( const QString& mime, | 24 | void addDir( const QString& mime, |
25 | QFileInfo* info, bool = FALSE ); | 25 | QFileInfo* info, bool = FALSE ); |
26 | void addDir( const QString& mime, const QString& dir, | 26 | void addDir( const QString& mime, const QString& dir, |
27 | const QString& file, bool = FALSE ); | 27 | const QString& file, bool = FALSE ); |
28 | 28 | ||
29 | void addSymlink( const QString& mime, | 29 | void addSymlink( const QString& mime, |
30 | QFileInfo* info, bool = FALSE ); | 30 | QFileInfo* info, bool = FALSE ); |
31 | void addSymlink( const QString& mine, const QString& path, | 31 | void addSymlink( const QString& mine, const QString& path, |
32 | const QString& file, bool isSymlink = FALSE ); | 32 | const QString& file, bool isSymlink = FALSE ); |
33 | void cd( const QString& path ); | 33 | void cd( const QString& path ); |
34 | QWidget* widget(); | 34 | QWidget* widget(); |
35 | void sort(); | ||
35 | 36 | ||
36 | QString selectedName()const ; | 37 | QString selectedName()const ; |
37 | QStringList selectedNames()const; | 38 | QStringList selectedNames()const; |
38 | 39 | ||
39 | QString selectedPath()const; | 40 | QString selectedPath()const; |
40 | QStringList selectedPaths()const; | 41 | QStringList selectedPaths()const; |
41 | int fileCount(); | 42 | int fileCount(); |
42 | 43 | private slots: | |
44 | void slotSelectionChanged(); | ||
45 | void slotCurrentChanged(QListViewItem* ); | ||
46 | void slotClicked( int, QListViewItem*, const QPoint&, int ); | ||
47 | void slotRightButton(int, QListViewItem*, const QPoint&, int ); | ||
43 | }; | 48 | }; |
44 | 49 | ||
45 | #endif | 50 | #endif |
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index 16ee3ee..98b61f7 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp | |||
@@ -1,1262 +1,1051 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #include <qcheckbox.h> | 3 | #include <qcheckbox.h> |
4 | #include <qcombobox.h> | 4 | #include <qcombobox.h> |
5 | #include <qheader.h> | 5 | #include <qheader.h> |
6 | #include <qlabel.h> | 6 | #include <qlabel.h> |
7 | #include <qabstractlayout.h> | 7 | #include <qabstractlayout.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qlistview.h> | 10 | #include <qlistview.h> |
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | #include <qpainter.h> | 12 | #include <qpainter.h> |
13 | #include <qpushbutton.h> | 13 | #include <qpushbutton.h> |
14 | #include <qwidgetstack.h> | 14 | #include <qwidgetstack.h> |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include <qfile.h> | 17 | #include <qfile.h> |
18 | #include <qfileinfo.h> | 18 | #include <qfileinfo.h> |
19 | #include <qtimer.h> | 19 | #include <qtimer.h> |
20 | 20 | ||
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/mimetype.h> | 24 | #include <qpe/mimetype.h> |
25 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
26 | #include <qpe/storage.h> | 26 | #include <qpe/storage.h> |
27 | 27 | ||
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | #include <sys/stat.h> | 30 | #include <sys/stat.h> |
31 | 31 | ||
32 | #include "ofileview.h" | 32 | #include "ofileview.h" |
33 | #include "ofileselector.h" | 33 | #include "ofileselector.h" |
34 | 34 | #include "olister.h" | |
35 | 35 | ||
36 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; | 36 | QMap<QString,QPixmap> *OFileSelector::m_pixmaps = 0; |
37 | 37 | ||
38 | namespace { | 38 | namespace { |
39 | int indexByString( const QComboBox *box, const QString &str ){ | 39 | /* let's find the index for a specified string */ |
40 | int index= 0; | 40 | int indexByString( const QComboBox *box, const QString &str ){ |
41 | for(int i= 0; i < box->count(); i++ ){ | 41 | int index= 0; |
42 | if( str == box->text(i ) ){ | 42 | for(int i= 0; i < box->count(); i++ ){ |
43 | index= i; | 43 | /* found */ |
44 | break; | 44 | if( str == box->text(i ) ){ |
45 | } | 45 | index= i; |
46 | break; | ||
47 | } | ||
48 | } | ||
49 | return index; | ||
46 | } | 50 | } |
47 | return index; | ||
48 | } | ||
49 | |||
50 | } | 51 | } |
51 | 52 | ||
52 | OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, | 53 | OFileSelector::OFileSelector( QWidget *wid, int mode, int selector, |
53 | const QString &dirName, | 54 | const QString &dirName, |
54 | const QString &fileName, | 55 | const QString &fileName, |
55 | const QMap<QString,QStringList>& mimeTypes) | 56 | const QMap<QString,QStringList>& mimeTypes) |
56 | : QWidget( wid, "OFileSelector") | 57 | : QWidget( wid, "OFileSelector") |
57 | { | 58 | { |
58 | m_mimetypes = mimeTypes; | 59 | m_mimetypes = mimeTypes; |
59 | if (mode == Save ) | 60 | if (mode == Save ) |
60 | m_name = fileName; | 61 | m_name = fileName; |
62 | |||
61 | initVars(); | 63 | initVars(); |
64 | |||
62 | m_mode = mode; | 65 | m_mode = mode; |
63 | m_selector = selector; | 66 | m_selector = selector; |
64 | m_currentDir = dirName; | 67 | m_currentDir = dirName; |
65 | init(); | 68 | init(); |
66 | //QTimer::singleShot(6*1000, this, SLOT( slotTest() ) ); | ||
67 | } | 69 | } |
68 | 70 | ||
69 | OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, | 71 | OFileSelector::OFileSelector(const QString &mimeFilter, QWidget *parent, |
70 | const char *name, bool newVisible, | 72 | const char *name, bool newVisible, |
71 | bool closeVisible ) | 73 | bool closeVisible ) |
72 | : QWidget( parent, name ) | 74 | : QWidget( parent, name ) |
73 | { | 75 | { |
76 | /* update the mimefilter */ | ||
74 | if (!mimeFilter.isEmpty() ) { | 77 | if (!mimeFilter.isEmpty() ) { |
75 | QStringList list = QStringList::split(";", mimeFilter ); | 78 | QStringList list = QStringList::split(";", mimeFilter ); |
76 | m_mimetypes.insert(mimeFilter, list ); | 79 | m_mimetypes.insert(mimeFilter, list ); |
77 | } | 80 | } |
78 | initVars(); | 81 | initVars(); |
79 | m_currentDir = QPEApplication::documentDir(); | 82 | m_currentDir = QPEApplication::documentDir(); |
80 | m_mode = Fileselector; | 83 | m_mode = Fileselector; |
81 | m_selector = Normal; | 84 | m_selector = Normal; |
82 | m_shClose = closeVisible; | 85 | m_shClose = closeVisible; |
83 | m_shNew = newVisible; | 86 | m_shNew = newVisible; |
84 | m_shLne = false; | 87 | m_shLne = false; |
85 | m_shPerm = false; | 88 | m_shPerm = false; |
86 | m_shYesNo = false; | 89 | m_shYesNo = false; |
87 | init(); | 90 | init(); |
88 | 91 | ||
89 | 92 | ||
90 | } | 93 | } |
91 | 94 | ||
92 | OFileSelector::~OFileSelector() | 95 | OFileSelector::~OFileSelector() |
93 | { | 96 | { |
94 | 97 | ||
95 | 98 | ||
96 | } | 99 | } |
97 | 100 | ||
98 | void OFileSelector::setNewVisible( bool visible ) | 101 | void OFileSelector::setNewVisible( bool visible ) |
99 | { | 102 | { |
100 | m_shNew = visible; | 103 | m_shNew = visible; |
101 | if( m_selector == Normal ){ | 104 | if( m_selector == Normal ){ |
102 | delete m_select; | 105 | delete m_select; |
103 | // we need to initialize but keep the selected mimetype | 106 | // we need to initialize but keep the selected mimetype |
104 | QString mime = currentMimeType(); | 107 | QString mime = currentMimeType(); |
105 | m_select = new FileSelector( mime , | 108 | m_select = new FileSelector( mime , |
106 | m_stack, "fileselector", | 109 | m_stack, "fileselector", |
107 | m_shNew, m_shClose); | 110 | m_shNew, m_shClose); |
108 | 111 | ||
109 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 112 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
110 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 113 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
111 | connect(m_select, SIGNAL(closeMe() ), | 114 | connect(m_select, SIGNAL(closeMe() ), |
112 | this, SIGNAL(closeMe() ) ); | 115 | this, SIGNAL(closeMe() ) ); |
113 | //connect to close me and other signals as well | 116 | //connect to close me and other signals as well |
114 | m_stack->addWidget( m_select, Normal ); | 117 | m_stack->addWidget( m_select, Normal ); |
115 | }else{ | 118 | }else{ |
116 | m_new->show(); | 119 | m_new->show(); |
117 | } | 120 | } |
118 | } | 121 | } |
119 | void OFileSelector::setCloseVisible( bool visible ) | 122 | void OFileSelector::setCloseVisible( bool visible ) |
120 | { | 123 | { |
121 | m_shClose = visible; | 124 | m_shClose = visible; |
122 | if( m_selector == Normal ){ | 125 | if( m_selector == Normal ){ |
123 | setNewVisible( m_shNew ); // yeah baby | 126 | setNewVisible( m_shNew ); // yeah baby |
124 | }else{ | 127 | }else{ |
125 | m_close->show(); | 128 | m_close->show(); |
126 | } | 129 | } |
127 | } | 130 | } |
128 | void OFileSelector::reread() | 131 | void OFileSelector::reread() |
129 | { | 132 | { |
130 | if( m_selector == Normal ){ | 133 | if( m_selector == Normal ){ |
131 | setNewVisible( m_shNew ); // make it a initializeSelector | 134 | setNewVisible( m_shNew ); // make it a initializeSelector |
132 | }else { | 135 | }else { |
133 | reparse(); | 136 | reparse(); |
134 | } | 137 | } |
135 | } | 138 | } |
136 | 139 | ||
137 | const DocLnk *OFileSelector::selected() | 140 | const DocLnk *OFileSelector::selected() |
138 | { | 141 | { |
139 | DocLnk *lnk = new DocLnk(selectedDocument() ); | 142 | DocLnk *lnk = new DocLnk(selectedDocument() ); |
140 | return lnk; | 143 | return lnk; |
141 | } | 144 | } |
142 | 145 | ||
143 | void OFileSelector::setYesCancelVisible( bool show ) | 146 | void OFileSelector::setYesCancelVisible( bool show ) |
144 | { | 147 | { |
145 | initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :( | 148 | initializeYes(); // FIXME if YesCancel is not shown we will initialize it to hide it :( |
146 | m_shYesNo = show; | 149 | m_shYesNo = show; |
147 | if( m_shYesNo ) | 150 | if( m_shYesNo ) |
148 | m_boxOk->show(); | 151 | m_boxOk->show(); |
149 | else | 152 | else |
150 | m_boxOk->hide(); | 153 | m_boxOk->hide(); |
151 | 154 | ||
152 | } | 155 | } |
153 | void OFileSelector::setToolbarVisible( bool show ) | 156 | void OFileSelector::setToolbarVisible( bool show ) |
154 | { | 157 | { |
155 | m_shTool = show; | 158 | m_shTool = show; |
156 | initializeListView(); // FIXME see above waste of memory | 159 | initializeListView(); // FIXME see above waste of memory |
160 | |||
157 | if(!m_shTool ){ | 161 | if(!m_shTool ){ |
158 | m_location->hide(); | 162 | m_location->hide(); |
159 | m_up->hide(); | 163 | m_up->hide(); |
160 | m_homeButton->hide(); | 164 | m_homeButton->hide(); |
161 | m_docButton->hide(); | 165 | m_docButton->hide(); |
162 | }else{ | 166 | }else{ |
163 | m_location->show(); | 167 | m_location->show(); |
164 | m_up->show(); | 168 | m_up->show(); |
165 | m_homeButton->show(); | 169 | m_homeButton->show(); |
166 | m_docButton->show(); | 170 | m_docButton->show(); |
167 | } | 171 | } |
168 | } | 172 | } |
169 | void OFileSelector::setPermissionBarVisible( bool show ) | 173 | void OFileSelector::setPermissionBarVisible( bool show ) |
170 | { | 174 | { |
171 | m_shPerm = show; | 175 | m_shPerm = show; |
172 | initializePerm(); | 176 | initializePerm(); |
173 | if( m_shPerm ) | 177 | if( m_shPerm ) |
174 | m_checkPerm->show(); | 178 | m_checkPerm->show(); |
175 | else | 179 | else |
176 | m_checkPerm->hide(); | 180 | m_checkPerm->hide(); |
177 | } | 181 | } |
178 | void OFileSelector::setLineEditVisible( bool show ) | 182 | void OFileSelector::setLineEditVisible( bool show ) |
179 | { | 183 | { |
180 | if( show ){ | 184 | if( show ){ |
181 | initializeName(); | 185 | initializeName(); |
182 | m_boxName->show(); | 186 | m_boxName->show(); |
183 | }else{ | 187 | }else{ |
184 | if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go | 188 | if( m_shLne && m_boxName != 0 ){ // check if we showed before this is the way to go |
185 | m_boxName->hide(); | 189 | m_boxName->hide(); |
186 | } | 190 | } |
187 | } | 191 | } |
188 | m_shLne = show; | 192 | m_shLne = show; |
189 | } | 193 | } |
190 | 194 | ||
191 | void OFileSelector::setChooserVisible( bool show ) | 195 | void OFileSelector::setChooserVisible( bool show ) |
192 | { | 196 | { |
193 | m_shChooser = show; | 197 | m_shChooser = show; |
194 | initializeChooser(); | 198 | initializeChooser(); |
195 | if( m_shChooser ){ | 199 | if( m_shChooser ){ |
196 | m_boxView->hide(); | 200 | m_boxView->hide(); |
197 | }else{ | 201 | }else{ |
198 | m_boxView->show(); | 202 | m_boxView->show(); |
199 | } | 203 | } |
200 | } | 204 | } |
201 | 205 | ||
202 | QCheckBox* OFileSelector::permissionCheckbox() | 206 | QCheckBox* OFileSelector::permissionCheckbox() |
203 | { | 207 | { |
204 | if( m_selector == Normal ) | 208 | if( m_selector == Normal ) |
205 | return 0l; | 209 | return 0l; |
206 | else | 210 | else |
207 | return m_checkPerm; | 211 | return m_checkPerm; |
208 | } | 212 | } |
209 | bool OFileSelector::setPermission()const | 213 | bool OFileSelector::setPermission()const |
210 | { | 214 | { |
211 | return m_checkPerm == 0 ? false : m_checkPerm->isChecked(); | 215 | return m_checkPerm == 0 ? false : m_checkPerm->isChecked(); |
212 | } | 216 | } |
213 | void OFileSelector::setPermissionChecked( bool check ) | 217 | void OFileSelector::setPermissionChecked( bool check ) |
214 | { | 218 | { |
215 | if( m_checkPerm ) | 219 | if( m_checkPerm ) |
216 | m_checkPerm->setChecked( check ); | 220 | m_checkPerm->setChecked( check ); |
217 | } | 221 | } |
218 | 222 | ||
219 | void OFileSelector::setMode(int mode) // FIXME do direct raising | 223 | void OFileSelector::setMode(int mode) // FIXME do direct raising |
220 | { | 224 | { |
221 | m_mode = mode; | 225 | m_mode = mode; |
222 | if( m_selector == Normal ) | 226 | if( m_selector == Normal ) |
223 | return; | 227 | return; |
224 | } | 228 | } |
225 | void OFileSelector::setShowDirs(bool ) | 229 | void OFileSelector::setShowDirs(bool ) |
226 | { | 230 | { |
227 | m_dir = true; | 231 | m_dir = true; |
228 | reparse(); | 232 | reparse(); |
229 | } | 233 | } |
230 | void OFileSelector::setCaseSensetive(bool caSe ) | 234 | void OFileSelector::setCaseSensetive(bool caSe ) |
231 | { | 235 | { |
232 | m_case = caSe; | 236 | m_case = caSe; |
233 | reparse(); | 237 | reparse(); |
234 | } | 238 | } |
235 | void OFileSelector::setShowFiles(bool show ) | 239 | void OFileSelector::setShowFiles(bool show ) |
236 | { | 240 | { |
237 | m_files = show; | 241 | m_files = show; |
238 | reparse(); | 242 | reparse(); |
239 | } | 243 | } |
240 | /// | 244 | /// |
241 | bool OFileSelector::cd(const QString &path ) | 245 | bool OFileSelector::cd(const QString &path ) |
242 | { | 246 | { |
243 | m_currentDir = path; | 247 | m_currentDir = path; |
244 | reparse(); | 248 | reparse(); |
245 | return true; | 249 | return true; |
246 | } | 250 | } |
247 | void OFileSelector::setSelector(int mode ) | 251 | void OFileSelector::setSelector(int mode ) |
248 | { | 252 | { |
249 | QString text; | 253 | QString text; |
250 | switch( mode ){ | 254 | switch( mode ){ |
251 | case Normal: | 255 | case Normal: |
252 | text = tr("Documents"); | 256 | text = tr("Documents"); |
253 | break; | 257 | break; |
254 | case Extended: | 258 | case Extended: |
255 | text = tr("Files"); | 259 | text = tr("Files"); |
256 | break; | 260 | break; |
257 | case ExtendedAll: | 261 | case ExtendedAll: |
258 | text = tr("All Files"); | 262 | text = tr("All Files"); |
259 | break; | 263 | break; |
260 | } | 264 | } |
261 | slotViewCheck( text ); | 265 | slotViewCheck( text ); |
262 | } | 266 | } |
263 | 267 | ||
264 | void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ ) | 268 | void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ ) |
265 | { | 269 | { |
266 | /* m_custom = popup; | 270 | /* m_custom = popup; |
267 | m_showPopup = true; | 271 | m_showPopup = true; |
268 | */ | 272 | */ |
269 | } | 273 | } |
270 | 274 | ||
271 | //void OFileSelector::updateL | 275 | //void OFileSelector::updateL |
272 | 276 | ||
273 | QString OFileSelector::selectedName() const | 277 | QString OFileSelector::selectedName() const |
274 | { | 278 | { |
275 | QString name; | 279 | QString name; |
276 | if( m_selector == Normal ){ | 280 | if( m_selector == Normal ){ |
277 | DocLnk lnk = m_select->selectedDocument(); | 281 | DocLnk lnk = m_select->selectedDocument(); |
278 | name = lnk.file(); | 282 | name = lnk.file(); |
279 | }else { | 283 | }else { |
280 | if ( m_shLne ) { | 284 | if ( m_shLne ) { |
281 | name = m_currentDir + "/" +m_edit->text(); | 285 | name = m_currentDir + "/" +m_edit->text(); |
282 | }else{ | 286 | }else{ |
283 | name = m_currentDir + "/" + currentView()->selectedName(); | 287 | name = m_currentDir + "/" + currentView()->selectedName(); |
284 | } | 288 | } |
285 | } | 289 | } |
286 | return name; | 290 | return name; |
287 | } | 291 | } |
288 | QStringList OFileSelector::selectedNames()const | 292 | QStringList OFileSelector::selectedNames()const |
289 | { | 293 | { |
290 | QStringList list; | 294 | QStringList list; |
291 | if( m_selector == Normal ){ | 295 | if( m_selector == Normal ){ |
292 | list << selectedName(); | 296 | list << selectedName(); |
293 | }else { | 297 | }else { |
294 | list << selectedName(); // FIXME implement multiple Selections | 298 | list << selectedName(); // FIXME implement multiple Selections |
295 | } | 299 | } |
296 | return list; | 300 | return list; |
297 | } | 301 | } |
298 | /** If mode is set to the Dir selection this will return the selected path. | 302 | /** If mode is set to the Dir selection this will return the selected path. |
299 | * | 303 | * |
300 | * | 304 | * |
301 | */ | 305 | */ |
302 | QString OFileSelector::selectedPath()const | 306 | QString OFileSelector::selectedPath()const |
303 | { | 307 | { |
304 | QString path; | 308 | QString path; |
305 | if( m_selector == Normal ){ | 309 | if( m_selector == Normal ){ |
306 | path = QPEApplication::documentDir(); | 310 | path = QPEApplication::documentDir(); |
307 | } /*else if( m_selector == Extended || m_selector == ExtendedAll ){ | 311 | } /*else if( m_selector == Extended || m_selector == ExtendedAll ){ |
308 | ; | 312 | ; |
309 | }*/ | 313 | }*/ |
310 | return path; | 314 | return path; |
311 | } | 315 | } |
312 | QStringList OFileSelector::selectedPaths() const | 316 | QStringList OFileSelector::selectedPaths() const |
313 | { | 317 | { |
314 | QStringList list; | 318 | QStringList list; |
315 | list << selectedPath(); | 319 | list << selectedPath(); |
316 | return list; | 320 | return list; |
317 | } | 321 | } |
318 | QString OFileSelector::directory()const | 322 | QString OFileSelector::directory()const |
319 | { | 323 | { |
320 | if( m_selector == Normal ) | 324 | if( m_selector == Normal ) |
321 | return QPEApplication::documentDir(); | 325 | return QPEApplication::documentDir(); |
322 | 326 | ||
323 | return QDir(m_currentDir).absPath(); | 327 | return QDir(m_currentDir).absPath(); |
324 | } | 328 | } |
325 | 329 | ||
326 | int OFileSelector::fileCount() | 330 | int OFileSelector::fileCount() |
327 | { | 331 | { |
328 | int count; | 332 | int count; |
329 | switch( m_selector ){ | 333 | switch( m_selector ){ |
330 | case Normal: | 334 | case Normal: |
331 | count = m_select->fileCount(); | 335 | count = m_select->fileCount(); |
332 | break; | 336 | break; |
333 | case Extended: | 337 | case Extended: |
334 | case ExtendedAll: | 338 | case ExtendedAll: |
335 | default: | 339 | default: |
336 | count = currentView()->fileCount(); | 340 | count = currentView()->fileCount(); |
337 | break; | 341 | break; |
338 | } | 342 | } |
339 | return count; | 343 | return count; |
340 | } | 344 | } |
341 | DocLnk OFileSelector::selectedDocument() const | 345 | DocLnk OFileSelector::selectedDocument() const |
342 | { | 346 | { |
343 | DocLnk lnk; | 347 | DocLnk lnk; |
344 | switch( m_selector ){ | 348 | switch( m_selector ){ |
345 | case Normal:{ | 349 | case Normal:{ |
346 | lnk = m_select->selectedDocument(); | 350 | lnk = m_select->selectedDocument(); |
347 | break; | 351 | break; |
348 | } | 352 | } |
349 | case Extended: | 353 | case Extended: |
350 | case ExtendedAll: | 354 | case ExtendedAll: |
351 | default: | 355 | default: |
352 | lnk = DocLnk( selectedName() ); | 356 | lnk = DocLnk( selectedName() ); |
353 | break; | 357 | break; |
354 | } | 358 | } |
355 | return lnk; | 359 | return lnk; |
356 | } | 360 | } |
357 | QValueList<DocLnk> OFileSelector::selectedDocuments() const | 361 | QValueList<DocLnk> OFileSelector::selectedDocuments() const |
358 | { | 362 | { |
359 | QValueList<DocLnk> docs; | 363 | QValueList<DocLnk> docs; |
360 | docs.append( selectedDocument() ); | 364 | docs.append( selectedDocument() ); |
361 | return docs; | 365 | return docs; |
362 | } | 366 | } |
363 | 367 | ||
364 | 368 | ||
365 | // slots internal | 369 | // slots internal |
366 | 370 | ||
367 | void OFileSelector::slotOk() | 371 | void OFileSelector::slotOk() |
368 | { | 372 | { |
369 | emit ok(); | 373 | emit ok(); |
370 | } | 374 | } |
371 | void OFileSelector::slotCancel() | 375 | void OFileSelector::slotCancel() |
372 | { | 376 | { |
373 | emit cancel(); | 377 | emit cancel(); |
374 | } | 378 | } |
375 | /* switch the views */ | 379 | /* switch the views */ |
376 | void OFileSelector::slotViewCheck(const QString &sel) | 380 | void OFileSelector::slotViewCheck(const QString &sel) |
377 | { | 381 | { |
378 | if( sel == tr("Documents" ) ){ | 382 | if( sel == tr("Documents" ) ){ |
379 | if( m_select == 0 ){ | 383 | if( m_select == 0 ){ |
380 | // autMime? fix cause now we use All and not the current | 384 | // autMime? fix cause now we use All and not the current |
381 | // yes currentMime fixes that for us | 385 | // yes currentMime fixes that for us |
382 | QString mime = currentMimeType(); | 386 | QString mime = currentMimeType(); |
383 | m_select = new FileSelector(mime, | 387 | m_select = new FileSelector(mime, |
384 | m_stack, "fileselector", | 388 | m_stack, "fileselector", |
385 | m_shNew, m_shClose); | 389 | m_shNew, m_shClose); |
386 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 390 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
387 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 391 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
388 | connect(m_select, SIGNAL(closeMe() ), | 392 | connect(m_select, SIGNAL(closeMe() ), |
389 | this, SIGNAL(closeMe() ) ); | 393 | this, SIGNAL(closeMe() ) ); |
390 | //connect to close me and other signals as well | 394 | //connect to close me and other signals as well |
391 | 395 | ||
392 | m_stack->addWidget( m_select, Normal ); | 396 | m_stack->addWidget( m_select, Normal ); |
393 | } | 397 | } |
394 | m_stack->raiseWidget( Normal ); | 398 | m_stack->raiseWidget( Normal ); |
395 | m_selector = Normal; | 399 | m_selector = Normal; |
396 | }else if( sel == tr("Files") ){ | 400 | }else if( sel == tr("Files") ){ |
397 | m_selector = Extended; | 401 | m_selector = Extended; |
398 | initializeListView(); | 402 | initializeListView(); |
399 | reparse(); | 403 | reparse(); |
400 | m_stack->raiseWidget( Extended ); | 404 | m_stack->raiseWidget( Extended ); |
401 | }else if( sel == tr("All Files") ){ | 405 | }else if( sel == tr("All Files") ){ |
402 | m_selector = ExtendedAll; | 406 | m_selector = ExtendedAll; |
403 | initializeListView(); | 407 | initializeListView(); |
404 | reparse(); | 408 | reparse(); |
405 | m_stack->raiseWidget( Extended ); // same widget other QFileFilter | 409 | m_stack->raiseWidget( Extended ); // same widget other QFileFilter |
406 | } | 410 | } |
407 | } | 411 | } |
408 | 412 | ||
409 | QString OFileSelector::currentMimeType() const{ | 413 | QString OFileSelector::currentMimeType() const{ |
410 | QString mime; | 414 | QString mime; |
411 | QString currentText; | 415 | QString currentText; |
412 | if (m_shChooser ) | 416 | if (m_shChooser ) |
413 | currentText = m_mimeCheck->currentText(); | 417 | currentText = m_mimeCheck->currentText(); |
414 | 418 | ||
415 | if (tr("All") == currentText ) return QString::null; | 419 | if (tr("All") == currentText ) return QString::null; |
416 | else if (currentText.isEmpty() ) { | 420 | else if (currentText.isEmpty() ) { |
417 | ; | 421 | ; |
418 | }else { | 422 | }else { |
419 | QMap<QString, QStringList>::ConstIterator it; | 423 | QMap<QString, QStringList>::ConstIterator it; |
420 | it = m_mimetypes.find( currentText ); | 424 | it = m_mimetypes.find( currentText ); |
421 | if ( it == m_mimetypes.end() ) { | 425 | if ( it == m_mimetypes.end() ) { |
422 | mime = it.data().join(";"); | 426 | mime = it.data().join(";"); |
423 | }else{ | 427 | }else{ |
424 | mime = currentText; | 428 | mime = currentText; |
425 | } | 429 | } |
426 | } | 430 | } |
427 | return mime; | 431 | return mime; |
428 | } | 432 | } |
429 | void OFileSelector::slotMimeCheck(const QString &mime) | 433 | void OFileSelector::slotMimeCheck(const QString &mime) |
430 | { | 434 | { |
431 | if( m_selector == Normal ){ | 435 | if( m_selector == Normal ){ |
432 | //if( m_autoMime ){ | 436 | //if( m_autoMime ){ |
433 | QString newMimeType; | 437 | QString newMimeType; |
434 | if (mime != tr("All") ) { | 438 | if (mime != tr("All") ) { |
435 | QMap<QString, QStringList>::Iterator it; | 439 | QMap<QString, QStringList>::Iterator it; |
436 | it = m_mimetypes.find(mime); | 440 | it = m_mimetypes.find(mime); |
437 | if ( it != m_mimetypes.end() ) { | 441 | if ( it != m_mimetypes.end() ) { |
438 | newMimeType = it.data().join(";"); | 442 | newMimeType = it.data().join(";"); |
439 | }else{ | 443 | }else{ |
440 | newMimeType = mime; | 444 | newMimeType = mime; |
441 | } | 445 | } |
442 | } | 446 | } |
443 | delete m_select; | 447 | delete m_select; |
444 | m_select = new FileSelector( newMimeType, | 448 | m_select = new FileSelector( newMimeType, |
445 | m_stack, "fileselector", | 449 | m_stack, "fileselector", |
446 | m_shNew, m_shClose); | 450 | m_shNew, m_shClose); |
447 | 451 | ||
448 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 452 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
449 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 453 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
450 | connect(m_select, SIGNAL(closeMe() ), | 454 | connect(m_select, SIGNAL(closeMe() ), |
451 | this, SIGNAL(closeMe() ) ); | 455 | this, SIGNAL(closeMe() ) ); |
452 | //connect to close me and other signals as well | 456 | //connect to close me and other signals as well |
453 | m_stack->addWidget( m_select, Normal ); | 457 | m_stack->addWidget( m_select, Normal ); |
454 | m_stack->raiseWidget( Normal ); | 458 | m_stack->raiseWidget( Normal ); |
455 | updateMimes(); | 459 | updateMimes(); |
456 | updateMimeCheck(); | 460 | updateMimeCheck(); |
457 | m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); | 461 | m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); |
458 | //} | 462 | //} |
459 | }else{ // others | 463 | }else{ // others |
460 | qWarning("Mime %s", mime.latin1() ); | 464 | qWarning("Mime %s", mime.latin1() ); |
461 | if(m_shChooser ){ | 465 | if(m_shChooser ){ |
462 | qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); | 466 | qWarning("Current Text %s", m_mimeCheck->currentText().latin1() ); |
463 | //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); | 467 | //m_mimeCheck->setCurrentItem(indexByString( m_mimeCheck, mime) ); |
464 | } | 468 | } |
465 | reparse(); | 469 | reparse(); |
466 | } | 470 | } |
467 | 471 | ||
468 | } | 472 | } |
469 | /* | 473 | /* |
470 | * Ok if a non dir gets inserted into this combobox | 474 | * Ok if a non dir gets inserted into this combobox |
471 | * we need to change it | 475 | * we need to change it |
472 | * QFileInfo and dirPath will give us the right Dir | 476 | * QFileInfo and dirPath will give us the right Dir |
473 | */ | 477 | */ |
474 | void OFileSelector::slotLocationActivated(const QString &file) | 478 | void OFileSelector::slotLocationActivated(const QString &file) |
475 | { | 479 | { |
476 | qWarning("slotLocationActivated"); | 480 | qWarning("slotLocationActivated"); |
477 | QString name = file.left( file.find("<-", 0, TRUE ) ); | 481 | QString name = file.left( file.find("<-", 0, TRUE ) ); |
478 | QFileInfo info( name ); | 482 | QFileInfo info( name ); |
479 | if ( info.isFile() ) | 483 | if ( info.isFile() ) |
480 | cd(info.dirPath( TRUE ) ); //absolute | 484 | cd(info.dirPath( TRUE ) ); //absolute |
481 | else | 485 | else |
482 | cd(name ); | 486 | cd(name ); |
483 | reparse(); | 487 | reparse(); |
484 | } | 488 | } |
485 | void OFileSelector::slotInsertLocationPath(const QString ¤tPath, int count) | 489 | void OFileSelector::slotInsertLocationPath(const QString ¤tPath, int count) |
486 | { | 490 | { |
487 | QStringList pathList; | 491 | QStringList pathList; |
488 | bool underDog = FALSE; | 492 | bool underDog = FALSE; |
489 | for(int i=0;i<count;i++) { | 493 | for(int i=0;i<count;i++) { |
490 | pathList << m_location->text(i); | 494 | pathList << m_location->text(i); |
491 | if( m_location->text(i) == currentPath) | 495 | if( m_location->text(i) == currentPath) |
492 | underDog = TRUE; | 496 | underDog = TRUE; |
493 | } | 497 | } |
494 | if( !underDog) { | 498 | if( !underDog) { |
495 | m_location->clear(); | 499 | m_location->clear(); |
496 | if( currentPath.left(2)=="//") | 500 | if( currentPath.left(2)=="//") |
497 | pathList.append( currentPath.right(currentPath.length()-1) ); | 501 | pathList.append( currentPath.right(currentPath.length()-1) ); |
498 | else | 502 | else |
499 | pathList.append( currentPath ); | 503 | pathList.append( currentPath ); |
500 | m_location->insertStringList( pathList,-1); | 504 | m_location->insertStringList( pathList,-1); |
501 | } | 505 | } |
502 | } | 506 | } |
503 | /* | 507 | /* |
504 | * Do not crash anymore | 508 | * Do not crash anymore |
505 | * don't try to change dir to a file | 509 | * don't try to change dir to a file |
506 | */ | 510 | */ |
507 | void OFileSelector::locationComboChanged() | 511 | void OFileSelector::locationComboChanged() |
508 | { | 512 | { |
509 | QFileInfo info( m_location->lineEdit()->text() ); | 513 | QFileInfo info( m_location->lineEdit()->text() ); |
510 | qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() ); | 514 | qWarning("info %s %s", info.dirPath(true).latin1(), m_location->lineEdit()->text().latin1() ); |
511 | if (info.isFile() ) | 515 | if (info.isFile() ) |
512 | cd(info.dirPath(TRUE) ); //absolute path | 516 | cd(info.dirPath(TRUE) ); //absolute path |
513 | else | 517 | else |
514 | cd( m_location->lineEdit()->text() ); | 518 | cd( m_location->lineEdit()->text() ); |
515 | 519 | ||
516 | reparse(); | 520 | reparse(); |
517 | } | 521 | } |
518 | void OFileSelector::init() | 522 | void OFileSelector::init() |
519 | { | 523 | { |
520 | m_lay = new QVBoxLayout( this ); | 524 | m_lay = new QVBoxLayout( this ); |
521 | m_lay->setSpacing(0 ); | 525 | m_lay->setSpacing(0 ); |
522 | 526 | ||
523 | m_stack = new QWidgetStack( this ); | 527 | m_stack = new QWidgetStack( this ); |
524 | if( m_selector == Normal ){ | 528 | if( m_selector == Normal ){ |
525 | QString mime; | 529 | QString mime; |
526 | if (!m_autoMime) { | 530 | if (!m_autoMime) { |
527 | if (!m_mimetypes.isEmpty() ) { | 531 | if (!m_mimetypes.isEmpty() ) { |
528 | QMap<QString, QStringList>::Iterator it; | 532 | QMap<QString, QStringList>::Iterator it; |
529 | it = m_mimetypes.begin(); // cause we're in the init | 533 | it = m_mimetypes.begin(); // cause we're in the init |
530 | mime = it.data().join(";"); | 534 | mime = it.data().join(";"); |
531 | } | 535 | } |
532 | } | 536 | } |
533 | m_select = new FileSelector(mime, | 537 | m_select = new FileSelector(mime, |
534 | m_stack, "fileselector", | 538 | m_stack, "fileselector", |
535 | m_shNew, m_shClose); | 539 | m_shNew, m_shClose); |
536 | 540 | ||
537 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 541 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
538 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 542 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
539 | connect(m_select, SIGNAL(closeMe() ), | 543 | connect(m_select, SIGNAL(closeMe() ), |
540 | this, SIGNAL( closeMe() ) ); | 544 | this, SIGNAL( closeMe() ) ); |
541 | //connect to close me and other signals as well | 545 | //connect to close me and other signals as well |
542 | 546 | ||
543 | m_stack->addWidget( m_select, Normal ); | 547 | m_stack->addWidget( m_select, Normal ); |
544 | m_stack->raiseWidget( Normal ); | 548 | m_stack->raiseWidget( Normal ); |
545 | }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL | 549 | }else{ // we're in init so it will be EXTENDED or EXTENDED_ALL |
546 | // and initializeListview will take care of those | 550 | // and initializeListview will take care of those |
547 | // toolbar get's generade in initializeListView | 551 | // toolbar get's generade in initializeListView |
548 | initializeListView( ); // will raise the widget as well | 552 | initializeListView( ); // will raise the widget as well |
549 | m_stack->raiseWidget( Extended ); | 553 | m_stack->raiseWidget( Extended ); |
550 | } | 554 | } |
551 | m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch | 555 | m_lay->addWidget( m_stack, 100 ); // add to the layout 10 = stretch |
552 | 556 | ||
553 | if( m_shLne ) // the LineEdit with the current FileName | 557 | if( m_shLne ) // the LineEdit with the current FileName |
554 | initializeName(); | 558 | initializeName(); |
555 | 559 | ||
556 | if( m_shPerm ) // the Permission QCheckBox | 560 | if( m_shPerm ) // the Permission QCheckBox |
557 | initializePerm(); | 561 | initializePerm(); |
558 | 562 | ||
559 | if( m_shChooser ) // the Chooser for the view and Mimetypes | 563 | if( m_shChooser ) // the Chooser for the view and Mimetypes |
560 | initializeChooser(); | 564 | initializeChooser(); |
561 | 565 | ||
562 | if( m_shYesNo ) // the Yes No button row | 566 | if( m_shYesNo ) // the Yes No button row |
563 | initializeYes( ); | 567 | initializeYes( ); |
564 | 568 | ||
565 | if (m_selector != Normal ) | 569 | if (m_selector != Normal ) |
566 | reparse(); | 570 | reparse(); |
567 | } | 571 | } |
568 | void OFileSelector::updateMimes() | 572 | void OFileSelector::updateMimes() |
569 | { | 573 | { |
570 | if( m_autoMime ){ | 574 | if( m_autoMime ){ |
571 | m_mimetypes.clear(); | 575 | m_mimetypes.clear(); |
572 | m_mimetypes.insert( tr("All"), QString::null ); | 576 | m_mimetypes.insert( tr("All"), QString::null ); |
573 | if( m_selector == Normal ){ | 577 | if( m_selector == Normal ){ |
574 | DocLnkSet set; | 578 | DocLnkSet set; |
575 | Global::findDocuments(&set, QString::null ); | 579 | Global::findDocuments(&set, QString::null ); |
576 | QListIterator<DocLnk> dit( set.children() ); | 580 | QListIterator<DocLnk> dit( set.children() ); |
577 | for( ; dit.current(); ++dit ){ | 581 | for( ; dit.current(); ++dit ){ |
578 | if( !m_mimetypes.contains( (*dit)->type() ) ) | 582 | if( !m_mimetypes.contains( (*dit)->type() ) ) |
579 | m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); | 583 | m_mimetypes.insert( (*dit)->type(), (*dit)->type() ); |
580 | } | 584 | } |
581 | }// else done in reparse | 585 | }// else done in reparse |
582 | } | 586 | } |
583 | } | 587 | } |
584 | void OFileSelector::initVars() | 588 | void OFileSelector::initVars() |
585 | { | 589 | { |
586 | if( m_mimetypes.isEmpty() ) | 590 | if( m_mimetypes.isEmpty() ) |
587 | m_autoMime = true; | 591 | m_autoMime = true; |
588 | else | 592 | else |
589 | m_autoMime = false; | 593 | m_autoMime = false; |
590 | 594 | ||
591 | m_shClose = false; | 595 | m_shClose = false; |
592 | m_shNew = false; | 596 | m_shNew = false; |
593 | m_shTool = true; | 597 | m_shTool = true; |
594 | m_shPerm = false; | 598 | m_shPerm = false; |
595 | m_shLne = true; | 599 | m_shLne = true; |
596 | m_shChooser = true; | 600 | m_shChooser = true; |
597 | m_shYesNo = true; | 601 | m_shYesNo = true; |
598 | m_case = false; | 602 | m_case = false; |
599 | m_dir = true; | 603 | m_dir = true; |
600 | m_files = true; | 604 | m_files = true; |
601 | m_showPopup = false; | 605 | m_showPopup = false; |
602 | 606 | ||
603 | if(m_pixmaps == 0 ) // init the pixmaps | 607 | if(m_pixmaps == 0 ) // init the pixmaps |
604 | initPics(); | 608 | initPics(); |
605 | 609 | ||
606 | // pointers | 610 | // pointers |
607 | m_location = 0; | 611 | m_location = 0; |
608 | m_mimeCheck = 0; | 612 | m_mimeCheck = 0; |
609 | m_viewCheck = 0; | 613 | m_viewCheck = 0; |
610 | m_homeButton = 0; | 614 | m_homeButton = 0; |
611 | m_docButton = 0; | 615 | m_docButton = 0; |
612 | m_hideButton = 0; | 616 | m_hideButton = 0; |
613 | m_ok = 0; | 617 | m_ok = 0; |
614 | m_cancel = 0; | 618 | m_cancel = 0; |
615 | m_reread = 0; | 619 | m_reread = 0; |
616 | m_up = 0; | 620 | m_up = 0; |
617 | m_View = 0; | 621 | m_View = 0; |
618 | m_checkPerm = 0; | 622 | m_checkPerm = 0; |
619 | m_pseudo = 0; | 623 | m_pseudo = 0; |
620 | m_pseudoLayout = 0; | 624 | m_pseudoLayout = 0; |
621 | m_select = 0; | 625 | m_select = 0; |
622 | m_stack = 0; | 626 | m_stack = 0; |
623 | m_lay = 0; | 627 | m_lay = 0; |
624 | m_Oselector = 0; | 628 | m_Oselector = 0; |
625 | m_boxToolbar = 0; | 629 | m_boxToolbar = 0; |
626 | m_boxOk = 0; | 630 | m_boxOk = 0; |
627 | m_boxName = 0; | 631 | m_boxName = 0; |
628 | m_boxView = 0; | 632 | m_boxView = 0; |
629 | m_custom = 0; | 633 | m_custom = 0; |
630 | m_edit = 0; | 634 | m_edit = 0; |
631 | m_fnLabel = 0; | 635 | m_fnLabel = 0; |
632 | m_new = 0; | 636 | m_new = 0; |
633 | m_close = 0; | 637 | m_close = 0; |
634 | } | 638 | } |
635 | void OFileSelector::addFile(const QString &, QFileInfo *info, bool ) | ||
636 | { | ||
637 | if(!m_files) | ||
638 | return; | ||
639 | // if( !compliesMime(info->absFilePath(), mime ) ) | ||
640 | // return; | ||
641 | MimeType type( info->absFilePath() ); | ||
642 | if (!compliesMime( type.id() ) ) | ||
643 | return; | ||
644 | |||
645 | } | ||
646 | void OFileSelector::addDir(const QString &, QFileInfo *, bool ) | ||
647 | { | ||
648 | if(!m_dir) | ||
649 | return; | ||
650 | } | ||
651 | void OFileSelector::delItems() | ||
652 | { | ||
653 | |||
654 | } | ||
655 | void OFileSelector::initializeName() | 639 | void OFileSelector::initializeName() |
656 | { | 640 | { |
657 | /** Name Layout Line | 641 | /** Name Layout Line |
658 | * This is the Layout line arranged in | 642 | * This is the Layout line arranged in |
659 | * horizontal way each components | 643 | * horizontal way each components |
660 | * are next to each other | 644 | * are next to each other |
661 | * but we will only do this if | 645 | * but we will only do this if |
662 | * we didn't initialize a while ago. | 646 | * we didn't initialize a while ago. |
663 | */ | 647 | */ |
664 | if( m_boxName == 0 ){ | 648 | if( m_boxName == 0 ){ |
665 | m_boxName = new QHBox( this ); // remove this this? or use a QHBox | 649 | m_boxName = new QHBox( this ); // remove this this? or use a QHBox |
666 | m_fnLabel = new QLabel( m_boxName ); | 650 | m_fnLabel = new QLabel( m_boxName ); |
667 | m_fnLabel->setText( tr("Name:") ); | 651 | m_fnLabel->setText( tr("Name:") ); |
668 | m_edit = new QLineEdit( m_boxName ); | 652 | m_edit = new QLineEdit( m_boxName ); |
669 | m_edit->setText( m_name ); | 653 | m_edit->setText( m_name ); |
670 | //m_boxName->addWidget( m_fnLabel ); | 654 | //m_boxName->addWidget( m_fnLabel ); |
671 | m_boxName->setMargin( 5 ); | 655 | m_boxName->setMargin( 5 ); |
672 | m_boxName->setSpacing( 8 ); | 656 | m_boxName->setSpacing( 8 ); |
673 | //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor | 657 | //m_boxName->setStretchFactor(m_edit, 100 ); // 100 is stretch factor |
674 | 658 | ||
675 | m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout | 659 | m_lay->addWidget( m_boxName, 0 ); // add it to the topLevel layout |
676 | }// else we already initialized | 660 | }// else we already initialized |
677 | // maybe show the components? | 661 | // maybe show the components? |
678 | // | 662 | // |
679 | } | 663 | } |
680 | void OFileSelector::initializeYes() | 664 | void OFileSelector::initializeYes() |
681 | { | 665 | { |
682 | /** The Save Cancel bar | 666 | /** The Save Cancel bar |
683 | * | 667 | * |
684 | */ | 668 | */ |
685 | if( m_boxOk == 0 ){ | 669 | if( m_boxOk == 0 ){ |
686 | m_boxOk = new QHBox( this ); | 670 | m_boxOk = new QHBox( this ); |
687 | m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); | 671 | m_ok = new QPushButton( tr("&Save"),m_boxOk , "save" ); |
688 | m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); | 672 | m_cancel = new QPushButton( tr("C&ancel"), m_boxOk, "cancel" ); |
689 | 673 | ||
690 | //m_boxOk->addWidget( m_ok ); | 674 | //m_boxOk->addWidget( m_ok ); |
691 | //m_boxOk->addWidget( m_cancel ); | 675 | //m_boxOk->addWidget( m_cancel ); |
692 | m_boxOk->setMargin( 5 ); | 676 | m_boxOk->setMargin( 5 ); |
693 | m_boxOk->setSpacing( 10 ); | 677 | m_boxOk->setSpacing( 10 ); |
694 | m_lay->addWidget( m_boxOk, 0 ); | 678 | m_lay->addWidget( m_boxOk, 0 ); |
695 | 679 | ||
696 | connect( m_ok, SIGNAL( clicked() ), | 680 | connect( m_ok, SIGNAL( clicked() ), |
697 | this, SLOT(slotOk() ) ); | 681 | this, SLOT(slotOk() ) ); |
698 | connect( m_cancel, SIGNAL( clicked() ), | 682 | connect( m_cancel, SIGNAL( clicked() ), |
699 | this, SLOT( slotCancel() ) ); | 683 | this, SLOT( slotCancel() ) ); |
700 | } | 684 | } |
701 | } | 685 | } |
702 | /* | 686 | /* |
703 | * OK m_mimeCheck is a QComboBox we now want to fill | 687 | * OK m_mimeCheck is a QComboBox we now want to fill |
704 | * out that combobox | 688 | * out that combobox |
705 | * if automime we need to update the mimetypes | 689 | * if automime we need to update the mimetypes |
706 | */ | 690 | */ |
707 | void OFileSelector::updateMimeCheck() { | 691 | void OFileSelector::updateMimeCheck() { |
708 | m_mimeCheck->clear(); | 692 | m_mimeCheck->clear(); |
709 | if (m_autoMime ) { | 693 | if (m_autoMime ) { |
710 | //m_mimeCheck->insertItem( tr("All") ); | 694 | //m_mimeCheck->insertItem( tr("All") ); |
711 | updateMimes(); | 695 | updateMimes(); |
712 | } | 696 | } |
713 | 697 | ||
714 | QMap<QString, QStringList>::Iterator it; | 698 | QMap<QString, QStringList>::Iterator it; |
715 | for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { | 699 | for (it = m_mimetypes.begin(); it != m_mimetypes.end(); ++it ) { |
716 | m_mimeCheck->insertItem( it.key() ); | 700 | m_mimeCheck->insertItem( it.key() ); |
717 | } | 701 | } |
718 | } | 702 | } |
719 | 703 | ||
720 | void OFileSelector::initializeChooser() | 704 | void OFileSelector::initializeChooser() |
721 | { | 705 | { |
722 | if( m_boxView == 0 ){ | 706 | if( m_boxView == 0 ){ |
723 | m_boxView = new QHBox( this ); | 707 | m_boxView = new QHBox( this ); |
724 | m_viewCheck = new QComboBox( m_boxView, "view check"); | 708 | m_viewCheck = new QComboBox( m_boxView, "view check"); |
725 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); | 709 | m_mimeCheck = new QComboBox( m_boxView, "mime check"); |
726 | m_boxView->setSpacing( 8 ); | 710 | m_boxView->setSpacing( 8 ); |
727 | m_lay->addWidget(m_boxView, 0 ); | 711 | m_lay->addWidget(m_boxView, 0 ); |
728 | 712 | ||
729 | m_viewCheck->insertItem( tr("Documents") ); | 713 | m_viewCheck->insertItem( tr("Documents") ); |
730 | m_viewCheck->insertItem( tr("Files") ); | 714 | m_viewCheck->insertItem( tr("Files") ); |
731 | m_viewCheck->insertItem( tr("All Files") ); | 715 | m_viewCheck->insertItem( tr("All Files") ); |
716 | /* update to custom views */ | ||
732 | updateMimeCheck(); | 717 | updateMimeCheck(); |
733 | 718 | ||
734 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), | 719 | connect( m_viewCheck, SIGNAL( activated(const QString & ) ), |
735 | this, SLOT( slotViewCheck(const QString & ) ) ); | 720 | this, SLOT( slotViewCheck(const QString & ) ) ); |
736 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), | 721 | connect( m_mimeCheck, SIGNAL( activated(const QString & ) ), |
737 | this, SLOT( slotMimeCheck( const QString & ) ) ); | 722 | this, SLOT( slotMimeCheck( const QString & ) ) ); |
738 | } | 723 | } |
739 | } | 724 | } |
740 | void OFileSelector::initializeListView() | 725 | void OFileSelector::initializeListView() |
741 | { | 726 | { |
742 | qWarning("initializeListView"); | 727 | qWarning("initializeListView"); |
743 | if( m_pseudo == 0 ){ | 728 | if( m_pseudo == 0 ){ |
744 | qWarning("init"); | 729 | qWarning("init"); |
745 | m_pseudo = new QWidget( m_stack, "Pseudo Widget"); | 730 | m_pseudo = new QWidget( m_stack, "Pseudo Widget"); |
746 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); | 731 | m_pseudoLayout = new QVBoxLayout( m_pseudo ); |
747 | // toolbar | 732 | // toolbar |
748 | m_boxToolbar = new QHBox( m_pseudo ); | 733 | m_boxToolbar = new QHBox( m_pseudo ); |
749 | m_boxToolbar->setSpacing(0 ); // next to each other please | 734 | m_boxToolbar->setSpacing(0 ); // next to each other please |
750 | 735 | ||
751 | // toolbar members | 736 | // toolbar members |
752 | { | 737 | { |
753 | // location QComboBox | 738 | // location QComboBox |
754 | m_location = new QComboBox( m_boxToolbar ); | 739 | m_location = new QComboBox( m_boxToolbar ); |
755 | m_location->setEditable( TRUE ); | 740 | m_location->setEditable( TRUE ); |
756 | m_location->setDuplicatesEnabled( FALSE ); | 741 | m_location->setDuplicatesEnabled( FALSE ); |
757 | connect( m_location, SIGNAL(activated(const QString &) ), | 742 | connect( m_location, SIGNAL(activated(const QString &) ), |
758 | this, SLOT( slotLocationActivated(const QString &) ) ); | 743 | this, SLOT( slotLocationActivated(const QString &) ) ); |
759 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ), | 744 | connect( m_location->lineEdit(), SIGNAL(returnPressed() ), |
760 | this, SLOT(locationComboChanged() ) ); | 745 | this, SLOT(locationComboChanged() ) ); |
761 | // UP Button | 746 | // UP Button |
762 | m_up = new QPushButton(Resource::loadIconSet("up"),"", | 747 | m_up = new QPushButton(Resource::loadIconSet("up"),"", |
763 | m_boxToolbar,"cdUpButton"); | 748 | m_boxToolbar,"cdUpButton"); |
764 | m_up->setFixedSize( QSize( 20, 20 ) ); | 749 | m_up->setFixedSize( QSize( 20, 20 ) ); |
765 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); | 750 | connect(m_up ,SIGNAL(clicked()),this,SLOT(cdUP() ) ); |
766 | m_up->setFlat(TRUE); | 751 | m_up->setFlat(TRUE); |
767 | 752 | ||
768 | // Home Button | 753 | // Home Button |
769 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , | 754 | m_homeButton = new QPushButton(Resource::loadIconSet("home") , |
770 | "", m_boxToolbar); | 755 | "", m_boxToolbar); |
771 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); | 756 | m_homeButton->setFixedSize( QSize( 20, 20 ) ); |
772 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); | 757 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotHome() ) ); |
773 | m_homeButton->setFlat(TRUE); | 758 | m_homeButton->setFlat(TRUE); |
774 | // Documents Button | 759 | // Documents Button |
775 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", | 760 | m_docButton = new QPushButton(Resource::loadIconSet("DocsIcon"),"", |
776 | m_boxToolbar,"docsButton"); | 761 | m_boxToolbar,"docsButton"); |
777 | m_docButton->setFixedSize( QSize( 20, 20 ) ); | 762 | m_docButton->setFixedSize( QSize( 20, 20 ) ); |
778 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); | 763 | connect(m_homeButton,SIGNAL(clicked()),this,SLOT(slotDoc() ) ); |
779 | m_docButton->setFlat(TRUE); | 764 | m_docButton->setFlat(TRUE); |
780 | 765 | ||
781 | // Close button | 766 | // Close button |
782 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", | 767 | m_close = new QPushButton( Resource::loadIconSet( "close"), "", |
783 | m_boxToolbar ); | 768 | m_boxToolbar ); |
784 | connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); | 769 | connect( m_close, SIGNAL(clicked() ), this, SIGNAL(closeMe() ) ); |
785 | m_close->setFixedSize( 20, 20 ); | 770 | m_close->setFixedSize( 20, 20 ); |
786 | 771 | ||
787 | m_boxToolbar->setFixedHeight( 20 ); | 772 | m_boxToolbar->setFixedHeight( 20 ); |
788 | m_pseudoLayout->addWidget(m_boxToolbar ); | 773 | m_pseudoLayout->addWidget(m_boxToolbar ); |
789 | 774 | ||
790 | // let;s fill the Location ComboBox | 775 | // let;s fill the Location ComboBox |
791 | StorageInfo storage; | 776 | StorageInfo storage; |
792 | const QList<FileSystem> &fs = storage.fileSystems(); | 777 | const QList<FileSystem> &fs = storage.fileSystems(); |
793 | QListIterator<FileSystem> it ( fs ); | 778 | QListIterator<FileSystem> it ( fs ); |
794 | for( ; it.current(); ++it ){ | 779 | for( ; it.current(); ++it ){ |
795 | const QString disk = (*it)->name(); | 780 | const QString disk = (*it)->name(); |
796 | const QString path = (*it)->path(); | 781 | const QString path = (*it)->path(); |
797 | m_location->insertItem(path+ "<-"+disk ); | 782 | m_location->insertItem(path+ "<-"+disk ); |
798 | } | 783 | } |
799 | int count = m_location->count(); | 784 | int count = m_location->count(); |
800 | m_location->insertItem( m_currentDir ); | 785 | m_location->insertItem( m_currentDir ); |
801 | m_location->setCurrentItem( count ); | 786 | m_location->setCurrentItem( count ); |
802 | // due to the New and Close button we can not simply hide m_boxToolBar to not show it | 787 | // due to the New and Close button we can not simply hide m_boxToolBar to not show it |
803 | if( !m_shTool ){ | 788 | if( !m_shTool ){ |
804 | m_location->hide( ); | 789 | m_location->hide( ); |
805 | m_up->hide( ); | 790 | m_up->hide( ); |
806 | m_homeButton->hide( ); | 791 | m_homeButton->hide( ); |
807 | m_docButton->hide( ); | 792 | m_docButton->hide( ); |
808 | } | 793 | } |
809 | if(!m_shClose ) | 794 | if(!m_shClose ) |
810 | m_close->hide(); | 795 | m_close->hide(); |
811 | //if(!m_shNew) | 796 | //if(!m_shNew) |
812 | //m_close->hide(); | 797 | //m_close->hide(); |
813 | 798 | ||
814 | } // off toolbar | 799 | } // off toolbar |
815 | // the Main ListView | 800 | // the Main ListView |
816 | // make a QWidgetStack first so Views can share the Toolbar | 801 | // make a QWidgetStack first so Views can share the Toolbar |
817 | m_View = new QListView( m_pseudo, "Extended view"); | 802 | |
818 | QPEApplication::setStylusOperation( m_View->viewport(), | 803 | // m_pseudoLayout->addWidget( m_View, 288 ); |
819 | QPEApplication::RightOnHold); | ||
820 | m_View->addColumn(" " ); | ||
821 | m_View->addColumn(tr("Name"), 135 ); | ||
822 | m_View->addColumn(tr("Size"), -1 ); | ||
823 | m_View->addColumn(tr("Date"), 60 ); | ||
824 | m_View->addColumn(tr("Mime Type"), -1 ); | ||
825 | QHeader *header = m_View->header(); | ||
826 | header->hide(); | ||
827 | m_View->setSorting( 1 ); | ||
828 | m_View->setAllColumnsShowFocus( TRUE ); | ||
829 | |||
830 | connect(m_View, SIGNAL(selectionChanged() ), | ||
831 | this, SLOT(slotSelectionChanged() ) ); | ||
832 | |||
833 | connect(m_View, SIGNAL(currentChanged(QListViewItem *) ), | ||
834 | this, SLOT(slotCurrentChanged(QListViewItem * ) ) ); | ||
835 | |||
836 | connect(m_View, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint &, int) ), | ||
837 | this, SLOT(slotClicked( int, QListViewItem *, const QPoint &, int) ) ); | ||
838 | |||
839 | connect(m_View, SIGNAL(mouseButtonPressed(int, QListViewItem *, const QPoint &, int )), | ||
840 | this, SLOT(slotRightButton(int, QListViewItem *, const QPoint &, int ) ) ); | ||
841 | |||
842 | m_pseudoLayout->addWidget( m_View, 288 ); | ||
843 | m_stack->addWidget( m_pseudo, Extended ); | 804 | m_stack->addWidget( m_pseudo, Extended ); |
844 | } | 805 | } |
845 | } | 806 | } |
846 | void OFileSelector::initializePerm() | 807 | void OFileSelector::initializePerm() |
847 | { | 808 | { |
848 | if( m_checkPerm == 0 ){ | 809 | if( m_checkPerm == 0 ){ |
849 | m_checkPerm = new QCheckBox(tr("Set Permission"), this, "perm"); | 810 | m_checkPerm = new QCheckBox(tr("Set Permission"), this, "perm"); |
850 | m_checkPerm->setChecked( false ); | 811 | m_checkPerm->setChecked( false ); |
851 | m_lay->addWidget( m_checkPerm ); | 812 | m_lay->addWidget( m_checkPerm ); |
852 | |||
853 | } | 813 | } |
854 | } | 814 | } |
855 | void OFileSelector::initPics() | 815 | void OFileSelector::initPics() |
856 | { | 816 | { |
857 | m_pixmaps = new QMap<QString,QPixmap>; | 817 | m_pixmaps = new QMap<QString,QPixmap>; |
858 | QPixmap pm = Resource::loadPixmap( "folder" ); | 818 | QPixmap pm = Resource::loadPixmap( "folder" ); |
859 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); | 819 | QPixmap lnk = Resource::loadPixmap( "opie/symlink" ); |
820 | |||
860 | QPainter painter( &pm ); | 821 | QPainter painter( &pm ); |
861 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); | 822 | painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); |
862 | pm.setMask( pm.createHeuristicMask( FALSE ) ); | 823 | pm.setMask( pm.createHeuristicMask( FALSE ) ); |
863 | m_pixmaps->insert("dirsymlink", pm ); | 824 | m_pixmaps->insert("dirsymlink", pm ); |
864 | 825 | ||
865 | QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); | 826 | QPixmap pm2 = Resource::loadPixmap( "lockedfolder" ); |
866 | QPainter pen(&pm2 ); | 827 | QPainter pen(&pm2 ); |
867 | pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); | 828 | pen.drawPixmap(pm2.width()-lnk.width(), pm2.height()-lnk.height(), lnk ); |
868 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); | 829 | pm2.setMask( pm2.createHeuristicMask( FALSE ) ); |
869 | m_pixmaps->insert("symlinkedlocked", pm2 ); | 830 | m_pixmaps->insert("symlinkedlocked", pm2 ); |
870 | } | 831 | } |
871 | // if a mime complies with the m_mimeCheck->currentItem | 832 | // if a mime complies with the m_mimeCheck->currentItem |
872 | bool OFileSelector::compliesMime( const QString &path, const QString &mime ) | 833 | bool OFileSelector::compliesMime( const QString &path, const QString &mime ) |
873 | { | 834 | { |
874 | if( mime == "All" ) | 835 | if( mime == "All" ) |
875 | return true; | 836 | return true; |
876 | MimeType type( path ); | 837 | MimeType type( path ); |
877 | if( type.id() == mime ) | 838 | if( type.id() == mime ) |
878 | return true; | 839 | return true; |
879 | return false; | 840 | return false; |
880 | } | 841 | } |
881 | /* check if the mimetype in mime | 842 | /* check if the mimetype in mime |
882 | * complies with the one which is current | 843 | * complies with the one which is current |
883 | */ | 844 | */ |
884 | /* | 845 | /* |
885 | * We've the mimetype of the file | 846 | * We've the mimetype of the file |
886 | * We need to get the stringlist of the current mimetype | 847 | * We need to get the stringlist of the current mimetype |
887 | * | 848 | * |
888 | * mime = image/jpeg | 849 | * mime = image/jpeg |
889 | * QStringList = 'image/*' | 850 | * QStringList = 'image/*' |
890 | * or QStringList = image/jpeg;image/png;application/x-ogg | 851 | * or QStringList = image/jpeg;image/png;application/x-ogg |
891 | * or QStringList = application/x-ogg;image/*; | 852 | * or QStringList = application/x-ogg;image/*; |
892 | * with all these mime filters it should get acceptes | 853 | * with all these mime filters it should get acceptes |
893 | * to do so we need to look if mime is contained inside | 854 | * to do so we need to look if mime is contained inside |
894 | * the stringlist | 855 | * the stringlist |
895 | * if it's contained return true | 856 | * if it's contained return true |
896 | * if not ( I'm no RegExp expert at all ) we'll look if a '/*' | 857 | * if not ( I'm no RegExp expert at all ) we'll look if a '/*' |
897 | * is contained in the mimefilter and then we will | 858 | * is contained in the mimefilter and then we will |
898 | * look if both are equal until the '/' | 859 | * look if both are equal until the '/' |
899 | */ | 860 | */ |
900 | bool OFileSelector::compliesMime( const QString& mime ) { | 861 | bool OFileSelector::compliesMime( const QString& mime ) { |
901 | qWarning("mimetype is %s", mime.latin1() ); | 862 | qWarning("mimetype is %s", mime.latin1() ); |
902 | QString currentText; | 863 | QString currentText; |
903 | if (m_shChooser ) | 864 | if (m_shChooser ) |
904 | currentText = m_mimeCheck->currentText(); | 865 | currentText = m_mimeCheck->currentText(); |
905 | 866 | ||
906 | qWarning("current text is %s", currentText.latin1() ); | 867 | qWarning("current text is %s", currentText.latin1() ); |
907 | QMap<QString, QStringList>::Iterator it; | 868 | QMap<QString, QStringList>::Iterator it; |
908 | QStringList list; | 869 | QStringList list; |
909 | if ( currentText == tr("All") ) return true; | 870 | if ( currentText == tr("All") ) return true; |
910 | else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { | 871 | else if ( currentText.isEmpty() && !m_mimetypes.isEmpty() ) { |
911 | it = m_mimetypes.begin(); | 872 | it = m_mimetypes.begin(); |
912 | list = it.data(); | 873 | list = it.data(); |
913 | }else if ( currentText.isEmpty() ) return true; | 874 | }else if ( currentText.isEmpty() ) return true; |
914 | else{ | 875 | else{ |
915 | it = m_mimetypes.find(currentText ); | 876 | it = m_mimetypes.find(currentText ); |
916 | if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; | 877 | if ( it == m_mimetypes.end() ) qWarning("not there"), list << currentText; |
917 | else qWarning("found"), list = it.data(); | 878 | else qWarning("found"), list = it.data(); |
918 | } | 879 | } |
919 | // dump it now | ||
920 | //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | ||
921 | // qWarning( "%s", (*it).latin1() ); | ||
922 | //} | ||
923 | 880 | ||
924 | 881 | ||
925 | if ( list.contains(mime) ) return true; | 882 | if ( list.contains(mime) ) return true; |
926 | qWarning("list doesn't contain it "); | 883 | qWarning("list doesn't contain it "); |
927 | QStringList::Iterator it2; | 884 | QStringList::Iterator it2; |
928 | int pos; | 885 | int pos; |
929 | for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { | 886 | for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { |
930 | pos = (*it2).findRev("/*"); | 887 | pos = (*it2).findRev("/*"); |
931 | if ( pos >= 0 ) { | 888 | if ( pos >= 0 ) { |
932 | if ( mime.contains( (*it2).left(pos) ) ) return true; | 889 | if ( mime.contains( (*it2).left(pos) ) ) return true; |
933 | } | 890 | } |
934 | } | 891 | } |
935 | return false; | 892 | return false; |
936 | } | 893 | } |
937 | void OFileSelector::slotFileSelected( const QString &string ) | 894 | void OFileSelector::slotFileSelected( const QString &string ) |
938 | { | 895 | { |
939 | if( m_shLne ) | 896 | if( m_shLne ) |
940 | m_edit->setText( string ); | 897 | m_edit->setText( string ); |
941 | emit fileSelected( string ); | 898 | emit fileSelected( string ); |
942 | } | 899 | } |
943 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) | 900 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) |
944 | { | 901 | { |
945 | slotFileSelected( lnk.name() ); | 902 | slotFileSelected( lnk.name() ); |
946 | // emit fileSelected( lnk ); | 903 | // emit fileSelected( lnk ); |
947 | } | 904 | } |
948 | void OFileSelector::slotSelectionChanged() | ||
949 | { | ||
950 | |||
951 | } | ||
952 | void OFileSelector::slotCurrentChanged(QListViewItem* /*item*/ ) | ||
953 | { | ||
954 | /* | ||
955 | if( item == 0 ) | ||
956 | return; | ||
957 | if( m_selector == Extended || m_selector == ExtendedAll ) { | ||
958 | OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) | ||
959 | qWarning("current changed"); | ||
960 | if(!sel->isDir() ){ | ||
961 | if( m_shLne ) | ||
962 | m_edit->setText( sel->text(1) ); | ||
963 | |||
964 | if (m_mode == Fileselector ) { | ||
965 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
966 | QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); | ||
967 | emit fileSelected(path ); | ||
968 | DocLnk lnk( path ); | ||
969 | emit fileSelected(lnk ); | ||
970 | } | ||
971 | } | ||
972 | } */ | ||
973 | } | ||
974 | void OFileSelector::slotClicked( int /*button*/, QListViewItem */*item*/, const QPoint &, int) | ||
975 | |||
976 | { | ||
977 | /* | ||
978 | if ( item == 0 ) | ||
979 | return; | ||
980 | |||
981 | if( button != Qt::LeftButton ) | ||
982 | return; | ||
983 | |||
984 | switch( m_selector ){ | ||
985 | default: | ||
986 | break; | ||
987 | case Extended: // fall through | ||
988 | case ExtendedAll:{ | ||
989 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | ||
990 | if(!sel->isLocked() ){ | ||
991 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
992 | if( sel->isDir() ){ | ||
993 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); | ||
994 | // if MODE Dir m_shLne set the Text | ||
995 | }else{ | ||
996 | if( m_shLne ) | ||
997 | m_edit->setText( str[0].stripWhiteSpace() ); | ||
998 | qWarning("selected here in slot clicked"); | ||
999 | emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); | ||
1000 | DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); | ||
1001 | qWarning("file selected"); | ||
1002 | emit fileSelected( lnk ); | ||
1003 | } | ||
1004 | } | ||
1005 | break; | ||
1006 | } | ||
1007 | } */ | ||
1008 | } | ||
1009 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) | ||
1010 | { | ||
1011 | if( item == 0 ) | ||
1012 | return; | ||
1013 | 905 | ||
1014 | if( button != Qt::RightButton ) | ||
1015 | return; | ||
1016 | slotContextMenu( item ); | ||
1017 | } | ||
1018 | void OFileSelector::slotContextMenu( QListViewItem */*item*/) | ||
1019 | { | ||
1020 | |||
1021 | } | ||
1022 | void OFileSelector::slotChangedDir() | ||
1023 | { | ||
1024 | /* | ||
1025 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | ||
1026 | if(sel->isDir() ){ | ||
1027 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
1028 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); | ||
1029 | } | ||
1030 | */ | ||
1031 | } | ||
1032 | void OFileSelector::slotOpen() | ||
1033 | { | ||
1034 | /* | ||
1035 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | ||
1036 | if(!sel->isDir() ){ | ||
1037 | QStringList str = QStringList::split("->", sel->text(1) ); | ||
1038 | slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); | ||
1039 | qWarning("slot open"); | ||
1040 | // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); | ||
1041 | //emit fileSelected( lnk ); | ||
1042 | } | ||
1043 | */ | ||
1044 | } | ||
1045 | void OFileSelector::slotRescan() | ||
1046 | { | ||
1047 | 906 | ||
1048 | } | ||
1049 | void OFileSelector::slotRename() | ||
1050 | { | ||
1051 | reparse(); | ||
1052 | } | ||
1053 | void OFileSelector::slotDelete() | 907 | void OFileSelector::slotDelete() |
1054 | { | 908 | { |
1055 | /* | 909 | /* |
1056 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 910 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1057 | QStringList list = QStringList::split("->", sel->text(1) ); | 911 | QStringList list = QStringList::split("->", sel->text(1) ); |
1058 | if( sel->isDir() ){ | 912 | if( sel->isDir() ){ |
1059 | QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry | 913 | QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry |
1060 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], | 914 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], |
1061 | tr("Yes"),tr("No"),0,1,1) ) { | 915 | tr("Yes"),tr("No"),0,1,1) ) { |
1062 | case 0: | 916 | case 0: |
1063 | ::system(str.utf8().data() ); | 917 | ::system(str.utf8().data() ); |
1064 | break; | 918 | break; |
1065 | } | 919 | } |
1066 | } else { | 920 | } else { |
1067 | QFile::remove( list[0] ); | 921 | QFile::remove( list[0] ); |
1068 | } | 922 | } |
1069 | m_View->takeItem( sel ); | 923 | m_View->takeItem( sel ); |
1070 | delete sel; | 924 | delete sel; |
1071 | */ | 925 | */ |
1072 | } | 926 | } |
1073 | void OFileSelector::cdUP() | 927 | void OFileSelector::cdUP() |
1074 | { | 928 | { |
1075 | QDir dir( m_currentDir ); | 929 | QDir dir( m_currentDir ); |
1076 | dir.cdUp(); | 930 | dir.cdUp(); |
1077 | if(dir.exists() ){ | 931 | if(dir.exists() ){ |
1078 | m_currentDir = dir.absPath(); | 932 | m_currentDir = dir.absPath(); |
1079 | reparse(); | 933 | reparse(); |
1080 | int count = m_location->count(); | 934 | int count = m_location->count(); |
1081 | slotInsertLocationPath( m_currentDir, count); | 935 | slotInsertLocationPath( m_currentDir, count); |
1082 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); | 936 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); |
1083 | //this wont work in all instances | 937 | //this wont work in all instances |
1084 | // FIXME | 938 | // FIXME |
1085 | } | 939 | } |
1086 | } | 940 | } |
1087 | void OFileSelector::slotHome() | 941 | void OFileSelector::slotHome() |
1088 | { | 942 | { |
1089 | cd(QDir::homeDirPath() ); | 943 | cd(QDir::homeDirPath() ); |
1090 | } | 944 | } |
1091 | void OFileSelector::slotDoc() | 945 | void OFileSelector::slotDoc() |
1092 | { | 946 | { |
1093 | cd(QPEApplication::documentDir() ); | 947 | cd(QPEApplication::documentDir() ); |
1094 | } | 948 | } |
1095 | void OFileSelector::slotNavigate( ) | 949 | void OFileSelector::slotNavigate( ) |
1096 | { | 950 | { |
1097 | 951 | ||
1098 | } | 952 | } |
1099 | // fill the View with life | 953 | // fill the View with life |
1100 | void OFileSelector::reparse() | 954 | void OFileSelector::reparse() |
1101 | { | 955 | { |
1102 | if( m_selector == Normal ) | 956 | if( m_selector == Normal ) |
1103 | return; | 957 | return; |
1104 | if( m_selector == Extended || m_selector == ExtendedAll ) | 958 | |
1105 | m_View->clear(); | 959 | currentView()->clear(); |
1106 | else // custom view | 960 | |
1107 | ; // currentView()->clear(); | ||
1108 | if( m_shChooser) | 961 | if( m_shChooser) |
1109 | qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); | 962 | qWarning("reparse %s", m_mimeCheck->currentText().latin1() ); |
1110 | 963 | ||
1111 | QString currentMimeType; | 964 | QString currentMimeType; |
965 | |||
1112 | // let's update the mimetype | 966 | // let's update the mimetype |
1113 | if( m_autoMime ){ | 967 | if( m_autoMime ){ |
1114 | m_mimetypes.clear(); | 968 | m_mimetypes.clear(); |
1115 | // ok we can change mimetype so we need to be able to give a selection | 969 | // ok we can change mimetype so we need to be able to give a selection |
1116 | if( m_shChooser ) { | 970 | if( m_shChooser ) { |
1117 | currentMimeType = m_mimeCheck->currentText(); | 971 | currentMimeType = m_mimeCheck->currentText(); |
1118 | m_mimeCheck->clear(); | 972 | m_mimeCheck->clear(); |
1119 | 973 | ||
1120 | // let's find possible mimetypes | 974 | // let's find possible mimetypes |
1121 | QDir dir( m_currentDir ); | 975 | m_mimetypes = currentLister()->mimeTypes( m_currentDir ); |
1122 | dir.setFilter( QDir::Files | QDir::Readable ); | 976 | |
1123 | dir.setSorting( QDir::Size ); | ||
1124 | const QFileInfoList *list = dir.entryInfoList(); | ||
1125 | QFileInfoListIterator it( *list ); | ||
1126 | QFileInfo *fi; | ||
1127 | while( (fi=it.current() ) ) { | ||
1128 | if( fi->extension() == QString::fromLatin1("desktop") ){ | ||
1129 | ++it; | ||
1130 | continue; | ||
1131 | } | ||
1132 | MimeType type( fi->absFilePath() ); | ||
1133 | if( !m_mimetypes.contains( type.id() ) ){ | ||
1134 | //qWarning("Type %s", type.id().latin1() ); | ||
1135 | m_mimetypes.insert( type.id(), type.id() ); | ||
1136 | } | ||
1137 | |||
1138 | ++it; | ||
1139 | } | ||
1140 | // add them to the chooser | 977 | // add them to the chooser |
1141 | updateMimeCheck(); | 978 | updateMimeCheck(); |
1142 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); | 979 | m_mimeCheck->setCurrentItem( indexByString( m_mimeCheck, currentMimeType ) ); |
1143 | currentMimeType = m_mimeCheck->currentText(); | 980 | currentMimeType = m_mimeCheck->currentText(); |
1144 | } | 981 | } |
1145 | }else { // no autoMime | 982 | }else { // no autoMime |
1146 | // let the mimetype be set from out side the m_mimeCheck FEATURE | 983 | // let the mimetype be set from out side the m_mimeCheck FEATURE |
1147 | 984 | ||
1148 | if( m_shChooser ){ | 985 | if( m_shChooser ) |
1149 | currentMimeType = m_mimeCheck->currentText(); | 986 | currentMimeType = m_mimeCheck->currentText(); |
1150 | // updateMimeCheck(); | 987 | |
1151 | } | ||
1152 | } | 988 | } |
1153 | // now we got our mimetypes we can add the files | 989 | // now we got our mimetypes we can add the files |
1154 | 990 | ||
1155 | QDir dir( m_currentDir ); | 991 | currentLister()->reparse( m_currentDir ); |
992 | /* we're done with adding let's sort */ | ||
993 | currentView()->sort(); | ||
994 | |||
1156 | 995 | ||
1157 | int sort; | ||
1158 | if ( m_case ) | ||
1159 | sort = (QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed); | ||
1160 | else | ||
1161 | sort = (QDir::Name | QDir::DirsFirst | QDir::Reversed); | ||
1162 | dir.setSorting( sort ); | ||
1163 | |||
1164 | int filter; | ||
1165 | if( m_selector == ExtendedAll /*|| m_selector ==CUSTOM_ALL */ ){ | ||
1166 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | ||
1167 | }else | ||
1168 | filter = QDir::Files | QDir::Dirs | QDir::All; | ||
1169 | dir.setFilter( filter ); | ||
1170 | |||
1171 | // now go through all files | ||
1172 | const QFileInfoList *list = dir.entryInfoList(); | ||
1173 | QFileInfoListIterator it( *list ); | ||
1174 | QFileInfo *fi; | ||
1175 | while( (fi=it.current() ) ){ | ||
1176 | //qWarning("True and only" ); | ||
1177 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ | ||
1178 | //qWarning(".. or ." ); | ||
1179 | ++it; | ||
1180 | continue; | ||
1181 | } | ||
1182 | if( fi->isSymLink() ){ | ||
1183 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); | ||
1184 | for( int i = 0; i<=4; i++) { // 5 tries to prevent dos | ||
1185 | QFileInfo info( file ); | ||
1186 | if( !info.exists() ){ | ||
1187 | addSymlink( currentMimeType, fi, TRUE ); | ||
1188 | break; | ||
1189 | }else if( info.isDir() ){ | ||
1190 | addDir( currentMimeType, fi, TRUE ); | ||
1191 | break; | ||
1192 | }else if( info.isFile() ){ | ||
1193 | addFile( currentMimeType, fi, TRUE ); | ||
1194 | break; | ||
1195 | }else if( info.isSymLink() ){ | ||
1196 | file = info.dirPath(true ) + "/" + info.readLink() ; | ||
1197 | break; | ||
1198 | }else if( i == 4){ | ||
1199 | addSymlink( currentMimeType, fi ); | ||
1200 | } | ||
1201 | } // off for loop | ||
1202 | }else if( fi->isDir() ){ | ||
1203 | addDir( currentMimeType, fi ); | ||
1204 | }else if( fi->isFile() ){ | ||
1205 | addFile( currentMimeType, fi ); | ||
1206 | } | ||
1207 | //qWarning( "%s", fi->fileName().latin1() ); | ||
1208 | ++it; | ||
1209 | } // of while loop | ||
1210 | m_View->sort(); | ||
1211 | if( m_shTool ){ | 996 | if( m_shTool ){ |
1212 | m_location->insertItem( m_currentDir ); | 997 | m_location->insertItem( m_currentDir ); |
1213 | 998 | ||
1214 | } | 999 | } |
1215 | // reenable painting and updates | 1000 | // reenable painting and updates |
1216 | } | 1001 | } |
1217 | 1002 | ||
1218 | 1003 | ||
1219 | OFileView* OFileSelector::currentView() { | 1004 | OFileView* OFileSelector::currentView() { |
1220 | return 0l; | 1005 | return 0l; |
1221 | } | 1006 | } |
1222 | OFileView* OFileSelector::currentView() const{ | 1007 | OFileView* OFileSelector::currentView() const{ |
1223 | return 0l; | 1008 | return 0l; |
1224 | } | 1009 | } |
1225 | int OFileSelector::filter() { | 1010 | int OFileSelector::filter() { |
1226 | int filter; | 1011 | int filter; |
1227 | if ( m_selector == ExtendedAll ) | 1012 | if ( m_selector == ExtendedAll ) |
1228 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 1013 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; |
1229 | else | 1014 | else |
1230 | filter = QDir::Files | QDir::Dirs | QDir::All ; | 1015 | filter = QDir::Files | QDir::Dirs | QDir::All ; |
1231 | 1016 | ||
1232 | return filter; | 1017 | return filter; |
1233 | } | 1018 | } |
1234 | int OFileSelector::sorting() { | 1019 | int OFileSelector::sorting() { |
1235 | int sort; | 1020 | int sort; |
1236 | 1021 | ||
1237 | if (m_case ) | 1022 | if (m_case ) |
1238 | sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 1023 | sort = ( QDir::IgnoreCase | QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
1239 | else | 1024 | else |
1240 | sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); | 1025 | sort = ( QDir::Name | QDir::DirsFirst | QDir::Reversed ); |
1241 | 1026 | ||
1242 | return sort; | 1027 | return sort; |
1243 | } | 1028 | } |
1244 | void OFileSelector::internFileSelected( const QString& s) { | 1029 | void OFileSelector::internFileSelected( const QString& s) { |
1245 | emit fileSelected( s ); | 1030 | emit fileSelected( s ); |
1246 | } | 1031 | } |
1247 | void OFileSelector::internFileSelected( const DocLnk& d ) { | 1032 | void OFileSelector::internFileSelected( const DocLnk& d ) { |
1248 | emit fileSelected( d ); | 1033 | emit fileSelected( d ); |
1249 | } | 1034 | } |
1250 | void OFileSelector::internContextMenu() { | 1035 | void OFileSelector::internContextMenu() { |
1251 | emit contextMenu(); | 1036 | emit contextMenu(); |
1252 | } | 1037 | } |
1253 | void OFileSelector::internChangedDir( const QString& s) { | 1038 | void OFileSelector::internChangedDir( const QString& s) { |
1254 | emit dirSelected( s ); | 1039 | emit dirSelected( s ); |
1040 | cd(s ); | ||
1255 | } | 1041 | } |
1256 | void OFileSelector::internChangedDir( const QDir& s) { | 1042 | void OFileSelector::internChangedDir( const QDir& s) { |
1257 | emit dirSelected( s ); | 1043 | emit dirSelected( s ); |
1258 | } | 1044 | } |
1259 | QPixmap OFileSelector::pixmap( const QString& s ) { | 1045 | QPixmap OFileSelector::pixmap( const QString& s ) { |
1260 | 1046 | ||
1261 | return (*m_pixmaps)[s]; | 1047 | return (*m_pixmaps)[s]; |
1262 | } | 1048 | } |
1049 | OLister* OFileSelector::currentLister()const { | ||
1050 | return 0l; | ||
1051 | } | ||
diff --git a/libopie/ofileselector/ofileselector.h b/libopie/ofileselector/ofileselector.h index 12af732..a7b363f 100644 --- a/libopie/ofileselector/ofileselector.h +++ b/libopie/ofileselector/ofileselector.h | |||
@@ -1,476 +1,475 @@ | |||
1 | /* | 1 | /* |
2 | This is based on code and ideas of | 2 | This is based on code and ideas of |
3 | L. J. Potter ljp@llornkcor.com | 3 | L. J. Potter ljp@llornkcor.com |
4 | Thanks a lot | 4 | Thanks a lot |
5 | 5 | ||
6 | 6 | ||
7 | =. This file is part of the OPIE Project | 7 | =. This file is part of the OPIE Project |
8 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 8 | .=l. Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This library is free software; you can | 10 | _;:, .> :=|. This library is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This library is distributed in the hope that | 17 | .i_,=:_. -<s. This library is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #ifndef opiefileselector_h | 34 | #ifndef opiefileselector_h |
35 | #define opiefileselector_h | 35 | #define opiefileselector_h |
36 | 36 | ||
37 | #include <qpe/fileselector.h> | 37 | #include <qpe/fileselector.h> |
38 | 38 | ||
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qwidget.h> | 40 | #include <qwidget.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qpixmap.h> | 42 | #include <qpixmap.h> |
43 | #include <qstringlist.h> | 43 | #include <qstringlist.h> |
44 | #include <qmap.h> | 44 | #include <qmap.h> |
45 | #include <qvaluelist.h> | 45 | #include <qvaluelist.h> |
46 | 46 | ||
47 | #include <qpe/applnk.h> | 47 | #include <qpe/applnk.h> |
48 | #include <qlistview.h> | 48 | #include <qlistview.h> |
49 | 49 | ||
50 | /** This is OPIEs FileDialog Widget. You can use it | 50 | /** This is OPIEs FileDialog Widget. You can use it |
51 | * as a dropin replacement of the fileselector and | 51 | * as a dropin replacement of the fileselector and |
52 | * or use any of the new features. | 52 | * or use any of the new features. |
53 | * This is also a complete FileSave and FileLoad widget | 53 | * This is also a complete FileSave and FileLoad widget |
54 | * If you look for a Dialog check OFileDialog | 54 | * If you look for a Dialog check OFileDialog |
55 | * | 55 | * |
56 | */ | 56 | */ |
57 | class DocLnk; | 57 | class DocLnk; |
58 | class QCheckBox; | 58 | class QCheckBox; |
59 | class QComboBox; | 59 | class QComboBox; |
60 | class QPushButton; | 60 | class QPushButton; |
61 | class QGridLayout; | 61 | class QGridLayout; |
62 | class QLineEdit; | 62 | class QLineEdit; |
63 | class QLabel; | 63 | class QLabel; |
64 | class QWidgetStack; | 64 | class QWidgetStack; |
65 | class QHBoxLayout; | 65 | class QHBoxLayout; |
66 | class QVBoxLayout; | 66 | class QVBoxLayout; |
67 | class QPopupMenu; | 67 | class QPopupMenu; |
68 | class QFileInfo; | 68 | class QFileInfo; |
69 | class QHBox; | 69 | class QHBox; |
70 | class OFileView; | 70 | class OFileView; |
71 | class OLister; | ||
71 | // | 72 | // |
72 | 73 | ||
73 | /* the mimetypes one name and a list of mimetypes */ | 74 | /* the mimetypes one name and a list of mimetypes */ |
74 | typedef QMap< QString, QStringList> MimeTypes; | 75 | typedef QMap< QString, QStringList> MimeTypes; |
75 | 76 | ||
76 | /** | 77 | /** |
77 | * FIXME later | 78 | * FIXME later |
78 | */ | 79 | */ |
79 | struct OPopupMenuFactory { | 80 | struct OPopupMenuFactory { |
80 | OPopupMenuFactory() {} | 81 | OPopupMenuFactory() {} |
81 | 82 | ||
82 | }; | 83 | }; |
83 | 84 | ||
84 | 85 | ||
85 | /** | 86 | /** |
86 | * Opie the default OFileSelector | 87 | * Opie the default OFileSelector |
87 | * It features multiple views. | 88 | * It features multiple views. |
88 | */ | 89 | */ |
89 | class OFileSelector : public QWidget { | 90 | class OFileSelector : public QWidget { |
90 | Q_OBJECT | 91 | Q_OBJECT |
91 | 92 | ||
92 | /* friends are evil but I don't want to make the | 93 | /* friends are evil but I don't want to make the |
93 | * methods public | 94 | * methods public |
94 | */ | 95 | */ |
95 | friend class OLister; | 96 | friend class OLister; |
96 | friend class OFileView; | 97 | friend class OFileView; |
97 | public: | 98 | public: |
98 | /** | 99 | /** |
99 | * The mode of the file selector | 100 | * The mode of the file selector |
100 | * Either open, save, fileselector or dir browsing mode | 101 | * Either open, save, fileselector or dir browsing mode |
101 | * | 102 | * |
102 | */ | 103 | */ |
103 | enum Mode {Open = 1, Save = 2, Fileselector = 4, Dir = 8 }; | 104 | enum Mode {Open = 1, Save = 2, Fileselector = 4, Dir = 8 }; |
104 | 105 | ||
105 | /** | 106 | /** |
106 | * Selector. Either Normal for the one shipped with | 107 | * Selector. Either Normal for the one shipped with |
107 | * libqpe or Extended. for the Extended | 108 | * libqpe or Extended. for the Extended |
108 | * ExtendedAll also shows 'hidden' files | 109 | * ExtendedAll also shows 'hidden' files |
109 | */ | 110 | */ |
110 | enum Selector{Normal=0, Extended = 1, ExtendedAll =2 }; | 111 | enum Selector{Normal=0, Extended = 1, ExtendedAll =2 }; |
111 | 112 | ||
112 | /** | 113 | /** |
113 | * This is reserved for futrue views | 114 | * This is reserved for futrue views |
114 | */ | 115 | */ |
115 | enum View { Dirs = 1, Files = 2, Tree = 4, Icon = 8 }; | 116 | enum View { Dirs = 1, Files = 2, Tree = 4, Icon = 8 }; |
116 | 117 | ||
117 | /** | 118 | /** |
118 | * A c'tor which should be used for advanced mode | 119 | * A c'tor which should be used for advanced mode |
119 | * @param wid the parent | 120 | * @param wid the parent |
120 | * @param mode the Mode of the Selector | 121 | * @param mode the Mode of the Selector |
121 | * @param selector the current View of the Selector | 122 | * @param selector the current View of the Selector |
122 | * @param dirName in which dir to start | 123 | * @param dirName in which dir to start |
123 | * @param fileName a proposed filename | 124 | * @param fileName a proposed filename |
124 | * @param mimetypes A list of mimetypes \ | 125 | * @param mimetypes A list of mimetypes \ |
125 | * QString is for a identifier name like "Text files" | 126 | * QString is for a identifier name like "Text files" |
126 | * the coresponding QStringList is used for the mimetypes | 127 | * the coresponding QStringList is used for the mimetypes |
127 | * if empty it'll fill the list of mimetypes depending | 128 | * if empty it'll fill the list of mimetypes depending |
128 | * on the content of the current directory | 129 | * on the content of the current directory |
129 | */ | 130 | */ |
130 | 131 | ||
131 | OFileSelector(QWidget *wid, int mode, int selector, | 132 | OFileSelector(QWidget *wid, int mode, int selector, |
132 | const QString &dirName, | 133 | const QString &dirName, |
133 | const QString &fileName = QString::null, | 134 | const QString &fileName = QString::null, |
134 | const MimeTypes &mimetypes = MimeTypes() ); | 135 | const MimeTypes &mimetypes = MimeTypes() ); |
135 | 136 | ||
136 | 137 | ||
137 | /** | 138 | /** |
138 | * This is a QPE compatible c'tor | 139 | * This is a QPE compatible c'tor |
139 | */ | 140 | */ |
140 | OFileSelector(const QString &mimeFilter, QWidget *parent, | 141 | OFileSelector(const QString &mimeFilter, QWidget *parent, |
141 | const char *name, bool newVisible = TRUE, | 142 | const char *name, bool newVisible = TRUE, |
142 | bool closeVisible = FALSE ); | 143 | bool closeVisible = FALSE ); |
143 | 144 | ||
144 | ~OFileSelector(); | 145 | ~OFileSelector(); |
145 | 146 | ||
146 | // currently only for the FileSelector Mode | 147 | // currently only for the FileSelector Mode |
147 | /* compability mode but only work | 148 | /* compability mode but only work |
148 | * with FileSelector | 149 | * with FileSelector |
149 | */ | 150 | */ |
150 | void setNewVisible( bool /*b*/ ); | 151 | void setNewVisible( bool /*b*/ ); |
151 | void setCloseVisible(bool /*b*/ ); | 152 | void setCloseVisible(bool /*b*/ ); |
152 | 153 | ||
153 | // end file selector mode | 154 | // end file selector mode |
154 | // deprecated | 155 | // deprecated |
155 | void reread(); | 156 | void reread(); |
156 | // make sure not to leak please | 157 | // make sure not to leak please |
157 | const DocLnk *selected(); | 158 | const DocLnk *selected(); |
158 | // end deprecated | 159 | // end deprecated |
159 | 160 | ||
160 | /** | 161 | /** |
161 | * @return if the toolbar is visible | 162 | * @return if the toolbar is visible |
162 | */ | 163 | */ |
163 | bool isToolbarVisible() const { return m_shTool; }; | 164 | bool isToolbarVisible() const { return m_shTool; }; |
164 | 165 | ||
165 | /** | 166 | /** |
166 | * @return if the permissionBas is visible | 167 | * @return if the permissionBas is visible |
167 | */ | 168 | */ |
168 | bool isPermissionBarVisible() const { return m_shPerm; }; | 169 | bool isPermissionBarVisible() const { return m_shPerm; }; |
169 | 170 | ||
170 | /** | 171 | /** |
171 | * @return if the lineEdit is visible | 172 | * @return if the lineEdit is visible |
172 | */ | 173 | */ |
173 | bool isLineEditVisible()const { return m_shLne; }; | 174 | bool isLineEditVisible()const { return m_shLne; }; |
174 | 175 | ||
175 | /** | 176 | /** |
176 | * if the chooser is visible | 177 | * if the chooser is visible |
177 | */ | 178 | */ |
178 | bool isChooserVisible( )const { return m_shChooser; }; | 179 | bool isChooserVisible( )const { return m_shChooser; }; |
179 | 180 | ||
180 | /** | 181 | /** |
181 | * @return if the yesCancel Bar is visible | 182 | * @return if the yesCancel Bar is visible |
182 | */ | 183 | */ |
183 | bool isYesCancelVisible()const { return m_shYesNo; }; | 184 | bool isYesCancelVisible()const { return m_shYesNo; }; |
184 | 185 | ||
185 | /** | 186 | /** |
186 | * set Yes/Cancel visible | 187 | * set Yes/Cancel visible |
187 | */ | 188 | */ |
188 | void setYesCancelVisible( bool show ); | 189 | void setYesCancelVisible( bool show ); |
189 | 190 | ||
190 | /** | 191 | /** |
191 | * set the toolbar visible | 192 | * set the toolbar visible |
192 | */ | 193 | */ |
193 | void setToolbarVisible( bool show ); | 194 | void setToolbarVisible( bool show ); |
194 | 195 | ||
195 | /** | 196 | /** |
196 | * set the permissionBar to be visible | 197 | * set the permissionBar to be visible |
197 | */ | 198 | */ |
198 | void setPermissionBarVisible( bool show ); | 199 | void setPermissionBarVisible( bool show ); |
199 | 200 | ||
200 | /** | 201 | /** |
201 | * set the lineedit for file entering visible | 202 | * set the lineedit for file entering visible |
202 | */ | 203 | */ |
203 | void setLineEditVisible(bool show) ; | 204 | void setLineEditVisible(bool show) ; |
204 | 205 | ||
205 | /** | 206 | /** |
206 | * set the chooser is visible | 207 | * set the chooser is visible |
207 | */ | 208 | */ |
208 | void setChooserVisible( bool chooser ); | 209 | void setChooserVisible( bool chooser ); |
209 | 210 | ||
210 | /** | 211 | /** |
211 | * The permissionCheckbox | 212 | * The permissionCheckbox |
212 | * | 213 | * |
213 | */ | 214 | */ |
214 | QCheckBox* permissionCheckbox(); | 215 | QCheckBox* permissionCheckbox(); |
215 | 216 | ||
216 | /** | 217 | /** |
217 | * setPermission | 218 | * setPermission |
218 | */ | 219 | */ |
219 | bool setPermission() const; | 220 | bool setPermission() const; |
220 | 221 | ||
221 | /** | 222 | /** |
222 | * set ther permission to bool | 223 | * set ther permission to bool |
223 | */ | 224 | */ |
224 | void setPermissionChecked( bool check ); | 225 | void setPermissionChecked( bool check ); |
225 | 226 | ||
226 | /** | 227 | /** |
227 | * set the Selector Mode | 228 | * set the Selector Mode |
228 | */ | 229 | */ |
229 | void setMode( int ); | 230 | void setMode( int ); |
230 | 231 | ||
231 | /** | 232 | /** |
232 | * whether or not to show dirs | 233 | * whether or not to show dirs |
233 | */ | 234 | */ |
234 | bool showDirs()const { return m_dir; } | 235 | bool showDirs()const { return m_dir; } |
235 | 236 | ||
236 | /** | 237 | /** |
237 | * setShowDirs | 238 | * setShowDirs |
238 | */ | 239 | */ |
239 | void setShowDirs(bool ); | 240 | void setShowDirs(bool ); |
240 | 241 | ||
241 | /** | 242 | /** |
242 | * set CaseSensetive | 243 | * set CaseSensetive |
243 | */ | 244 | */ |
244 | bool isCaseSensetive()const { return m_case; } | 245 | bool isCaseSensetive()const { return m_case; } |
245 | 246 | ||
246 | /** | 247 | /** |
247 | * set if to be case sensetive | 248 | * set if to be case sensetive |
248 | */ | 249 | */ |
249 | void setCaseSensetive(bool caSe ); | 250 | void setCaseSensetive(bool caSe ); |
250 | 251 | ||
251 | /** | 252 | /** |
252 | * @return if to show files | 253 | * @return if to show files |
253 | */ | 254 | */ |
254 | bool showFiles()const { return m_files; }; | 255 | bool showFiles()const { return m_files; }; |
255 | 256 | ||
256 | /** | 257 | /** |
257 | * set if files should be shown | 258 | * set if files should be shown |
258 | */ | 259 | */ |
259 | void setShowFiles(bool ); | 260 | void setShowFiles(bool ); |
260 | 261 | ||
261 | /** | 262 | /** |
262 | * change dir to path | 263 | * change dir to path |
263 | */ | 264 | */ |
264 | bool cd(const QString &path ); | 265 | bool cd(const QString &path ); |
265 | 266 | ||
266 | 267 | ||
267 | /** | 268 | /** |
268 | * return the mode of the fileselector | 269 | * return the mode of the fileselector |
269 | */ | 270 | */ |
270 | int mode()const { return m_mode; }; | 271 | int mode()const { return m_mode; }; |
271 | 272 | ||
272 | /** | 273 | /** |
273 | * return the selector | 274 | * return the selector |
274 | */ | 275 | */ |
275 | int selector()const { return m_selector; }; | 276 | int selector()const { return m_selector; }; |
276 | 277 | ||
277 | /** | 278 | /** |
278 | * set the Selector | 279 | * set the Selector |
279 | */ | 280 | */ |
280 | void setSelector( int ); | 281 | void setSelector( int ); |
281 | 282 | ||
282 | /** | 283 | /** |
283 | * wether or not to show popups | 284 | * wether or not to show popups |
284 | */ | 285 | */ |
285 | bool showPopup()const { return m_showPopup; }; | 286 | bool showPopup()const { return m_showPopup; }; |
286 | 287 | ||
287 | /** | 288 | /** |
288 | * set show popups | 289 | * set show popups |
289 | */ | 290 | */ |
290 | void setShowPopup( bool pop ) { m_showPopup = pop; } | 291 | void setShowPopup( bool pop ) { m_showPopup = pop; } |
291 | 292 | ||
292 | /** | 293 | /** |
293 | * set the popup factory | 294 | * set the popup factory |
294 | */ | 295 | */ |
295 | void setPopupFactory( OPopupMenuFactory * ); | 296 | void setPopupFactory( OPopupMenuFactory * ); |
296 | 297 | ||
297 | /** | 298 | /** |
298 | * reparse the current directory and updates | 299 | * reparse the current directory and updates |
299 | * the views + mimetypes | 300 | * the views + mimetypes |
300 | */ | 301 | */ |
301 | void reparse(); // re reads the dir | 302 | void reparse(); // re reads the dir |
302 | 303 | ||
303 | /** | 304 | /** |
304 | * return the selected name | 305 | * return the selected name |
305 | */ | 306 | */ |
306 | QString selectedName( )const; | 307 | QString selectedName( )const; |
307 | 308 | ||
308 | /** | 309 | /** |
309 | * for multiple selections return multiple | 310 | * for multiple selections return multiple |
310 | * filenames | 311 | * filenames |
311 | */ | 312 | */ |
312 | QStringList selectedNames()const; | 313 | QStringList selectedNames()const; |
313 | 314 | ||
314 | /** | 315 | /** |
315 | * return the complete to the file | 316 | * return the complete to the file |
316 | */ | 317 | */ |
317 | QString selectedPath() const; | 318 | QString selectedPath() const; |
318 | 319 | ||
319 | /** | 320 | /** |
320 | * return the completed paths | 321 | * return the completed paths |
321 | */ | 322 | */ |
322 | QStringList selectedPaths() const; | 323 | QStringList selectedPaths() const; |
323 | 324 | ||
324 | /** | 325 | /** |
325 | * the current directory | 326 | * the current directory |
326 | */ | 327 | */ |
327 | QString directory()const; | 328 | QString directory()const; |
328 | 329 | ||
329 | /** | 330 | /** |
330 | * fileCount | 331 | * fileCount |
331 | */ | 332 | */ |
332 | int fileCount(); | 333 | int fileCount(); |
333 | 334 | ||
334 | DocLnk selectedDocument()const; | 335 | DocLnk selectedDocument()const; |
335 | 336 | ||
336 | QValueList<DocLnk> selectedDocuments()const; | 337 | QValueList<DocLnk> selectedDocuments()const; |
337 | 338 | ||
338 | OFileView* currentView(); | 339 | OFileView* currentView(); |
339 | OFileView* currentView()const; | 340 | OFileView* currentView()const; |
341 | OLister* currentLister()const; | ||
340 | int filter(); | 342 | int filter(); |
341 | int sorting(); | 343 | int sorting(); |
342 | QPixmap pixmap( const QString& ); | 344 | QPixmap pixmap( const QString& ); |
343 | 345 | ||
344 | signals: | 346 | signals: |
345 | void fileSelected( const DocLnk & ); | 347 | void fileSelected( const DocLnk & ); |
346 | void fileSelected( const QString & ); | 348 | void fileSelected( const QString & ); |
347 | void dirSelected(const QString &dir ); | 349 | void dirSelected(const QString &dir ); |
348 | void dirSelected( const QDir& ); | 350 | void dirSelected( const QDir& ); |
349 | void closeMe(); | 351 | void closeMe(); |
350 | void ok(); | 352 | void ok(); |
351 | void cancel(); | 353 | void cancel(); |
352 | void contextMenu(); | 354 | void contextMenu(); |
353 | 355 | ||
354 | private slots: | 356 | private slots: |
355 | void slotOk(); | 357 | void slotOk(); |
356 | void slotCancel(); | 358 | void slotCancel(); |
357 | void slotViewCheck(const QString & ); | 359 | void slotViewCheck(const QString & ); |
358 | void slotMimeCheck(const QString & ); | 360 | void slotMimeCheck(const QString & ); |
359 | void slotLocationActivated(const QString & ); | 361 | void slotLocationActivated(const QString & ); |
360 | void slotInsertLocationPath(const QString &, int); | 362 | void slotInsertLocationPath(const QString &, int); |
361 | void locationComboChanged(); | 363 | void locationComboChanged(); |
362 | 364 | ||
363 | private: | 365 | private: |
364 | void init(); | 366 | void init(); |
365 | void updateMimes(); | 367 | void updateMimes(); |
366 | 368 | ||
367 | 369 | ||
368 | private: | 370 | private: |
369 | 371 | ||
370 | FileSelector* m_select; | 372 | FileSelector* m_select; |
371 | int m_mode, m_selector; | 373 | int m_mode, m_selector; |
372 | QComboBox *m_location, *m_mimeCheck, *m_viewCheck; | 374 | QComboBox *m_location, |
373 | QPushButton *m_homeButton, *m_docButton, *m_hideButton, *m_ok, *m_cancel; | 375 | *m_mimeCheck, |
374 | QPushButton *m_reread, *m_up, *m_new, *m_close; | 376 | *m_viewCheck; |
377 | |||
378 | QPushButton *m_homeButton, | ||
379 | *m_docButton, | ||
380 | *m_hideButton, | ||
381 | *m_ok, *m_cancel; | ||
382 | QPushButton *m_reread, | ||
383 | *m_up, | ||
384 | *m_new, | ||
385 | *m_close; | ||
375 | QListView *m_View; | 386 | QListView *m_View; |
376 | QCheckBox *m_checkPerm; | 387 | QCheckBox *m_checkPerm; |
377 | QWidget *m_pseudo; | 388 | QWidget *m_pseudo; |
378 | QVBoxLayout *m_pseudoLayout; | 389 | QVBoxLayout *m_pseudoLayout; |
379 | 390 | ||
380 | QString m_currentDir; | 391 | QString m_currentDir; |
381 | QString m_name; | 392 | QString m_name; |
382 | // QStringList m_mimetypes; | ||
383 | QMap<QString, QStringList> m_mimetypes; | 393 | QMap<QString, QStringList> m_mimetypes; |
384 | 394 | ||
385 | 395 | ||
386 | QWidgetStack *m_stack; | 396 | QWidgetStack *m_stack; |
387 | QVBoxLayout *m_lay; | 397 | QVBoxLayout *m_lay; |
388 | QGridLayout *m_Oselector; | 398 | QGridLayout *m_Oselector; |
389 | 399 | ||
390 | QHBox *m_boxToolbar; | 400 | QHBox *m_boxToolbar; |
391 | QHBox *m_boxOk; // (no layout anymore) wait | 401 | QHBox *m_boxOk; |
392 | QHBox *m_boxName; // (no Layout anymore) wait | 402 | QHBox *m_boxName; |
393 | QHBox *m_boxView; | 403 | QHBox *m_boxView; |
394 | 404 | ||
395 | QPopupMenu *m_custom; | 405 | QPopupMenu *m_custom; |
396 | 406 | ||
397 | QLineEdit *m_edit; | 407 | QLineEdit *m_edit; |
398 | QLabel *m_fnLabel; | 408 | QLabel *m_fnLabel; |
399 | 409 | ||
400 | bool m_shClose : 1; | 410 | bool m_shClose : 1; |
401 | bool m_shNew : 1; | 411 | bool m_shNew : 1; |
402 | bool m_shTool : 1; | 412 | bool m_shTool : 1; |
403 | bool m_shPerm : 1; | 413 | bool m_shPerm : 1; |
404 | bool m_shLne : 1; | 414 | bool m_shLne : 1; |
405 | bool m_shChooser : 1; | 415 | bool m_shChooser : 1; |
406 | bool m_shYesNo : 1; | 416 | bool m_shYesNo : 1; |
407 | bool m_boCheckPerm : 1; | 417 | bool m_boCheckPerm : 1; |
408 | bool m_autoMime : 1; | 418 | bool m_autoMime : 1; |
409 | bool m_case : 1; | 419 | bool m_case : 1; |
410 | bool m_dir : 1; | 420 | bool m_dir : 1; |
411 | bool m_files : 1; | 421 | bool m_files : 1; |
412 | bool m_showPopup : 1; | 422 | bool m_showPopup : 1; |
413 | 423 | ||
414 | void initVars(); | 424 | void initVars(); |
415 | virtual void addFile(const QString &mime, QFileInfo *info, bool symlink = FALSE ); | 425 | |
416 | virtual void addDir( const QString &mime, QFileInfo *info , bool symlink = FALSE ); | ||
417 | virtual void addSymlink(const QString &, QFileInfo *, bool = FALSE ){}; | ||
418 | void delItems(); | 426 | void delItems(); |
419 | void initializeName(); | 427 | void initializeName(); |
420 | void initializeYes(); | 428 | void initializeYes(); |
421 | void initializeChooser(); | 429 | void initializeChooser(); |
422 | void initializeListView(); | 430 | void initializeListView(); |
423 | void initializePerm(); | 431 | void initializePerm(); |
424 | void initPics(); | 432 | void initPics(); |
425 | bool compliesMime(const QString &path, | 433 | bool compliesMime(const QString &path, |
426 | const QString &mime); | 434 | const QString &mime); |
427 | bool compliesMime(const QString& mime ); | 435 | bool compliesMime(const QString& mime ); |
428 | /** | 436 | /** |
429 | * Updates the QComboBox with the current mimetypes | 437 | * Updates the QComboBox with the current mimetypes |
430 | */ | 438 | */ |
431 | void updateMimeCheck(); | 439 | void updateMimeCheck(); |
432 | 440 | ||
433 | /** | 441 | /** |
434 | * Returns the current mimetype | 442 | * Returns the current mimetype |
435 | */ | 443 | */ |
436 | QString currentMimeType()const; | 444 | QString currentMimeType()const; |
437 | class OFileSelectorPrivate; | 445 | class OFileSelectorPrivate; |
438 | OFileSelectorPrivate *d; | 446 | OFileSelectorPrivate *d; |
439 | static QMap<QString,QPixmap> *m_pixmaps; | 447 | static QMap<QString,QPixmap> *m_pixmaps; |
440 | 448 | ||
441 | private slots: | 449 | private slots: |
442 | void slotFileSelected(const QString & ); // not really meant to be a slot | 450 | void slotFileSelected(const QString & ); // not really meant to be a slot |
443 | void slotFileBridgeSelected( const DocLnk & ); | 451 | void slotFileBridgeSelected( const DocLnk & ); |
444 | virtual void slotSelectionChanged(); | ||
445 | virtual void slotCurrentChanged(QListViewItem* ); | ||
446 | virtual void slotClicked( int, QListViewItem *item, const QPoint &, int); | ||
447 | virtual void slotRightButton(int, QListViewItem *, const QPoint &, int ); | ||
448 | virtual void slotContextMenu( QListViewItem *item); | ||
449 | // listview above | 452 | // listview above |
450 | // popup below | 453 | // popup below |
451 | virtual void slotChangedDir(); | ||
452 | virtual void slotOpen(); | ||
453 | virtual void slotRescan(); | ||
454 | virtual void slotRename(); | ||
455 | virtual void slotDelete(); | 454 | virtual void slotDelete(); |
456 | virtual void cdUP(); | 455 | virtual void cdUP(); |
457 | virtual void slotHome(); | 456 | virtual void slotHome(); |
458 | virtual void slotDoc(); | 457 | virtual void slotDoc(); |
459 | virtual void slotNavigate( ); | 458 | virtual void slotNavigate( ); |
460 | 459 | ||
461 | /* for OLister */ | 460 | /* for OLister */ |
462 | private: | 461 | private: |
463 | 462 | ||
464 | /* for OFileView */ | 463 | /* for OFileView */ |
465 | private: | 464 | private: |
466 | void internFileSelected( const QString& ); | 465 | void internFileSelected( const QString& ); |
467 | void internFileSelected( const DocLnk& ); | 466 | void internFileSelected( const DocLnk& ); |
468 | void internContextMenu(); | 467 | void internContextMenu(); |
469 | void internChangedDir( const QString& ); | 468 | void internChangedDir( const QString& ); |
470 | void internChangedDir( const QDir& ) ; | 469 | void internChangedDir( const QDir& ) ; |
471 | 470 | ||
472 | }; | 471 | }; |
473 | 472 | ||
474 | 473 | ||
475 | #endif | 474 | #endif |
476 | 475 | ||
diff --git a/libopie/ofileselector/ofileview.cpp b/libopie/ofileselector/ofileview.cpp index 9bb40c9..38f722c 100644 --- a/libopie/ofileselector/ofileview.cpp +++ b/libopie/ofileselector/ofileview.cpp | |||
@@ -1,31 +1,36 @@ | |||
1 | #include <qlineedit.h> | ||
2 | |||
1 | #include <qpe/applnk.h> | 3 | #include <qpe/applnk.h> |
2 | 4 | ||
3 | #include "ofileselector.h" | 5 | #include "ofileselector.h" |
4 | |||
5 | #include "ofileview.h" | 6 | #include "ofileview.h" |
6 | 7 | ||
7 | 8 | ||
8 | OFileView::OFileView( OFileSelector* sel) | 9 | OFileView::OFileView( OFileSelector* sel) |
9 | : m_sel( sel ) | 10 | : m_sel( sel ) |
10 | { | 11 | { |
11 | } | 12 | } |
12 | OFileView::~OFileView() { | 13 | OFileView::~OFileView() { |
13 | } | 14 | } |
14 | void OFileView::fileSelected( const QString& s ) { | 15 | void OFileView::fileSelected( const QString& s ) { |
15 | m_sel->internFileSelected( s ); | 16 | m_sel->internFileSelected( s ); |
16 | } | 17 | } |
17 | void OFileView::fileSelected( const DocLnk& s) { | 18 | void OFileView::fileSelected( const DocLnk& s) { |
18 | m_sel->internFileSelected( s ); | 19 | m_sel->internFileSelected( s ); |
19 | } | 20 | } |
20 | void OFileView::contextMenu() { | 21 | void OFileView::contextMenu() { |
21 | m_sel->internContextMenu(); | 22 | m_sel->internContextMenu(); |
22 | } | 23 | } |
23 | void OFileView::changedDir( const QString& s) { | 24 | void OFileView::changedDir( const QString& s) { |
24 | m_sel->internChangedDir( s ); | 25 | m_sel->internChangedDir( s ); |
25 | } | 26 | } |
26 | void OFileView::changedDir( const QDir& d ) { | 27 | void OFileView::changedDir( const QDir& d ) { |
27 | m_sel->internChangedDir( d ); | 28 | m_sel->internChangedDir( d ); |
28 | } | 29 | } |
29 | OFileSelector* OFileView::selector() const { | 30 | OFileSelector* OFileView::selector() const { |
30 | return m_sel; | 31 | return m_sel; |
31 | } | 32 | } |
33 | void OFileView::updateLine( const QString& str ) { | ||
34 | if (m_sel->m_shLne ) | ||
35 | m_sel->m_edit->setText( str ); | ||
36 | } | ||
diff --git a/libopie/ofileselector/ofileview.h b/libopie/ofileselector/ofileview.h index 1b397f5..a4b1748 100644 --- a/libopie/ofileselector/ofileview.h +++ b/libopie/ofileselector/ofileview.h | |||
@@ -1,109 +1,111 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> | 3 | .=l. Copyright (c) 2002 zecke <zecke@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef ofileview_h | 29 | #ifndef ofileview_h |
30 | #define ofileview_h | 30 | #define ofileview_h |
31 | 31 | ||
32 | #include <qobject.h> | 32 | #include <qobject.h> |
33 | #include <qwidget.h> | 33 | #include <qwidget.h> |
34 | #include <qpopupmenu.h> | 34 | #include <qpopupmenu.h> |
35 | 35 | ||
36 | class QFileInfo; | 36 | class QFileInfo; |
37 | class QDir; | 37 | class QDir; |
38 | class DocLnk; | 38 | class DocLnk; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * A OFileView is a specialised View for the | 41 | * A OFileView is a specialised View for the |
42 | * OFileSelector | 42 | * OFileSelector |
43 | * With a View you can chage the user visible | 43 | * With a View you can chage the user visible |
44 | * representation of a OFileLister | 44 | * representation of a OFileLister |
45 | * OFileView is just a basic interface which helps you to | 45 | * OFileView is just a basic interface which helps you to |
46 | * write new views | 46 | * write new views |
47 | */ | 47 | */ |
48 | class OFileSelector; | 48 | class OFileSelector; |
49 | class OFileView { | 49 | class OFileView { |
50 | public: | 50 | public: |
51 | OFileView( OFileSelector* ); | 51 | OFileView( OFileSelector* ); |
52 | OFileView(); | 52 | OFileView(); |
53 | virtual ~OFileView(); | 53 | virtual ~OFileView(); |
54 | 54 | ||
55 | virtual void clear() = 0; | 55 | virtual void clear() = 0; |
56 | virtual void addFile(const QString &mine, | 56 | virtual void addFile(const QString &mine, |
57 | QFileInfo *info, | 57 | QFileInfo *info, |
58 | bool isSymlink = FALSE ) = 0; | 58 | bool isSymlink = FALSE ) = 0; |
59 | virtual void addFile(const QString& mine, const QString& dir, | 59 | virtual void addFile(const QString& mine, const QString& dir, |
60 | const QString& file, bool = FALSE ) = 0; | 60 | const QString& file, bool = FALSE ) = 0; |
61 | 61 | ||
62 | virtual void addDir (const QString &mine, | 62 | virtual void addDir (const QString &mine, |
63 | QFileInfo *info, | 63 | QFileInfo *info, |
64 | bool isSymlink = FALSE ) = 0; | 64 | bool isSymlink = FALSE ) = 0; |
65 | virtual void addDir (const QString& mine, const QString& dir, | 65 | virtual void addDir (const QString& mine, const QString& dir, |
66 | const QString& file, bool = FALSE) = 0; | 66 | const QString& file, bool = FALSE) = 0; |
67 | 67 | ||
68 | virtual void addSymlink(const QString &mime, | 68 | virtual void addSymlink(const QString &mime, |
69 | QFileInfo *info, | 69 | QFileInfo *info, |
70 | bool isSymlink = FALSE ) = 0; | 70 | bool isSymlink = FALSE ) = 0; |
71 | virtual void addSymlink(const QString& mine, | 71 | virtual void addSymlink(const QString& mine, |
72 | const QString& path, | 72 | const QString& path, |
73 | const QString& file, | 73 | const QString& file, |
74 | bool isSymlink = FALSE ) = 0; | 74 | bool isSymlink = FALSE ) = 0; |
75 | 75 | ||
76 | virtual void cd(const QString &path ) = 0; | 76 | virtual void cd(const QString &path ) = 0; |
77 | virtual QWidget* widget() = 0; | 77 | virtual QWidget* widget() = 0; |
78 | 78 | ||
79 | virtual QString selectedName()const = 0; | 79 | virtual QString selectedName()const = 0; |
80 | virtual QStringList selectedNames()const = 0; | 80 | virtual QStringList selectedNames()const = 0; |
81 | virtual QString selectedPath()const = 0; | 81 | virtual QString selectedPath()const = 0; |
82 | virtual QStringList selectedPaths()const = 0; | 82 | virtual QStringList selectedPaths()const = 0; |
83 | virtual int fileCount() = 0; | 83 | virtual int fileCount() = 0; |
84 | virtual void sort() =0; | ||
84 | 85 | ||
85 | /*signals:*/ | 86 | /*signals:*/ |
86 | protected: | 87 | protected: |
87 | 88 | ||
88 | void fileSelected(const QString &); | 89 | void fileSelected(const QString &); |
89 | void fileSelected(const DocLnk & ); | 90 | void fileSelected(const DocLnk & ); |
90 | void contextMenu(); | 91 | void contextMenu(); |
91 | void changedDir(const QString &); | 92 | void changedDir(const QString &); |
92 | void changedDir(const QDir & ); | 93 | void changedDir(const QDir & ); |
94 | void updateLine( const QString& ); | ||
93 | OFileSelector* selector()const; | 95 | OFileSelector* selector()const; |
94 | 96 | ||
95 | private: | 97 | private: |
96 | OFileSelector* m_sel; | 98 | OFileSelector* m_sel; |
97 | }; | 99 | }; |
98 | 100 | ||
99 | class OFileViewFactory { | 101 | class OFileViewFactory { |
100 | public: | 102 | public: |
101 | OFileViewFactory() {} ; | 103 | OFileViewFactory() {} ; |
102 | virtual ~OFileViewFactory() = 0; | 104 | virtual ~OFileViewFactory() = 0; |
103 | 105 | ||
104 | OFileView* newView(QWidget *parent, const char *name ); | 106 | OFileView* newView(QWidget *parent, const char *name ); |
105 | QString name()const; | 107 | QString name()const; |
106 | }; | 108 | }; |
107 | 109 | ||
108 | 110 | ||
109 | #endif | 111 | #endif |