-rw-r--r-- | libopie/ofileselector/ofiledialog.cpp | 4 | ||||
-rw-r--r-- | libopie/ofileselector/ofilelistview.cpp | 43 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.cpp | 56 | ||||
-rw-r--r-- | libopie/ofileselector/ofileselector.h | 2 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.cpp | 3 | ||||
-rw-r--r-- | libopie/ofileselector/ofileview.h | 2 |
6 files changed, 69 insertions, 41 deletions
diff --git a/libopie/ofileselector/ofiledialog.cpp b/libopie/ofileselector/ofiledialog.cpp index 4783004..430def2 100644 --- a/libopie/ofileselector/ofiledialog.cpp +++ b/libopie/ofileselector/ofiledialog.cpp | |||
@@ -72,41 +72,41 @@ DocLnk OFileDialog::selectedDocument()const | |||
72 | { | 72 | { |
73 | return file->selectedDocument(); | 73 | return file->selectedDocument(); |
74 | } | 74 | } |
75 | QString OFileDialog::getOpenFileName(int selector, | 75 | QString OFileDialog::getOpenFileName(int selector, |
76 | const QString &startDir, | 76 | const QString &startDir, |
77 | const QString &file, | 77 | const QString &file, |
78 | const MimeTypes &mimes, | 78 | const MimeTypes &mimes, |
79 | QWidget *wid, | 79 | QWidget *wid, |
80 | const QString &caption ) | 80 | const QString &caption ) |
81 | { | 81 | { |
82 | QString ret; | 82 | QString ret; |
83 | OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, | 83 | OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, |
84 | wid, OFileSelector::OPEN, selector, startDir, file, mimes); | 84 | wid, OFileSelector::Open, selector, startDir, file, mimes); |
85 | dlg.showMaximized(); | 85 | dlg.showMaximized(); |
86 | if( dlg.exec() ) | 86 | if( dlg.exec() ) |
87 | ret = dlg.fileName(); | 87 | ret = dlg.fileName(); |
88 | 88 | ||
89 | return ret; | 89 | return ret; |
90 | } | 90 | } |
91 | QString OFileDialog::getSaveFileName(int selector, | 91 | QString OFileDialog::getSaveFileName(int selector, |
92 | const QString &startDir, | 92 | const QString &startDir, |
93 | const QString &file, | 93 | const QString &file, |
94 | const MimeTypes &mimes, | 94 | const MimeTypes &mimes, |
95 | QWidget *wid, | 95 | QWidget *wid, |
96 | const QString &caption ) | 96 | const QString &caption ) |
97 | { | 97 | { |
98 | QString ret; | 98 | QString ret; |
99 | OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, | 99 | OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, |
100 | wid, OFileSelector::SAVE, selector, startDir, file, mimes); | 100 | wid, OFileSelector::Save, selector, startDir, file, mimes); |
101 | dlg.showMaximized(); | 101 | dlg.showMaximized(); |
102 | if( dlg.exec() ) | 102 | if( dlg.exec() ) |
103 | ret = dlg.fileName(); | 103 | ret = dlg.fileName(); |
104 | 104 | ||
105 | return ret; | 105 | return ret; |
106 | } | 106 | } |
107 | 107 | ||
108 | void OFileDialog::slotFileSelected(const QString & ) | 108 | void OFileDialog::slotFileSelected(const QString & ) |
109 | { | 109 | { |
110 | accept(); | 110 | accept(); |
111 | } | 111 | } |
112 | void OFileDialog::slotDirSelected(const QString & ) | 112 | void OFileDialog::slotDirSelected(const QString & ) |
diff --git a/libopie/ofileselector/ofilelistview.cpp b/libopie/ofileselector/ofilelistview.cpp index 0c7d45b..7108a5b 100644 --- a/libopie/ofileselector/ofilelistview.cpp +++ b/libopie/ofileselector/ofilelistview.cpp | |||
@@ -1,118 +1,125 @@ | |||
1 | 1 | ||
2 | #include <qpe/mimetype.h> | ||
3 | #include <qpe/resource.h> | ||
4 | |||
2 | #include "ofileselector.h" | 5 | #include "ofileselector.h" |
3 | #include "ofileselectoritem.h" | 6 | #include "ofileselectoritem.h" |
4 | #include "ofilelistview.h" | 7 | #include "ofilelistview.h" |
5 | 8 | ||
6 | 9 | ||
7 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) | 10 | OFileListView::OFileListView( QWidget* parent, OFileSelector* sel) |
8 | : QListView( parent ), OFileView( sel ) | 11 | : QListView( parent ), OFileView( sel ) |
9 | { | 12 | { |
10 | 13 | ||
11 | } | 14 | } |
12 | OFileListView::~OFileListView() { | 15 | OFileListView::~OFileListView() { |
13 | 16 | ||
14 | } | 17 | } |
15 | void OFileListView::clear() { | 18 | void OFileListView::clear() { |
16 | QListView::clear(); | 19 | QListView::clear(); |
17 | } | 20 | } |
18 | void OFileListView::addFile( const QString& mime, | 21 | void OFileListView::addFile( const QString&, |
19 | QFileInfo* info, | 22 | QFileInfo* info, |
20 | bool isSymlink ) { | 23 | bool isSymlink ) { |
21 | MimeType type( info->absFilePath() ); | 24 | MimeType type( info->absFilePath() ); |
22 | QPixmap pix = type.pixmap(); | 25 | QPixmap pix = type.pixmap(); |
23 | QString dir; | 26 | QString dir; |
24 | QString name; | 27 | QString name; |
25 | bool locked = false; | 28 | bool locked = false; |
26 | 29 | ||
27 | if( pix.isNull() ) | 30 | if( pix.isNull() ) |
28 | pix = Resource::loadPixmap( "UnknownDocument-14"); | 31 | pix = Resource::loadPixmap( "UnknownDocument-14"); |
29 | 32 | ||
30 | dir = info->dirPath( true ); | 33 | dir = info->dirPath( true ); |
31 | 34 | ||
32 | if( isSymlink ) | 35 | if( isSymlink ) |
33 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); | 36 | name = info->fileName() + " -> " +info->dirPath() + "/" + info->readLink(); |
34 | else { | 37 | else { |
35 | name = info->fileName(); | 38 | name = info->fileName(); |
36 | if( ( selector()->mode() == Open && !info->isReadable() )|| | 39 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || |
37 | ( selector()->mode() == Save && !info->isWritable() ) ){ | 40 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ |
38 | 41 | ||
39 | locked = true; pix = Resource::loadPixmap("locked"); | 42 | locked = true; pix = Resource::loadPixmap("locked"); |
40 | } | 43 | } |
41 | } | 44 | } |
42 | new OFileSelectorItem( this, pix, name, | 45 | new OFileSelectorItem( this, pix, name, |
43 | info->lastModified().toString(), | 46 | info->lastModified().toString(), |
44 | QString::number( info->size() ), | 47 | QString::number( info->size() ), |
45 | dir, locked ); | 48 | dir, locked ); |
46 | } | 49 | } |
47 | void OFileListView::addFile( const QString& /*mime*/, const QString& /*dir*/, | 50 | void OFileListView::addFile( const QString& /*mime*/, const QString& /*dir*/, |
48 | const QString& /*file*/, bool /*isSyml*/ ) { | 51 | const QString& /*file*/, bool /*isSyml*/ ) { |
49 | 52 | ||
50 | } | 53 | } |
51 | void OFileListView::addDir( const QString& mime, | 54 | void OFileListView::addDir( const QString&, |
52 | QFileInfo* info, bool isSym ) { | 55 | QFileInfo* info, bool symlink ) { |
53 | 56 | ||
54 | bool locked = false; | 57 | bool locked = false; |
55 | QString name; | 58 | QString name; |
56 | QPixmap pix; | 59 | QPixmap pix; |
57 | 60 | ||
58 | if( ( selector()->mode() == Open && !info->isReadable() ) || | 61 | if( ( selector()->mode() == OFileSelector::Open && !info->isReadable() ) || |
59 | ( selector()->mode() == Save && !info->isWritable() ) ){ | 62 | ( selector()->mode() == OFileSelector::Save && !info->isWritable() ) ){ |
60 | 63 | ||
61 | locked = true; | 64 | locked = true; |
62 | 65 | ||
63 | if( symlink ) | 66 | if( symlink ) |
64 | pix = selector()->pixmap("symlinkedlocked"); | 67 | pix = selector()->pixmap("symlinkedlocked"); |
65 | else | 68 | else |
66 | pix = Resource::loadPixmap("lockedfolder"); | 69 | pix = Resource::loadPixmap("lockedfolder"); |
67 | 70 | ||
68 | }else { // readable | 71 | }else { // readable |
69 | pix = symlink ? selector()->pixmap("dirsymlink") : Resource::loadPixmap("folder") ; | 72 | pix = symlink ? selector()->pixmap("dirsymlink") : Resource::loadPixmap("folder") ; |
70 | } | 73 | } |
71 | 74 | ||
72 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; | 75 | name = symlink ? info->fileName() + "->" + info->dirPath(true) + "/" +info->readLink() : info->fileName() ; |
73 | 76 | ||
74 | new OFileSelectorItem( this, pix, name, | 77 | new OFileSelectorItem( this, pix, name, |
75 | info->lastModified().toString(), | 78 | info->lastModified().toString(), |
76 | QString::number( info->size() ), | 79 | QString::number( info->size() ), |
77 | info->dirPath( true ), locked, | 80 | info->dirPath( true ), locked, |
78 | true ); | 81 | true ); |
79 | 82 | ||
80 | } | 83 | } |
81 | void OFileListView::addDir( const QString& mime, const QString& dir, | 84 | void OFileListView::addDir( const QString& /*mime*/, const QString& /*dir*/, |
82 | const QString& file, bool ) { | 85 | const QString& /*file*/, bool ) { |
83 | 86 | ||
84 | } | 87 | } |
85 | void OFileListView::addSymlink( const QString& mime, | 88 | void OFileListView::addSymlink( const QString& /*mime*/, |
86 | QFileInfo* info, | 89 | QFileInfo* /*info*/, |
87 | bool isSym ) { | 90 | bool /*isSym*/ ) { |
88 | 91 | ||
89 | } | 92 | } |
90 | void OFileListView::addSymlink( const QString& mime, const QString& path, | 93 | void OFileListView::addSymlink( const QString& /*mime*/, const QString& /*path*/, |
91 | const QString& file, bool isSym ) { | 94 | const QString& /*file*/, bool /*isSym*/ ) { |
92 | 95 | ||
93 | } | 96 | } |
94 | void OFileListView::cd( const QString& ) { | 97 | void OFileListView::cd( const QString& ) { |
95 | 98 | ||
96 | } | 99 | } |
97 | QWidget* OFileListView::widget() { | 100 | QWidget* OFileListView::widget() { |
98 | return this; | 101 | return this; |
99 | } | 102 | } |
100 | QString OFileListView::selectedName()const{ | 103 | QString OFileListView::selectedName()const{ |
101 | QListViewItem *item = currentItem(); | 104 | QListViewItem *item = currentItem(); |
102 | if (!item ) | 105 | if (!item ) |
103 | return QString::null; | 106 | return QString::null; |
104 | 107 | ||
105 | return item->text( 1 ); | 108 | return item->text( 1 ); |
106 | } | 109 | } |
107 | QStringList OFileListView::selectedNames()const { | 110 | QStringList OFileListView::selectedNames()const { |
108 | 111 | QStringList list; | |
112 | list << selectedName(); | ||
113 | return list; | ||
109 | } | 114 | } |
110 | QString OFileListView::selectedPath()const { | 115 | QString OFileListView::selectedPath()const { |
111 | 116 | return QString::null; | |
112 | } | 117 | } |
113 | QString OFileListView::selectedPaths()const { | 118 | QStringList OFileListView::selectedPaths()const { |
114 | 119 | QStringList list; | |
120 | list << selectedPath(); | ||
121 | return list; | ||
115 | } | 122 | } |
116 | int OFileListView::fileCount() { | 123 | int OFileListView::fileCount() { |
117 | return childCount(); | 124 | return childCount(); |
118 | } | 125 | } |
diff --git a/libopie/ofileselector/ofileselector.cpp b/libopie/ofileselector/ofileselector.cpp index f655606..16ee3ee 100644 --- a/libopie/ofileselector/ofileselector.cpp +++ b/libopie/ofileselector/ofileselector.cpp | |||
@@ -237,55 +237,55 @@ void OFileSelector::setShowFiles(bool show ) | |||
237 | m_files = show; | 237 | m_files = show; |
238 | reparse(); | 238 | reparse(); |
239 | } | 239 | } |
240 | /// | 240 | /// |
241 | bool OFileSelector::cd(const QString &path ) | 241 | bool OFileSelector::cd(const QString &path ) |
242 | { | 242 | { |
243 | m_currentDir = path; | 243 | m_currentDir = path; |
244 | reparse(); | 244 | reparse(); |
245 | return true; | 245 | return true; |
246 | } | 246 | } |
247 | void OFileSelector::setSelector(int mode ) | 247 | void OFileSelector::setSelector(int mode ) |
248 | { | 248 | { |
249 | QString text; | 249 | QString text; |
250 | switch( mode ){ | 250 | switch( mode ){ |
251 | case Normal: | 251 | case Normal: |
252 | text = tr("Documents"); | 252 | text = tr("Documents"); |
253 | break; | 253 | break; |
254 | case Extended: | 254 | case Extended: |
255 | text = tr("Files"); | 255 | text = tr("Files"); |
256 | break; | 256 | break; |
257 | case ExtendedAll: | 257 | case ExtendedAll: |
258 | text = tr("All Files"); | 258 | text = tr("All Files"); |
259 | break; | 259 | break; |
260 | } | 260 | } |
261 | slotViewCheck( text ); | 261 | slotViewCheck( text ); |
262 | } | 262 | } |
263 | 263 | ||
264 | void OFileSelector::setPopupFactory(OPopupMenuFactory *popup ) | 264 | void OFileSelector::setPopupFactory(OPopupMenuFactory */*popup*/ ) |
265 | { | 265 | { |
266 | /* m_custom = popup; | 266 | /* m_custom = popup; |
267 | m_showPopup = true; | 267 | m_showPopup = true; |
268 | */ | 268 | */ |
269 | } | 269 | } |
270 | 270 | ||
271 | //void OFileSelector::updateL | 271 | //void OFileSelector::updateL |
272 | 272 | ||
273 | QString OFileSelector::selectedName() const | 273 | QString OFileSelector::selectedName() const |
274 | { | 274 | { |
275 | QString name; | 275 | QString name; |
276 | if( m_selector == Normal ){ | 276 | if( m_selector == Normal ){ |
277 | DocLnk lnk = m_select->selectedDocument(); | 277 | DocLnk lnk = m_select->selectedDocument(); |
278 | name = lnk.file(); | 278 | name = lnk.file(); |
279 | }else if( m_selector == Extended || m_selector == ExtendedAll ){ | 279 | }else { |
280 | if ( m_shLne ) { | 280 | if ( m_shLne ) { |
281 | name = m_currentDir + "/" +m_edit->text(); | 281 | name = m_currentDir + "/" +m_edit->text(); |
282 | }else{ | 282 | }else{ |
283 | name = m_currentDir + "/" + currentView()->selectedName(); | 283 | name = m_currentDir + "/" + currentView()->selectedName(); |
284 | } | 284 | } |
285 | } | 285 | } |
286 | return name; | 286 | return name; |
287 | } | 287 | } |
288 | QStringList OFileSelector::selectedNames()const | 288 | QStringList OFileSelector::selectedNames()const |
289 | { | 289 | { |
290 | QStringList list; | 290 | QStringList list; |
291 | if( m_selector == Normal ){ | 291 | if( m_selector == Normal ){ |
@@ -295,27 +295,27 @@ QStringList OFileSelector::selectedNames()const | |||
295 | } | 295 | } |
296 | return list; | 296 | return list; |
297 | } | 297 | } |
298 | /** If mode is set to the Dir selection this will return the selected path. | 298 | /** If mode is set to the Dir selection this will return the selected path. |
299 | * | 299 | * |
300 | * | 300 | * |
301 | */ | 301 | */ |
302 | QString OFileSelector::selectedPath()const | 302 | QString OFileSelector::selectedPath()const |
303 | { | 303 | { |
304 | QString path; | 304 | QString path; |
305 | if( m_selector == Normal ){ | 305 | if( m_selector == Normal ){ |
306 | path = QPEApplication::documentDir(); | 306 | path = QPEApplication::documentDir(); |
307 | }else if( m_selector == Extended || m_selector == ExtendedAll ){ | 307 | } /*else if( m_selector == Extended || m_selector == ExtendedAll ){ |
308 | ; //FIXME | 308 | ; |
309 | } | 309 | }*/ |
310 | return path; | 310 | return path; |
311 | } | 311 | } |
312 | QStringList OFileSelector::selectedPaths() const | 312 | QStringList OFileSelector::selectedPaths() const |
313 | { | 313 | { |
314 | QStringList list; | 314 | QStringList list; |
315 | list << selectedPath(); | 315 | list << selectedPath(); |
316 | return list; | 316 | return list; |
317 | } | 317 | } |
318 | QString OFileSelector::directory()const | 318 | QString OFileSelector::directory()const |
319 | { | 319 | { |
320 | if( m_selector == Normal ) | 320 | if( m_selector == Normal ) |
321 | return QPEApplication::documentDir(); | 321 | return QPEApplication::documentDir(); |
@@ -324,63 +324,64 @@ QString OFileSelector::directory()const | |||
324 | } | 324 | } |
325 | 325 | ||
326 | int OFileSelector::fileCount() | 326 | int OFileSelector::fileCount() |
327 | { | 327 | { |
328 | int count; | 328 | int count; |
329 | switch( m_selector ){ | 329 | switch( m_selector ){ |
330 | case Normal: | 330 | case Normal: |
331 | count = m_select->fileCount(); | 331 | count = m_select->fileCount(); |
332 | break; | 332 | break; |
333 | case Extended: | 333 | case Extended: |
334 | case ExtendedAll: | 334 | case ExtendedAll: |
335 | default: | 335 | default: |
336 | count = currentView()->childCount(); | 336 | count = currentView()->fileCount(); |
337 | break; | 337 | break; |
338 | } | 338 | } |
339 | return count; | 339 | return count; |
340 | } | 340 | } |
341 | DocLnk OFileSelector::selectedDocument() const | 341 | DocLnk OFileSelector::selectedDocument() const |
342 | { | 342 | { |
343 | DocLnk lnk; | 343 | DocLnk lnk; |
344 | switch( m_selector ){ | 344 | switch( m_selector ){ |
345 | case Normal:{ | 345 | case Normal:{ |
346 | lnk = m_select->selectedDocument(); | 346 | lnk = m_select->selectedDocument(); |
347 | break; | 347 | break; |
348 | } | 348 | } |
349 | case Extended: | 349 | case Extended: |
350 | case ExtendedAll: | 350 | case ExtendedAll: |
351 | default: | 351 | default: |
352 | lnk = DocLnk( selectedName() ); // new DocLnk | 352 | lnk = DocLnk( selectedName() ); |
353 | break; | 353 | break; |
354 | } | 354 | } |
355 | return lnk; | 355 | return lnk; |
356 | } | 356 | } |
357 | QValueList<DocLnk> OFileSelector::selectedDocuments() const | 357 | QValueList<DocLnk> OFileSelector::selectedDocuments() const |
358 | { | 358 | { |
359 | QValueList<DocLnk> docs; | 359 | QValueList<DocLnk> docs; |
360 | docs.append( selectedDocument() ); | 360 | docs.append( selectedDocument() ); |
361 | return docs; | 361 | return docs; |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | // slots internal | 365 | // slots internal |
366 | 366 | ||
367 | void OFileSelector::slotOk() | 367 | void OFileSelector::slotOk() |
368 | { | 368 | { |
369 | emit ok(); | 369 | emit ok(); |
370 | } | 370 | } |
371 | void OFileSelector::slotCancel() | 371 | void OFileSelector::slotCancel() |
372 | { | 372 | { |
373 | emit cancel(); | 373 | emit cancel(); |
374 | } | 374 | } |
375 | /* switch the views */ | ||
375 | void OFileSelector::slotViewCheck(const QString &sel) | 376 | void OFileSelector::slotViewCheck(const QString &sel) |
376 | { | 377 | { |
377 | if( sel == tr("Documents" ) ){ | 378 | if( sel == tr("Documents" ) ){ |
378 | if( m_select == 0 ){ | 379 | if( m_select == 0 ){ |
379 | // autMime? fix cause now we use All and not the current | 380 | // autMime? fix cause now we use All and not the current |
380 | // yes currentMime fixes that for us | 381 | // yes currentMime fixes that for us |
381 | QString mime = currentMimeType(); | 382 | QString mime = currentMimeType(); |
382 | m_select = new FileSelector(mime, | 383 | m_select = new FileSelector(mime, |
383 | m_stack, "fileselector", | 384 | m_stack, "fileselector", |
384 | m_shNew, m_shClose); | 385 | m_shNew, m_shClose); |
385 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), | 386 | connect(m_select, SIGNAL(fileSelected( const DocLnk & ) ), |
386 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); | 387 | this, SLOT( slotFileBridgeSelected(const DocLnk & ) ) ); |
@@ -395,25 +396,25 @@ void OFileSelector::slotViewCheck(const QString &sel) | |||
395 | }else if( sel == tr("Files") ){ | 396 | }else if( sel == tr("Files") ){ |
396 | m_selector = Extended; | 397 | m_selector = Extended; |
397 | initializeListView(); | 398 | initializeListView(); |
398 | reparse(); | 399 | reparse(); |
399 | m_stack->raiseWidget( Extended ); | 400 | m_stack->raiseWidget( Extended ); |
400 | }else if( sel == tr("All Files") ){ | 401 | }else if( sel == tr("All Files") ){ |
401 | m_selector = ExtendedAll; | 402 | m_selector = ExtendedAll; |
402 | initializeListView(); | 403 | initializeListView(); |
403 | reparse(); | 404 | reparse(); |
404 | m_stack->raiseWidget( Extended ); // same widget other QFileFilter | 405 | m_stack->raiseWidget( Extended ); // same widget other QFileFilter |
405 | } | 406 | } |
406 | } | 407 | } |
407 | // not yet finished..... | 408 | |
408 | QString OFileSelector::currentMimeType() const{ | 409 | QString OFileSelector::currentMimeType() const{ |
409 | QString mime; | 410 | QString mime; |
410 | QString currentText; | 411 | QString currentText; |
411 | if (m_shChooser ) | 412 | if (m_shChooser ) |
412 | currentText = m_mimeCheck->currentText(); | 413 | currentText = m_mimeCheck->currentText(); |
413 | 414 | ||
414 | if (tr("All") == currentText ) return QString::null; | 415 | if (tr("All") == currentText ) return QString::null; |
415 | else if (currentText.isEmpty() ) { | 416 | else if (currentText.isEmpty() ) { |
416 | ; | 417 | ; |
417 | }else { | 418 | }else { |
418 | QMap<QString, QStringList>::ConstIterator it; | 419 | QMap<QString, QStringList>::ConstIterator it; |
419 | it = m_mimetypes.find( currentText ); | 420 | it = m_mimetypes.find( currentText ); |
@@ -622,36 +623,36 @@ void OFileSelector::initVars() | |||
622 | m_lay = 0; | 623 | m_lay = 0; |
623 | m_Oselector = 0; | 624 | m_Oselector = 0; |
624 | m_boxToolbar = 0; | 625 | m_boxToolbar = 0; |
625 | m_boxOk = 0; | 626 | m_boxOk = 0; |
626 | m_boxName = 0; | 627 | m_boxName = 0; |
627 | m_boxView = 0; | 628 | m_boxView = 0; |
628 | m_custom = 0; | 629 | m_custom = 0; |
629 | m_edit = 0; | 630 | m_edit = 0; |
630 | m_fnLabel = 0; | 631 | m_fnLabel = 0; |
631 | m_new = 0; | 632 | m_new = 0; |
632 | m_close = 0; | 633 | m_close = 0; |
633 | } | 634 | } |
634 | void OFileSelector::addFile(const QString &mime, QFileInfo *info, bool symlink) | 635 | void OFileSelector::addFile(const QString &, QFileInfo *info, bool ) |
635 | { | 636 | { |
636 | if(!m_files) | 637 | if(!m_files) |
637 | return; | 638 | return; |
638 | // if( !compliesMime(info->absFilePath(), mime ) ) | 639 | // if( !compliesMime(info->absFilePath(), mime ) ) |
639 | // return; | 640 | // return; |
640 | MimeType type( info->absFilePath() ); | 641 | MimeType type( info->absFilePath() ); |
641 | if (!compliesMime( type.id() ) ) | 642 | if (!compliesMime( type.id() ) ) |
642 | return; | 643 | return; |
643 | 644 | ||
644 | } | 645 | } |
645 | void OFileSelector::addDir(const QString &mime, QFileInfo *info, bool symlink ) | 646 | void OFileSelector::addDir(const QString &, QFileInfo *, bool ) |
646 | { | 647 | { |
647 | if(!m_dir) | 648 | if(!m_dir) |
648 | return; | 649 | return; |
649 | } | 650 | } |
650 | void OFileSelector::delItems() | 651 | void OFileSelector::delItems() |
651 | { | 652 | { |
652 | 653 | ||
653 | } | 654 | } |
654 | void OFileSelector::initializeName() | 655 | void OFileSelector::initializeName() |
655 | { | 656 | { |
656 | /** Name Layout Line | 657 | /** Name Layout Line |
657 | * This is the Layout line arranged in | 658 | * This is the Layout line arranged in |
@@ -916,159 +917,167 @@ bool OFileSelector::compliesMime( const QString& mime ) { | |||
916 | else qWarning("found"), list = it.data(); | 917 | else qWarning("found"), list = it.data(); |
917 | } | 918 | } |
918 | // dump it now | 919 | // dump it now |
919 | //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { | 920 | //for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { |
920 | // qWarning( "%s", (*it).latin1() ); | 921 | // qWarning( "%s", (*it).latin1() ); |
921 | //} | 922 | //} |
922 | 923 | ||
923 | 924 | ||
924 | if ( list.contains(mime) ) return true; | 925 | if ( list.contains(mime) ) return true; |
925 | qWarning("list doesn't contain it "); | 926 | qWarning("list doesn't contain it "); |
926 | QStringList::Iterator it2; | 927 | QStringList::Iterator it2; |
927 | int pos; | 928 | int pos; |
928 | int pos2; | ||
929 | for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { | 929 | for ( it2 = list.begin(); it2 != list.end(); ++it2 ) { |
930 | pos = (*it2).findRev("/*"); | 930 | pos = (*it2).findRev("/*"); |
931 | if ( pos >= 0 ) { | 931 | if ( pos >= 0 ) { |
932 | if ( mime.contains( (*it2).left(pos) ) ) return true; | 932 | if ( mime.contains( (*it2).left(pos) ) ) return true; |
933 | } | 933 | } |
934 | } | 934 | } |
935 | return false; | 935 | return false; |
936 | } | 936 | } |
937 | void OFileSelector::slotFileSelected( const QString &string ) | 937 | void OFileSelector::slotFileSelected( const QString &string ) |
938 | { | 938 | { |
939 | if( m_shLne ) | 939 | if( m_shLne ) |
940 | m_edit->setText( string ); | 940 | m_edit->setText( string ); |
941 | emit fileSelected( string ); | 941 | emit fileSelected( string ); |
942 | } | 942 | } |
943 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) | 943 | void OFileSelector::slotFileBridgeSelected( const DocLnk &lnk ) |
944 | { | 944 | { |
945 | slotFileSelected( lnk.name() ); | 945 | slotFileSelected( lnk.name() ); |
946 | // emit fileSelected( lnk ); | 946 | // emit fileSelected( lnk ); |
947 | } | 947 | } |
948 | void OFileSelector::slotSelectionChanged() | 948 | void OFileSelector::slotSelectionChanged() |
949 | { | 949 | { |
950 | 950 | ||
951 | } | 951 | } |
952 | void OFileSelector::slotCurrentChanged(QListViewItem* item ) | 952 | void OFileSelector::slotCurrentChanged(QListViewItem* /*item*/ ) |
953 | { | 953 | { |
954 | /* | ||
954 | if( item == 0 ) | 955 | if( item == 0 ) |
955 | return; | 956 | return; |
956 | if( m_selector == Extended || m_selector == ExtendedAll ) { | 957 | if( m_selector == Extended || m_selector == ExtendedAll ) { |
957 | OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) | 958 | OFileSelectorItem *sel = (OFileSelectorItem*) item; // start to use the C++ casts ;) |
958 | qWarning("current changed"); | 959 | qWarning("current changed"); |
959 | if(!sel->isDir() ){ | 960 | if(!sel->isDir() ){ |
960 | if( m_shLne ) | 961 | if( m_shLne ) |
961 | m_edit->setText( sel->text(1) ); | 962 | m_edit->setText( sel->text(1) ); |
962 | 963 | ||
963 | if (m_mode == Fileselector ) { | 964 | if (m_mode == Fileselector ) { |
964 | QStringList str = QStringList::split("->", sel->text(1) ); | 965 | QStringList str = QStringList::split("->", sel->text(1) ); |
965 | QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); | 966 | QString path =sel->directory() + "/" + str[0].stripWhiteSpace(); |
966 | emit fileSelected(path ); | 967 | emit fileSelected(path ); |
967 | DocLnk lnk( path ); | 968 | DocLnk lnk( path ); |
968 | emit fileSelected(lnk ); | 969 | emit fileSelected(lnk ); |
969 | } | 970 | } |
970 | } | 971 | } |
971 | } | 972 | } */ |
972 | } | 973 | } |
973 | void OFileSelector::slotClicked( int button, QListViewItem *item, const QPoint &, int) | 974 | void OFileSelector::slotClicked( int /*button*/, QListViewItem */*item*/, const QPoint &, int) |
975 | |||
974 | { | 976 | { |
977 | /* | ||
975 | if ( item == 0 ) | 978 | if ( item == 0 ) |
976 | return; | 979 | return; |
977 | 980 | ||
978 | if( button != Qt::LeftButton ) | 981 | if( button != Qt::LeftButton ) |
979 | return; | 982 | return; |
980 | 983 | ||
981 | switch( m_selector ){ | 984 | switch( m_selector ){ |
982 | default: | 985 | default: |
983 | break; | 986 | break; |
984 | case Extended: // fall through | 987 | case Extended: // fall through |
985 | case ExtendedAll:{ | 988 | case ExtendedAll:{ |
986 | OFileSelectorItem *sel = (OFileSelectorItem*)item; | 989 | OFileSelectorItem *sel = (OFileSelectorItem*)item; |
987 | if(!sel->isLocked() ){ | 990 | if(!sel->isLocked() ){ |
988 | QStringList str = QStringList::split("->", sel->text(1) ); | 991 | QStringList str = QStringList::split("->", sel->text(1) ); |
989 | if( sel->isDir() ){ | 992 | if( sel->isDir() ){ |
990 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 993 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
991 | // if MODE Dir m_shLne set the Text | 994 | // if MODE Dir m_shLne set the Text |
992 | }else{ | 995 | }else{ |
993 | if( m_shLne ) | 996 | if( m_shLne ) |
994 | m_edit->setText( str[0].stripWhiteSpace() ); | 997 | m_edit->setText( str[0].stripWhiteSpace() ); |
995 | qWarning("selected here in slot clicked"); | 998 | qWarning("selected here in slot clicked"); |
996 | emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 999 | emit fileSelected( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
997 | DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 1000 | DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
998 | qWarning("file selected"); | 1001 | qWarning("file selected"); |
999 | emit fileSelected( lnk ); | 1002 | emit fileSelected( lnk ); |
1000 | } | 1003 | } |
1001 | } | 1004 | } |
1002 | break; | 1005 | break; |
1003 | } | 1006 | } |
1004 | } | 1007 | } */ |
1005 | } | 1008 | } |
1006 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) | 1009 | void OFileSelector::slotRightButton(int button, QListViewItem *item, const QPoint &, int ) |
1007 | { | 1010 | { |
1008 | if( item == 0 ) | 1011 | if( item == 0 ) |
1009 | return; | 1012 | return; |
1010 | 1013 | ||
1011 | if( button != Qt::RightButton ) | 1014 | if( button != Qt::RightButton ) |
1012 | return; | 1015 | return; |
1013 | slotContextMenu( item ); | 1016 | slotContextMenu( item ); |
1014 | } | 1017 | } |
1015 | void OFileSelector::slotContextMenu( QListViewItem *item) | 1018 | void OFileSelector::slotContextMenu( QListViewItem */*item*/) |
1016 | { | 1019 | { |
1017 | 1020 | ||
1018 | } | 1021 | } |
1019 | void OFileSelector::slotChangedDir() | 1022 | void OFileSelector::slotChangedDir() |
1020 | { | 1023 | { |
1024 | /* | ||
1021 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1025 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1022 | if(sel->isDir() ){ | 1026 | if(sel->isDir() ){ |
1023 | QStringList str = QStringList::split("->", sel->text(1) ); | 1027 | QStringList str = QStringList::split("->", sel->text(1) ); |
1024 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 1028 | cd( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
1025 | } | 1029 | } |
1030 | */ | ||
1026 | } | 1031 | } |
1027 | void OFileSelector::slotOpen() | 1032 | void OFileSelector::slotOpen() |
1028 | { | 1033 | { |
1034 | /* | ||
1029 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1035 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1030 | if(!sel->isDir() ){ | 1036 | if(!sel->isDir() ){ |
1031 | QStringList str = QStringList::split("->", sel->text(1) ); | 1037 | QStringList str = QStringList::split("->", sel->text(1) ); |
1032 | slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); | 1038 | slotFileSelected( sel->directory() +"/" +str[0].stripWhiteSpace() ); |
1033 | qWarning("slot open"); | 1039 | qWarning("slot open"); |
1034 | // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); | 1040 | // DocLnk lnk( sel->directory() + "/" + str[0].stripWhiteSpace() ); |
1035 | //emit fileSelected( lnk ); | 1041 | //emit fileSelected( lnk ); |
1036 | } | 1042 | } |
1043 | */ | ||
1037 | } | 1044 | } |
1038 | void OFileSelector::slotRescan() | 1045 | void OFileSelector::slotRescan() |
1039 | { | 1046 | { |
1040 | 1047 | ||
1041 | } | 1048 | } |
1042 | void OFileSelector::slotRename() | 1049 | void OFileSelector::slotRename() |
1043 | { | 1050 | { |
1044 | reparse(); | 1051 | reparse(); |
1045 | } | 1052 | } |
1046 | void OFileSelector::slotDelete() | 1053 | void OFileSelector::slotDelete() |
1047 | { | 1054 | { |
1055 | /* | ||
1048 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); | 1056 | OFileSelectorItem *sel = (OFileSelectorItem*)m_View->currentItem(); |
1049 | QStringList list = QStringList::split("->", sel->text(1) ); | 1057 | QStringList list = QStringList::split("->", sel->text(1) ); |
1050 | if( sel->isDir() ){ | 1058 | if( sel->isDir() ){ |
1051 | QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry | 1059 | QString str = QString::fromLatin1("rm -rf ") + sel->directory() +"/" + list[0]; //better safe than sorry |
1052 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], | 1060 | switch ( QMessageBox::warning(this,tr("Delete"),tr("Do you really want to delete\n")+list[0], |
1053 | tr("Yes"),tr("No"),0,1,1) ) { | 1061 | tr("Yes"),tr("No"),0,1,1) ) { |
1054 | case 0: | 1062 | case 0: |
1055 | ::system(str.utf8().data() ); | 1063 | ::system(str.utf8().data() ); |
1056 | break; | 1064 | break; |
1057 | } | 1065 | } |
1058 | } else { | 1066 | } else { |
1059 | QFile::remove( list[0] ); | 1067 | QFile::remove( list[0] ); |
1060 | } | 1068 | } |
1061 | m_View->takeItem( sel ); | 1069 | m_View->takeItem( sel ); |
1062 | delete sel; | 1070 | delete sel; |
1071 | */ | ||
1063 | } | 1072 | } |
1064 | void OFileSelector::cdUP() | 1073 | void OFileSelector::cdUP() |
1065 | { | 1074 | { |
1066 | QDir dir( m_currentDir ); | 1075 | QDir dir( m_currentDir ); |
1067 | dir.cdUp(); | 1076 | dir.cdUp(); |
1068 | if(dir.exists() ){ | 1077 | if(dir.exists() ){ |
1069 | m_currentDir = dir.absPath(); | 1078 | m_currentDir = dir.absPath(); |
1070 | reparse(); | 1079 | reparse(); |
1071 | int count = m_location->count(); | 1080 | int count = m_location->count(); |
1072 | slotInsertLocationPath( m_currentDir, count); | 1081 | slotInsertLocationPath( m_currentDir, count); |
1073 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); | 1082 | m_location->setCurrentItem( indexByString( m_location, m_currentDir)); |
1074 | //this wont work in all instances | 1083 | //this wont work in all instances |
@@ -1201,24 +1210,27 @@ void OFileSelector::reparse() | |||
1201 | m_View->sort(); | 1210 | m_View->sort(); |
1202 | if( m_shTool ){ | 1211 | if( m_shTool ){ |
1203 | m_location->insertItem( m_currentDir ); | 1212 | m_location->insertItem( m_currentDir ); |
1204 | 1213 | ||
1205 | } | 1214 | } |
1206 | // reenable painting and updates | 1215 | // reenable painting and updates |
1207 | } | 1216 | } |
1208 | 1217 | ||
1209 | 1218 | ||
1210 | OFileView* OFileSelector::currentView() { | 1219 | OFileView* OFileSelector::currentView() { |
1211 | return 0l; | 1220 | return 0l; |
1212 | } | 1221 | } |
1222 | OFileView* OFileSelector::currentView() const{ | ||
1223 | return 0l; | ||
1224 | } | ||
1213 | int OFileSelector::filter() { | 1225 | int OFileSelector::filter() { |
1214 | int filter; | 1226 | int filter; |
1215 | if ( m_selector == ExtendedAll ) | 1227 | if ( m_selector == ExtendedAll ) |
1216 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; | 1228 | filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; |
1217 | else | 1229 | else |
1218 | filter = QDir::Files | QDir::Dirs | QDir::All ; | 1230 | filter = QDir::Files | QDir::Dirs | QDir::All ; |
1219 | 1231 | ||
1220 | return filter; | 1232 | return filter; |
1221 | } | 1233 | } |
1222 | int OFileSelector::sorting() { | 1234 | int OFileSelector::sorting() { |
1223 | int sort; | 1235 | int sort; |
1224 | 1236 | ||
@@ -1235,12 +1247,16 @@ void OFileSelector::internFileSelected( const QString& s) { | |||
1235 | void OFileSelector::internFileSelected( const DocLnk& d ) { | 1247 | void OFileSelector::internFileSelected( const DocLnk& d ) { |
1236 | emit fileSelected( d ); | 1248 | emit fileSelected( d ); |
1237 | } | 1249 | } |
1238 | void OFileSelector::internContextMenu() { | 1250 | void OFileSelector::internContextMenu() { |
1239 | emit contextMenu(); | 1251 | emit contextMenu(); |
1240 | } | 1252 | } |
1241 | void OFileSelector::internChangedDir( const QString& s) { | 1253 | void OFileSelector::internChangedDir( const QString& s) { |
1242 | emit dirSelected( s ); | 1254 | emit dirSelected( s ); |
1243 | } | 1255 | } |
1244 | void OFileSelector::internChangedDir( const QDir& s) { | 1256 | void OFileSelector::internChangedDir( const QDir& s) { |
1245 | emit dirSelected( s ); | 1257 | emit dirSelected( s ); |
1246 | } | 1258 | } |
1259 | QPixmap OFileSelector::pixmap( const QString& s ) { | ||
1260 | |||
1261 | return (*m_pixmaps)[s]; | ||
1262 | } | ||
diff --git a/libopie/ofileselector/ofileselector.h b/libopie/ofileselector/ofileselector.h index 937569d..12af732 100644 --- a/libopie/ofileselector/ofileselector.h +++ b/libopie/ofileselector/ofileselector.h | |||
@@ -327,26 +327,28 @@ class OFileSelector : public QWidget { | |||
327 | QString directory()const; | 327 | QString directory()const; |
328 | 328 | ||
329 | /** | 329 | /** |
330 | * fileCount | 330 | * fileCount |
331 | */ | 331 | */ |
332 | int fileCount(); | 332 | int fileCount(); |
333 | 333 | ||
334 | DocLnk selectedDocument()const; | 334 | DocLnk selectedDocument()const; |
335 | 335 | ||
336 | QValueList<DocLnk> selectedDocuments()const; | 336 | QValueList<DocLnk> selectedDocuments()const; |
337 | 337 | ||
338 | OFileView* currentView(); | 338 | OFileView* currentView(); |
339 | OFileView* currentView()const; | ||
339 | int filter(); | 340 | int filter(); |
340 | int sorting(); | 341 | int sorting(); |
342 | QPixmap pixmap( const QString& ); | ||
341 | 343 | ||
342 | signals: | 344 | signals: |
343 | void fileSelected( const DocLnk & ); | 345 | void fileSelected( const DocLnk & ); |
344 | void fileSelected( const QString & ); | 346 | void fileSelected( const QString & ); |
345 | void dirSelected(const QString &dir ); | 347 | void dirSelected(const QString &dir ); |
346 | void dirSelected( const QDir& ); | 348 | void dirSelected( const QDir& ); |
347 | void closeMe(); | 349 | void closeMe(); |
348 | void ok(); | 350 | void ok(); |
349 | void cancel(); | 351 | void cancel(); |
350 | void contextMenu(); | 352 | void contextMenu(); |
351 | 353 | ||
352 | private slots: | 354 | private slots: |
diff --git a/libopie/ofileselector/ofileview.cpp b/libopie/ofileselector/ofileview.cpp index 71843c1..9bb40c9 100644 --- a/libopie/ofileselector/ofileview.cpp +++ b/libopie/ofileselector/ofileview.cpp | |||
@@ -17,12 +17,15 @@ void OFileView::fileSelected( const QString& s ) { | |||
17 | void OFileView::fileSelected( const DocLnk& s) { | 17 | void OFileView::fileSelected( const DocLnk& s) { |
18 | m_sel->internFileSelected( s ); | 18 | m_sel->internFileSelected( s ); |
19 | } | 19 | } |
20 | void OFileView::contextMenu() { | 20 | void OFileView::contextMenu() { |
21 | m_sel->internContextMenu(); | 21 | m_sel->internContextMenu(); |
22 | } | 22 | } |
23 | void OFileView::changedDir( const QString& s) { | 23 | void OFileView::changedDir( const QString& s) { |
24 | m_sel->internChangedDir( s ); | 24 | m_sel->internChangedDir( s ); |
25 | } | 25 | } |
26 | void OFileView::changedDir( const QDir& d ) { | 26 | void OFileView::changedDir( const QDir& d ) { |
27 | m_sel->internChangedDir( d ); | 27 | m_sel->internChangedDir( d ); |
28 | } | 28 | } |
29 | OFileSelector* OFileView::selector() const { | ||
30 | return m_sel; | ||
31 | } | ||
diff --git a/libopie/ofileselector/ofileview.h b/libopie/ofileselector/ofileview.h index 997266a..1b397f5 100644 --- a/libopie/ofileselector/ofileview.h +++ b/libopie/ofileselector/ofileview.h | |||
@@ -81,25 +81,25 @@ public: | |||
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 | 84 | ||
85 | /*signals:*/ | 85 | /*signals:*/ |
86 | protected: | 86 | protected: |
87 | 87 | ||
88 | void fileSelected(const QString &); | 88 | void fileSelected(const QString &); |
89 | void fileSelected(const DocLnk & ); | 89 | void fileSelected(const DocLnk & ); |
90 | void contextMenu(); | 90 | void contextMenu(); |
91 | void changedDir(const QString &); | 91 | void changedDir(const QString &); |
92 | void changedDir(const QDir & ); | 92 | void changedDir(const QDir & ); |
93 | OFileSelector* selector(); | 93 | OFileSelector* selector()const; |
94 | 94 | ||
95 | private: | 95 | private: |
96 | OFileSelector* m_sel; | 96 | OFileSelector* m_sel; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | class OFileViewFactory { | 99 | class OFileViewFactory { |
100 | public: | 100 | public: |
101 | OFileViewFactory() {} ; | 101 | OFileViewFactory() {} ; |
102 | virtual ~OFileViewFactory() = 0; | 102 | virtual ~OFileViewFactory() = 0; |
103 | 103 | ||
104 | OFileView* newView(QWidget *parent, const char *name ); | 104 | OFileView* newView(QWidget *parent, const char *name ); |
105 | QString name()const; | 105 | QString name()const; |