summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-05 12:03:42 (UTC)
committer zautrix <zautrix>2005-02-05 12:03:42 (UTC)
commitf5902d0e08e0b10321c555e8846a8a8ce2087d30 (patch) (unidiff)
tree5aeaa9689b3161867fb0c8707adc5908b5072f06
parent86c0d35262454a31ed7d50d3e20cbdace954ebdf (diff)
downloadkdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.zip
kdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.tar.gz
kdepimpi-f5902d0e08e0b10321c555e8846a8a8ce2087d30.tar.bz2
file selector fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--korganizer/kolistview.cpp2
-rw-r--r--microkde/kfiledialog.cpp2
-rw-r--r--microkde/ofileselector_p.cpp28
-rw-r--r--microkde/ofileselector_p.h1
5 files changed, 35 insertions, 3 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 9ba4f3e..4421e61 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,86 +1,89 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.3 ************ 3********** VERSION 2.0.3 ************
4 4
5KO/Pi: 5KO/Pi:
6Added feature for changing alarm settings for many items at once: 6Added feature for changing alarm settings for many items at once:
7Open list view (or search dialog), select the desired items and choose in 7Open list view (or search dialog), select the desired items and choose in
8the popup menu: Set alarm for selected... 8the popup menu: Set alarm for selected...
9 9
10Added to the event/todo viewer the option to send an email to 10Added to the event/todo viewer the option to send an email to
11all attendees or all selected (with RSVP) attendees. 11all attendees or all selected (with RSVP) attendees.
12 12
13Made the week-month mode changing in month view faster. 13Made the week-month mode changing in month view faster.
14 14
15Made month view better useable with keyboard. 15Made month view better useable with keyboard.
16Now TAB key jumps to next cell with an event/todo. 16Now TAB key jumps to next cell with an event/todo.
17Scroll in cell with coursor keys, scroll in time (next week) with 17Scroll in cell with coursor keys, scroll in time (next week) with
18Shift/Control + coursorkeys. 18Shift/Control + coursorkeys.
19 19
20Fixed bug that the todo view flat mode was reset after first view update. 20Fixed bug that the todo view flat mode was reset after first view update.
21 21
22If a todo is displayed closed in the todo view, it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. 22If a todo is displayed closed in the todo view,
23it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
24
25Added info about the numbers of years to the caption (title) information about a birthday event.
23 26
24********** VERSION 2.0.2 ************ 27********** VERSION 2.0.2 ************
25 28
26KO/Pi: 29KO/Pi:
27Fixed the layout problem of the day label buttons 30Fixed the layout problem of the day label buttons
28of the agenda view introduced in version 2.0.1. 31of the agenda view introduced in version 2.0.1.
29 32
30Added WhatsThis support for the todo view and the list view. 33Added WhatsThis support for the todo view and the list view.
31 34
32Added a quite useful feature to the montview. 35Added a quite useful feature to the montview.
33Just click on the week numbers on the left. 36Just click on the week numbers on the left.
34And in the top right corner of month view/agenda view 37And in the top right corner of month view/agenda view
35there is now a "week number quick selector". 38there is now a "week number quick selector".
36(Click on the black triangle). 39(Click on the black triangle).
37 40
38Made the quite difficult timezone change in KO/Pi easy. 41Made the quite difficult timezone change in KO/Pi easy.
39 42
40OM/Pi: 43OM/Pi:
41Fixed too small icons on desktop. 44Fixed too small icons on desktop.
42Fixed non visible icons in mainwindow on Z with fastload enabled. 45Fixed non visible icons in mainwindow on Z with fastload enabled.
43Added signature file setting to smtp account config. 46Added signature file setting to smtp account config.
44And the signature can be edited and saved in the edit mail dialog. 47And the signature can be edited and saved in the edit mail dialog.
45That does mean: 48That does mean:
46Simply edit the signature for the selected smtp account in the 49Simply edit the signature for the selected smtp account in the
47edit new mail dialog and press the "save signature" button there. 50edit new mail dialog and press the "save signature" button there.
48Then the signature is saved to the file specified in the smtp account settings. 51Then the signature is saved to the file specified in the smtp account settings.
49If there is no file specified, it is saved automatically to the file 52If there is no file specified, it is saved automatically to the file
50kdepim/apps/kopiemail/<accountname>.sig. 53kdepim/apps/kopiemail/<accountname>.sig.
51 54
52 55
53 56
54********** VERSION 2.0.1 ************ 57********** VERSION 2.0.1 ************
55 58
56Oooops ... I forgot to test on the Zaurus 5500 ... 59Oooops ... I forgot to test on the Zaurus 5500 ...
57 60
58Fixed many problems of new (english) strings (and german translations) 61Fixed many problems of new (english) strings (and german translations)
59introduced in the latest versions, where the text was not fitting on the 62introduced in the latest versions, where the text was not fitting on the
60240x320 display of the Zaurus 5500. 63240x320 display of the Zaurus 5500.
61 64
62KO/Pi: 65KO/Pi:
63Added a popup menu ( press pen and hold to get popup ) to the agenda view 66Added a popup menu ( press pen and hold to get popup ) to the agenda view
64with many useful items (add event/todo, show next week, two weeks, month, journal). 67with many useful items (add event/todo, show next week, two weeks, month, journal).
65 68
66Added items to the todolist popup menu for: 69Added items to the todolist popup menu for:
67Display all opened, all closed or all todos flat. 70Display all opened, all closed or all todos flat.
68The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 71The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
69Made the reparenting of todos on the desktop possible via Drag&Drop. 72Made the reparenting of todos on the desktop possible via Drag&Drop.
70Fixed several bugs in setting the completed datetime for todos. 73Fixed several bugs in setting the completed datetime for todos.
71Added info about completed datetime of todos to the todo viewer. 74Added info about completed datetime of todos to the todo viewer.
72Now displaying a completed todo (with completed datetime set) in the agenda view 75Now displaying a completed todo (with completed datetime set) in the agenda view
73at the time of the completion. Such that now it is possible to see in the agenda view 76at the time of the completion. Such that now it is possible to see in the agenda view
74when what todo was completed. 77when what todo was completed.
75Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 78Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
76Now the behaviour is: 79Now the behaviour is:
77Setting a parent to complete sets all (sub)childs to complete. 80Setting a parent to complete sets all (sub)childs to complete.
78Setting a parent to uncomplete does not change the childs. 81Setting a parent to uncomplete does not change the childs.
79Setting a child to uncomplete sets all parent to uncomplete. 82Setting a child to uncomplete sets all parent to uncomplete.
80Setting a child to complete does not change the parents. 83Setting a child to complete does not change the parents.
81 84
82Smart updating and double buffering of the daymatrix. 85Smart updating and double buffering of the daymatrix.
83Showing holidays in the day matrix. 86Showing holidays in the day matrix.
84Many other small performance updates. 87Many other small performance updates.
85 88
86Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. 89Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp
index d0dbb47..acd9265 100644
--- a/korganizer/kolistview.cpp
+++ b/korganizer/kolistview.cpp
@@ -459,129 +459,129 @@ void KOListView::setCategories( bool removeOld )
459 temp = item; 459 temp = item;
460 item = sel.next(); 460 item = sel.next();
461 mUidDict.remove( inc->uid() ); 461 mUidDict.remove( inc->uid() );
462 delete temp;; 462 delete temp;;
463 addIncidence( inc ); 463 addIncidence( inc );
464 } 464 }
465} 465}
466 466
467void KOListView::beamSelected() 467void KOListView::beamSelected()
468{ 468{
469 int icount = 0; 469 int icount = 0;
470 QPtrList<Incidence> delSel ; 470 QPtrList<Incidence> delSel ;
471 QListViewItem *item = mListView->firstChild (); 471 QListViewItem *item = mListView->firstChild ();
472 while ( item ) { 472 while ( item ) {
473 if ( item->isSelected() ) { 473 if ( item->isSelected() ) {
474 delSel.append(((KOListViewItem *)item)->data()); 474 delSel.append(((KOListViewItem *)item)->data());
475 ++icount; 475 ++icount;
476 } 476 }
477 477
478 item = item->nextSibling(); 478 item = item->nextSibling();
479 } 479 }
480 if ( icount ) { 480 if ( icount ) {
481 emit beamIncidenceList( delSel ); 481 emit beamIncidenceList( delSel );
482 return; 482 return;
483 QString fn ; 483 QString fn ;
484 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs"; 484 fn = QDir::homeDirPath()+"/kopitempbeamfile.vcs";
485 QString mes; 485 QString mes;
486 bool createbup = true; 486 bool createbup = true;
487 if ( createbup ) { 487 if ( createbup ) {
488 QString description = "\n"; 488 QString description = "\n";
489 CalendarLocal* cal = new CalendarLocal(); 489 CalendarLocal* cal = new CalendarLocal();
490 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 490 cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
491 Incidence *incidence = delSel.first(); 491 Incidence *incidence = delSel.first();
492 while ( incidence ) { 492 while ( incidence ) {
493 Incidence *in = incidence->clone(); 493 Incidence *in = incidence->clone();
494 description += in->summary() + "\n"; 494 description += in->summary() + "\n";
495 cal->addIncidence( in ); 495 cal->addIncidence( in );
496 incidence = delSel.next(); 496 incidence = delSel.next();
497 } 497 }
498 FileStorage storage( cal, fn, new VCalFormat ); 498 FileStorage storage( cal, fn, new VCalFormat );
499 storage.save(); 499 storage.save();
500 delete cal; 500 delete cal;
501 mes = i18n("KO/Pi: Ready for beaming"); 501 mes = i18n("KO/Pi: Ready for beaming");
502 topLevelWidget()->setCaption(mes); 502 topLevelWidget()->setCaption(mes);
503 503
504#ifndef DESKTOP_VERSION 504#ifndef DESKTOP_VERSION
505 Ir *ir = new Ir( this ); 505 Ir *ir = new Ir( this );
506 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); 506 connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) );
507 ir->send( fn, description, "text/x-vCalendar" ); 507 ir->send( fn, description, "text/x-vCalendar" );
508#endif 508#endif
509 } 509 }
510 } 510 }
511} 511}
512void KOListView::beamDone( Ir *ir ) 512void KOListView::beamDone( Ir *ir )
513{ 513{
514#ifndef DESKTOP_VERSION 514#ifndef DESKTOP_VERSION
515 delete ir; 515 delete ir;
516#endif 516#endif
517 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done")); 517 topLevelWidget()->setCaption(i18n("KO/Pi:Beaming done"));
518} 518}
519 519
520void KOListView::saveDescriptionToFile() 520void KOListView::saveDescriptionToFile()
521{ 521{
522 522
523 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 523 int result = QMessageBox::warning( this, i18n("KO/Pi: Information!"),
524 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."), 524 i18n("This saves the text/details of selected\nJournals and Events/Todos\nto a text file."),
525 i18n("Continue"), i18n("Cancel"), 0, 525 i18n("Continue"), i18n("Cancel"), 0,
526 0, 1 ); 526 0, 1 );
527 if ( result != 0 ) { 527 if ( result != 0 ) {
528 return; 528 return;
529 } 529 }
530 int icount = 0; 530 int icount = 0;
531 QPtrList<Incidence> delSel ; 531 QPtrList<Incidence> delSel ;
532 QListViewItem *item = mListView->firstChild (); 532 QListViewItem *item = mListView->firstChild ();
533 while ( item ) { 533 while ( item ) {
534 if ( item->isSelected() ) { 534 if ( item->isSelected() ) {
535 delSel.append(((KOListViewItem *)item)->data()); 535 delSel.append(((KOListViewItem *)item)->data());
536 ++icount; 536 ++icount;
537 } 537 }
538 538
539 item = item->nextSibling(); 539 item = item->nextSibling();
540 } 540 }
541 if ( icount ) { 541 if ( icount ) {
542 QString fn = KOPrefs::instance()->mLastSaveFile; 542 QString fn = KOPrefs::instance()->mLastSaveFile;
543 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this ); 543 fn = KFileDialog::getSaveFileName( fn, i18n("Save filename"), this );
544 544
545 if ( fn == "" ) 545 if ( fn == "" )
546 return; 546 return;
547 QFileInfo info; 547 QFileInfo info;
548 info.setFile( fn ); 548 info.setFile( fn );
549 QString mes; 549 QString mes;
550 bool createbup = true; 550 bool createbup = true;
551 if ( info. exists() ) { 551 if ( info. exists() ) {
552 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 552 mes = i18n("File already exists!\nOld file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
553 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 553 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
554 i18n("Overwrite!"), i18n("Cancel"), 0, 554 i18n("Overwrite!"), i18n("Cancel"), 0,
555 0, 1 ); 555 0, 1 );
556 if ( result != 0 ) { 556 if ( result != 0 ) {
557 createbup = false; 557 createbup = false;
558 } 558 }
559 } 559 }
560 if ( createbup ) { 560 if ( createbup ) {
561 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") + 561 QString text = i18n("KO/Pi Description/Journal save file.\nSave date: ") +
562 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false); 562 KGlobal::locale()->formatDateTime(QDateTime::currentDateTime(), false);
563 Incidence *incidence = delSel.first(); 563 Incidence *incidence = delSel.first();
564 icount = 0; 564 icount = 0;
565 while ( incidence ) { 565 while ( incidence ) {
566 if ( incidence->type() == "Journal" ) { 566 if ( incidence->type() == "Journal" ) {
567 text += "\n************************************\n"; 567 text += "\n************************************\n";
568 text += i18n("Journal from: ") +incidence->dtStartDateStr( false ); 568 text += i18n("Journal from: ") +incidence->dtStartDateStr( false );
569 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 569 text +="\n" + i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
570 text +="\n" + i18n("Description: ") + "\n"+ incidence->description(); 570 text +="\n" + i18n("Description: ") + "\n"+ incidence->description();
571 ++icount; 571 ++icount;
572 572
573 } else { 573 } else {
574 if ( !incidence->description().isEmpty() ) { 574 if ( !incidence->description().isEmpty() ) {
575 text += "\n************************************\n"; 575 text += "\n************************************\n";
576 if ( incidence->type() == "Todo" ) 576 if ( incidence->type() == "Todo" )
577 text += i18n("To-Do: "); 577 text += i18n("To-Do: ");
578 text += incidence->summary(); 578 text += incidence->summary();
579 if ( incidence->hasStartDate() ) 579 if ( incidence->hasStartDate() )
580 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false ); 580 text +="\n"+ i18n("Start Date: ") + incidence->dtStartStr( false );
581 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false); 581 text +="\n"+ i18n("Last modified: ") +KGlobal::locale()->formatDateTime(incidence->lastModified(), false);
582 if ( !incidence->location().isEmpty() ) 582 if ( !incidence->location().isEmpty() )
583 text += "\n" +i18n("Location: ") + incidence->location(); 583 text += "\n" +i18n("Location: ") + incidence->location();
584 text += "\n" + i18n("Description: ") + "\n" + incidence->description(); 584 text += "\n" + i18n("Description: ") + "\n" + incidence->description();
585 ++icount; 585 ++icount;
586 586
587 } 587 }
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
index 977499e..309f8dc 100644
--- a/microkde/kfiledialog.cpp
+++ b/microkde/kfiledialog.cpp
@@ -1,74 +1,76 @@
1#include <kfiledialog.h> 1#include <kfiledialog.h>
2#include <qdialog.h> 2#include <qdialog.h>
3#include <qlayout.h> 3#include <qlayout.h>
4#include <qdir.h> 4#include <qdir.h>
5#include <qfileinfo.h> 5#include <qfileinfo.h>
6#include <qapplication.h> 6#include <qapplication.h>
7 7
8#ifndef DESKTOP_VERSION 8#ifndef DESKTOP_VERSION
9//US orig#include <ofileselector.h> 9//US orig#include <ofileselector.h>
10#include <ofileselector_p.h> 10#include <ofileselector_p.h>
11QString KFileDialog::getSaveFileName( const QString & fn, 11QString KFileDialog::getSaveFileName( const QString & fn,
12 const QString & cap , QWidget * par ) 12 const QString & cap , QWidget * par )
13{ 13{
14 QString retfile = ""; 14 QString retfile = "";
15 QDialog dia ( par, "input-dialog", true ); 15 QDialog dia ( par, "input-dialog", true );
16 QVBoxLayout lay( &dia ); 16 QVBoxLayout lay( &dia );
17 lay.setMargin(7); 17 lay.setMargin(7);
18 lay.setSpacing(7); 18 lay.setSpacing(7);
19 dia.setCaption( cap ); 19 dia.setCaption( cap );
20 QString file = fn; 20 QString file = fn;
21 if ( file.isEmpty() ) 21 if ( file.isEmpty() )
22 file = QDir::homeDirPath()+"/*"; 22 file = QDir::homeDirPath()+"/*";
23 QFileInfo fi ( file ); 23 QFileInfo fi ( file );
24 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() ); 24 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
25 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
25 lay.addWidget( &o); 26 lay.addWidget( &o);
26 // o.setNewVisible( true ); 27 // o.setNewVisible( true );
27 // o.setNameVisible( true ); 28 // o.setNameVisible( true );
28 dia.showMaximized(); 29 dia.showMaximized();
29 int res = dia.exec(); 30 int res = dia.exec();
30 if ( res ) 31 if ( res )
31 retfile = o.selectedName(); 32 retfile = o.selectedName();
32 return retfile; 33 return retfile;
33} 34}
34 35
35QString KFileDialog::getOpenFileName( const QString & fn, 36QString KFileDialog::getOpenFileName( const QString & fn,
36 const QString & cap, QWidget * par ) 37 const QString & cap, QWidget * par )
37{ 38{
38 QString retfile = ""; 39 QString retfile = "";
39 QDialog dia ( par, "input-dialog", true ); 40 QDialog dia ( par, "input-dialog", true );
40 // QLineEdit lab ( &dia ); 41 // QLineEdit lab ( &dia );
41 QVBoxLayout lay( &dia ); 42 QVBoxLayout lay( &dia );
42 lay.setMargin(7); 43 lay.setMargin(7);
43 lay.setSpacing(7); 44 lay.setSpacing(7);
44 dia.setCaption( cap ); 45 dia.setCaption( cap );
45 QString file = fn; 46 QString file = fn;
46 if ( file.isEmpty() ) 47 if ( file.isEmpty() )
47 file = QDir::homeDirPath()+"/*";; 48 file = QDir::homeDirPath()+"/*";;
48 QFileInfo fi ( file ); 49 QFileInfo fi ( file );
49 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); 50 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
51 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
50 lay.addWidget( &o); 52 lay.addWidget( &o);
51 dia.showMaximized(); 53 dia.showMaximized();
52 int res = dia.exec(); 54 int res = dia.exec();
53 if ( res ) 55 if ( res )
54 retfile = o.selectedName(); 56 retfile = o.selectedName();
55 return retfile; 57 return retfile;
56} 58}
57 59
58#else 60#else
59 61
60#include <qfiledialog.h> 62#include <qfiledialog.h>
61 63
62QString KFileDialog::getSaveFileName( const QString & fn, 64QString KFileDialog::getSaveFileName( const QString & fn,
63 const QString & cap , QWidget * par ) 65 const QString & cap , QWidget * par )
64{ 66{
65 return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); 67 return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
66} 68}
67QString KFileDialog::getOpenFileName( const QString & fn, 69QString KFileDialog::getOpenFileName( const QString & fn,
68 const QString & cap, QWidget * par ) 70 const QString & cap, QWidget * par )
69{ 71{
70 72
71 return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); 73 return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
72} 74}
73#endif 75#endif
74 76
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index fd5f965..f85f8f4 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -324,179 +324,205 @@ void OFileViewFileListView::reread( bool all ) {
324 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All; 324 filter = QDir::Files | QDir::Dirs | QDir::Hidden | QDir::All;
325 else 325 else
326 filter = QDir::Files | QDir::Dirs | QDir::All; 326 filter = QDir::Files | QDir::Dirs | QDir::All;
327 dir.setFilter( filter ); 327 dir.setFilter( filter );
328 328
329 // now go through all files 329 // now go through all files
330 const QFileInfoList *list = dir.entryInfoList(); 330 const QFileInfoList *list = dir.entryInfoList();
331 if (!list) { 331 if (!list) {
332 cdUP(); 332 cdUP();
333 return; 333 return;
334 } 334 }
335 QFileInfoListIterator it( *list ); 335 QFileInfoListIterator it( *list );
336 QFileInfo *fi; 336 QFileInfo *fi;
337 while( (fi=it.current() ) ){ 337 while( (fi=it.current() ) ){
338 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){ 338 if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ){
339 ++it; 339 ++it;
340 continue; 340 continue;
341 } 341 }
342 342
343 /* 343 /*
344 * It is a symlink we try to resolve it now but don't let us attack by DOS 344 * It is a symlink we try to resolve it now but don't let us attack by DOS
345 * 345 *
346 */ 346 */
347 if( fi->isSymLink() ){ 347 if( fi->isSymLink() ){
348 QString file = fi->dirPath( true ) + "/" + fi->readLink(); 348 QString file = fi->dirPath( true ) + "/" + fi->readLink();
349 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos 349 for( int i = 0; i<=4; i++) { // 5 tries to prevent dos
350 QFileInfo info( file ); 350 QFileInfo info( file );
351 if( !info.exists() ){ 351 if( !info.exists() ){
352 addSymlink( fi, TRUE ); 352 addSymlink( fi, TRUE );
353 break; 353 break;
354 }else if( info.isDir() ){ 354 }else if( info.isDir() ){
355 addDir( fi, TRUE ); 355 addDir( fi, TRUE );
356 break; 356 break;
357 }else if( info.isFile() ){ 357 }else if( info.isFile() ){
358 addFile( fi, TRUE ); 358 addFile( fi, TRUE );
359 break; 359 break;
360 }else if( info.isSymLink() ){ 360 }else if( info.isSymLink() ){
361 file = info.dirPath(true ) + "/" + info.readLink() ; 361 file = info.dirPath(true ) + "/" + info.readLink() ;
362 break; 362 break;
363 }else if( i == 4){ // couldn't resolve symlink add it as symlink 363 }else if( i == 4){ // couldn't resolve symlink add it as symlink
364 addSymlink( fi ); 364 addSymlink( fi );
365 } 365 }
366 } // off for loop for symlink resolving 366 } // off for loop for symlink resolving
367 }else if( fi->isDir() ) 367 }else if( fi->isDir() )
368 addDir( fi ); 368 addDir( fi );
369 else if( fi->isFile() ) 369 else if( fi->isFile() )
370 addFile( fi ); 370 addFile( fi );
371 371
372 ++it; 372 ++it;
373 } // of while loop 373 } // of while loop
374 m_view->sort(); 374 m_view->sort();
375 375
376} 376}
377int OFileViewFileListView::fileCount()const{ 377int OFileViewFileListView::fileCount()const{
378 return m_view->childCount(); 378 return m_view->childCount();
379} 379}
380QString OFileViewFileListView::currentDir()const{ 380QString OFileViewFileListView::currentDir()const{
381 return m_currentDir; 381 return m_currentDir;
382} 382}
383OFileSelector* OFileViewFileListView::selector() { 383OFileSelector* OFileViewFileListView::selector() {
384 return m_sel; 384 return m_sel;
385} 385}
386 386
387bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) { 387bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) {
388#if 0
388 if ( e->type() == QEvent::KeyPress ) { 389 if ( e->type() == QEvent::KeyPress ) {
389 QKeyEvent *k = (QKeyEvent *)e; 390 QKeyEvent *k = (QKeyEvent *)e;
390 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) { 391 if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) {
391 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); 392 slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0);
392 return true; 393 return true;
393 } 394 }
394 } 395 }
396#endif
395 return false; 397 return false;
396} 398}
397 399
398 400
399void OFileViewFileListView::connectSlots() { 401void OFileViewFileListView::connectSlots() {
400 connect(m_view, SIGNAL(clicked(QListViewItem*) ), 402 connect(m_view, SIGNAL(clicked(QListViewItem*) ),
401 this, SLOT(slotCurrentChanged(QListViewItem*) ) ); 403 this, SLOT(slotCurrentChanged(QListViewItem*) ) );
402 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), 404 connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ),
403 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); 405 this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) );
406 connect(m_view, SIGNAL(doubleClicked( QListViewItem* )),
407 this, SLOT(slotDoubleClicked(QListViewItem* ) ) );
408 connect(m_view, SIGNAL(returnPressed( QListViewItem* )),
409 this, SLOT(slotDoubleClicked(QListViewItem* ) ) );
404} 410}
405void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) { 411void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) {
406 if (!item) 412 if (!item)
407 return; 413 return;
408#if 0 414#if 0
409 415
410 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 416 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
411 417
412 if (!sel->isDir() ) { 418 if (!sel->isDir() ) {
413 selector()->m_lneEdit->setText( sel->text(1) ); 419 selector()->m_lneEdit->setText( sel->text(1) );
414 // if in fileselector mode we will emit selected 420 // if in fileselector mode we will emit selected
415 if ( selector()->mode() == OFileSelector::FileSelector ) { 421 if ( selector()->mode() == OFileSelector::FileSelector ) {
416 qWarning("slot Current Changed"); 422 qWarning("slot Current Changed");
417 QStringList str = QStringList::split("->", sel->text(1) ); 423 QStringList str = QStringList::split("->", sel->text(1) );
418 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 424 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
419 emit selector()->fileSelected( path ); 425 emit selector()->fileSelected( path );
420 DocLnk lnk( path ); 426 DocLnk lnk( path );
421 emit selector()->fileSelected( lnk ); 427 emit selector()->fileSelected( lnk );
422 } 428 }
423 } 429 }
424#endif 430#endif
425} 431}
432void OFileViewFileListView::slotDoubleClicked(QListViewItem* item ) {
433 if (!item ) return;
434 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
435 if (!sel->isLocked() ) {
436 QStringList str = QStringList::split("->", sel->text(1) );
437 if (sel->isDir() ) {
438 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
439 emit selector()->dirSelected( m_currentDir );
440 reread( m_all );
441 }else { // file
442 //qWarning("slot Clicked");
443 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
444 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
445 emit selector()->fileSelected( path );
446 DocLnk lnk( path );
447 emit selector()->fileSelected( lnk );
448 emit selector()->ok();
449 }
450 } // not locked
451}
426void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) { 452void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) {
427 if (!item || ( button != Qt::LeftButton) ) 453 if (!item || ( button != Qt::LeftButton) )
428 return; 454 return;
429 455
430 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); 456 OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item);
431 if (!sel->isLocked() ) { 457 if (!sel->isLocked() ) {
432 QStringList str = QStringList::split("->", sel->text(1) ); 458 QStringList str = QStringList::split("->", sel->text(1) );
433 if (sel->isDir() ) { 459 if (sel->isDir() ) {
434 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); 460 m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace();
435 emit selector()->dirSelected( m_currentDir ); 461 emit selector()->dirSelected( m_currentDir );
436 reread( m_all ); 462 reread( m_all );
437 }else { // file 463 }else { // file
438 qWarning("slot Clicked"); 464 //qWarning("slot Clicked");
439 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); 465 selector()->m_lneEdit->setText( str[0].stripWhiteSpace() );
440 QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); 466 QString path = sel->directory() + "/" + str[0].stripWhiteSpace();
441 emit selector()->fileSelected( path ); 467 emit selector()->fileSelected( path );
442 DocLnk lnk( path ); 468 DocLnk lnk( path );
443 emit selector()->fileSelected( lnk ); 469 emit selector()->fileSelected( lnk );
444 } 470 }
445 } // not locked 471 } // not locked
446} 472}
447void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) { 473void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) {
448 MimeType type( info->absFilePath() ); 474 MimeType type( info->absFilePath() );
449 if (!compliesMime( type.id() ) ) 475 if (!compliesMime( type.id() ) )
450 return; 476 return;
451 477
452 QPixmap pix = type.pixmap(); 478 QPixmap pix = type.pixmap();
453 QString dir, name; bool locked; 479 QString dir, name; bool locked;
454 if ( pix.isNull() ) { 480 if ( pix.isNull() ) {
455 QWMatrix matrix; 481 QWMatrix matrix;
456 QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); 482 QPixmap pixer(Resource::loadPixmap("UnknownDocument") );
457 matrix.scale( .4, .4 ); 483 matrix.scale( .4, .4 );
458 pix = pixer.xForm( matrix ); 484 pix = pixer.xForm( matrix );
459 } 485 }
460 dir = info->dirPath( true ); 486 dir = info->dirPath( true );
461 locked = false; 487 locked = false;
462 if ( symlink ) 488 if ( symlink )
463 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); 489 name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink();
464 else{ 490 else{
465 name = info->fileName(); 491 name = info->fileName();
466 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || 492 if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) ||
467 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) { 493 ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) {
468 locked = true; pix = Resource::loadPixmap("locked"); 494 locked = true; pix = Resource::loadPixmap("locked");
469 } 495 }
470 } 496 }
471 (void)new OFileSelectorItem( m_view, pix, name, 497 (void)new OFileSelectorItem( m_view, pix, name,
472 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), 498 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
473 QString::number( info->size() ), 499 QString::number( info->size() ),
474 dir, locked ); 500 dir, locked );
475} 501}
476void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) { 502void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) {
477 bool locked = false; QString name; QPixmap pix; 503 bool locked = false; QString name; QPixmap pix;
478 504
479 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || 505 if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) ||
480 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) { 506 ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) {
481 locked = true; 507 locked = true;
482 if ( symlink ) 508 if ( symlink )
483 pix = Resource::loadPixmap( "symlink" ); 509 pix = Resource::loadPixmap( "symlink" );
484 else 510 else
485 pix = Resource::loadPixmap( "lockedfolder" ); 511 pix = Resource::loadPixmap( "lockedfolder" );
486 }else 512 }else
487 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder"); 513 pix = symlink ? Resource::loadPixmap( "symlink") : Resource::loadPixmap("folder");
488 514
489 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() : 515 name = symlink ? info->fileName() + " -> " + info->dirPath(true) + "/" + info->readLink() :
490 info->fileName(); 516 info->fileName();
491 517
492 (void)new OFileSelectorItem( m_view, pix, name, 518 (void)new OFileSelectorItem( m_view, pix, name,
493 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate), 519 KGlobal::locale()->formatDateTime(info->lastModified(),true, true, KLocale::ISODate),
494 QString::number( info->size() ), 520 QString::number( info->size() ),
495 info->dirPath( true ), locked, true ); 521 info->dirPath( true ), locked, true );
496 522
497 523
498} 524}
499void OFileViewFileListView::addSymlink( QFileInfo* , bool ) { 525void OFileViewFileListView::addSymlink( QFileInfo* , bool ) {
500 526
501} 527}
502void OFileViewFileListView::cdUP() { 528void OFileViewFileListView::cdUP() {
diff --git a/microkde/ofileselector_p.h b/microkde/ofileselector_p.h
index b371806..834fd70 100644
--- a/microkde/ofileselector_p.h
+++ b/microkde/ofileselector_p.h
@@ -65,128 +65,129 @@ private:
65 OFileSelector* m_selector; 65 OFileSelector* m_selector;
66}; 66};
67 67
68 68
69/* THE Document View hosting a FileSelector*/ 69/* THE Document View hosting a FileSelector*/
70class ODocumentFileView : public OFileViewInterface { 70class ODocumentFileView : public OFileViewInterface {
71public: 71public:
72 ODocumentFileView( OFileSelector* selector ); 72 ODocumentFileView( OFileSelector* selector );
73 ~ODocumentFileView(); 73 ~ODocumentFileView();
74 74
75 QString selectedName() const; 75 QString selectedName() const;
76 QString selectedPath() const; 76 QString selectedPath() const;
77 77
78 QString directory() const; 78 QString directory() const;
79 void reread(); 79 void reread();
80 int fileCount()const; 80 int fileCount()const;
81 DocLnk selectedDocument()const; 81 DocLnk selectedDocument()const;
82 82
83 QWidget* widget( QWidget* parent ); 83 QWidget* widget( QWidget* parent );
84 84
85private: 85private:
86 mutable FileSelector* m_selector; 86 mutable FileSelector* m_selector;
87 87
88}; 88};
89 89
90class OFileSelectorItem : public QListViewItem { 90class OFileSelectorItem : public QListViewItem {
91public: 91public:
92 OFileSelectorItem( QListView* view, const QPixmap& pixmap, 92 OFileSelectorItem( QListView* view, const QPixmap& pixmap,
93 const QString& path, const QString& date, 93 const QString& path, const QString& date,
94 const QString& size, const QString& mDir, 94 const QString& size, const QString& mDir,
95 bool isLocked = false, bool isDir = false ); 95 bool isLocked = false, bool isDir = false );
96 ~OFileSelectorItem(); 96 ~OFileSelectorItem();
97 bool isLocked()const; 97 bool isLocked()const;
98 bool isDir()const; 98 bool isDir()const;
99 QString directory()const; 99 QString directory()const;
100 QString path()const; 100 QString path()const;
101 QString key(int id, bool )const; 101 QString key(int id, bool )const;
102 102
103private: 103private:
104 bool m_locked : 1; 104 bool m_locked : 1;
105 bool m_isDir : 1; 105 bool m_isDir : 1;
106 QString m_dir; 106 QString m_dir;
107}; 107};
108 108
109class OFileViewFileListView : public QWidget { 109class OFileViewFileListView : public QWidget {
110 Q_OBJECT 110 Q_OBJECT
111public: 111public:
112 OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector ); 112 OFileViewFileListView( QWidget* parent, const QString& dir, OFileSelector* selector );
113 ~OFileViewFileListView(); 113 ~OFileViewFileListView();
114 114
115 OFileSelectorItem* currentItem()const; 115 OFileSelectorItem* currentItem()const;
116 void reread( bool all = false ); 116 void reread( bool all = false );
117 int fileCount()const; 117 int fileCount()const;
118 QString currentDir()const; 118 QString currentDir()const;
119protected: 119protected:
120 bool eventFilter (QObject *o, QEvent *e); 120 bool eventFilter (QObject *o, QEvent *e);
121private slots: 121private slots:
122 void slotNew(); // will emit newSelected 122 void slotNew(); // will emit newSelected
123 void cdUP(); 123 void cdUP();
124 void cdHome(); 124 void cdHome();
125 void cdDoc(); 125 void cdDoc();
126 void changeDir( const QString& ); 126 void changeDir( const QString& );
127 void slotCurrentChanged( QListViewItem* ); 127 void slotCurrentChanged( QListViewItem* );
128 void slotClicked(int, QListViewItem*, const QPoint&, int ); 128 void slotClicked(int, QListViewItem*, const QPoint&, int );
129 void slotDoubleClicked(QListViewItem*);
129 void slotFSActivated(int); 130 void slotFSActivated(int);
130 131
131protected: 132protected:
132 133
133 OFileSelector* selector(); 134 OFileSelector* selector();
134 135
135private: 136private:
136 QMap<QString, QString> m_dev; 137 QMap<QString, QString> m_dev;
137 bool m_all : 1; 138 bool m_all : 1;
138 OFileSelector* m_sel; 139 OFileSelector* m_sel;
139 QPopupMenu* m_fsPop; 140 QPopupMenu* m_fsPop;
140 bool compliesMime( const QString& ); 141 bool compliesMime( const QString& );
141 QStringList m_mimes; // used in compy mime 142 QStringList m_mimes; // used in compy mime
142 QString m_currentDir; 143 QString m_currentDir;
143 QToolButton *m_btnNew, *m_btnClose; 144 QToolButton *m_btnNew, *m_btnClose;
144 void connectSlots(); 145 void connectSlots();
145 void addFile( QFileInfo* info, bool symlink = FALSE ); 146 void addFile( QFileInfo* info, bool symlink = FALSE );
146 void addDir ( QFileInfo* info, bool symlink = FALSE ); 147 void addDir ( QFileInfo* info, bool symlink = FALSE );
147 void addSymlink( QFileInfo* info, bool = FALSE ); 148 void addSymlink( QFileInfo* info, bool = FALSE );
148 149
149 150
150private: 151private:
151 QListView* m_view; 152 QListView* m_view;
152}; 153};
153 154
154typedef QMap<QString, QStringList> MimeTypes; 155typedef QMap<QString, QStringList> MimeTypes;
155 156
156class OFileViewInterface; 157class OFileViewInterface;
157class OFileViewFileListView; 158class OFileViewFileListView;
158class QLineEdit; 159class QLineEdit;
159class QComboBox; 160class QComboBox;
160class QWidgetStack; 161class QWidgetStack;
161class QHBox; 162class QHBox;
162class OFileSelector : public QWidget { 163class OFileSelector : public QWidget {
163 Q_OBJECT 164 Q_OBJECT
164 friend class OFileViewInterface; 165 friend class OFileViewInterface;
165 friend class OFileViewFileListView; 166 friend class OFileViewFileListView;
166public: 167public:
167 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 }; 168 enum Mode { Open=1, Save=2, FileSelector=4, OPEN=1, SAVE=2, FILESELECTOR=4 };
168// enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 }; 169// enum OldMode { OPEN=1, SAVE=2, FILESELECTOR = 4 };
169 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 }; 170 enum Selector { Normal = 0, Extended=1, ExtendedAll =2, Default=3, NORMAL=0,EXTENDED=1, EXTENDED_ALL =2, DEFAULT=3 };
170// enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2}; 171// enum OldSelector { NORMAL = 0, EXTENDED =1, EXTENDED_ALL = 2};
171 172
172 OFileSelector(QWidget* parent, int mode, int selector, 173 OFileSelector(QWidget* parent, int mode, int selector,
173 const QString& dirName, 174 const QString& dirName,
174 const QString& fileName, 175 const QString& fileName,
175 const MimeTypes& mimetypes = MimeTypes(), 176 const MimeTypes& mimetypes = MimeTypes(),
176 bool newVisible = FALSE, bool closeVisible = FALSE ); 177 bool newVisible = FALSE, bool closeVisible = FALSE );
177 178
178 OFileSelector(const QString& mimeFilter, QWidget* parent, 179 OFileSelector(const QString& mimeFilter, QWidget* parent,
179 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE ); 180 const char* name = 0, bool newVisible = TRUE, bool closeVisible = FALSE );
180 ~OFileSelector(); 181 ~OFileSelector();
181 182
182 const DocLnk* selected(); 183 const DocLnk* selected();
183 184
184 QString selectedName()const; 185 QString selectedName()const;
185 QString selectedPath()const; 186 QString selectedPath()const;
186 QString directory()const; 187 QString directory()const;
187 188
188 DocLnk selectedDocument()const; 189 DocLnk selectedDocument()const;
189 190
190 int fileCount()const; 191 int fileCount()const;
191 void reread(); 192 void reread();
192 193