summaryrefslogtreecommitdiffabout
path: root/microkde
Unidiff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/ofileselector_p.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index 488dee2..f4f112e 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -1,755 +1,755 @@
1#include <qcombobox.h> 1#include <qcombobox.h>
2#include <qdir.h> 2#include <qdir.h>
3#include <qhbox.h> 3#include <qhbox.h>
4#include <qheader.h> 4#include <qheader.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qlayout.h> 6#include <qlayout.h>
7#include <qlineedit.h> 7#include <qlineedit.h>
8#include <qlistview.h> 8#include <qlistview.h>
9#include <qpopupmenu.h> 9#include <qpopupmenu.h>
10#include <qwidgetstack.h> 10#include <qwidgetstack.h>
11#include <qregexp.h> 11#include <qregexp.h>
12#include <qobjectlist.h> 12#include <qobjectlist.h>
13 13
14/* hacky but we need to get FileSelector::filter */ 14/* hacky but we need to get FileSelector::filter */
15#define private public 15#define private public
16#include <qpe/fileselector.h> 16#include <qpe/fileselector.h>
17#undef private 17#undef private
18 18
19#include <qpe/qpeapplication.h> 19#include <qpe/qpeapplication.h>
20#include <qpe/mimetype.h> 20#include <qpe/mimetype.h>
21#include <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/storage.h> 22#include <qpe/storage.h>
23#include <kglobal.h> 23#include <kglobal.h>
24#include <klocale.h> 24#include <klocale.h>
25 25
26#include "ofileselector_p.h" 26#include "ofileselector_p.h"
27//US#include "ofileselector.h" 27//US#include "ofileselector.h"
28 28
29#include "klocale.h" 29#include "klocale.h"
30 30
31OFileViewInterface::OFileViewInterface( OFileSelector* selector ) 31OFileViewInterface::OFileViewInterface( OFileSelector* selector )
32 : m_selector( selector ) { 32 : m_selector( selector ) {
33} 33}
34OFileViewInterface::~OFileViewInterface() { 34OFileViewInterface::~OFileViewInterface() {
35} 35}
36QString OFileViewInterface::name()const{ 36QString OFileViewInterface::name()const{
37 return m_name; 37 return m_name;
38} 38}
39void OFileViewInterface::setName( const QString& name ) { 39void OFileViewInterface::setName( const QString& name ) {
40 m_name = name; 40 m_name = name;
41} 41}
42OFileSelector* OFileViewInterface::selector()const { 42OFileSelector* OFileViewInterface::selector()const {
43 return m_selector; 43 return m_selector;
44} 44}
45 45
46DocLnk OFileViewInterface::selectedDocument()const { 46DocLnk OFileViewInterface::selectedDocument()const {
47 return DocLnk( selectedName() ); 47 return DocLnk( selectedName() );
48} 48}
49 49
50bool OFileViewInterface::showNew()const { 50bool OFileViewInterface::showNew()const {
51 return selector()->showNew(); 51 return selector()->showNew();
52} 52}
53bool OFileViewInterface::showClose()const { 53bool OFileViewInterface::showClose()const {
54 return selector()->showClose(); 54 return selector()->showClose();
55} 55}
56MimeTypes OFileViewInterface::mimeTypes()const { 56MimeTypes OFileViewInterface::mimeTypes()const {
57 return selector()->mimeTypes(); 57 return selector()->mimeTypes();
58} 58}
59QStringList OFileViewInterface::currentMimeType()const { 59QStringList OFileViewInterface::currentMimeType()const {
60 return selector()->currentMimeType(); 60 return selector()->currentMimeType();
61} 61}
62void OFileViewInterface::activate( const QString& ) { 62void OFileViewInterface::activate( const QString& ) {
63 // not implemented here 63 // not implemented here
64} 64}
65void OFileViewInterface::ok() { 65void OFileViewInterface::ok() {
66 emit selector()->ok(); 66 emit selector()->ok();
67} 67}
68void OFileViewInterface::cancel() { 68void OFileViewInterface::cancel() {
69 emit selector()->cancel(); 69 emit selector()->cancel();
70} 70}
71void OFileViewInterface::closeMe() { 71void OFileViewInterface::closeMe() {
72 emit selector()->closeMe(); 72 emit selector()->closeMe();
73} 73}
74void OFileViewInterface::fileSelected( const QString& str) { 74void OFileViewInterface::fileSelected( const QString& str) {
75 emit selector()->fileSelected( str); 75 emit selector()->fileSelected( str);
76} 76}
77void OFileViewInterface::fileSelected( const DocLnk& lnk) { 77void OFileViewInterface::fileSelected( const DocLnk& lnk) {
78 emit selector()->fileSelected( lnk ); 78 emit selector()->fileSelected( lnk );
79} 79}
80void OFileViewInterface::setCurrentFileName( const QString& str ) { 80void OFileViewInterface::setCurrentFileName( const QString& str ) {
81 selector()->m_lneEdit->setText( str ); 81 selector()->m_lneEdit->setText( str );
82} 82}
83QString OFileViewInterface::currentFileName()const{ 83QString OFileViewInterface::currentFileName()const{
84 return selector()->m_lneEdit->text(); 84 return selector()->m_lneEdit->text();
85} 85}
86QString OFileViewInterface::startDirectory()const{ 86QString OFileViewInterface::startDirectory()const{
87 return selector()->m_startDir; 87 return selector()->m_startDir;
88} 88}
89 89
90 90
91ODocumentFileView::ODocumentFileView( OFileSelector* selector ) 91ODocumentFileView::ODocumentFileView( OFileSelector* selector )
92 : OFileViewInterface( selector ) { 92 : OFileViewInterface( selector ) {
93 m_selector = 0; 93 m_selector = 0;
94 setName( i18n("Documents") ); 94 setName( i18n("Documents") );
95} 95}
96ODocumentFileView::~ODocumentFileView() { 96ODocumentFileView::~ODocumentFileView() {
97 97
98} 98}
99QString ODocumentFileView::selectedName()const { 99QString ODocumentFileView::selectedName()const {
100 if (!m_selector) 100 if (!m_selector)
101 return QString::null; 101 return QString::null;
102 102
103 return m_selector->selected()->file(); 103 return m_selector->selected()->file();
104} 104}
105QString ODocumentFileView::selectedPath()const { 105QString ODocumentFileView::selectedPath()const {
106 return QPEApplication::documentDir(); 106 return QPEApplication::documentDir();
107} 107}
108QString ODocumentFileView::directory()const { 108QString ODocumentFileView::directory()const {
109 return selectedPath(); 109 return selectedPath();
110} 110}
111void ODocumentFileView::reread() { 111void ODocumentFileView::reread() {
112 if (!m_selector) 112 if (!m_selector)
113 return; 113 return;
114 114
115 m_selector->setNewVisible( showNew() ); 115 m_selector->setNewVisible( showNew() );
116 m_selector->setCloseVisible( showClose() ); 116 m_selector->setCloseVisible( showClose() );
117 m_selector->filter = currentMimeType().join(";"); 117 m_selector->filter = currentMimeType().join(";");
118 m_selector->reread(); 118 m_selector->reread();
119} 119}
120int ODocumentFileView::fileCount()const { 120int ODocumentFileView::fileCount()const {
121 if (!m_selector) 121 if (!m_selector)
122 return -1; 122 return -1;
123 123
124 return m_selector->fileCount(); 124 return m_selector->fileCount();
125} 125}
126 126
127DocLnk ODocumentFileView::selectedDocument()const { 127DocLnk ODocumentFileView::selectedDocument()const {
128 if (!m_selector) 128 if (!m_selector)
129 return DocLnk(); 129 return DocLnk();
130 DocLnk lnk = *m_selector->selected(); 130 DocLnk lnk = *m_selector->selected();
131 return lnk; 131 return lnk;
132} 132}
133 133
134QWidget* ODocumentFileView::widget( QWidget* parent ) { 134QWidget* ODocumentFileView::widget( QWidget* parent ) {
135 if (!m_selector ) { 135 if (!m_selector ) {
136 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); 136 m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() );
137 QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), 137 QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ),
138 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); 138 selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) );
139 QObject::connect(m_selector, SIGNAL(closeMe() ), 139 QObject::connect(m_selector, SIGNAL(closeMe() ),
140 selector(), SIGNAL(closeMe() ) ); 140 selector(), SIGNAL(closeMe() ) );
141 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), 141 QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ),
142 selector(), SIGNAL(newSelected(const DocLnk& ) ) ); 142 selector(), SIGNAL(newSelected(const DocLnk& ) ) );
143 } 143 }
144 144
145 return m_selector; 145 return m_selector;
146} 146}
147 147
148/* 148/*
149 * This is the file system view used 149 * This is the file system view used
150 * we use a QListView + QListViewItems for it 150 * we use a QListView + QListViewItems for it
151 */ 151 */
152 152
153OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, 153OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap,
154 const QString& path, const QString& date, 154 const QString& path, const QString& date,
155 const QString& size, const QString& dir, 155 const QString& size, const QString& dir,
156 bool isLocked, bool isDir ) 156 bool isLocked, bool isDir )
157 : QListViewItem( view ) 157 : QListViewItem( view )
158{ 158{
159 159
160 QString kind = "dir";; 160 QString kind = "dir";;
161 QString _path = path; 161 QString _path = path;
162 if ( !isDir ){ 162 if ( !isDir ){
163 int arrow = path.findRev( "." ,-1); 163 int arrow = path.findRev( "." ,-1);
164 if (arrow > 0 ) { 164 if (arrow > 0 ) {
165 kind = path.mid(arrow+1); 165 kind = path.mid(arrow+1);
166 } 166 }
167 } 167 }
168 setPixmap(0, pixmap ); 168 setPixmap(0, pixmap );
169 int arrow = path.find( "->" ); 169 int arrow = path.find( "->" );
170 if (arrow > 0 ) { 170 if (arrow > 0 ) {
171 _path = path.left(arrow); 171 _path = path.left(arrow);
172 } 172 }
173 setText(1, _path ); 173 setText(1, _path );
174 setText(2, size ); 174 setText(2, size );
175 setText(3, date ); 175 setText(3, date );
176 setText(4, kind ); 176 setText(4, kind );
177 m_isDir = isDir; 177 m_isDir = isDir;
178 m_dir = dir; 178 m_dir = dir;
179 m_locked = isLocked; 179 m_locked = isLocked;
180} 180}
181OFileSelectorItem::~OFileSelectorItem() { 181OFileSelectorItem::~OFileSelectorItem() {
182 182
183} 183}
184bool OFileSelectorItem::isLocked()const { 184bool OFileSelectorItem::isLocked()const {
185 return m_locked; 185 return m_locked;
186} 186}
187QString OFileSelectorItem::directory()const { 187QString OFileSelectorItem::directory()const {
188 return m_dir; 188 return m_dir;
189} 189}
190bool OFileSelectorItem::isDir()const { 190bool OFileSelectorItem::isDir()const {
191 return m_isDir; 191 return m_isDir;
192} 192}
193QString OFileSelectorItem::path()const { 193QString OFileSelectorItem::path()const {
194 return text( 1 ); 194 return text( 1 );
195} 195}
196QString OFileSelectorItem::key( int id, bool )const { 196QString OFileSelectorItem::key( int id, bool )const {
197 QString ke; 197 QString ke;
198 if( id == 0 || id == 1 ){ // name 198 if( id == 0 || id == 1 ){ // name
199 if( m_isDir ){ 199 if( m_isDir ){
200 ke.append("0" ); 200 ke.append("0" );
201 ke.append( text(1) ); 201 ke.append( text(1) );
202 }else{ 202 }else{
203 ke.append("1" ); 203 ke.append("1" );
204 ke.append( text(1) ); 204 ke.append( text(1) );
205 } 205 }
206 return ke; 206 return ke;
207 } else if ( id == 2 ) { 207 } else if ( id == 2 ) {
208 QString sort = "00000000"; 208 QString sort = "00000000";
209 sort = sort.left( 9-text( 2 ).length()) + text( 2 ); 209 sort = sort.left( 9-text( 2 ).length()) + text( 2 );
210 return sort; 210 return sort;
211 211
212 } else 212 } else
213 return text( id ); 213 return text( id );
214 214
215} 215}
216 216
217OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, 217OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir,
218 OFileSelector* sel) 218 OFileSelector* sel)
219 : QWidget( parent ), m_sel( sel ) { 219 : QWidget( parent ), m_sel( sel ) {
220 m_all = false; 220 m_all = false;
221 QVBoxLayout* lay = new QVBoxLayout( this ); 221 QVBoxLayout* lay = new QVBoxLayout( this );
222 m_currentDir = startDir; 222 m_currentDir = startDir;
223 223
224 /* 224 /*
225 * now we add a special bar 225 * now we add a special bar
226 * One Button For Up 226 * One Button For Up
227 * Home 227 * Home
228 * Doc 228 * Doc
229 * And a dropdown menu with FileSystems 229 * And a dropdown menu with FileSystems
230 * FUTURE: one to change dir with lineedit 230 * FUTURE: one to change dir with lineedit
231 * Bookmarks 231 * Bookmarks
232 * Create Dir 232 * Create Dir
233 */ 233 */
234 QHBox* box = new QHBox(this ); 234 QHBox* box = new QHBox(this );
235 box->setBackgroundMode( PaletteButton ); 235 box->setBackgroundMode( PaletteButton );
236 box->setSpacing( 0 ); 236 box->setSpacing( 0 );
237 237
238 QToolButton *btn = new QToolButton( box ); 238 QToolButton *btn = new QToolButton( box );
239 btn->setIconSet( Resource::loadPixmap("up") ); 239 btn->setIconSet( Resource::loadPixmap("up") );
240 connect(btn, SIGNAL(clicked() ), 240 connect(btn, SIGNAL(clicked() ),
241 this, SLOT( cdUP() ) ); 241 this, SLOT( cdUP() ) );
242 242
243 btn = new QToolButton( box ); 243 btn = new QToolButton( box );
244 btn->setIconSet( Resource::loadPixmap("home") ); 244 btn->setIconSet( Resource::loadPixmap("home") );
245 connect(btn, SIGNAL(clicked() ), 245 connect(btn, SIGNAL(clicked() ),
246 this, SLOT( cdHome() ) ); 246 this, SLOT( cdHome() ) );
247 247
248 btn = new QToolButton( box ); 248 btn = new QToolButton( box );
249 btn->setIconSet( Resource::loadPixmap("DocsIcon") ); 249 btn->setIconSet( Resource::loadPixmap("DocsIcon") );
250 connect(btn, SIGNAL(clicked() ), 250 connect(btn, SIGNAL(clicked() ),
251 this, SLOT(cdDoc() ) ); 251 this, SLOT(cdDoc() ) );
252 252
253 m_btnNew = new QToolButton( box ); 253 m_btnNew = new QToolButton( box );
254 m_btnNew->setIconSet( Resource::loadPixmap("new") ); 254 m_btnNew->setIconSet( Resource::loadPixmap("new") );
255 connect(m_btnNew, SIGNAL(clicked() ), 255 connect(m_btnNew, SIGNAL(clicked() ),
256 this, SLOT(slotNew() ) ); 256 this, SLOT(slotNew() ) );
257 257
258 258
259 m_btnClose = new QToolButton( box ); 259 m_btnClose = new QToolButton( box );
260 m_btnClose->setIconSet( Resource::loadPixmap("close") ); 260 m_btnClose->setIconSet( Resource::loadPixmap("close") );
261 connect(m_btnClose, SIGNAL(clicked() ), 261 connect(m_btnClose, SIGNAL(clicked() ),
262 selector(), SIGNAL(closeMe() ) ); 262 selector(), SIGNAL(closeMe() ) );
263 263
264 btn = new QToolButton( box ); 264 btn = new QToolButton( box );
265 btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") ); 265 btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") );
266 266
267 /* let's fill device parts */ 267 /* let's fill device parts */
268 QPopupMenu* pop = new QPopupMenu(this); 268 QPopupMenu* pop = new QPopupMenu(this);
269 connect(pop, SIGNAL( activated(int) ), 269 connect(pop, SIGNAL( activated(int) ),
270 this, SLOT(slotFSActivated(int) ) ); 270 this, SLOT(slotFSActivated(int) ) );
271 271
272 StorageInfo storage; 272 StorageInfo storage;
273 const QList<FileSystem> &fs = storage.fileSystems(); 273 const QList<FileSystem> &fs = storage.fileSystems();
274 QListIterator<FileSystem> it(fs); 274 QListIterator<FileSystem> it(fs);
275 for ( ; it.current(); ++it ) { 275 for ( ; it.current(); ++it ) {
276 const QString disk = (*it)->name(); 276 const QString disk = (*it)->name();
277 const QString path = (*it)->path(); 277 const QString path = (*it)->path();
278 m_dev.insert( disk, path ); 278 m_dev.insert( disk, path );
279 pop->insertItem( disk ); 279 pop->insertItem( disk );
280 } 280 }
281 m_fsPop = pop; 281 m_fsPop = pop;
282 282
283 283
284 btn->setPopup( pop ); 284 btn->setPopup( pop );
285 btn->setPopupDelay ( 0 ); 285 btn->setPopupDelay ( 0 );
286 lay->addWidget( box ); 286 lay->addWidget( box );
287 287
288 m_view = new QListView( this ); 288 m_view = new QListView( this );
289 289
290 m_view->installEventFilter(this); 290 m_view->installEventFilter(this);
291 291
292 QPEApplication::setStylusOperation( m_view->viewport(), 292 QPEApplication::setStylusOperation( m_view->viewport(),
293 QPEApplication::RightOnHold); 293 QPEApplication::RightOnHold);
294 m_view->addColumn(" " ); 294 m_view->addColumn(" " );
295 m_view->addColumn(i18n("Name"), 150 ); 295 m_view->addColumn(i18n("Name"), 150 );
296 m_view->addColumn(i18n("Size"), -1 ); 296 m_view->addColumn(i18n("Size"), -1 );
297 m_view->addColumn(i18n("Date"), -1 ); 297 m_view->addColumn(i18n("Date"), -1 );
298 m_view->addColumn(i18n("Mime Type"), -1 ); 298 m_view->addColumn(i18n("Mime Type"), -1 );
299 299
300 300
301 m_view->setSorting( 1 ); 301 m_view->setSorting( 1 );
302 m_view->setAllColumnsShowFocus( TRUE ); 302 m_view->setAllColumnsShowFocus( TRUE );
303 303
304 lay->addWidget( m_view, 1000 ); 304 lay->addWidget( m_view, 1000 );
305 connectSlots(); 305 connectSlots();
306} 306}
307OFileViewFileListView::~OFileViewFileListView() { 307OFileViewFileListView::~OFileViewFileListView() {
308} 308}
309void OFileViewFileListView::slotNew() { 309void OFileViewFileListView::slotNew() {
310 DocLnk lnk; 310 DocLnk lnk;
311 emit selector()->newSelected( lnk ); 311 emit selector()->newSelected( lnk );
312} 312}
313OFileSelectorItem* OFileViewFileListView::currentItem()const{ 313OFileSelectorItem* OFileViewFileListView::currentItem()const{
314 QListViewItem* item = m_view->currentItem(); 314 QListViewItem* item = m_view->currentItem();
315 if (!item ) 315 if (!item )
316 return 0l; 316 return 0l;
317 317
318 return static_cast<OFileSelectorItem*>(item); 318 return static_cast<OFileSelectorItem*>(item);
319} 319}
320void OFileViewFileListView::reread( bool all ) { 320void OFileViewFileListView::reread( bool all ) {
321 m_view->clear(); 321 m_view->clear();
322 322
323 if (selector()->showClose() ) 323 if (selector()->showClose() )
324 m_btnClose->show(); 324 m_btnClose->show();
325 else 325 else
326 m_btnClose->hide(); 326 m_btnClose->hide();
327 327
328 if (selector()->showNew() ) 328 if (selector()->showNew() )
329 m_btnNew->show(); 329 m_btnNew->show();
330 else 330 else
331 m_btnNew->hide(); 331 m_btnNew->hide();
332 332
333 m_mimes = selector()->currentMimeType(); 333 m_mimes = selector()->currentMimeType();
334 m_all = all; 334 m_all = all;
335 335
336 QDir dir( m_currentDir ); 336 QDir dir( m_currentDir );
337 if (!dir.exists() ) 337 if (!dir.exists() )
338 return; 338 return;
339 topLevelWidget()->setCaption( dir.path() ); 339 topLevelWidget()->setCaption( dir.path() );
340 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed ); 340 dir.setSorting( QDir::Name | QDir::DirsFirst | QDir::Reversed );
341 int filter; 341 int filter;
342 if (m_all ) 342 if (m_all )
343 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 343 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
344 else 344 else
345 filter = QDir::Files | QDir::Dirs | QDir::All; 345 filter = QDir::Files | QDir::Dirs | QDir::All;
346 dir.setFilter( filter ); 346 dir.setFilter( filter );
347 347
348 // now go through all files 348 // now go through all files
349 const QFileInfoList *list = dir.entryInfoList(); 349 const QFileInfoList *list = dir.entryInfoList();
350 if (!list) { 350 if (!list) {
351 cdUP(); 351 cdUP();
352 return; 352 return;
353 } 353 }
354 QFileInfoListIterator it( *list ); 354 QFileInfoListIterator it( *list );
355 QFileInfo *fi; 355 QFileInfo *fi;
356 while( (fi=it.current() ) ){ 356 while( (fi=it.current() ) ){
357 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ 357 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){
358 ++it; 358 ++it;
359 continue; 359 continue;
360 } 360 }
361 361
362 /* 362 /*
363 * It is a symlink we try to resolve it now but don't let us attack by DOS 363 * It is a symlink we try to resolve it now but don't let us attack by DOS
364 * 364 *
365 */ 365 */
366 if( fi->isSymLink() ){ 366 if( fi->isSymLink() ){
367 qDebug("SYMLINK "); 367 //qDebug("SYMLINK ");
368 QString file = fi->readLink(); 368 QString file = fi->readLink();
369 for( int i = 0; i<=5; i++) { // 5 tries to prevent dos 369 for( int i = 0; i<=5; i++) { // 5 tries to prevent dos
370 QFileInfo info( file ); 370 QFileInfo info( file );
371 qDebug("FILE %s ", file.latin1()); 371 //qDebug("FILE %s ", file.latin1());
372 if( !info.exists() ){ 372 if( !info.exists() ){
373 addSymlink( fi, TRUE ); 373 addSymlink( fi, TRUE );
374 break; 374 break;
375 }else if( info.isDir() ){ 375 }else if( info.isDir() ){
376 addDir( fi, TRUE ); 376 addDir( fi, TRUE );
377 break; 377 break;
378 }else if( info.isFile() ){ 378 }else if( info.isFile() ){
379 addFile( fi, TRUE ); 379 addFile( fi, TRUE );
380 break; 380 break;
381 }else if( info.isSymLink() ){ 381 }else if( info.isSymLink() ){
382 file = info.readLink() ; 382 file = info.readLink() ;
383 break; 383 break;
384 }else if( i == 4){ // couldn't resolve symlink add it as symlink 384 }else if( i == 4){ // couldn't resolve symlink add it as symlink
385 addSymlink( fi ); 385 addSymlink( fi );
386 } 386 }
387 } // off for loop for symlink resolving 387 } // off for loop for symlink resolving
388 }else if( fi->isDir() ) 388 }else if( fi->isDir() )
389 addDir( fi ); 389 addDir( fi );
390 else if( fi->isFile() ) 390 else if( fi->isFile() )
391 addFile( fi ); 391 addFile( fi );
392 392
393 ++it; 393 ++it;
394 } // of while loop 394 } // of while loop
395 m_view->sort(); 395 m_view->sort();
396 396
397} 397}
398int OFileViewFileListView::fileCount()const{ 398int OFileViewFileListView::fileCount()const{
399 return m_view->childCount(); 399 return m_view->childCount();
400} 400}
401QString OFileViewFileListView::currentDir()const{ 401QString OFileViewFileListView::currentDir()const{
402 return m_currentDir; 402 return m_currentDir;
403} 403}
404OFileSelector* OFileViewFileListView::selector() { 404OFileSelector* OFileViewFileListView::selector() {
405 return m_sel; 405 return m_sel;
406} 406}
407 407
408bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { 408bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) {
409#if 0 409#if 0
410 if ( e->type() == QEvent::KeyPress ) { 410 if ( e->type() == QEvent::KeyPress ) {
411 QKeyEvent *k = (QKeyEvent *)e; 411 QKeyEvent *k = (QKeyEvent *)e;
412 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { 412 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) {
413 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); 413 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
414 return true; 414 return true;
415 } 415 }
416 } 416 }
417#endif 417#endif
418 return false; 418 return false;
419} 419}
420 420
421 421
422void OFileViewFileListView::connectSlots() { 422void OFileViewFileListView::connectSlots() {
423 connect(m_view, SIGNAL(clicked(QListViewItem*) ), 423 connect(m_view, SIGNAL(clicked(QListViewItem*) ),
424 this, SLOT(slotCurrentChanged(QListViewItem*) ) ); 424 this, SLOT(slotCurrentChanged(QListViewItem*) ) );
425 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), 425 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ),
426 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); 426 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) );
427 connect(m_view, SIGNAL(doubleClicked( QListViewItem* )), 427 connect(m_view, SIGNAL(doubleClicked( QListViewItem* )),
428 this, SLOT(slotDoubleClicked(QListViewItem* ) ) ); 428 this, SLOT(slotDoubleClicked(QListViewItem* ) ) );
429 connect(m_view, SIGNAL(returnPressed( QListViewItem* )), 429 connect(m_view, SIGNAL(returnPressed( QListViewItem* )),
430 this, SLOT(slotDoubleClicked(QListViewItem* ) ) ); 430 this, SLOT(slotDoubleClicked(QListViewItem* ) ) );
431} 431}
432void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { 432void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) {
433 if (!item) 433 if (!item)
434 return; 434 return;
435#if 0 435#if 0
436 436
437 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 437 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
438 438
439 if (!sel->isDir() ) { 439 if (!sel->isDir() ) {
440 selector()->m_lneEdit->setText( sel->text(1) ); 440 selector()->m_lneEdit->setText( sel->text(1) );
441 // if in fileselector mode we will emit selected 441 // if in fileselector mode we will emit selected
442 if ( selector()->mode() == OFileSelector::FileSelector ) { 442 if ( selector()->mode() == OFileSelector::FileSelector ) {
443 qWarning("slot Current Changed"); 443 qWarning("slot Current Changed");
444 QStringList str = QStringList::split("->", sel->text(1) ); 444 QStringList str = QStringList::split("->", sel->text(1) );
445 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 445 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
446 emit selector()->fileSelected( path ); 446 emit selector()->fileSelected( path );
447 DocLnk lnk( path ); 447 DocLnk lnk( path );
448 emit selector()->fileSelected( lnk ); 448 emit selector()->fileSelected( lnk );
449 } 449 }
450 } 450 }
451#endif 451#endif
452} 452}
453void OFileViewFileListView::slotDoubleClicked(QListViewItem* item ) { 453void OFileViewFileListView::slotDoubleClicked(QListViewItem* item ) {
454 if (!item ) return; 454 if (!item ) return;
455 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 455 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
456 if (!sel->isLocked() ) { 456 if (!sel->isLocked() ) {
457 QStringList str = QStringList::split("->", sel->text(1) ); 457 QStringList str = QStringList::split("->", sel->text(1) );
458 if (sel->isDir() ) { 458 if (sel->isDir() ) {
459 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 459 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
460 emit selector()->dirSelected( m_currentDir ); 460 emit selector()->dirSelected( m_currentDir );
461 reread( m_all ); 461 reread( m_all );
462 }else { // file 462 }else { // file
463 //qWarning("slot Clicked"); 463 //qWarning("slot Clicked");
464 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 464 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
465 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 465 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
466 emit selector()->fileSelected( path ); 466 emit selector()->fileSelected( path );
467 DocLnk lnk( path ); 467 DocLnk lnk( path );
468 emit selector()->fileSelected( lnk ); 468 emit selector()->fileSelected( lnk );
469 emit selector()->ok(); 469 emit selector()->ok();
470 } 470 }
471 } // not locked 471 } // not locked
472} 472}
473void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { 473void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) {
474 if (!item || ( button != Qt::LeftButton) ) 474 if (!item || ( button != Qt::LeftButton) )
475 return; 475 return;
476 476
477 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 477 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
478 if (!sel->isLocked() ) { 478 if (!sel->isLocked() ) {
479 QStringList str = QStringList::split("->", sel->text(1) ); 479 QStringList str = QStringList::split("->", sel->text(1) );
480 if (sel->isDir() ) { 480 if (sel->isDir() ) {
481 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 481 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
482 emit selector()->dirSelected( m_currentDir ); 482 emit selector()->dirSelected( m_currentDir );
483 reread( m_all ); 483 reread( m_all );
484 }else { // file 484 }else { // file
485 //qWarning("slot Clicked"); 485 //qWarning("slot Clicked");
486 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 486 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
487 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 487 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
488 emit selector()->fileSelected( path ); 488 emit selector()->fileSelected( path );
489 DocLnk lnk( path ); 489 DocLnk lnk( path );
490 emit selector()->fileSelected( lnk ); 490 emit selector()->fileSelected( lnk );
491 } 491 }
492 } // not locked 492 } // not locked
493} 493}
494void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { 494void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) {
495 MimeType type( info->absFilePath() ); 495 MimeType type( info->absFilePath() );
496 if (!compliesMime( type.id() ) ) 496 if (!compliesMime( type.id() ) )
497 return; 497 return;
498 498
499 QPixmap pix = type.pixmap(); 499 QPixmap pix = type.pixmap();
500 QString dir, name; bool locked; 500 QString dir, name; bool locked;
501 if ( pix.isNull() ) { 501 if ( pix.isNull() ) {
502 QWMatrix matrix; 502 QWMatrix matrix;
503 QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); 503 QPixmap pixer(Resource::loadPixmap("UnknownDocument") );
504 matrix.scale( .4, .4 ); 504 matrix.scale( .4, .4 );
505 pix = pixer.xForm( matrix ); 505 pix = pixer.xForm( matrix );
506 } 506 }
507 dir = info->dirPath( true ); 507 dir = info->dirPath( true );
508 locked = false; 508 locked = false;
509 if ( symlink ) 509 if ( symlink )
510 name = info->fileName() + " -> " + info->readLink(); 510 name = info->fileName() + " -> " + info->readLink();
511 else{ 511 else{
512 name = info->fileName(); 512 name = info->fileName();
513 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || 513 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) ||
514 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { 514 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) {
515 locked = true; pix = Resource::loadPixmap("locked"); 515 locked = true; pix = Resource::loadPixmap("locked");
516 } 516 }
517 } 517 }
518 (void)new OFileSelectorItem( m_view, pix, name, 518 (void)new OFileSelectorItem( m_view, pix, name,
519 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), 519 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
520 QString::number( info->size() ), 520 QString::number( info->size() ),
521 dir, locked ); 521 dir, locked );
522} 522}
523void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { 523void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) {
524 bool locked = false; QString name; QPixmap pix; 524 bool locked = false; QString name; QPixmap pix;
525 525
526 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || 526 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) ||
527 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { 527 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) {
528 locked = true; 528 locked = true;
529 if ( symlink ) 529 if ( symlink )
530 pix = Resource::loadPixmap( "symlink" ); 530 pix = Resource::loadPixmap( "symlink" );
531 else 531 else
532 pix = Resource::loadPixmap( "lockedfolder" ); 532 pix = Resource::loadPixmap( "lockedfolder" );
533 }else 533 }else
534 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); 534 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder");
535 535
536 name = symlink ? info->fileName() + " -> " + info->readLink() : 536 name = symlink ? info->fileName() + " -> " + info->readLink() :
537 info->fileName(); 537 info->fileName();
538 538
539 (void)new OFileSelectorItem( m_view, pix, name, 539 (void)new OFileSelectorItem( m_view, pix, name,
540 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), 540 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
541 QString::number( info->size() ), 541 QString::number( info->size() ),
542 info->dirPath( true ), locked, true ); 542 info->dirPath( true ), locked, true );
543 543
544 544
545} 545}
546void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { 546void OFileViewFileListView::addSymlink( QFileInfo* , bool ) {
547 547
548} 548}
549void OFileViewFileListView::cdUP() { 549void OFileViewFileListView::cdUP() {
550 QDir dir( m_currentDir ); 550 QDir dir( m_currentDir );
551 dir.cdUp(); 551 dir.cdUp();
552 552
553 if (!dir.exists() ) 553 if (!dir.exists() )
554 m_currentDir = "/"; 554 m_currentDir = "/";
555 else 555 else
556 m_currentDir = dir.absPath(); 556 m_currentDir = dir.absPath();
557 557
558 emit selector()->dirSelected( m_currentDir ); 558 emit selector()->dirSelected( m_currentDir );
559 reread( m_all ); 559 reread( m_all );
560} 560}
561void OFileViewFileListView::cdHome() { 561void OFileViewFileListView::cdHome() {
562 m_currentDir = QDir::homeDirPath(); 562 m_currentDir = QDir::homeDirPath();
563 emit selector()->dirSelected( m_currentDir ); 563 emit selector()->dirSelected( m_currentDir );
564 reread( m_all ); 564 reread( m_all );
565} 565}
566void OFileViewFileListView::cdDoc() { 566void OFileViewFileListView::cdDoc() {
567 m_currentDir = QPEApplication::documentDir(); 567 m_currentDir = QPEApplication::documentDir();
568 emit selector()->dirSelected( m_currentDir ); 568 emit selector()->dirSelected( m_currentDir );
569 reread( m_all ); 569 reread( m_all );
570} 570}
571void OFileViewFileListView::changeDir( const QString& dir ) { 571void OFileViewFileListView::changeDir( const QString& dir ) {
572 m_currentDir = dir; 572 m_currentDir = dir;
573 emit selector()->dirSelected( m_currentDir ); 573 emit selector()->dirSelected( m_currentDir );
574 reread( m_all ); 574 reread( m_all );
575} 575}
576void OFileViewFileListView::slotFSActivated( int id ) { 576void OFileViewFileListView::slotFSActivated( int id ) {
577 changeDir ( m_dev[m_fsPop->text(id)] ); 577 changeDir ( m_dev[m_fsPop->text(id)] );
578} 578}
579 579
580/* check if the mimetype in mime 580/* check if the mimetype in mime
581 * complies with the one which is current 581 * complies with the one which is current
582 */ 582 */
583/* 583/*
584 * We've the mimetype of the file 584 * We've the mimetype of the file
585 * We need to get the stringlist of the current mimetype 585 * We need to get the stringlist of the current mimetype
586 * 586 *
587 * mime = image@slashjpeg 587 * mime = image@slashjpeg
588 * QStringList = 'image@slash*' 588 * QStringList = 'image@slash*'
589 * or QStringList = image/jpeg;image/png;application/x-ogg 589 * or QStringList = image/jpeg;image/png;application/x-ogg
590 * or QStringList = application/x-ogg;image@slash*; 590 * or QStringList = application/x-ogg;image@slash*;
591 * with all these mime filters it should get acceptes 591 * with all these mime filters it should get acceptes
592 * to do so we need to look if mime is contained inside 592 * to do so we need to look if mime is contained inside
593 * the stringlist 593 * the stringlist
594 * if it's contained return true 594 * if it's contained return true
595 * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*' 595 * if not ( I'm no RegExp expert at all ) we'll look if a '@slash*'
596 * is contained in the mimefilter and then we will 596 * is contained in the mimefilter and then we will
597 * look if both are equal until the '/' 597 * look if both are equal until the '/'
598 */ 598 */
599bool OFileViewFileListView::compliesMime( const QString& str) { 599bool OFileViewFileListView::compliesMime( const QString& str) {
600 if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() ) 600 if (str.isEmpty() || m_mimes.isEmpty() || str.stripWhiteSpace().isEmpty() )
601 return true; 601 return true;
602 602
603 for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) { 603 for (QStringList::Iterator it = m_mimes.begin(); it != m_mimes.end(); ++it ) {
604 QRegExp reg( (*it) ); 604 QRegExp reg( (*it) );
605 reg.setWildcard( true ); 605 reg.setWildcard( true );
606 if ( str.find( reg ) != -1 ) 606 if ( str.find( reg ) != -1 )
607 return true; 607 return true;
608 608
609 } 609 }
610 return false; 610 return false;
611} 611}
612/* 612/*
613 * The listView giving access to the file system! 613 * The listView giving access to the file system!
614 */ 614 */
615class OFileViewFileSystem : public OFileViewInterface { 615class OFileViewFileSystem : public OFileViewInterface {
616public: 616public:
617 OFileViewFileSystem( OFileSelector* ); 617 OFileViewFileSystem( OFileSelector* );
618 ~OFileViewFileSystem(); 618 ~OFileViewFileSystem();
619 619
620 QString selectedName() const; 620 QString selectedName() const;
621 QString selectedPath() const; 621 QString selectedPath() const;
622 622
623 QString directory()const; 623 QString directory()const;
624 void reread(); 624 void reread();
625 int fileCount()const; 625 int fileCount()const;
626 626
627 QWidget* widget( QWidget* parent ); 627 QWidget* widget( QWidget* parent );
628 void activate( const QString& ); 628 void activate( const QString& );
629private: 629private:
630 OFileViewFileListView* m_view; 630 OFileViewFileListView* m_view;
631 bool m_all : 1; 631 bool m_all : 1;
632}; 632};
633OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel) 633OFileViewFileSystem::OFileViewFileSystem( OFileSelector* sel)
634 : OFileViewInterface( sel ) { 634 : OFileViewInterface( sel ) {
635 m_view = 0; 635 m_view = 0;
636 m_all = false; 636 m_all = false;
637} 637}
638OFileViewFileSystem::~OFileViewFileSystem() { 638OFileViewFileSystem::~OFileViewFileSystem() {
639} 639}
640QString OFileViewFileSystem::selectedName()const{ 640QString OFileViewFileSystem::selectedName()const{
641 if (!m_view ) 641 if (!m_view )
642 return QString::null; 642 return QString::null;
643 643
644 QString cFN=currentFileName(); 644 QString cFN=currentFileName();
645 if (cFN.startsWith("/")) return cFN; 645 if (cFN.startsWith("/")) return cFN;
646 return m_view->currentDir() + "/" + cFN; 646 return m_view->currentDir() + "/" + cFN;
647} 647}
648QString OFileViewFileSystem::selectedPath()const{ 648QString OFileViewFileSystem::selectedPath()const{
649 return QString::null; 649 return QString::null;
650} 650}
651QString OFileViewFileSystem::directory()const{ 651QString OFileViewFileSystem::directory()const{
652 if (!m_view) 652 if (!m_view)
653 return QString::null; 653 return QString::null;
654 654
655 OFileSelectorItem* item = m_view->currentItem(); 655 OFileSelectorItem* item = m_view->currentItem();
656 if (!item ) 656 if (!item )
657 return QString::null; 657 return QString::null;
658 658
659 return QDir(item->directory() ).absPath(); 659 return QDir(item->directory() ).absPath();
660} 660}
661void OFileViewFileSystem::reread() { 661void OFileViewFileSystem::reread() {
662 if (!m_view) 662 if (!m_view)
663 return; 663 return;
664 664
665 m_view->reread( m_all ); 665 m_view->reread( m_all );
666} 666}
667int OFileViewFileSystem::fileCount()const{ 667int OFileViewFileSystem::fileCount()const{
668 if (!m_view ) 668 if (!m_view )
669 return -1; 669 return -1;
670 return m_view->fileCount(); 670 return m_view->fileCount();
671} 671}
672QWidget* OFileViewFileSystem::widget( QWidget* parent ) { 672QWidget* OFileViewFileSystem::widget( QWidget* parent ) {
673 if (!m_view ) { 673 if (!m_view ) {
674 m_view = new OFileViewFileListView( parent, startDirectory(), selector() ); 674 m_view = new OFileViewFileListView( parent, startDirectory(), selector() );
675 } 675 }
676 return m_view; 676 return m_view;
677} 677}
678void OFileViewFileSystem::activate( const QString& str) { 678void OFileViewFileSystem::activate( const QString& str) {
679 m_all = (str !=i18n("Files") ); 679 m_all = (str !=i18n("Files") );
680 680
681 681
682} 682}
683 683
684/* Selector */ 684/* Selector */
685OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, 685OFileSelector::OFileSelector( QWidget* parent, int mode, int sel,
686 const QString& dirName, const QString& fileName, 686 const QString& dirName, const QString& fileName,
687 const MimeTypes& mimetypes, 687 const MimeTypes& mimetypes,
688 bool showNew, bool showClose) 688 bool showNew, bool showClose)
689 : QWidget( parent, "OFileSelector" ) 689 : QWidget( parent, "OFileSelector" )
690{ 690{
691 m_current = 0; 691 m_current = 0;
692 m_shNew = showNew; 692 m_shNew = showNew;
693 m_shClose = showClose; 693 m_shClose = showClose;
694 m_mimeType = mimetypes; 694 m_mimeType = mimetypes;
695 m_startDir = dirName; 695 m_startDir = dirName;
696 m_mode = mode; 696 m_mode = mode;
697 m_selector = sel; 697 m_selector = sel;
698 698
699 initUI(); 699 initUI();
700 m_lneEdit->setText( fileName ); 700 m_lneEdit->setText( fileName );
701 initMime(); 701 initMime();
702 initViews(); 702 initViews();
703 703
704 QString str; 704 QString str;
705 switch ( m_selector ) { 705 switch ( m_selector ) {
706 default: 706 default:
707 case Normal: 707 case Normal:
708 str = i18n("Documents"); 708 str = i18n("Documents");
709 m_cmbView->setCurrentItem( 0 ); 709 m_cmbView->setCurrentItem( 0 );
710 break; 710 break;
711 case Extended: 711 case Extended:
712 str = i18n("Files"); 712 str = i18n("Files");
713 m_cmbView->setCurrentItem( 1 ); 713 m_cmbView->setCurrentItem( 1 );
714 break; 714 break;
715 case ExtendedAll: 715 case ExtendedAll:
716 str = i18n("All Files"); 716 str = i18n("All Files");
717 m_cmbView->setCurrentItem( 2 ); 717 m_cmbView->setCurrentItem( 2 );
718 break; 718 break;
719 } 719 }
720 slotViewChange( str ); 720 slotViewChange( str );
721 721
722} 722}
723OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, 723OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name,
724 bool showNew, bool showClose ) 724 bool showNew, bool showClose )
725 : QWidget( parent, name ) 725 : QWidget( parent, name )
726{ 726{
727 m_current = 0; 727 m_current = 0;
728 m_shNew = showNew; 728 m_shNew = showNew;
729 m_shClose = showClose; 729 m_shClose = showClose;
730 m_startDir = QPEApplication::documentDir(); 730 m_startDir = QPEApplication::documentDir();
731 731
732 if (!mimeFilter.isEmpty() ) 732 if (!mimeFilter.isEmpty() )
733 m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); 733 m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) );
734 734
735 m_mode = OFileSelector::FileSelector; 735 m_mode = OFileSelector::FileSelector;
736 m_selector = OFileSelector::Normal; 736 m_selector = OFileSelector::Normal;
737 737
738 initUI(); 738 initUI();
739 initMime(); 739 initMime();
740 initViews(); 740 initViews();
741 m_cmbView->setCurrentItem( 0 ); 741 m_cmbView->setCurrentItem( 0 );
742 slotViewChange( i18n("Documents") ); 742 slotViewChange( i18n("Documents") );
743} 743}
744/* 744/*
745 * INIT UI will set up the basic GUI 745 * INIT UI will set up the basic GUI
746 * Layout: Simple VBoxLayout 746 * Layout: Simple VBoxLayout
747 * On top a WidgetStack containing the Views... 747 * On top a WidgetStack containing the Views...
748 * - List View 748 * - List View
749 * - Document View 749 * - Document View
750 * Below we will have a Label + LineEdit 750 * Below we will have a Label + LineEdit
751 * Below we will have two ComoBoxes one for choosing the view one for 751 * Below we will have two ComoBoxes one for choosing the view one for
752 * choosing the mimetype 752 * choosing the mimetype
753 */ 753 */
754void OFileSelector::initUI() { 754void OFileSelector::initUI() {
755 QVBoxLayout* lay = new QVBoxLayout( this ); 755 QVBoxLayout* lay = new QVBoxLayout( this );