-rw-r--r-- | bin/kdepim/WhatsNew.txt | 10 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 11 | ||||
-rw-r--r-- | kmicromail/libmailwrapper/settings.cpp | 2 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 27 | ||||
-rw-r--r-- | kmicromail/opiemail.h | 2 | ||||
-rw-r--r-- | kmicromail/viewmail.cpp | 5 | ||||
-rw-r--r-- | kmicromail/viewmail.h | 1 | ||||
-rw-r--r-- | korganizer/calendarview.cpp | 24 | ||||
-rw-r--r-- | qtcompat/qinputdialog.cpp | 7 |
10 files changed, 80 insertions, 20 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt index 46d59a3..ec75fad 100644 --- a/bin/kdepim/WhatsNew.txt +++ b/bin/kdepim/WhatsNew.txt | |||
@@ -1,141 +1,151 @@ | |||
1 | Info about the changes in new versions of KDE-Pim/Pi | 1 | Info about the changes in new versions of KDE-Pim/Pi |
2 | 2 | ||
3 | ********** VERSION 1.9.15 ************ | 3 | ********** VERSION 1.9.15 ************ |
4 | 4 | ||
5 | Usebilty enhancements in KO/Pi: | 5 | Usebilty enhancements in KO/Pi: |
6 | When clicking on the date in a month view cell, the day view is shown. | 6 | When clicking on the date in a month view cell, the day view is shown. |
7 | Old behaviour was, that the "new event" dialog popped up. | 7 | Old behaviour was, that the "new event" dialog popped up. |
8 | 8 | ||
9 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). | 9 | Added a one step "undo delete" in KO/Pi (Accessable in the "Action" menu). |
10 | That means, you can restore the latest | 10 | That means, you can restore the latest |
11 | event/todo/journal you have deleted. | 11 | event/todo/journal you have deleted. |
12 | A journal is deleted, if you clear all the text of the journal. | 12 | A journal is deleted, if you clear all the text of the journal. |
13 | 13 | ||
14 | Fixed the bug of the editor dialogs in KO/Pi of version 1.9.14. | ||
15 | |||
16 | KA/Pi starting in 480x640 resolution: | ||
17 | Hide the filter action in toolbar | ||
18 | and added icons for undo/delete/redo in toolbar. | ||
19 | |||
20 | Change in OM/Pi ViewMail dialog: | ||
21 | When clicking on the "delete" icon the mail is deleted after confirmation as usual. But the edit dialog is not closed as before, now the next mail in the folder is shown automatically (if there is any). | ||
22 | |||
23 | Fixed a crash when deleting mail-accounts in OM/Pi. | ||
14 | 24 | ||
15 | 25 | ||
16 | ********** VERSION 1.9.14 ************ | 26 | ********** VERSION 1.9.14 ************ |
17 | 27 | ||
18 | Fixed some problems with the dialog sizes when switching | 28 | Fixed some problems with the dialog sizes when switching |
19 | portrait/landscape mode on 640x480 PDA display. | 29 | portrait/landscape mode on 640x480 PDA display. |
20 | 30 | ||
21 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. | 31 | Fixed some other small bugs in KA/Pi KO/Pi and OM/Pi and PwM/Pi. |
22 | 32 | ||
23 | Fixed an ugly bug in KOpieMail: | 33 | Fixed an ugly bug in KOpieMail: |
24 | KOpieMail was not able to write files (mails) to MSDOS file system, | 34 | KOpieMail was not able to write files (mails) to MSDOS file system, |
25 | like on an usual preformatted SD card. That should work now. | 35 | like on an usual preformatted SD card. That should work now. |
26 | To save your mail data on the Sd card do the following: | 36 | To save your mail data on the Sd card do the following: |
27 | Create a dir on the SD card: | 37 | Create a dir on the SD card: |
28 | mkdir /mnt/card/localmail | 38 | mkdir /mnt/card/localmail |
29 | Go to your home dir: | 39 | Go to your home dir: |
30 | cd | 40 | cd |
31 | Go to kopiemail data storage dir: | 41 | Go to kopiemail data storage dir: |
32 | cd kdepim/apps/kopiemail | 42 | cd kdepim/apps/kopiemail |
33 | Create a symlink to the SD card: | 43 | Create a symlink to the SD card: |
34 | ls -s /mnt/card/localmail | 44 | ls -s /mnt/card/localmail |
35 | Now KOpieMail will store all mails on the SD card. | 45 | Now KOpieMail will store all mails on the SD card. |
36 | 46 | ||
37 | KO/Pi Monthview: | 47 | KO/Pi Monthview: |
38 | Now "Go to Today" selects the current month from day 1-end, | 48 | Now "Go to Today" selects the current month from day 1-end, |
39 | not the current date + some days. | 49 | not the current date + some days. |
40 | I.e. "Go to Today" shows now always | 50 | I.e. "Go to Today" shows now always |
41 | the current month with first day of month in the first row. | 51 | the current month with first day of month in the first row. |
42 | 52 | ||
43 | Added missing German translation. | 53 | Added missing German translation. |
44 | 54 | ||
45 | Fixed icons of executeable on Wintendo. | 55 | Fixed icons of executeable on Wintendo. |
46 | 56 | ||
47 | Added a "Show next Mail" button to the OM/Pi | 57 | Added a "Show next Mail" button to the OM/Pi |
48 | mail viewer such that the mail below the current mail | 58 | mail viewer such that the mail below the current mail |
49 | in the mail list view of the current folder | 59 | in the mail list view of the current folder |
50 | can be read with a single click. | 60 | can be read with a single click. |
51 | 61 | ||
52 | 62 | ||
53 | ********** VERSION 1.9.13 ************ | 63 | ********** VERSION 1.9.13 ************ |
54 | 64 | ||
55 | Fixed nasty PwM/Pi file reading bug, when | 65 | Fixed nasty PwM/Pi file reading bug, when |
56 | the used hash algo of file is different then the global | 66 | the used hash algo of file is different then the global |
57 | hash algo. | 67 | hash algo. |
58 | 68 | ||
59 | Added KA/Pi support for opie mailit mailapplication. | 69 | Added KA/Pi support for opie mailit mailapplication. |
60 | 70 | ||
61 | Fixed some bugs in OM/Pi. | 71 | Fixed some bugs in OM/Pi. |
62 | Now character conversion tables are available for the Zaurus | 72 | Now character conversion tables are available for the Zaurus |
63 | to make OM/Pi working properly. | 73 | to make OM/Pi working properly. |
64 | To get the character conversion in OM/Pi working, please download | 74 | To get the character conversion in OM/Pi working, please download |
65 | at the sourceforge project site the package | 75 | at the sourceforge project site the package |
66 | sr-character-conversion_SharpROM_arm.ipk.zip | 76 | sr-character-conversion_SharpROM_arm.ipk.zip |
67 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) | 77 | (or oz-character-conversion_OZ-gcc3xx_arm.ipk.zip for OZ roms) |
68 | from the section "general files for KDE/Pim" | 78 | from the section "general files for KDE/Pim" |
69 | Instructions how to install this package are in a ReadMe in this file. | 79 | Instructions how to install this package are in a ReadMe in this file. |
70 | 80 | ||
71 | 81 | ||
72 | Fixed the orientation change problem in KA/Pi when switching | 82 | Fixed the orientation change problem in KA/Pi when switching |
73 | portrait/landscape mode. | 83 | portrait/landscape mode. |
74 | 84 | ||
75 | French translation available for KA/Pi and OM/Pi. | 85 | French translation available for KA/Pi and OM/Pi. |
76 | 86 | ||
77 | Fixed some problems with categories in KO/Pi in DTM sync. | 87 | Fixed some problems with categories in KO/Pi in DTM sync. |
78 | 88 | ||
79 | Added selection dialog for export to phone in KA/Pi. | 89 | Added selection dialog for export to phone in KA/Pi. |
80 | 90 | ||
81 | If in KO/Pi is an attendee selected to add to a meeting and this | 91 | If in KO/Pi is an attendee selected to add to a meeting and this |
82 | attendee is already in the list of attendees, this person is not added | 92 | attendee is already in the list of attendees, this person is not added |
83 | again. | 93 | again. |
84 | 94 | ||
85 | Some menu cleanup in KA/Pi. | 95 | Some menu cleanup in KA/Pi. |
86 | 96 | ||
87 | ********** VERSION 1.9.12 ************ | 97 | ********** VERSION 1.9.12 ************ |
88 | 98 | ||
89 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. | 99 | Fix for the bug in KO/Pi What's Next view of version 1.9.11. |
90 | 100 | ||
91 | Bugfix: Licence file is now shown again. | 101 | Bugfix: Licence file is now shown again. |
92 | 102 | ||
93 | OM/Pi now supports Unicode (utf8 charset). | 103 | OM/Pi now supports Unicode (utf8 charset). |
94 | Fixed some bugs in OM/Pi. | 104 | Fixed some bugs in OM/Pi. |
95 | 105 | ||
96 | KA/Pi has more German translation. | 106 | KA/Pi has more German translation. |
97 | 107 | ||
98 | 108 | ||
99 | ********** VERSION 1.9.11 ************ | 109 | ********** VERSION 1.9.11 ************ |
100 | 110 | ||
101 | Fixed several problems in PWM/Pi, like | 111 | Fixed several problems in PWM/Pi, like |
102 | asking the user, if unsaved changed are pending | 112 | asking the user, if unsaved changed are pending |
103 | when closing the app. | 113 | when closing the app. |
104 | And PwM/Pi handles now different texts for the | 114 | And PwM/Pi handles now different texts for the |
105 | fields Description, Username, Password, configurable per category. | 115 | fields Description, Username, Password, configurable per category. |
106 | 116 | ||
107 | Fixed a crash in KO/Pi , when importing/loading vcs files | 117 | Fixed a crash in KO/Pi , when importing/loading vcs files |
108 | which have an entry with an attendee with state: | 118 | which have an entry with an attendee with state: |
109 | NEEDS ACTION | 119 | NEEDS ACTION |
110 | 120 | ||
111 | Fixed some problems in the German translation of OM/Pi, | 121 | Fixed some problems in the German translation of OM/Pi, |
112 | which makes some dialogs not fitting on the screen | 122 | which makes some dialogs not fitting on the screen |
113 | of the Z 5500. | 123 | of the Z 5500. |
114 | 124 | ||
115 | Fixed Qtopia crash, when disabling/deinstalling | 125 | Fixed Qtopia crash, when disabling/deinstalling |
116 | KO/Pi alarm applet. | 126 | KO/Pi alarm applet. |
117 | 127 | ||
118 | Implemented direct KDE<->KA/Pi sync for KA/Pi running | 128 | Implemented direct KDE<->KA/Pi sync for KA/Pi running |
119 | on Linux desktop. | 129 | on Linux desktop. |
120 | 130 | ||
121 | Added feature "remove sync info" to sync menu. | 131 | Added feature "remove sync info" to sync menu. |
122 | 132 | ||
123 | Tweaked the KO/Pi What's next view a bit, added | 133 | Tweaked the KO/Pi What's next view a bit, added |
124 | setting to hide events that are done. | 134 | setting to hide events that are done. |
125 | 135 | ||
126 | Disabled "beam receive enabled" on startup to | 136 | Disabled "beam receive enabled" on startup to |
127 | avoid problems if Fastload is enabled. | 137 | avoid problems if Fastload is enabled. |
128 | Please set "beam receive enabled", | 138 | Please set "beam receive enabled", |
129 | if you want to receive data via IR. | 139 | if you want to receive data via IR. |
130 | 140 | ||
131 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running | 141 | Fixed bug in direct KDE<->KO/Pi sync for KO/Pi running |
132 | on Linux desktop. | 142 | on Linux desktop. |
133 | 143 | ||
134 | Made in KA/Pi scrolling possible, if details view is selected. | 144 | Made in KA/Pi scrolling possible, if details view is selected. |
135 | (The keyboard focus is set automatically to the search line) | 145 | (The keyboard focus is set automatically to the search line) |
136 | 146 | ||
137 | Fixed a bug in DMT sync, that a new entry in DTM was added | 147 | Fixed a bug in DMT sync, that a new entry in DTM was added |
138 | on every sync to Kx/Pi. | 148 | on every sync to Kx/Pi. |
139 | 149 | ||
140 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. | 150 | Fixed missing writing of KA/Pi categories to DMT entries when syncing. |
141 | 151 | ||
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index b7edccd..f6bdda4 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -662,256 +662,257 @@ void KABCore::setContactSelected( const QString &uid ) | |||
662 | } | 662 | } |
663 | } | 663 | } |
664 | 664 | ||
665 | 665 | ||
666 | mExtensionManager->setSelectionChanged(); | 666 | mExtensionManager->setSelectionChanged(); |
667 | 667 | ||
668 | // update the actions | 668 | // update the actions |
669 | bool selected = !uid.isEmpty(); | 669 | bool selected = !uid.isEmpty(); |
670 | 670 | ||
671 | if ( mReadWrite ) { | 671 | if ( mReadWrite ) { |
672 | mActionCut->setEnabled( selected ); | 672 | mActionCut->setEnabled( selected ); |
673 | mActionPaste->setEnabled( selected ); | 673 | mActionPaste->setEnabled( selected ); |
674 | } | 674 | } |
675 | 675 | ||
676 | mActionCopy->setEnabled( selected ); | 676 | mActionCopy->setEnabled( selected ); |
677 | mActionDelete->setEnabled( selected ); | 677 | mActionDelete->setEnabled( selected ); |
678 | mActionEditAddressee->setEnabled( selected ); | 678 | mActionEditAddressee->setEnabled( selected ); |
679 | mActionMail->setEnabled( selected ); | 679 | mActionMail->setEnabled( selected ); |
680 | mActionMailVCard->setEnabled( selected ); | 680 | mActionMailVCard->setEnabled( selected ); |
681 | //if (mActionBeam) | 681 | //if (mActionBeam) |
682 | //mActionBeam->setEnabled( selected ); | 682 | //mActionBeam->setEnabled( selected ); |
683 | mActionWhoAmI->setEnabled( selected ); | 683 | mActionWhoAmI->setEnabled( selected ); |
684 | } | 684 | } |
685 | 685 | ||
686 | void KABCore::sendMail() | 686 | void KABCore::sendMail() |
687 | { | 687 | { |
688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); | 688 | sendMail( mViewManager->selectedEmails().join( ", " ) ); |
689 | } | 689 | } |
690 | 690 | ||
691 | void KABCore::sendMail( const QString& emaillist ) | 691 | void KABCore::sendMail( const QString& emaillist ) |
692 | { | 692 | { |
693 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " | 693 | // the parameter has the form "name1 <abc@aol.com>,name2 <abc@aol.com>;... " |
694 | if (emaillist.contains(",") > 0) | 694 | if (emaillist.contains(",") > 0) |
695 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); | 695 | ExternalAppHandler::instance()->mailToMultipleContacts( emaillist, QString::null ); |
696 | else | 696 | else |
697 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); | 697 | ExternalAppHandler::instance()->mailToOneContact( emaillist ); |
698 | } | 698 | } |
699 | 699 | ||
700 | 700 | ||
701 | 701 | ||
702 | void KABCore::mailVCard() | 702 | void KABCore::mailVCard() |
703 | { | 703 | { |
704 | QStringList uids = mViewManager->selectedUids(); | 704 | QStringList uids = mViewManager->selectedUids(); |
705 | if ( !uids.isEmpty() ) | 705 | if ( !uids.isEmpty() ) |
706 | mailVCard( uids ); | 706 | mailVCard( uids ); |
707 | } | 707 | } |
708 | 708 | ||
709 | void KABCore::mailVCard( const QStringList& uids ) | 709 | void KABCore::mailVCard( const QStringList& uids ) |
710 | { | 710 | { |
711 | QStringList urls; | 711 | QStringList urls; |
712 | 712 | ||
713 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); | 713 | // QString tmpdir = locateLocal("tmp", KGlobal::getAppName()); |
714 | 714 | ||
715 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); | 715 | QString dirName = "/tmp/" + KApplication::randomString( 8 ); |
716 | 716 | ||
717 | 717 | ||
718 | 718 | ||
719 | QDir().mkdir( dirName, true ); | 719 | QDir().mkdir( dirName, true ); |
720 | 720 | ||
721 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 721 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
722 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 722 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
723 | 723 | ||
724 | if ( a.isEmpty() ) | 724 | if ( a.isEmpty() ) |
725 | continue; | 725 | continue; |
726 | 726 | ||
727 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; | 727 | QString name = a.givenName() + "_" + a.familyName() + ".vcf"; |
728 | 728 | ||
729 | QString fileName = dirName + "/" + name; | 729 | QString fileName = dirName + "/" + name; |
730 | 730 | ||
731 | QFile outFile(fileName); | 731 | QFile outFile(fileName); |
732 | 732 | ||
733 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully | 733 | if ( outFile.open(IO_WriteOnly) ) { // file opened successfully |
734 | KABC::VCardConverter converter; | 734 | KABC::VCardConverter converter; |
735 | QString vcard; | 735 | QString vcard; |
736 | 736 | ||
737 | converter.addresseeToVCard( a, vcard ); | 737 | converter.addresseeToVCard( a, vcard ); |
738 | 738 | ||
739 | QTextStream t( &outFile ); // use a text stream | 739 | QTextStream t( &outFile ); // use a text stream |
740 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 740 | t.setEncoding( QTextStream::UnicodeUTF8 ); |
741 | t << vcard; | 741 | t << vcard; |
742 | 742 | ||
743 | outFile.close(); | 743 | outFile.close(); |
744 | 744 | ||
745 | urls.append( fileName ); | 745 | urls.append( fileName ); |
746 | } | 746 | } |
747 | } | 747 | } |
748 | 748 | ||
749 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); | 749 | bool result = ExternalAppHandler::instance()->mailToMultipleContacts( QString::null, urls.join(", ") ); |
750 | 750 | ||
751 | 751 | ||
752 | /*US | 752 | /*US |
753 | kapp->invokeMailer( QString::null, QString::null, QString::null, | 753 | kapp->invokeMailer( QString::null, QString::null, QString::null, |
754 | QString::null, // subject | 754 | QString::null, // subject |
755 | QString::null, // body | 755 | QString::null, // body |
756 | QString::null, | 756 | QString::null, |
757 | urls ); // attachments | 757 | urls ); // attachments |
758 | */ | 758 | */ |
759 | 759 | ||
760 | } | 760 | } |
761 | 761 | ||
762 | /** | 762 | /** |
763 | Beams the "WhoAmI contact. | 763 | Beams the "WhoAmI contact. |
764 | */ | 764 | */ |
765 | void KABCore::beamMySelf() | 765 | void KABCore::beamMySelf() |
766 | { | 766 | { |
767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); | 767 | KABC::Addressee a = KABC::StdAddressBook::self()->whoAmI(); |
768 | if (!a.isEmpty()) | 768 | if (!a.isEmpty()) |
769 | { | 769 | { |
770 | QStringList uids; | 770 | QStringList uids; |
771 | uids << a.uid(); | 771 | uids << a.uid(); |
772 | 772 | ||
773 | beamVCard(uids); | 773 | beamVCard(uids); |
774 | } else { | 774 | } else { |
775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); | 775 | KMessageBox::information( this, i18n( "Your personal contact is\nnot set! Please select it\nand set it with menu:\nSettings - Set Who Am I\n" ) ); |
776 | 776 | ||
777 | 777 | ||
778 | } | 778 | } |
779 | } | 779 | } |
780 | void KABCore::updateMainWindow() | 780 | void KABCore::updateMainWindow() |
781 | { | 781 | { |
782 | 782 | ||
783 | mMainWindow->showMaximized(); | 783 | mMainWindow->showMaximized(); |
784 | mMainWindow->update(); | 784 | mMainWindow->update(); |
785 | } | 785 | } |
786 | void KABCore::resizeEvent(QResizeEvent* e ) | 786 | void KABCore::resizeEvent(QResizeEvent* e ) |
787 | { | 787 | { |
788 | if ( !mMiniSplitter ) | 788 | if ( !mMiniSplitter ) |
789 | return; | 789 | return; |
790 | //qDebug("KABCore::resizeEvent(QResizeEvent* e ) "); | ||
790 | if ( QApplication::desktop()->width() >= 480 ) { | 791 | if ( QApplication::desktop()->width() >= 480 ) { |
791 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 | 792 | if (QApplication::desktop()->width() == 640 ) { // e.g. 640x480 |
792 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { | 793 | if ( mMiniSplitter->orientation() == Qt::Vertical ) { |
793 | mMiniSplitter->setOrientation( Qt::Horizontal); | 794 | mMiniSplitter->setOrientation( Qt::Horizontal); |
794 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 795 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
795 | if ( QApplication::desktop()->width() <= 640 ) { | 796 | if ( QApplication::desktop()->width() <= 640 ) { |
796 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 797 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
797 | mViewManager->getFilterAction()->setComboWidth( 150 ); | 798 | mViewManager->getFilterAction()->setComboWidth( 150 ); |
798 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 799 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
799 | } | 800 | } |
800 | } | 801 | } |
801 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 | 802 | } else if (QApplication::desktop()->width() == 480 ){// e.g. 480x640 |
802 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { | 803 | if ( mMiniSplitter->orientation() == Qt::Horizontal ) { |
803 | mMiniSplitter->setOrientation( Qt::Vertical ); | 804 | mMiniSplitter->setOrientation( Qt::Vertical ); |
804 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 805 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
805 | if ( QApplication::desktop()->width() <= 640 ) { | 806 | if ( QApplication::desktop()->width() <= 640 ) { |
806 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); | 807 | //mMainWindow->setMaximumSize( QApplication::desktop()->size() ); |
807 | mMainWindow->showMinimized(); | 808 | mMainWindow->showMinimized(); |
808 | mViewManager->getFilterAction()->setComboWidth( 0 ); | 809 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
809 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); | 810 | QTimer::singleShot( 1, this , SLOT ( updateMainWindow())); |
810 | } | 811 | } |
811 | } | 812 | } |
812 | } | 813 | } |
813 | } | 814 | } |
814 | 815 | ||
815 | } | 816 | } |
816 | void KABCore::export2phone() | 817 | void KABCore::export2phone() |
817 | { | 818 | { |
818 | 819 | ||
819 | QStringList uids; | 820 | QStringList uids; |
820 | XXPortSelectDialog dlg( this, false, this ); | 821 | XXPortSelectDialog dlg( this, false, this ); |
821 | if ( dlg.exec() ) | 822 | if ( dlg.exec() ) |
822 | uids = dlg.uids(); | 823 | uids = dlg.uids(); |
823 | else | 824 | else |
824 | return; | 825 | return; |
825 | if ( uids.isEmpty() ) | 826 | if ( uids.isEmpty() ) |
826 | return; | 827 | return; |
827 | // qDebug("count %d ", uids.count()); | 828 | // qDebug("count %d ", uids.count()); |
828 | 829 | ||
829 | KAex2phonePrefs ex2phone; | 830 | KAex2phonePrefs ex2phone; |
830 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 831 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
831 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 832 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
832 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 833 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
833 | 834 | ||
834 | if ( !ex2phone.exec() ) { | 835 | if ( !ex2phone.exec() ) { |
835 | return; | 836 | return; |
836 | } | 837 | } |
837 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 838 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
838 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 839 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
839 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 840 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
840 | 841 | ||
841 | 842 | ||
842 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 843 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
843 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 844 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
844 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 845 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
845 | 846 | ||
846 | QString fileName = getPhoneFile(); | 847 | QString fileName = getPhoneFile(); |
847 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) | 848 | if ( ! mAddressBook->export2PhoneFormat( uids ,fileName ) ) |
848 | return; | 849 | return; |
849 | 850 | ||
850 | message(i18n("Exporting to phone...")); | 851 | message(i18n("Exporting to phone...")); |
851 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); | 852 | QTimer::singleShot( 1, this , SLOT ( writeToPhone())); |
852 | 853 | ||
853 | } | 854 | } |
854 | QString KABCore::getPhoneFile() | 855 | QString KABCore::getPhoneFile() |
855 | { | 856 | { |
856 | #ifdef DESKTOP_VERSION | 857 | #ifdef DESKTOP_VERSION |
857 | return locateLocal("tmp", "phonefile.vcf"); | 858 | return locateLocal("tmp", "phonefile.vcf"); |
858 | #else | 859 | #else |
859 | return "/tmp/phonefile.vcf"; | 860 | return "/tmp/phonefile.vcf"; |
860 | #endif | 861 | #endif |
861 | 862 | ||
862 | } | 863 | } |
863 | void KABCore::writeToPhone( ) | 864 | void KABCore::writeToPhone( ) |
864 | { | 865 | { |
865 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) | 866 | if ( PhoneAccess::writeToPhone( getPhoneFile() ) ) |
866 | message(i18n("Export to phone finished!")); | 867 | message(i18n("Export to phone finished!")); |
867 | else | 868 | else |
868 | qDebug(i18n("Error exporting to phone")); | 869 | qDebug(i18n("Error exporting to phone")); |
869 | } | 870 | } |
870 | void KABCore::beamVCard() | 871 | void KABCore::beamVCard() |
871 | { | 872 | { |
872 | QStringList uids; | 873 | QStringList uids; |
873 | XXPortSelectDialog dlg( this, false, this ); | 874 | XXPortSelectDialog dlg( this, false, this ); |
874 | if ( dlg.exec() ) | 875 | if ( dlg.exec() ) |
875 | uids = dlg.uids(); | 876 | uids = dlg.uids(); |
876 | else | 877 | else |
877 | return; | 878 | return; |
878 | if ( uids.isEmpty() ) | 879 | if ( uids.isEmpty() ) |
879 | return; | 880 | return; |
880 | beamVCard( uids ); | 881 | beamVCard( uids ); |
881 | } | 882 | } |
882 | 883 | ||
883 | 884 | ||
884 | void KABCore::beamVCard(const QStringList& uids) | 885 | void KABCore::beamVCard(const QStringList& uids) |
885 | { | 886 | { |
886 | 887 | ||
887 | // LR: we should use the /tmp dir on the Zaurus, | 888 | // LR: we should use the /tmp dir on the Zaurus, |
888 | // because: /tmp = RAM, (HOME)/kdepim = flash memory | 889 | // because: /tmp = RAM, (HOME)/kdepim = flash memory |
889 | 890 | ||
890 | #ifdef DESKTOP_VERSION | 891 | #ifdef DESKTOP_VERSION |
891 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); | 892 | QString fileName = locateLocal("tmp", "kapibeamfile.vcf"); |
892 | #else | 893 | #else |
893 | QString fileName = "/tmp/kapibeamfile.vcf"; | 894 | QString fileName = "/tmp/kapibeamfile.vcf"; |
894 | #endif | 895 | #endif |
895 | 896 | ||
896 | KABC::VCardConverter converter; | 897 | KABC::VCardConverter converter; |
897 | QString description; | 898 | QString description; |
898 | QString datastream; | 899 | QString datastream; |
899 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 900 | for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
900 | KABC::Addressee a = mAddressBook->findByUid( *it ); | 901 | KABC::Addressee a = mAddressBook->findByUid( *it ); |
901 | 902 | ||
902 | if ( a.isEmpty() ) | 903 | if ( a.isEmpty() ) |
903 | continue; | 904 | continue; |
904 | 905 | ||
905 | if (description.isEmpty()) | 906 | if (description.isEmpty()) |
906 | description = a.formattedName(); | 907 | description = a.formattedName(); |
907 | 908 | ||
908 | QString vcard; | 909 | QString vcard; |
909 | converter.addresseeToVCard( a, vcard ); | 910 | converter.addresseeToVCard( a, vcard ); |
910 | int start = 0; | 911 | int start = 0; |
911 | int next; | 912 | int next; |
912 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 913 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
913 | int semi = vcard.find(";", next); | 914 | int semi = vcard.find(";", next); |
914 | int dopp = vcard.find(":", next); | 915 | int dopp = vcard.find(":", next); |
915 | int sep; | 916 | int sep; |
916 | if ( semi < dopp && semi >= 0 ) | 917 | if ( semi < dopp && semi >= 0 ) |
917 | sep = semi ; | 918 | sep = semi ; |
@@ -2067,261 +2068,263 @@ void KABCore::addActionsManually() | |||
2067 | mb->insertItem( i18n("&Help"), helpMenu ); | 2068 | mb->insertItem( i18n("&Help"), helpMenu ); |
2068 | mIncSearchWidget = new IncSearchWidget( tb ); | 2069 | mIncSearchWidget = new IncSearchWidget( tb ); |
2069 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 2070 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
2070 | #ifndef DESKTOP_VERSION | 2071 | #ifndef DESKTOP_VERSION |
2071 | } else { | 2072 | } else { |
2072 | //US setup toolbar | 2073 | //US setup toolbar |
2073 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); | 2074 | QPEMenuBar *menuBarTB = new QPEMenuBar( tb ); |
2074 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 2075 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
2075 | menuBarTB->insertItem( "ME", popupBarTB); | 2076 | menuBarTB->insertItem( "ME", popupBarTB); |
2076 | tb->insertWidget(-1, 0, menuBarTB); | 2077 | tb->insertWidget(-1, 0, menuBarTB); |
2077 | mIncSearchWidget = new IncSearchWidget( tb ); | 2078 | mIncSearchWidget = new IncSearchWidget( tb ); |
2078 | 2079 | ||
2079 | tb->enableMoving(false); | 2080 | tb->enableMoving(false); |
2080 | popupBarTB->insertItem( i18n("&File"), fileMenu ); | 2081 | popupBarTB->insertItem( i18n("&File"), fileMenu ); |
2081 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); | 2082 | popupBarTB->insertItem( i18n("&Edit"), editMenu ); |
2082 | popupBarTB->insertItem( i18n("&View"), viewMenu ); | 2083 | popupBarTB->insertItem( i18n("&View"), viewMenu ); |
2083 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); | 2084 | popupBarTB->insertItem( i18n("&Settings"), settingsMenu ); |
2084 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); | 2085 | popupBarTB->insertItem( i18n("Synchronize"), syncMenu ); |
2085 | mViewManager->getFilterAction()->plug ( popupBarTB); | 2086 | mViewManager->getFilterAction()->plug ( popupBarTB); |
2086 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); | 2087 | //popupBarTB->insertItem( i18n("&Change selected"), changeMenu ); |
2087 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); | 2088 | popupBarTB->insertItem( i18n("&Help"), helpMenu ); |
2088 | if (QApplication::desktop()->width() > 320 ) { | 2089 | if (QApplication::desktop()->width() > 320 ) { |
2089 | // mViewManager->getFilterAction()->plug ( tb); | 2090 | // mViewManager->getFilterAction()->plug ( tb); |
2090 | } | 2091 | } |
2091 | } | 2092 | } |
2092 | #endif | 2093 | #endif |
2093 | // mActionQuit->plug ( mMainWindow->toolBar()); | 2094 | // mActionQuit->plug ( mMainWindow->toolBar()); |
2094 | 2095 | ||
2095 | 2096 | ||
2096 | 2097 | ||
2097 | //US Now connect the actions with the menue entries. | 2098 | //US Now connect the actions with the menue entries. |
2098 | mActionPrint->plug( fileMenu ); | 2099 | mActionPrint->plug( fileMenu ); |
2099 | mActionMail->plug( fileMenu ); | 2100 | mActionMail->plug( fileMenu ); |
2100 | fileMenu->insertSeparator(); | 2101 | fileMenu->insertSeparator(); |
2101 | 2102 | ||
2102 | mActionNewContact->plug( fileMenu ); | 2103 | mActionNewContact->plug( fileMenu ); |
2103 | mActionNewContact->plug( tb ); | 2104 | mActionNewContact->plug( tb ); |
2104 | 2105 | ||
2105 | mActionEditAddressee->plug( fileMenu ); | 2106 | mActionEditAddressee->plug( fileMenu ); |
2106 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || | 2107 | // if ((KGlobal::getDesktopSize() > KGlobal::Small ) || |
2107 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) | 2108 | // (!KABPrefs::instance()->mMultipleViewsAtOnce )) |
2108 | mActionEditAddressee->plug( tb ); | 2109 | mActionEditAddressee->plug( tb ); |
2109 | 2110 | ||
2110 | fileMenu->insertSeparator(); | 2111 | fileMenu->insertSeparator(); |
2111 | mActionSave->plug( fileMenu ); | 2112 | mActionSave->plug( fileMenu ); |
2112 | fileMenu->insertItem( "&Import", ImportMenu ); | 2113 | fileMenu->insertItem( "&Import", ImportMenu ); |
2113 | fileMenu->insertItem( "&Export", ExportMenu ); | 2114 | fileMenu->insertItem( "&Export", ExportMenu ); |
2114 | fileMenu->insertItem( i18n("&Change"), changeMenu ); | 2115 | fileMenu->insertItem( i18n("&Change"), changeMenu ); |
2115 | #ifndef DESKTOP_VERSION | 2116 | #ifndef DESKTOP_VERSION |
2116 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); | 2117 | if ( Ir::supported() ) fileMenu->insertItem( i18n("&Beam"), beamMenu ); |
2117 | #endif | 2118 | #endif |
2118 | 2119 | ||
2119 | fileMenu->insertSeparator(); | 2120 | fileMenu->insertSeparator(); |
2120 | mActionMailVCard->plug( fileMenu ); | 2121 | mActionMailVCard->plug( fileMenu ); |
2121 | #ifndef DESKTOP_VERSION | 2122 | #ifndef DESKTOP_VERSION |
2122 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); | 2123 | if ( Ir::supported() ) mActionBR->plug( beamMenu ); |
2123 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); | 2124 | if ( Ir::supported() ) mActionBeamVCard->plug( beamMenu ); |
2124 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); | 2125 | if ( Ir::supported() ) mActionBeam->plug( beamMenu ); |
2125 | #endif | 2126 | #endif |
2126 | fileMenu->insertSeparator(); | 2127 | fileMenu->insertSeparator(); |
2127 | mActionQuit->plug( fileMenu ); | 2128 | mActionQuit->plug( fileMenu ); |
2128 | #ifdef _WIN32_ | 2129 | #ifdef _WIN32_ |
2129 | mActionImportOL->plug( ImportMenu ); | 2130 | mActionImportOL->plug( ImportMenu ); |
2130 | #endif | 2131 | #endif |
2131 | // edit menu | 2132 | // edit menu |
2132 | mActionUndo->plug( editMenu ); | 2133 | mActionUndo->plug( editMenu ); |
2133 | mActionRedo->plug( editMenu ); | 2134 | mActionRedo->plug( editMenu ); |
2134 | editMenu->insertSeparator(); | 2135 | editMenu->insertSeparator(); |
2135 | mActionCut->plug( editMenu ); | 2136 | mActionCut->plug( editMenu ); |
2136 | mActionCopy->plug( editMenu ); | 2137 | mActionCopy->plug( editMenu ); |
2137 | mActionPaste->plug( editMenu ); | 2138 | mActionPaste->plug( editMenu ); |
2138 | mActionDelete->plug( editMenu ); | 2139 | mActionDelete->plug( editMenu ); |
2139 | editMenu->insertSeparator(); | 2140 | editMenu->insertSeparator(); |
2140 | mActionSelectAll->plug( editMenu ); | 2141 | mActionSelectAll->plug( editMenu ); |
2141 | 2142 | ||
2142 | mActionRemoveVoice->plug( changeMenu ); | 2143 | mActionRemoveVoice->plug( changeMenu ); |
2143 | // settings menu | 2144 | // settings menu |
2144 | //US special menuentry to configure the addressbook resources. On KDE | 2145 | //US special menuentry to configure the addressbook resources. On KDE |
2145 | // you do that through the control center !!! | 2146 | // you do that through the control center !!! |
2146 | mActionConfigResources->plug( settingsMenu ); | 2147 | mActionConfigResources->plug( settingsMenu ); |
2147 | settingsMenu->insertSeparator(); | 2148 | settingsMenu->insertSeparator(); |
2148 | 2149 | ||
2149 | mActionConfigKAddressbook->plug( settingsMenu ); | 2150 | mActionConfigKAddressbook->plug( settingsMenu ); |
2150 | 2151 | ||
2151 | if ( mIsPart ) { | 2152 | if ( mIsPart ) { |
2152 | //US not implemented yet | 2153 | //US not implemented yet |
2153 | //mActionConfigShortcuts->plug( settingsMenu ); | 2154 | //mActionConfigShortcuts->plug( settingsMenu ); |
2154 | //mActionConfigureToolbars->plug( settingsMenu ); | 2155 | //mActionConfigureToolbars->plug( settingsMenu ); |
2155 | 2156 | ||
2156 | } else { | 2157 | } else { |
2157 | //US not implemented yet | 2158 | //US not implemented yet |
2158 | //mActionKeyBindings->plug( settingsMenu ); | 2159 | //mActionKeyBindings->plug( settingsMenu ); |
2159 | } | 2160 | } |
2160 | 2161 | ||
2161 | settingsMenu->insertSeparator(); | 2162 | settingsMenu->insertSeparator(); |
2162 | 2163 | ||
2163 | mActionJumpBar->plug( settingsMenu ); | 2164 | mActionJumpBar->plug( settingsMenu ); |
2164 | mActionDetails->plug( settingsMenu ); | 2165 | mActionDetails->plug( settingsMenu ); |
2165 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) | 2166 | //if (!KABPrefs::instance()->mMultipleViewsAtOnce || KGlobal::getDesktopSize() == KGlobal::Desktop ) |
2166 | mActionDetails->plug( tb ); | 2167 | mActionDetails->plug( tb ); |
2167 | settingsMenu->insertSeparator(); | 2168 | settingsMenu->insertSeparator(); |
2168 | #ifndef DESKTOP_VERSION | 2169 | #ifndef DESKTOP_VERSION |
2169 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); | 2170 | if ( Ir::supported() ) mActionBR->plug(settingsMenu ); |
2170 | #endif | 2171 | #endif |
2171 | settingsMenu->insertSeparator(); | 2172 | settingsMenu->insertSeparator(); |
2172 | 2173 | ||
2173 | mActionWhoAmI->plug( settingsMenu ); | 2174 | mActionWhoAmI->plug( settingsMenu ); |
2174 | mActionEditCategories->plug( settingsMenu ); | 2175 | mActionEditCategories->plug( settingsMenu ); |
2175 | mActionEditCategories->plug( changeMenu ); | 2176 | mActionEditCategories->plug( changeMenu ); |
2176 | mActionCategories->plug( changeMenu ); | 2177 | mActionCategories->plug( changeMenu ); |
2177 | mActionManageCategories->plug( changeMenu ); | 2178 | mActionManageCategories->plug( changeMenu ); |
2178 | 2179 | ||
2179 | mActionCategories->plug( settingsMenu ); | 2180 | mActionCategories->plug( settingsMenu ); |
2180 | mActionManageCategories->plug( settingsMenu ); | 2181 | mActionManageCategories->plug( settingsMenu ); |
2181 | 2182 | ||
2182 | 2183 | ||
2183 | mActionWN->plug( helpMenu ); | 2184 | mActionWN->plug( helpMenu ); |
2184 | mActionSyncHowto->plug( helpMenu ); | 2185 | mActionSyncHowto->plug( helpMenu ); |
2185 | mActionKdeSyncHowto->plug( helpMenu ); | 2186 | mActionKdeSyncHowto->plug( helpMenu ); |
2186 | mActionMultiSyncHowto->plug( helpMenu ); | 2187 | mActionMultiSyncHowto->plug( helpMenu ); |
2187 | mActionFaq->plug( helpMenu ); | 2188 | mActionFaq->plug( helpMenu ); |
2188 | mActionLicence->plug( helpMenu ); | 2189 | mActionLicence->plug( helpMenu ); |
2189 | mActionAboutKAddressbook->plug( helpMenu ); | 2190 | mActionAboutKAddressbook->plug( helpMenu ); |
2190 | 2191 | ||
2191 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { | 2192 | if (KGlobal::getDesktopSize() > KGlobal::Small ) { |
2192 | 2193 | ||
2193 | mActionSave->plug( tb ); | 2194 | mActionSave->plug( tb ); |
2194 | mViewManager->getFilterAction()->plug ( tb); | 2195 | mViewManager->getFilterAction()->plug ( tb); |
2195 | if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { | 2196 | //LR hide filteraction on started in 480x640 |
2196 | mActionUndo->plug( tb ); | 2197 | if (QApplication::desktop()->width() == 480 ) { |
2197 | mActionDelete->plug( tb ); | 2198 | mViewManager->getFilterAction()->setComboWidth( 0 ); |
2198 | mActionRedo->plug( tb ); | ||
2199 | } | 2199 | } |
2200 | mActionUndo->plug( tb ); | ||
2201 | mActionDelete->plug( tb ); | ||
2202 | mActionRedo->plug( tb ); | ||
2200 | } else { | 2203 | } else { |
2201 | mActionSave->plug( tb ); | 2204 | mActionSave->plug( tb ); |
2202 | tb->enableMoving(false); | 2205 | tb->enableMoving(false); |
2203 | } | 2206 | } |
2204 | //mActionQuit->plug ( tb ); | 2207 | //mActionQuit->plug ( tb ); |
2205 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 2208 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
2206 | 2209 | ||
2207 | //US link the searchwidget first to this. | 2210 | //US link the searchwidget first to this. |
2208 | // The real linkage to the toolbar happens later. | 2211 | // The real linkage to the toolbar happens later. |
2209 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 2212 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
2210 | //US tb->insertItem( mIncSearchWidget ); | 2213 | //US tb->insertItem( mIncSearchWidget ); |
2211 | /*US | 2214 | /*US |
2212 | mIncSearchWidget = new IncSearchWidget( tb ); | 2215 | mIncSearchWidget = new IncSearchWidget( tb ); |
2213 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 2216 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
2214 | SLOT( incrementalSearch( const QString& ) ) ); | 2217 | SLOT( incrementalSearch( const QString& ) ) ); |
2215 | 2218 | ||
2216 | mJumpButtonBar = new JumpButtonBar( this, this ); | 2219 | mJumpButtonBar = new JumpButtonBar( this, this ); |
2217 | 2220 | ||
2218 | //US topLayout->addWidget( mJumpButtonBar ); | 2221 | //US topLayout->addWidget( mJumpButtonBar ); |
2219 | this->layout()->add( mJumpButtonBar ); | 2222 | this->layout()->add( mJumpButtonBar ); |
2220 | */ | 2223 | */ |
2221 | 2224 | ||
2222 | #endif //KAB_EMBEDDED | 2225 | #endif //KAB_EMBEDDED |
2223 | 2226 | ||
2224 | mActionExport2phone->plug( ExportMenu ); | 2227 | mActionExport2phone->plug( ExportMenu ); |
2225 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 2228 | connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
2226 | syncManager->fillSyncMenu(); | 2229 | syncManager->fillSyncMenu(); |
2227 | 2230 | ||
2228 | } | 2231 | } |
2229 | void KABCore::showLicence() | 2232 | void KABCore::showLicence() |
2230 | { | 2233 | { |
2231 | KApplication::showLicence(); | 2234 | KApplication::showLicence(); |
2232 | } | 2235 | } |
2233 | 2236 | ||
2234 | void KABCore::manageCategories( ) | 2237 | void KABCore::manageCategories( ) |
2235 | { | 2238 | { |
2236 | KABCatPrefs* cp = new KABCatPrefs(); | 2239 | KABCatPrefs* cp = new KABCatPrefs(); |
2237 | cp->show(); | 2240 | cp->show(); |
2238 | int w =cp->sizeHint().width() ; | 2241 | int w =cp->sizeHint().width() ; |
2239 | int h = cp->sizeHint().height() ; | 2242 | int h = cp->sizeHint().height() ; |
2240 | int dw = QApplication::desktop()->width(); | 2243 | int dw = QApplication::desktop()->width(); |
2241 | int dh = QApplication::desktop()->height(); | 2244 | int dh = QApplication::desktop()->height(); |
2242 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2245 | cp->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2243 | if ( !cp->exec() ) { | 2246 | if ( !cp->exec() ) { |
2244 | delete cp; | 2247 | delete cp; |
2245 | return; | 2248 | return; |
2246 | } | 2249 | } |
2247 | int count = 0; | 2250 | int count = 0; |
2248 | message( i18n("Please wait, processing categories...")); | 2251 | message( i18n("Please wait, processing categories...")); |
2249 | if ( cp->addCat() ) { | 2252 | if ( cp->addCat() ) { |
2250 | KABC::AddressBook::Iterator it; | 2253 | KABC::AddressBook::Iterator it; |
2251 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2254 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2252 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2255 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2253 | QStringList catIncList = (*it).categories(); | 2256 | QStringList catIncList = (*it).categories(); |
2254 | int i; | 2257 | int i; |
2255 | for( i = 0; i< catIncList.count(); ++i ) { | 2258 | for( i = 0; i< catIncList.count(); ++i ) { |
2256 | if ( !catList.contains (catIncList[i])) { | 2259 | if ( !catList.contains (catIncList[i])) { |
2257 | catList.append( catIncList[i] ); | 2260 | catList.append( catIncList[i] ); |
2258 | //qDebug("add cat %s ", catIncList[i].latin1()); | 2261 | //qDebug("add cat %s ", catIncList[i].latin1()); |
2259 | ++count; | 2262 | ++count; |
2260 | } | 2263 | } |
2261 | } | 2264 | } |
2262 | } | 2265 | } |
2263 | catList.sort(); | 2266 | catList.sort(); |
2264 | KABPrefs::instance()->mCustomCategories = catList; | 2267 | KABPrefs::instance()->mCustomCategories = catList; |
2265 | KABPrefs::instance()->writeConfig(); | 2268 | KABPrefs::instance()->writeConfig(); |
2266 | message(QString::number( count )+ i18n(" categories added to list! ")); | 2269 | message(QString::number( count )+ i18n(" categories added to list! ")); |
2267 | } else { | 2270 | } else { |
2268 | QStringList catList = KABPrefs::instance()->mCustomCategories; | 2271 | QStringList catList = KABPrefs::instance()->mCustomCategories; |
2269 | QStringList catIncList; | 2272 | QStringList catIncList; |
2270 | QStringList newCatList; | 2273 | QStringList newCatList; |
2271 | KABC::AddressBook::Iterator it; | 2274 | KABC::AddressBook::Iterator it; |
2272 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 2275 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
2273 | QStringList catIncList = (*it).categories(); | 2276 | QStringList catIncList = (*it).categories(); |
2274 | int i; | 2277 | int i; |
2275 | if ( catIncList.count() ) { | 2278 | if ( catIncList.count() ) { |
2276 | newCatList.clear(); | 2279 | newCatList.clear(); |
2277 | for( i = 0; i< catIncList.count(); ++i ) { | 2280 | for( i = 0; i< catIncList.count(); ++i ) { |
2278 | if ( catList.contains (catIncList[i])) { | 2281 | if ( catList.contains (catIncList[i])) { |
2279 | newCatList.append( catIncList[i] ); | 2282 | newCatList.append( catIncList[i] ); |
2280 | } | 2283 | } |
2281 | } | 2284 | } |
2282 | newCatList.sort(); | 2285 | newCatList.sort(); |
2283 | (*it).setCategories( newCatList ); | 2286 | (*it).setCategories( newCatList ); |
2284 | mAddressBook->insertAddressee( (*it) ); | 2287 | mAddressBook->insertAddressee( (*it) ); |
2285 | } | 2288 | } |
2286 | } | 2289 | } |
2287 | setModified( true ); | 2290 | setModified( true ); |
2288 | mViewManager->refreshView(); | 2291 | mViewManager->refreshView(); |
2289 | mDetails->refreshView(); | 2292 | mDetails->refreshView(); |
2290 | message( i18n("Removing categories done!")); | 2293 | message( i18n("Removing categories done!")); |
2291 | } | 2294 | } |
2292 | delete cp; | 2295 | delete cp; |
2293 | } | 2296 | } |
2294 | void KABCore::removeVoice() | 2297 | void KABCore::removeVoice() |
2295 | { | 2298 | { |
2296 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) | 2299 | if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) |
2297 | return; | 2300 | return; |
2298 | KABC::Addressee::List list; | 2301 | KABC::Addressee::List list; |
2299 | XXPortSelectDialog dlg( this, false, this ); | 2302 | XXPortSelectDialog dlg( this, false, this ); |
2300 | if ( dlg.exec() ) | 2303 | if ( dlg.exec() ) |
2301 | list = dlg.contacts(); | 2304 | list = dlg.contacts(); |
2302 | else | 2305 | else |
2303 | return; | 2306 | return; |
2304 | KABC::Addressee::List::Iterator it; | 2307 | KABC::Addressee::List::Iterator it; |
2305 | for ( it = list.begin(); it != list.end(); ++it ) { | 2308 | for ( it = list.begin(); it != list.end(); ++it ) { |
2306 | if ( (*it).removeVoice() ) | 2309 | if ( (*it).removeVoice() ) |
2307 | contactModified((*it) ); | 2310 | contactModified((*it) ); |
2308 | } | 2311 | } |
2309 | } | 2312 | } |
2310 | 2313 | ||
2311 | 2314 | ||
2312 | 2315 | ||
2313 | void KABCore::clipboardDataChanged() | 2316 | void KABCore::clipboardDataChanged() |
2314 | { | 2317 | { |
2315 | 2318 | ||
2316 | if ( mReadWrite ) | 2319 | if ( mReadWrite ) |
2317 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 2320 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
2318 | 2321 | ||
2319 | } | 2322 | } |
2320 | 2323 | ||
2321 | void KABCore::updateActionMenu() | 2324 | void KABCore::updateActionMenu() |
2322 | { | 2325 | { |
2323 | UndoStack *undo = UndoStack::instance(); | 2326 | UndoStack *undo = UndoStack::instance(); |
2324 | RedoStack *redo = RedoStack::instance(); | 2327 | RedoStack *redo = RedoStack::instance(); |
2325 | 2328 | ||
2326 | if ( undo->isEmpty() ) | 2329 | if ( undo->isEmpty() ) |
2327 | mActionUndo->setText( i18n( "Undo" ) ); | 2330 | mActionUndo->setText( i18n( "Undo" ) ); |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 0d91c12..33bef5a 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -1,237 +1,241 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> | 3 | Copyright (c) 2002 Mike Pilone <mpilone@slac.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | 31 | ||
32 | #ifndef KAB_EMBEDDED | 32 | #ifndef KAB_EMBEDDED |
33 | #include <libkdepim/kvcarddrag.h> | 33 | #include <libkdepim/kvcarddrag.h> |
34 | #include <kabc/vcardconverter.h> | 34 | #include <kabc/vcardconverter.h> |
35 | #include <kconfig.h> | 35 | #include <kconfig.h> |
36 | #include <kdeversion.h> | 36 | #include <kdeversion.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kmessagebox.h> | 39 | #include <kmessagebox.h> |
40 | #include <kmultipledrag.h> | 40 | #include <kmultipledrag.h> |
41 | #include <ktrader.h> | 41 | #include <ktrader.h> |
42 | #include <kurldrag.h> | 42 | #include <kurldrag.h> |
43 | 43 | ||
44 | #include "addresseeutil.h" | 44 | #include "addresseeutil.h" |
45 | #else //KAB_EMBEDDED | 45 | #else //KAB_EMBEDDED |
46 | #include "views/kaddressbookiconview.h" | 46 | #include "views/kaddressbookiconview.h" |
47 | #include "views/kaddressbooktableview.h" | 47 | #include "views/kaddressbooktableview.h" |
48 | #include "views/kaddressbookcardview.h" | 48 | #include "views/kaddressbookcardview.h" |
49 | #include "kaddressbookview.h" | 49 | #include "kaddressbookview.h" |
50 | 50 | ||
51 | #include <qaction.h> | 51 | #include <qaction.h> |
52 | #include <qmessagebox.h> | 52 | #include <qmessagebox.h> |
53 | #include <qpopupmenu.h> | 53 | #include <qpopupmenu.h> |
54 | #include <kconfigbase.h> | 54 | #include <kconfigbase.h> |
55 | 55 | ||
56 | #endif //KAB_EMBEDDED | 56 | #endif //KAB_EMBEDDED |
57 | 57 | ||
58 | 58 | ||
59 | #include <kdebug.h> | 59 | #include <kdebug.h> |
60 | #include <kactionclasses.h> | 60 | #include <kactionclasses.h> |
61 | 61 | ||
62 | #include <qlayout.h> | 62 | #include <qlayout.h> |
63 | #include <qapplication.h> | ||
63 | #include <qwidgetstack.h> | 64 | #include <qwidgetstack.h> |
64 | 65 | ||
65 | #include <kabc/addressbook.h> | 66 | #include <kabc/addressbook.h> |
66 | #include "filtereditdialog.h" | 67 | #include "filtereditdialog.h" |
67 | #include "addviewdialog.h" | 68 | #include "addviewdialog.h" |
68 | #include "kabcore.h" | 69 | #include "kabcore.h" |
69 | #include "kabprefs.h" | 70 | #include "kabprefs.h" |
70 | #include "viewmanager.h" | 71 | #include "viewmanager.h" |
71 | 72 | ||
72 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) | 73 | ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) |
73 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) | 74 | : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) |
74 | { | 75 | { |
75 | initGUI(); | 76 | initGUI(); |
76 | initActions(); | 77 | initActions(); |
77 | 78 | ||
78 | mViewDict.setAutoDelete( true ); | 79 | mViewDict.setAutoDelete( true ); |
79 | 80 | ||
80 | createViewFactories(); | 81 | createViewFactories(); |
81 | } | 82 | } |
82 | 83 | ||
83 | ViewManager::~ViewManager() | 84 | ViewManager::~ViewManager() |
84 | { | 85 | { |
85 | unloadViews(); | 86 | unloadViews(); |
86 | mViewFactoryDict.clear(); | 87 | mViewFactoryDict.clear(); |
87 | } | 88 | } |
88 | void ViewManager::scrollUP() | 89 | void ViewManager::scrollUP() |
89 | { | 90 | { |
90 | if ( mActiveView ) | 91 | if ( mActiveView ) |
91 | mActiveView->scrollUP(); | 92 | mActiveView->scrollUP(); |
92 | } | 93 | } |
93 | void ViewManager::scrollDOWN() | 94 | void ViewManager::scrollDOWN() |
94 | { | 95 | { |
95 | if ( mActiveView ) | 96 | if ( mActiveView ) |
96 | mActiveView->scrollDOWN(); | 97 | mActiveView->scrollDOWN(); |
97 | } | 98 | } |
98 | void ViewManager::restoreSettings() | 99 | void ViewManager::restoreSettings() |
99 | { | 100 | { |
100 | mViewNameList = KABPrefs::instance()->mViewNames; | 101 | mViewNameList = KABPrefs::instance()->mViewNames; |
101 | QString activeViewName = KABPrefs::instance()->mCurrentView; | 102 | QString activeViewName = KABPrefs::instance()->mCurrentView; |
102 | 103 | ||
103 | mActionSelectView->setItems( mViewNameList ); | 104 | mActionSelectView->setItems( mViewNameList ); |
104 | 105 | ||
105 | // Filter | 106 | // Filter |
106 | mFilterList = Filter::restore( mCore->config(), "Filter" ); | 107 | mFilterList = Filter::restore( mCore->config(), "Filter" ); |
107 | mActionSelectFilter->setItems( filterNames() ); | 108 | mActionSelectFilter->setItems( filterNames() ); |
108 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); | 109 | mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); |
109 | mActionSelectFilter->setComboWidth( 150 ); | 110 | int cw = 150; |
111 | if (QApplication::desktop()->width() == 480 ) | ||
112 | cw = 0; | ||
113 | mActionSelectFilter->setComboWidth( cw ); | ||
110 | // Tell the views to reread their config, since they may have | 114 | // Tell the views to reread their config, since they may have |
111 | // been modified by global settings | 115 | // been modified by global settings |
112 | QString _oldgroup = mCore->config()->group(); | 116 | QString _oldgroup = mCore->config()->group(); |
113 | 117 | ||
114 | QDictIterator<KAddressBookView> it( mViewDict ); | 118 | QDictIterator<KAddressBookView> it( mViewDict ); |
115 | for ( it.toFirst(); it.current(); ++it ) { | 119 | for ( it.toFirst(); it.current(); ++it ) { |
116 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 120 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
117 | it.current()->readConfig( mCore->config() ); | 121 | it.current()->readConfig( mCore->config() ); |
118 | } | 122 | } |
119 | setActiveView( activeViewName ); | 123 | setActiveView( activeViewName ); |
120 | 124 | ||
121 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 125 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
122 | } | 126 | } |
123 | 127 | ||
124 | void ViewManager::saveSettings() | 128 | void ViewManager::saveSettings() |
125 | { | 129 | { |
126 | QString _oldgroup = mCore->config()->group(); | 130 | QString _oldgroup = mCore->config()->group(); |
127 | 131 | ||
128 | QDictIterator<KAddressBookView> it( mViewDict ); | 132 | QDictIterator<KAddressBookView> it( mViewDict ); |
129 | for ( it.toFirst(); it.current(); ++it ) { | 133 | for ( it.toFirst(); it.current(); ++it ) { |
130 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 134 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
131 | #ifdef DESKTOP_VERSION | 135 | #ifdef DESKTOP_VERSION |
132 | (*it)->writeConfig( mCore->config() ); | 136 | (*it)->writeConfig( mCore->config() ); |
133 | #else | 137 | #else |
134 | (*it).writeConfig( mCore->config() ); | 138 | (*it).writeConfig( mCore->config() ); |
135 | #endif | 139 | #endif |
136 | } | 140 | } |
137 | 141 | ||
138 | Filter::save( mCore->config(), "Filter", mFilterList ); | 142 | Filter::save( mCore->config(), "Filter", mFilterList ); |
139 | KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); | 143 | KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); |
140 | 144 | ||
141 | // write the view name list | 145 | // write the view name list |
142 | KABPrefs::instance()->mViewNames = mViewNameList; | 146 | KABPrefs::instance()->mViewNames = mViewNameList; |
143 | KABPrefs::instance()->mCurrentView = mActiveView->caption(); | 147 | KABPrefs::instance()->mCurrentView = mActiveView->caption(); |
144 | 148 | ||
145 | } | 149 | } |
146 | 150 | ||
147 | QStringList ViewManager::selectedUids() const | 151 | QStringList ViewManager::selectedUids() const |
148 | { | 152 | { |
149 | if ( mActiveView ) | 153 | if ( mActiveView ) |
150 | return mActiveView->selectedUids(); | 154 | return mActiveView->selectedUids(); |
151 | else | 155 | else |
152 | return QStringList(); | 156 | return QStringList(); |
153 | } | 157 | } |
154 | 158 | ||
155 | QStringList ViewManager::selectedEmails() const | 159 | QStringList ViewManager::selectedEmails() const |
156 | { | 160 | { |
157 | if ( mActiveView ) | 161 | if ( mActiveView ) |
158 | return mActiveView->selectedEmails(); | 162 | return mActiveView->selectedEmails(); |
159 | else | 163 | else |
160 | return QStringList(); | 164 | return QStringList(); |
161 | } | 165 | } |
162 | 166 | ||
163 | KABC::Addressee::List ViewManager::selectedAddressees() const | 167 | KABC::Addressee::List ViewManager::selectedAddressees() const |
164 | { | 168 | { |
165 | KABC::Addressee::List list; | 169 | KABC::Addressee::List list; |
166 | if ( mActiveView ) { | 170 | if ( mActiveView ) { |
167 | QStringList uids = mActiveView->selectedUids(); | 171 | QStringList uids = mActiveView->selectedUids(); |
168 | QStringList::Iterator it; | 172 | QStringList::Iterator it; |
169 | for ( it = uids.begin(); it != uids.end(); ++it ) { | 173 | for ( it = uids.begin(); it != uids.end(); ++it ) { |
170 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); | 174 | KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); |
171 | if ( !addr.isEmpty() ) | 175 | if ( !addr.isEmpty() ) |
172 | list.append( addr ); | 176 | list.append( addr ); |
173 | } | 177 | } |
174 | } | 178 | } |
175 | 179 | ||
176 | return list; | 180 | return list; |
177 | } | 181 | } |
178 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 182 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
179 | void ViewManager::setSelected() | 183 | void ViewManager::setSelected() |
180 | { | 184 | { |
181 | setSelected( QString::null, true ); | 185 | setSelected( QString::null, true ); |
182 | } | 186 | } |
183 | 187 | ||
184 | void ViewManager::setSelected( const QString &uid, bool selected ) | 188 | void ViewManager::setSelected( const QString &uid, bool selected ) |
185 | { | 189 | { |
186 | if ( mActiveView ) | 190 | if ( mActiveView ) |
187 | mActiveView->setSelected( uid, selected ); | 191 | mActiveView->setSelected( uid, selected ); |
188 | } | 192 | } |
189 | 193 | ||
190 | void ViewManager::setListSelected(QStringList list) | 194 | void ViewManager::setListSelected(QStringList list) |
191 | { | 195 | { |
192 | int i, count = list.count(); | 196 | int i, count = list.count(); |
193 | for ( i = 0; i < count;++i ) | 197 | for ( i = 0; i < count;++i ) |
194 | setSelected( list[i], true ); | 198 | setSelected( list[i], true ); |
195 | 199 | ||
196 | } | 200 | } |
197 | void ViewManager::unloadViews() | 201 | void ViewManager::unloadViews() |
198 | { | 202 | { |
199 | mViewDict.clear(); | 203 | mViewDict.clear(); |
200 | mActiveView = 0; | 204 | mActiveView = 0; |
201 | } | 205 | } |
202 | 206 | ||
203 | void ViewManager::setActiveView( const QString &name ) | 207 | void ViewManager::setActiveView( const QString &name ) |
204 | { | 208 | { |
205 | KAddressBookView *view = 0; | 209 | KAddressBookView *view = 0; |
206 | 210 | ||
207 | // Check that this isn't the same as the current active view | 211 | // Check that this isn't the same as the current active view |
208 | if ( mActiveView && ( mActiveView->caption() == name ) ) | 212 | if ( mActiveView && ( mActiveView->caption() == name ) ) |
209 | return; | 213 | return; |
210 | 214 | ||
211 | // At this point we know the view that should be active is not | 215 | // At this point we know the view that should be active is not |
212 | // currently active. We will try to find the new on in the list. If | 216 | // currently active. We will try to find the new on in the list. If |
213 | // we can't find it, it means it hasn't been instantiated, so we will | 217 | // we can't find it, it means it hasn't been instantiated, so we will |
214 | // create it on demand. | 218 | // create it on demand. |
215 | 219 | ||
216 | view = mViewDict.find( name ); | 220 | view = mViewDict.find( name ); |
217 | 221 | ||
218 | // Check if we found the view. If we didn't, then we need to create it | 222 | // Check if we found the view. If we didn't, then we need to create it |
219 | if ( view == 0 ) { | 223 | if ( view == 0 ) { |
220 | KConfig *config = mCore->config(); | 224 | KConfig *config = mCore->config(); |
221 | 225 | ||
222 | KConfigGroupSaver saver( config, name ); | 226 | KConfigGroupSaver saver( config, name ); |
223 | 227 | ||
224 | QString type = config->readEntry( "Type", "Table" ); | 228 | QString type = config->readEntry( "Type", "Table" ); |
225 | 229 | ||
226 | kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; | 230 | kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl; |
227 | 231 | ||
228 | ViewFactory *factory = mViewFactoryDict.find( type ); | 232 | ViewFactory *factory = mViewFactoryDict.find( type ); |
229 | if ( factory ) | 233 | if ( factory ) |
230 | view = factory->view( mCore->addressBook(), mViewWidgetStack ); | 234 | view = factory->view( mCore->addressBook(), mViewWidgetStack ); |
231 | 235 | ||
232 | if ( view ) { | 236 | if ( view ) { |
233 | view->setCaption( name ); | 237 | view->setCaption( name ); |
234 | mViewDict.insert( name, view ); | 238 | mViewDict.insert( name, view ); |
235 | //US my version needs an int as second parameter to addWidget | 239 | //US my version needs an int as second parameter to addWidget |
236 | mViewWidgetStack->addWidget( view, -1 ); | 240 | mViewWidgetStack->addWidget( view, -1 ); |
237 | view->readConfig( config ); | 241 | view->readConfig( config ); |
@@ -472,247 +476,250 @@ void ViewManager::createViewFactories() | |||
472 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 476 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
473 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 477 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
474 | 478 | ||
475 | viewFactory = new TableViewFactory(); | 479 | viewFactory = new TableViewFactory(); |
476 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 480 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
477 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 481 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
478 | 482 | ||
479 | viewFactory = new CardViewFactory(); | 483 | viewFactory = new CardViewFactory(); |
480 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 484 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
481 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 485 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
482 | 486 | ||
483 | #endif //KAB_EMBEDDED | 487 | #endif //KAB_EMBEDDED |
484 | 488 | ||
485 | } | 489 | } |
486 | 490 | ||
487 | void ViewManager::dropped( QDropEvent *e ) | 491 | void ViewManager::dropped( QDropEvent *e ) |
488 | { | 492 | { |
489 | kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl; | 493 | kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl; |
490 | 494 | ||
491 | #ifndef KAB_EMBEDDED | 495 | #ifndef KAB_EMBEDDED |
492 | 496 | ||
493 | QString clipText, vcards; | 497 | QString clipText, vcards; |
494 | KURL::List urls; | 498 | KURL::List urls; |
495 | 499 | ||
496 | if ( KURLDrag::decode( e, urls) ) { | 500 | if ( KURLDrag::decode( e, urls) ) { |
497 | KURL::List::Iterator it = urls.begin(); | 501 | KURL::List::Iterator it = urls.begin(); |
498 | int c = urls.count(); | 502 | int c = urls.count(); |
499 | if ( c > 1 ) { | 503 | if ( c > 1 ) { |
500 | QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); | 504 | QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); |
501 | if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { | 505 | if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { |
502 | for ( ; it != urls.end(); ++it ) | 506 | for ( ; it != urls.end(); ++it ) |
503 | emit urlDropped( *it ); | 507 | emit urlDropped( *it ); |
504 | } | 508 | } |
505 | } else if ( c == 1 ) | 509 | } else if ( c == 1 ) |
506 | emit urlDropped( *it ); | 510 | emit urlDropped( *it ); |
507 | } else if ( KVCardDrag::decode( e, vcards ) ) { | 511 | } else if ( KVCardDrag::decode( e, vcards ) ) { |
508 | KABC::Addressee addr; | 512 | KABC::Addressee addr; |
509 | KABC::VCardConverter converter; | 513 | KABC::VCardConverter converter; |
510 | QStringList list = QStringList::split( "\r\n\r\n", vcards ); | 514 | QStringList list = QStringList::split( "\r\n\r\n", vcards ); |
511 | QStringList::Iterator it; | 515 | QStringList::Iterator it; |
512 | for ( it = list.begin(); it != list.end(); ++it ) { | 516 | for ( it = list.begin(); it != list.end(); ++it ) { |
513 | if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { | 517 | if ( converter.vCardToAddressee( (*it).stripWhiteSpace(), addr ) ) { |
514 | KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); | 518 | KABC::Addressee a = mCore->addressBook()->findByUid( addr.uid() ); |
515 | if ( a.isEmpty() ) { | 519 | if ( a.isEmpty() ) { |
516 | mCore->addressBook()->insertAddressee( addr ); | 520 | mCore->addressBook()->insertAddressee( addr ); |
517 | emit modified(); | 521 | emit modified(); |
518 | } | 522 | } |
519 | } | 523 | } |
520 | } | 524 | } |
521 | 525 | ||
522 | mActiveView->refresh(); | 526 | mActiveView->refresh(); |
523 | } | 527 | } |
524 | #else //KAB_EMBEDDED | 528 | #else //KAB_EMBEDDED |
525 | qDebug("ViewManager::dropped() has to be changed!!" ); | 529 | qDebug("ViewManager::dropped() has to be changed!!" ); |
526 | #endif //KAB_EMBEDDED | 530 | #endif //KAB_EMBEDDED |
527 | 531 | ||
528 | } | 532 | } |
529 | 533 | ||
530 | void ViewManager::startDrag() | 534 | void ViewManager::startDrag() |
531 | { | 535 | { |
532 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; | 536 | kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; |
533 | 537 | ||
534 | #ifndef KAB_EMBEDDED | 538 | #ifndef KAB_EMBEDDED |
535 | 539 | ||
536 | // Get the list of all the selected addressees | 540 | // Get the list of all the selected addressees |
537 | KABC::Addressee::List addrList; | 541 | KABC::Addressee::List addrList; |
538 | QStringList uidList = selectedUids(); | 542 | QStringList uidList = selectedUids(); |
539 | QStringList::Iterator iter; | 543 | QStringList::Iterator iter; |
540 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) | 544 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) |
541 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); | 545 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); |
542 | 546 | ||
543 | KMultipleDrag *drag = new KMultipleDrag( this ); | 547 | KMultipleDrag *drag = new KMultipleDrag( this ); |
544 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); | 548 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); |
545 | KABC::Addressee::List::Iterator it; | 549 | KABC::Addressee::List::Iterator it; |
546 | QStringList vcards; | 550 | QStringList vcards; |
547 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { | 551 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { |
548 | QString vcard = QString::null; | 552 | QString vcard = QString::null; |
549 | KABC::VCardConverter converter; | 553 | KABC::VCardConverter converter; |
550 | if ( converter.addresseeToVCard( *it, vcard ) ) | 554 | if ( converter.addresseeToVCard( *it, vcard ) ) |
551 | vcards.append( vcard ); | 555 | vcards.append( vcard ); |
552 | } | 556 | } |
553 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); | 557 | drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); |
554 | 558 | ||
555 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); | 559 | drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); |
556 | drag->dragCopy(); | 560 | drag->dragCopy(); |
557 | 561 | ||
558 | #else //KAB_EMBEDDED | 562 | #else //KAB_EMBEDDED |
559 | qDebug("ViewManager::startDrag() has to be changed!!" ); | 563 | qDebug("ViewManager::startDrag() has to be changed!!" ); |
560 | #endif //KAB_EMBEDDED | 564 | #endif //KAB_EMBEDDED |
561 | 565 | ||
562 | } | 566 | } |
563 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) | 567 | void ViewManager::doSearch( const QString& s,KABC::Field *field ) |
564 | { | 568 | { |
565 | if ( mActiveView ) | 569 | if ( mActiveView ) |
566 | mActiveView->doSearch( s, field ); | 570 | mActiveView->doSearch( s, field ); |
567 | 571 | ||
568 | } | 572 | } |
569 | void ViewManager::setActiveFilter( int index ) | 573 | void ViewManager::setActiveFilter( int index ) |
570 | { | 574 | { |
571 | Filter currentFilter; | 575 | Filter currentFilter; |
572 | 576 | ||
573 | if ( ( index - 1 ) < 0 ) | 577 | if ( ( index - 1 ) < 0 ) |
574 | currentFilter = Filter(); | 578 | currentFilter = Filter(); |
575 | else | 579 | else |
576 | currentFilter = mFilterList[ index - 1 ]; | 580 | currentFilter = mFilterList[ index - 1 ]; |
577 | 581 | ||
578 | // Check if we have a view. Since the filter combo is created before | 582 | // Check if we have a view. Since the filter combo is created before |
579 | // the view, this slot could be called before there is a valid view. | 583 | // the view, this slot could be called before there is a valid view. |
580 | if ( mActiveView ) { | 584 | if ( mActiveView ) { |
581 | mActiveView->setFilter( currentFilter ); | 585 | mActiveView->setFilter( currentFilter ); |
582 | mActiveView->refresh(); | 586 | mActiveView->refresh(); |
583 | emit selected( QString::null ); | 587 | emit selected( QString::null ); |
584 | } | 588 | } |
585 | } | 589 | } |
586 | 590 | ||
587 | void ViewManager::configureFilters() | 591 | void ViewManager::configureFilters() |
588 | { | 592 | { |
589 | FilterDialog dlg( this ); | 593 | FilterDialog dlg( this ); |
590 | 594 | ||
591 | dlg.setFilters( mFilterList ); | 595 | dlg.setFilters( mFilterList ); |
592 | 596 | ||
593 | if ( dlg.exec() ) | 597 | if ( dlg.exec() ) |
594 | mFilterList = dlg.filters(); | 598 | mFilterList = dlg.filters(); |
595 | 599 | ||
596 | uint pos = mActionSelectFilter->currentItem(); | 600 | uint pos = mActionSelectFilter->currentItem(); |
597 | mActionSelectFilter->setItems( filterNames() ); | 601 | mActionSelectFilter->setItems( filterNames() ); |
598 | mActionSelectFilter->setCurrentItem( pos ); | 602 | mActionSelectFilter->setCurrentItem( pos ); |
599 | setActiveFilter( pos ); | 603 | setActiveFilter( pos ); |
600 | mActionSelectFilter->setComboWidth( 150 ); | 604 | int cw = 150; |
605 | if (QApplication::desktop()->width() == 480 ) | ||
606 | cw = 0; | ||
607 | mActionSelectFilter->setComboWidth( cw ); | ||
601 | } | 608 | } |
602 | 609 | ||
603 | QStringList ViewManager::filterNames() const | 610 | QStringList ViewManager::filterNames() const |
604 | { | 611 | { |
605 | QStringList names( i18n( "No Filter" ) ); | 612 | QStringList names( i18n( "No Filter" ) ); |
606 | 613 | ||
607 | Filter::List::ConstIterator it; | 614 | Filter::List::ConstIterator it; |
608 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) | 615 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it ) |
609 | names.append( (*it).name() ); | 616 | names.append( (*it).name() ); |
610 | 617 | ||
611 | return names; | 618 | return names; |
612 | } | 619 | } |
613 | 620 | ||
614 | int ViewManager::filterPosition( const QString &name ) const | 621 | int ViewManager::filterPosition( const QString &name ) const |
615 | { | 622 | { |
616 | int pos = 0; | 623 | int pos = 0; |
617 | 624 | ||
618 | Filter::List::ConstIterator it; | 625 | Filter::List::ConstIterator it; |
619 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) | 626 | for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) |
620 | if ( name == (*it).name() ) | 627 | if ( name == (*it).name() ) |
621 | return pos + 1; | 628 | return pos + 1; |
622 | 629 | ||
623 | return 0; | 630 | return 0; |
624 | } | 631 | } |
625 | 632 | ||
626 | void ViewManager::initActions() | 633 | void ViewManager::initActions() |
627 | { | 634 | { |
628 | //US <ActionList name="view_loadedviews"/> | 635 | //US <ActionList name="view_loadedviews"/> |
629 | //US <Separator/> | 636 | //US <Separator/> |
630 | 637 | ||
631 | #ifdef KAB_EMBEDDED | 638 | #ifdef KAB_EMBEDDED |
632 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 639 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); |
633 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 640 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
634 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 641 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); |
635 | #endif //KAB_EMBEDDED | 642 | #endif //KAB_EMBEDDED |
636 | 643 | ||
637 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 644 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
638 | #if KDE_VERSION >= 309 | 645 | #if KDE_VERSION >= 309 |
639 | mActionSelectView->setMenuAccelsEnabled( false ); | 646 | mActionSelectView->setMenuAccelsEnabled( false ); |
640 | #endif | 647 | #endif |
641 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 648 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
642 | SLOT( setActiveView( const QString& ) ) ); | 649 | SLOT( setActiveView( const QString& ) ) ); |
643 | 650 | ||
644 | 651 | ||
645 | #ifdef KAB_EMBEDDED | 652 | #ifdef KAB_EMBEDDED |
646 | mActionSelectView->plug(viewmenu); | 653 | mActionSelectView->plug(viewmenu); |
647 | viewmenu->insertSeparator(); | 654 | viewmenu->insertSeparator(); |
648 | #endif //KAB_EMBEDDED | 655 | #endif //KAB_EMBEDDED |
649 | 656 | ||
650 | KAction *action; | 657 | KAction *action; |
651 | 658 | ||
652 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, | 659 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, |
653 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); | 660 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); |
654 | #ifndef KAB_EMBEDDED | 661 | #ifndef KAB_EMBEDDED |
655 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); | 662 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); |
656 | #else //KAB_EMBEDDED | 663 | #else //KAB_EMBEDDED |
657 | action->plug(viewmenu); | 664 | action->plug(viewmenu); |
658 | #endif //KAB_EMBEDDED | 665 | #endif //KAB_EMBEDDED |
659 | 666 | ||
660 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, | 667 | action = new KAction( i18n( "Add View..." ), "window_new", 0, this, |
661 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); | 668 | SLOT( addView() ), mCore->actionCollection(), "view_add" ); |
662 | #ifndef KAB_EMBEDDED | 669 | #ifndef KAB_EMBEDDED |
663 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); | 670 | action->setWhatsThis( i18n( "You can add a new view by choosing one of the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views." ) ); |
664 | #else //KAB_EMBEDDED | 671 | #else //KAB_EMBEDDED |
665 | action->plug(viewmenu); | 672 | action->plug(viewmenu); |
666 | #endif //KAB_EMBEDDED | 673 | #endif //KAB_EMBEDDED |
667 | 674 | ||
668 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, | 675 | mActionDeleteView = new KAction( i18n( "Delete View" ), "view_remove", 0, |
669 | this, SLOT( deleteView() ), | 676 | this, SLOT( deleteView() ), |
670 | mCore->actionCollection(), "view_delete" ); | 677 | mCore->actionCollection(), "view_delete" ); |
671 | #ifndef KAB_EMBEDDED | 678 | #ifndef KAB_EMBEDDED |
672 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); | 679 | mActionDeleteView->setWhatsThis( i18n( "By pressing this button you can delete the actual view, which you have added before." ) ); |
673 | #else //KAB_EMBEDDED | 680 | #else //KAB_EMBEDDED |
674 | mActionDeleteView->plug(viewmenu); | 681 | mActionDeleteView->plug(viewmenu); |
675 | viewmenu->insertSeparator(); | 682 | viewmenu->insertSeparator(); |
676 | #endif //KAB_EMBEDDED | 683 | #endif //KAB_EMBEDDED |
677 | 684 | ||
678 | #ifndef KAB_EMBEDDED | 685 | #ifndef KAB_EMBEDDED |
679 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 686 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
680 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), | 687 | SLOT( refreshView(const QString &) ), mCore->actionCollection(), |
681 | "view_refresh" ); | 688 | "view_refresh" ); |
682 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); | 689 | action->setWhatsThis( i18n( "The view will be refreshed by pressing this button." ) ); |
683 | #else //KAB_EMBEDDED | 690 | #else //KAB_EMBEDDED |
684 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, | 691 | action = new KAction( i18n( "Refresh View" ), "reload", 0, this, |
685 | SLOT( refreshView()), mCore->actionCollection(), | 692 | SLOT( refreshView()), mCore->actionCollection(), |
686 | "view_refresh" ); | 693 | "view_refresh" ); |
687 | action->plug(viewmenu); | 694 | action->plug(viewmenu); |
688 | viewmenu->insertSeparator(); | 695 | viewmenu->insertSeparator(); |
689 | #endif //KAB_EMBEDDED | 696 | #endif //KAB_EMBEDDED |
690 | 697 | ||
691 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, | 698 | action = new KAction( i18n( "Edit &Filters..." ), "filter", 0, this, |
692 | SLOT( configureFilters() ), mCore->actionCollection(), | 699 | SLOT( configureFilters() ), mCore->actionCollection(), |
693 | "options_edit_filters" ); | 700 | "options_edit_filters" ); |
694 | 701 | ||
695 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); | 702 | mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); |
696 | #if KDE_VERSION >= 309 | 703 | #if KDE_VERSION >= 309 |
697 | mActionSelectFilter->setMenuAccelsEnabled( false ); | 704 | mActionSelectFilter->setMenuAccelsEnabled( false ); |
698 | #endif | 705 | #endif |
699 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), | 706 | connect( mActionSelectFilter, SIGNAL( activated( int ) ), |
700 | SLOT( setActiveFilter( int ) ) ); | 707 | SLOT( setActiveFilter( int ) ) ); |
701 | 708 | ||
702 | #ifdef KAB_EMBEDDED | 709 | #ifdef KAB_EMBEDDED |
703 | action->plug(settingsmenu); | 710 | action->plug(settingsmenu); |
704 | mActionSelectFilter->plug(viewmenu); | 711 | mActionSelectFilter->plug(viewmenu); |
705 | #endif //KAB_EMBEDDED | 712 | #endif //KAB_EMBEDDED |
706 | 713 | ||
707 | } | 714 | } |
708 | 715 | ||
709 | void ViewManager::initGUI() | 716 | void ViewManager::initGUI() |
710 | { | 717 | { |
711 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); | 718 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); |
712 | mViewWidgetStack = new QWidgetStack( this ); | 719 | mViewWidgetStack = new QWidgetStack( this ); |
713 | layout->addWidget( mViewWidgetStack ); | 720 | layout->addWidget( mViewWidgetStack ); |
714 | } | 721 | } |
715 | 722 | ||
716 | #ifndef KAB_EMBEDDED | 723 | #ifndef KAB_EMBEDDED |
717 | #include "viewmanager.moc" | 724 | #include "viewmanager.moc" |
718 | #endif //KAB_EMBEDDED | 725 | #endif //KAB_EMBEDDED |
diff --git a/kmicromail/libmailwrapper/settings.cpp b/kmicromail/libmailwrapper/settings.cpp index 04afe7c..19093b1 100644 --- a/kmicromail/libmailwrapper/settings.cpp +++ b/kmicromail/libmailwrapper/settings.cpp | |||
@@ -1,182 +1,182 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <qdir.h> | 2 | #include <qdir.h> |
3 | 3 | ||
4 | //#include <opie2/odebug.h> | 4 | //#include <opie2/odebug.h> |
5 | #include <kconfig.h> | 5 | #include <kconfig.h> |
6 | 6 | ||
7 | #include <kstandarddirs.h> | 7 | #include <kstandarddirs.h> |
8 | #include "settings.h" | 8 | #include "settings.h" |
9 | //#include "defines.h" | 9 | //#include "defines.h" |
10 | 10 | ||
11 | #define IMAP_PORT "143" | 11 | #define IMAP_PORT "143" |
12 | #define IMAP_SSL_PORT "993" | 12 | #define IMAP_SSL_PORT "993" |
13 | #define SMTP_PORT "25" | 13 | #define SMTP_PORT "25" |
14 | #define SMTP_SSL_PORT "465" | 14 | #define SMTP_SSL_PORT "465" |
15 | #define POP3_PORT "110" | 15 | #define POP3_PORT "110" |
16 | #define POP3_SSL_PORT "995" | 16 | #define POP3_SSL_PORT "995" |
17 | #define NNTP_PORT "119" | 17 | #define NNTP_PORT "119" |
18 | #define NNTP_SSL_PORT "563" | 18 | #define NNTP_SSL_PORT "563" |
19 | 19 | ||
20 | 20 | ||
21 | Settings::Settings() | 21 | Settings::Settings() |
22 | : QObject() | 22 | : QObject() |
23 | { | 23 | { |
24 | accounts.setAutoDelete( true ); ; | 24 | accounts.setAutoDelete( true ); ; |
25 | updateAccounts(); | 25 | updateAccounts(); |
26 | //qDebug("++++++++++++++++++new settings "); | 26 | //qDebug("++++++++++++++++++new settings "); |
27 | } | 27 | } |
28 | 28 | ||
29 | void Settings::checkDirectory() | 29 | void Settings::checkDirectory() |
30 | { | 30 | { |
31 | return; | 31 | return; |
32 | locateLocal("data", "kopiemail" ); | 32 | locateLocal("data", "kopiemail" ); |
33 | /* | 33 | /* |
34 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { | 34 | if ( !QDir( (QString) getenv( "HOME" ) + "/Applications/opiemail/" ).exists() ) { |
35 | system( "mkdir -p $HOME/Applications/opiemail" ); | 35 | system( "mkdir -p $HOME/Applications/opiemail" ); |
36 | qDebug("$HOME/Applications/opiemail created "); | 36 | qDebug("$HOME/Applications/opiemail created "); |
37 | } | 37 | } |
38 | */ | 38 | */ |
39 | } | 39 | } |
40 | 40 | ||
41 | QList<Account> Settings::getAccounts() | 41 | QList<Account> Settings::getAccounts() |
42 | { | 42 | { |
43 | return accounts; | 43 | return accounts; |
44 | } | 44 | } |
45 | 45 | ||
46 | void Settings::addAccount( Account *account ) | 46 | void Settings::addAccount( Account *account ) |
47 | { | 47 | { |
48 | accounts.append( account ); | 48 | accounts.append( account ); |
49 | } | 49 | } |
50 | 50 | ||
51 | void Settings::delAccount( Account *account ) | 51 | void Settings::delAccount( Account *account ) |
52 | { | 52 | { |
53 | accounts.remove( account ); | ||
54 | account->remove(); | 53 | account->remove(); |
54 | accounts.remove( account ); | ||
55 | } | 55 | } |
56 | 56 | ||
57 | void Settings::updateAccounts() | 57 | void Settings::updateAccounts() |
58 | { | 58 | { |
59 | accounts.clear(); | 59 | accounts.clear(); |
60 | QDir dir( locateLocal("data", "kopiemail" ) ); | 60 | QDir dir( locateLocal("data", "kopiemail" ) ); |
61 | QStringList::Iterator it; | 61 | QStringList::Iterator it; |
62 | 62 | ||
63 | QStringList imap = dir.entryList( "imap-*" ); | 63 | QStringList imap = dir.entryList( "imap-*" ); |
64 | for ( it = imap.begin(); it != imap.end(); it++ ) { | 64 | for ( it = imap.begin(); it != imap.end(); it++ ) { |
65 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); | 65 | IMAPaccount *account = new IMAPaccount( (*it).replace(0, 5, "") ); |
66 | accounts.append( account ); | 66 | accounts.append( account ); |
67 | } | 67 | } |
68 | 68 | ||
69 | QStringList pop3 = dir.entryList( "pop3-*" ); | 69 | QStringList pop3 = dir.entryList( "pop3-*" ); |
70 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { | 70 | for ( it = pop3.begin(); it != pop3.end(); it++ ) { |
71 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); | 71 | POP3account *account = new POP3account( (*it).replace(0, 5, "") ); |
72 | accounts.append( account ); | 72 | accounts.append( account ); |
73 | } | 73 | } |
74 | 74 | ||
75 | QStringList smtp = dir.entryList( "smtp-*" ); | 75 | QStringList smtp = dir.entryList( "smtp-*" ); |
76 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { | 76 | for ( it = smtp.begin(); it != smtp.end(); it++ ) { |
77 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); | 77 | SMTPaccount *account = new SMTPaccount( (*it).replace(0, 5, "") ); |
78 | accounts.append( account ); | 78 | accounts.append( account ); |
79 | } | 79 | } |
80 | 80 | ||
81 | QStringList nntp = dir.entryList( "nntp-*" ); | 81 | QStringList nntp = dir.entryList( "nntp-*" ); |
82 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { | 82 | for ( it = nntp.begin(); it != nntp.end(); it++ ) { |
83 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); | 83 | NNTPaccount *account = new NNTPaccount( (*it).replace(0, 5, "") ); |
84 | accounts.append( account ); | 84 | accounts.append( account ); |
85 | } | 85 | } |
86 | 86 | ||
87 | readAccounts(); | 87 | readAccounts(); |
88 | } | 88 | } |
89 | 89 | ||
90 | void Settings::saveAccounts() | 90 | void Settings::saveAccounts() |
91 | { | 91 | { |
92 | checkDirectory(); | 92 | checkDirectory(); |
93 | Account *it; | 93 | Account *it; |
94 | 94 | ||
95 | for ( it = accounts.first(); it; it = accounts.next() ) { | 95 | for ( it = accounts.first(); it; it = accounts.next() ) { |
96 | it->save(); | 96 | it->save(); |
97 | } | 97 | } |
98 | } | 98 | } |
99 | 99 | ||
100 | void Settings::readAccounts() | 100 | void Settings::readAccounts() |
101 | { | 101 | { |
102 | checkDirectory(); | 102 | checkDirectory(); |
103 | Account *it; | 103 | Account *it; |
104 | 104 | ||
105 | for ( it = accounts.first(); it; it = accounts.next() ) { | 105 | for ( it = accounts.first(); it; it = accounts.next() ) { |
106 | it->read(); | 106 | it->read(); |
107 | } | 107 | } |
108 | } | 108 | } |
109 | 109 | ||
110 | Account::Account() | 110 | Account::Account() |
111 | { | 111 | { |
112 | accountName = "changeMe"; | 112 | accountName = "changeMe"; |
113 | type = MAILLIB::A_UNDEFINED; | 113 | type = MAILLIB::A_UNDEFINED; |
114 | ssl = false; | 114 | ssl = false; |
115 | connectionType = 1; | 115 | connectionType = 1; |
116 | offline = false; | 116 | offline = false; |
117 | maxMailSize = 0; | 117 | maxMailSize = 0; |
118 | lastFetch; | 118 | lastFetch; |
119 | leaveOnServer = false; | 119 | leaveOnServer = false; |
120 | } | 120 | } |
121 | 121 | ||
122 | void Account::remove() | 122 | void Account::remove() |
123 | { | 123 | { |
124 | QFile file( getFileName() ); | 124 | QFile file( getFileName() ); |
125 | file.remove(); | 125 | file.remove(); |
126 | } | 126 | } |
127 | 127 | ||
128 | void Account::setPasswordList(const QStringList &str) | 128 | void Account::setPasswordList(const QStringList &str) |
129 | { | 129 | { |
130 | password = ""; | 130 | password = ""; |
131 | int i; | 131 | int i; |
132 | for ( i = 0; i < str.count() ; ++i ) { | 132 | for ( i = 0; i < str.count() ; ++i ) { |
133 | QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3))); | 133 | QChar c ( (str[i].toUInt()-131)/(str.count()- (i%3))); |
134 | password.append( c ); | 134 | password.append( c ); |
135 | } | 135 | } |
136 | //qDebug("password %s ", password.latin1()); | 136 | //qDebug("password %s ", password.latin1()); |
137 | } | 137 | } |
138 | QStringList Account::getPasswordList() | 138 | QStringList Account::getPasswordList() |
139 | { | 139 | { |
140 | int i; | 140 | int i; |
141 | int len = password.length(); | 141 | int len = password.length(); |
142 | QStringList str; | 142 | QStringList str; |
143 | 143 | ||
144 | for ( i = 0; i < len ; ++i ) { | 144 | for ( i = 0; i < len ; ++i ) { |
145 | int val = password.at(i).unicode()*(len-(i%3))+131; | 145 | int val = password.at(i).unicode()*(len-(i%3))+131; |
146 | str.append( QString::number( val ) ); | 146 | str.append( QString::number( val ) ); |
147 | // qDebug("append %s ", str[i].latin1()); | 147 | // qDebug("append %s ", str[i].latin1()); |
148 | } | 148 | } |
149 | return str; | 149 | return str; |
150 | } | 150 | } |
151 | 151 | ||
152 | IMAPaccount::IMAPaccount() | 152 | IMAPaccount::IMAPaccount() |
153 | : Account() | 153 | : Account() |
154 | { | 154 | { |
155 | file = IMAPaccount::getUniqueFileName(); | 155 | file = IMAPaccount::getUniqueFileName(); |
156 | accountName = "New IMAP Account"; | 156 | accountName = "New IMAP Account"; |
157 | ssl = false; | 157 | ssl = false; |
158 | connectionType = 1; | 158 | connectionType = 1; |
159 | type = MAILLIB::A_IMAP; | 159 | type = MAILLIB::A_IMAP; |
160 | port = IMAP_PORT; | 160 | port = IMAP_PORT; |
161 | } | 161 | } |
162 | 162 | ||
163 | IMAPaccount::IMAPaccount( QString filename ) | 163 | IMAPaccount::IMAPaccount( QString filename ) |
164 | : Account() | 164 | : Account() |
165 | { | 165 | { |
166 | file = filename; | 166 | file = filename; |
167 | accountName = "New IMAP Account"; | 167 | accountName = "New IMAP Account"; |
168 | ssl = false; | 168 | ssl = false; |
169 | connectionType = 1; | 169 | connectionType = 1; |
170 | type = MAILLIB::A_IMAP; | 170 | type = MAILLIB::A_IMAP; |
171 | port = IMAP_PORT; | 171 | port = IMAP_PORT; |
172 | } | 172 | } |
173 | 173 | ||
174 | QString IMAPaccount::getUniqueFileName() | 174 | QString IMAPaccount::getUniqueFileName() |
175 | { | 175 | { |
176 | int num = 0; | 176 | int num = 0; |
177 | QString unique; | 177 | QString unique; |
178 | 178 | ||
179 | QDir dir( locateLocal("data", "kopiemail" ) ); | 179 | QDir dir( locateLocal("data", "kopiemail" ) ); |
180 | 180 | ||
181 | QStringList imap = dir.entryList( "imap-*" ); | 181 | QStringList imap = dir.entryList( "imap-*" ); |
182 | do { | 182 | do { |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index ec192ea..915b3e8 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -174,286 +174,313 @@ void OpieMail::slotSendQueued() | |||
174 | { | 174 | { |
175 | SMTPaccount *smtp = 0; | 175 | SMTPaccount *smtp = 0; |
176 | 176 | ||
177 | QList<Account> list = settings->getAccounts(); | 177 | QList<Account> list = settings->getAccounts(); |
178 | QList<SMTPaccount> smtpList; | 178 | QList<SMTPaccount> smtpList; |
179 | smtpList.setAutoDelete(false); | 179 | smtpList.setAutoDelete(false); |
180 | Account *it; | 180 | Account *it; |
181 | for ( it = list.first(); it; it = list.next() ) | 181 | for ( it = list.first(); it; it = list.next() ) |
182 | { | 182 | { |
183 | if ( it->getType() == MAILLIB::A_SMTP ) | 183 | if ( it->getType() == MAILLIB::A_SMTP ) |
184 | { | 184 | { |
185 | smtp = static_cast<SMTPaccount *>(it); | 185 | smtp = static_cast<SMTPaccount *>(it); |
186 | smtpList.append(smtp); | 186 | smtpList.append(smtp); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | if (smtpList.count()==0) | 189 | if (smtpList.count()==0) |
190 | { | 190 | { |
191 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); | 191 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); |
192 | return; | 192 | return; |
193 | } | 193 | } |
194 | if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) | 194 | if ( QMessageBox::warning(this, i18n("Sending all mails"), i18n("Do you really want to send\nall queued mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::No ) |
195 | return; | 195 | return; |
196 | if (smtpList.count()==1) | 196 | if (smtpList.count()==1) |
197 | { | 197 | { |
198 | smtp = smtpList.at(0); | 198 | smtp = smtpList.at(0); |
199 | } | 199 | } |
200 | else | 200 | else |
201 | { | 201 | { |
202 | smtp = 0; | 202 | smtp = 0; |
203 | selectsmtp selsmtp; | 203 | selectsmtp selsmtp; |
204 | selsmtp.setSelectionlist(&smtpList); | 204 | selsmtp.setSelectionlist(&smtpList); |
205 | #ifndef DESKTOP_VERSION | 205 | #ifndef DESKTOP_VERSION |
206 | selsmtp.showMaximized(); | 206 | selsmtp.showMaximized(); |
207 | #endif | 207 | #endif |
208 | if ( selsmtp.exec() == QDialog::Accepted ) | 208 | if ( selsmtp.exec() == QDialog::Accepted ) |
209 | { | 209 | { |
210 | smtp = selsmtp.selected_smtp(); | 210 | smtp = selsmtp.selected_smtp(); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | if (smtp) | 213 | if (smtp) |
214 | { | 214 | { |
215 | 215 | ||
216 | Global::statusMessage("Sending mails...!"); | 216 | Global::statusMessage("Sending mails...!"); |
217 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 217 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
218 | if ( wrap->flushOutbox() ) | 218 | if ( wrap->flushOutbox() ) |
219 | { | 219 | { |
220 | Global::statusMessage("Mails sent!"); | 220 | Global::statusMessage("Mails sent!"); |
221 | } | 221 | } |
222 | delete wrap; | 222 | delete wrap; |
223 | } | 223 | } |
224 | // pending refresh list view, if outgoing is displayed | 224 | // pending refresh list view, if outgoing is displayed |
225 | } | 225 | } |
226 | 226 | ||
227 | void OpieMail::slotSearchMails() | 227 | void OpieMail::slotSearchMails() |
228 | { | 228 | { |
229 | qDebug("OpieMail::slotSearchMails():not implemented "); | 229 | qDebug("OpieMail::slotSearchMails():not implemented "); |
230 | } | 230 | } |
231 | 231 | ||
232 | void OpieMail::slotEditSettings() | 232 | void OpieMail::slotEditSettings() |
233 | { | 233 | { |
234 | 234 | ||
235 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | 235 | KOPrefsDialog settingsDialog( this, "koprefs", true ); |
236 | #ifndef DESKTOP_VERSION | 236 | #ifndef DESKTOP_VERSION |
237 | settingsDialog.showMaximized(); | 237 | settingsDialog.showMaximized(); |
238 | #endif | 238 | #endif |
239 | settingsDialog.exec(); | 239 | settingsDialog.exec(); |
240 | 240 | ||
241 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); | 241 | slotSetCodec( KOPrefs::instance()->mCurrentCodec ); |
242 | // KApplication::execDialog(settingsDialog); | 242 | // KApplication::execDialog(settingsDialog); |
243 | } | 243 | } |
244 | 244 | ||
245 | void OpieMail::slotEditAccounts() | 245 | void OpieMail::slotEditAccounts() |
246 | { | 246 | { |
247 | EditAccounts eaDialog( settings, this, 0, true ); | 247 | EditAccounts eaDialog( settings, this, 0, true ); |
248 | eaDialog.slotAdjustColumns(); | 248 | eaDialog.slotAdjustColumns(); |
249 | #ifndef DESKTOP_VERSION | 249 | #ifndef DESKTOP_VERSION |
250 | eaDialog.showMaximized(); | 250 | eaDialog.showMaximized(); |
251 | #endif | 251 | #endif |
252 | eaDialog.exec(); | 252 | eaDialog.exec(); |
253 | if ( settings ) delete settings; | 253 | if ( settings ) delete settings; |
254 | settings = new Settings(); | 254 | settings = new Settings(); |
255 | 255 | ||
256 | folderView->populate( settings->getAccounts() ); | 256 | folderView->populate( settings->getAccounts() ); |
257 | } | 257 | } |
258 | void OpieMail::replyMail() | 258 | void OpieMail::replyMail() |
259 | { | 259 | { |
260 | 260 | ||
261 | QListViewItem*item = mailView->currentItem(); | 261 | QListViewItem*item = mailView->currentItem(); |
262 | if (!item) return; | 262 | if (!item) return; |
263 | RecMailP mail = ((MailListViewItem*)item)->data(); | 263 | RecMailP mail = ((MailListViewItem*)item)->data(); |
264 | RecBodyP body = folderView->fetchBody(mail); | 264 | RecBodyP body = folderView->fetchBody(mail); |
265 | 265 | ||
266 | QString rtext; | 266 | QString rtext; |
267 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 267 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
268 | .arg( mail->getFrom()) | 268 | .arg( mail->getFrom()) |
269 | .arg( mail->getDate()); | 269 | .arg( mail->getDate()); |
270 | 270 | ||
271 | QString text = body->Bodytext(); | 271 | QString text = body->Bodytext(); |
272 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 272 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
273 | QStringList::Iterator it; | 273 | QStringList::Iterator it; |
274 | for (it = lines.begin(); it != lines.end(); it++) | 274 | for (it = lines.begin(); it != lines.end(); it++) |
275 | { | 275 | { |
276 | rtext += "> " + *it + "\n"; | 276 | rtext += "> " + *it + "\n"; |
277 | } | 277 | } |
278 | rtext += "\n"; | 278 | rtext += "\n"; |
279 | 279 | ||
280 | QString prefix; | 280 | QString prefix; |
281 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 281 | if ( mail->getSubject().find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
282 | else prefix = "Re: "; // no i18n on purpose | 282 | else prefix = "Re: "; // no i18n on purpose |
283 | 283 | ||
284 | Settings *settings = new Settings(); | 284 | Settings *settings = new Settings(); |
285 | ComposeMail composer( settings ,this, 0, true); | 285 | ComposeMail composer( settings ,this, 0, true); |
286 | if (mail->Replyto().isEmpty()) { | 286 | if (mail->Replyto().isEmpty()) { |
287 | composer.setTo( mail->getFrom()); | 287 | composer.setTo( mail->getFrom()); |
288 | } else { | 288 | } else { |
289 | composer.setTo( mail->Replyto()); | 289 | composer.setTo( mail->Replyto()); |
290 | } | 290 | } |
291 | composer.setSubject( prefix + mail->getSubject()); | 291 | composer.setSubject( prefix + mail->getSubject()); |
292 | composer.setMessage( rtext ); | 292 | composer.setMessage( rtext ); |
293 | composer.setInReplyTo( mail->Msgid()); | 293 | composer.setInReplyTo( mail->Msgid()); |
294 | composer.setCharset( body->getCharset() ); | 294 | composer.setCharset( body->getCharset() ); |
295 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 295 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
296 | { | 296 | { |
297 | mail->Wrapper()->answeredMail(mail); | 297 | mail->Wrapper()->answeredMail(mail); |
298 | } | 298 | } |
299 | delete settings; | 299 | delete settings; |
300 | 300 | ||
301 | } | 301 | } |
302 | void OpieMail::closeViewMail(ViewMail * vm) | ||
303 | { | ||
304 | vm->hide(); | ||
305 | } | ||
306 | void OpieMail::deleteAndDisplayNextMail(ViewMail * vm) | ||
307 | { | ||
308 | QListViewItem*item = mailView->currentItem(); | ||
309 | if (!item ) { | ||
310 | closeViewMail(vm); | ||
311 | return; | ||
312 | } | ||
313 | RecMailP mail = ((MailListViewItem*)item)->data(); | ||
314 | mail->Wrapper()->deleteMail( mail ); | ||
315 | item = item->itemBelow(); | ||
316 | if (!item ) { | ||
317 | closeViewMail(vm); | ||
318 | return; | ||
319 | } | ||
320 | mailView->setCurrentItem(item); | ||
321 | mail = ((MailListViewItem*)item)->data(); | ||
322 | RecBodyP body = folderView->fetchBody(mail); | ||
323 | vm->setBody( body ); | ||
324 | vm->setMail( mail ); | ||
325 | } | ||
302 | void OpieMail::displayNextMail(ViewMail * vm) | 326 | void OpieMail::displayNextMail(ViewMail * vm) |
303 | { | 327 | { |
304 | QListViewItem*item = mailView->currentItem(); | 328 | QListViewItem*item = mailView->currentItem(); |
305 | if (!item) return; | 329 | if (!item) return; |
330 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | ||
306 | item = item->itemBelow(); | 331 | item = item->itemBelow(); |
307 | if (!item) { | 332 | if (!item) { |
308 | vm->setCaption(i18n("End of List" )); | 333 | vm->setCaption(i18n("End of List" )); |
309 | return; | 334 | return; |
310 | } | 335 | } |
311 | mailView->setCurrentItem(item); | 336 | mailView->setCurrentItem(item); |
312 | RecMailP mail = ((MailListViewItem*)item)->data(); | 337 | RecMailP mail = ((MailListViewItem*)item)->data(); |
313 | RecBodyP body = folderView->fetchBody(mail); | 338 | RecBodyP body = folderView->fetchBody(mail); |
314 | vm->setBody( body ); | 339 | vm->setBody( body ); |
315 | vm->setMail( mail ); | 340 | vm->setMail( mail ); |
316 | } | 341 | } |
317 | void OpieMail::displayMail() | 342 | void OpieMail::displayMail() |
318 | { | 343 | { |
319 | QListViewItem*item = mailView->currentItem(); | 344 | QListViewItem*item = mailView->currentItem(); |
320 | if (!item) return; | 345 | if (!item) return; |
321 | RecMailP mail = ((MailListViewItem*)item)->data(); | 346 | RecMailP mail = ((MailListViewItem*)item)->data(); |
322 | RecBodyP body = folderView->fetchBody(mail); | 347 | RecBodyP body = folderView->fetchBody(mail); |
323 | ViewMail readMail( this,"", Qt::WType_Modal ); | 348 | ViewMail readMail( this,"", Qt::WType_Modal ); |
324 | readMail.setBody( body ); | 349 | readMail.setBody( body ); |
325 | readMail.setMail( mail ); | 350 | readMail.setMail( mail ); |
326 | #ifndef DESKTOP_VERSION | 351 | #ifndef DESKTOP_VERSION |
327 | readMail.showMaximized(); | 352 | readMail.showMaximized(); |
328 | #else | 353 | #else |
329 | readMail.resize( 640, 480); | 354 | readMail.resize( 640, 480); |
330 | #endif | 355 | #endif |
331 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); | 356 | connect( &readMail,SIGNAL( showNextMail(ViewMail *) ), this, SLOT( displayNextMail(ViewMail *) ) ); |
357 | connect( &readMail,SIGNAL( deleteAndDisplayNextMail(ViewMail *) ), this, SLOT(deleteAndDisplayNextMail(ViewMail *) ) ); | ||
358 | |||
332 | readMail.exec(); | 359 | readMail.exec(); |
333 | 360 | ||
334 | if ( readMail.deleted ) | 361 | if ( readMail.deleted ) |
335 | { | 362 | { |
336 | folderView->refreshCurrent(); | 363 | folderView->refreshCurrent(); |
337 | } | 364 | } |
338 | else | 365 | else |
339 | { | 366 | { |
340 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 367 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
341 | } | 368 | } |
342 | } | 369 | } |
343 | void OpieMail::slotGetAllMail() | 370 | void OpieMail::slotGetAllMail() |
344 | { | 371 | { |
345 | QListViewItem * item = folderView->firstChild(); | 372 | QListViewItem * item = folderView->firstChild(); |
346 | while ( item ){ | 373 | while ( item ){ |
347 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 374 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
348 | item = item->nextSibling (); | 375 | item = item->nextSibling (); |
349 | } | 376 | } |
350 | } | 377 | } |
351 | void OpieMail::slotGetMail() | 378 | void OpieMail::slotGetMail() |
352 | { | 379 | { |
353 | QListViewItem * item = folderView->currentItem(); | 380 | QListViewItem * item = folderView->currentItem(); |
354 | if ( ! item ) return; | 381 | if ( ! item ) return; |
355 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); | 382 | ((AccountViewItem *)item)->contextMenuSelected( 101 ); |
356 | } | 383 | } |
357 | void OpieMail::slotDeleteMail() | 384 | void OpieMail::slotDeleteMail() |
358 | { | 385 | { |
359 | if (!mailView->currentItem()) return; | 386 | if (!mailView->currentItem()) return; |
360 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 387 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
361 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 388 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
362 | { | 389 | { |
363 | mail->Wrapper()->deleteMail( mail ); | 390 | mail->Wrapper()->deleteMail( mail ); |
364 | folderView->refreshCurrent(); | 391 | folderView->refreshCurrent(); |
365 | } | 392 | } |
366 | } | 393 | } |
367 | void OpieMail::slotDeleteAllMail() | 394 | void OpieMail::slotDeleteAllMail() |
368 | { | 395 | { |
369 | 396 | ||
370 | QValueList<RecMailP> t; | 397 | QValueList<RecMailP> t; |
371 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 398 | if ( QMessageBox::warning(this, i18n("Delete All Mails"), i18n("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
372 | { | 399 | { |
373 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 400 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
374 | while ( item ) { | 401 | while ( item ) { |
375 | if ( item->isSelected() ) { | 402 | if ( item->isSelected() ) { |
376 | t.append( item->data() ); | 403 | t.append( item->data() ); |
377 | } | 404 | } |
378 | item = (MailListViewItem*)item->nextSibling(); | 405 | item = (MailListViewItem*)item->nextSibling(); |
379 | } | 406 | } |
380 | } | 407 | } |
381 | else | 408 | else |
382 | return; | 409 | return; |
383 | if ( t.count() == 0 ) | 410 | if ( t.count() == 0 ) |
384 | return; | 411 | return; |
385 | RecMailP mail = t.first(); | 412 | RecMailP mail = t.first(); |
386 | mail->Wrapper()->deleteMailList(t); | 413 | mail->Wrapper()->deleteMailList(t); |
387 | folderView->refreshCurrent(); | 414 | folderView->refreshCurrent(); |
388 | 415 | ||
389 | 416 | ||
390 | } | 417 | } |
391 | void OpieMail::clearSelection() | 418 | void OpieMail::clearSelection() |
392 | { | 419 | { |
393 | mailView->clearSelection(); | 420 | mailView->clearSelection(); |
394 | 421 | ||
395 | } | 422 | } |
396 | 423 | ||
397 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 424 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
398 | { | 425 | { |
399 | if (!mailView->currentItem()) return; | 426 | if (!mailView->currentItem()) return; |
400 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 427 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
401 | /* just the RIGHT button - or hold on pda */ | 428 | /* just the RIGHT button - or hold on pda */ |
402 | if (button!=2) {return;} | 429 | if (button!=2) {return;} |
403 | if (!item) return; | 430 | if (!item) return; |
404 | QPopupMenu *m = new QPopupMenu(0); | 431 | QPopupMenu *m = new QPopupMenu(0); |
405 | if (m) | 432 | if (m) |
406 | { | 433 | { |
407 | if (mailtype==MAILLIB::A_NNTP) { | 434 | if (mailtype==MAILLIB::A_NNTP) { |
408 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); | 435 | m->insertItem(i18n("Read this posting"),this,SLOT(displayMail())); |
409 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 436 | m->insertItem(i18n("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
410 | m->insertSeparator(); | 437 | m->insertSeparator(); |
411 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); | 438 | m->insertItem(i18n("Copy all selected postings"),this,SLOT(slotMoveCopyAllMail())); |
412 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 439 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
413 | } else { | 440 | } else { |
414 | if (folderView->currentisDraft()) { | 441 | if (folderView->currentisDraft()) { |
415 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); | 442 | m->insertItem(i18n("Edit this mail"),this,SLOT(reEditMail())); |
416 | } | 443 | } |
417 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); | 444 | m->insertItem(i18n("Reply to this mail"),this,SLOT(replyMail())); |
418 | m->insertSeparator(); | 445 | m->insertSeparator(); |
419 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); | 446 | m->insertItem(i18n("Read this mail"),this,SLOT(displayMail())); |
420 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); | 447 | m->insertItem(i18n("Move/Copy this mail"),this,SLOT(slotMoveCopyMail())); |
421 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); | 448 | m->insertItem(i18n("Delete this mail"),this,SLOT(slotDeleteMail())); |
422 | m->insertSeparator(); | 449 | m->insertSeparator(); |
423 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); | 450 | m->insertItem(i18n("Move/Copy all selected mail"),this,SLOT(slotMoveCopyAllMail())); |
424 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 451 | m->insertItem(i18n("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
425 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); | 452 | m->insertItem(i18n("Clear selection"),this,SLOT(clearSelection())); |
426 | } | 453 | } |
427 | m->setFocus(); | 454 | m->setFocus(); |
428 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 455 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
429 | delete m; | 456 | delete m; |
430 | } | 457 | } |
431 | } | 458 | } |
432 | 459 | ||
433 | void OpieMail::slotShowFolders( bool show ) | 460 | void OpieMail::slotShowFolders( bool show ) |
434 | { | 461 | { |
435 | if ( show && folderView->isHidden() ) | 462 | if ( show && folderView->isHidden() ) |
436 | { | 463 | { |
437 | folderView->show(); | 464 | folderView->show(); |
438 | } | 465 | } |
439 | else if ( !show && !folderView->isHidden() ) | 466 | else if ( !show && !folderView->isHidden() ) |
440 | { | 467 | { |
441 | folderView->hide(); | 468 | folderView->hide(); |
442 | } | 469 | } |
443 | } | 470 | } |
444 | 471 | ||
445 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 472 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
446 | { | 473 | { |
447 | MailListViewItem*item = 0; | 474 | MailListViewItem*item = 0; |
448 | mailView->clear(); | 475 | mailView->clear(); |
449 | 476 | ||
450 | QValueList<RecMailP>::ConstIterator it; | 477 | QValueList<RecMailP>::ConstIterator it; |
451 | for (it = list.begin(); it != list.end();++it) | 478 | for (it = list.begin(); it != list.end();++it) |
452 | { | 479 | { |
453 | item = new MailListViewItem(mailView,item); | 480 | item = new MailListViewItem(mailView,item); |
454 | item->storeData((*it)); | 481 | item->storeData((*it)); |
455 | item->showEntry(); | 482 | item->showEntry(); |
456 | } | 483 | } |
457 | mailView->setSorting ( 4, false ); | 484 | mailView->setSorting ( 4, false ); |
458 | } | 485 | } |
459 | 486 | ||
diff --git a/kmicromail/opiemail.h b/kmicromail/opiemail.h index 30968a7..a81a34c 100644 --- a/kmicromail/opiemail.h +++ b/kmicromail/opiemail.h | |||
@@ -1,58 +1,60 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #ifndef OPIEMAIL_H | 2 | #ifndef OPIEMAIL_H |
3 | #define OPIEMAIL_H | 3 | #define OPIEMAIL_H |
4 | 4 | ||
5 | #include "mainwindow.h" | 5 | #include "mainwindow.h" |
6 | #include <libmailwrapper/settings.h> | 6 | #include <libmailwrapper/settings.h> |
7 | 7 | ||
8 | #include <opie2/osmartpointer.h> | 8 | #include <opie2/osmartpointer.h> |
9 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
10 | #include <viewmail.h> | 10 | #include <viewmail.h> |
11 | 11 | ||
12 | class OpieMail : public MainWindow | 12 | class OpieMail : public MainWindow |
13 | { | 13 | { |
14 | Q_OBJECT | 14 | Q_OBJECT |
15 | 15 | ||
16 | public: | 16 | public: |
17 | OpieMail( QWidget *parent = 0, const char *name = 0 ); | 17 | OpieMail( QWidget *parent = 0, const char *name = 0 ); |
18 | virtual ~OpieMail(); | 18 | virtual ~OpieMail(); |
19 | static QString appName() { return QString::fromLatin1("kopiemail"); } | 19 | static QString appName() { return QString::fromLatin1("kopiemail"); } |
20 | 20 | ||
21 | public slots: | 21 | public slots: |
22 | virtual void slotwriteMail(const QString&name,const QString&email); | 22 | virtual void slotwriteMail(const QString&name,const QString&email); |
23 | virtual void slotwriteMail2(const QString&nameemail); | 23 | virtual void slotwriteMail2(const QString&nameemail); |
24 | virtual void slotComposeMail(); | 24 | virtual void slotComposeMail(); |
25 | virtual void slotExtAppHandler(); | 25 | virtual void slotExtAppHandler(); |
26 | virtual void appMessage(const QCString &msg, const QByteArray &data); | 26 | virtual void appMessage(const QCString &msg, const QByteArray &data); |
27 | virtual void message(const QCString &msg, const QByteArray &data); | 27 | virtual void message(const QCString &msg, const QByteArray &data); |
28 | protected slots: | 28 | protected slots: |
29 | virtual void deleteAndDisplayNextMail(ViewMail * vm); | ||
29 | virtual void displayNextMail(ViewMail * vm); | 30 | virtual void displayNextMail(ViewMail * vm); |
30 | virtual void slotSendQueued(); | 31 | virtual void slotSendQueued(); |
31 | virtual void slotSearchMails(); | 32 | virtual void slotSearchMails(); |
32 | virtual void slotEditSettings(); | 33 | virtual void slotEditSettings(); |
33 | virtual void slotEditAccounts(); | 34 | virtual void slotEditAccounts(); |
34 | virtual void displayMail(); | 35 | virtual void displayMail(); |
35 | virtual void replyMail(); | 36 | virtual void replyMail(); |
36 | virtual void slotDeleteMail(); | 37 | virtual void slotDeleteMail(); |
37 | virtual void slotGetMail(); | 38 | virtual void slotGetMail(); |
38 | virtual void slotGetAllMail(); | 39 | virtual void slotGetAllMail(); |
39 | virtual void slotDeleteAllMail(); | 40 | virtual void slotDeleteAllMail(); |
40 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); | 41 | virtual void mailHold(int, QListViewItem *,const QPoint&,int); |
41 | virtual void slotShowFolders( bool show ); | 42 | virtual void slotShowFolders( bool show ); |
42 | virtual void refreshMailView(const QValueList<RecMailP>&); | 43 | virtual void refreshMailView(const QValueList<RecMailP>&); |
43 | virtual void mailLeftClicked( QListViewItem * ); | 44 | virtual void mailLeftClicked( QListViewItem * ); |
44 | virtual void slotMoveCopyMail(); | 45 | virtual void slotMoveCopyMail(); |
45 | virtual void slotMoveCopyAllMail(); | 46 | virtual void slotMoveCopyAllMail(); |
46 | virtual void reEditMail(); | 47 | virtual void reEditMail(); |
47 | void clearSelection(); | 48 | void clearSelection(); |
48 | 49 | ||
49 | private: | 50 | private: |
51 | void closeViewMail(ViewMail * vm); | ||
50 | QString mPendingEmail; | 52 | QString mPendingEmail; |
51 | QString mPendingName; | 53 | QString mPendingName; |
52 | QByteArray mPendingData; | 54 | QByteArray mPendingData; |
53 | QCString mPendingMessage; | 55 | QCString mPendingMessage; |
54 | Settings *settings; | 56 | Settings *settings; |
55 | 57 | ||
56 | }; | 58 | }; |
57 | 59 | ||
58 | #endif | 60 | #endif |
diff --git a/kmicromail/viewmail.cpp b/kmicromail/viewmail.cpp index 60c764c..6d88cad 100644 --- a/kmicromail/viewmail.cpp +++ b/kmicromail/viewmail.cpp | |||
@@ -381,153 +381,154 @@ void ViewMail::setText() | |||
381 | } | 381 | } |
382 | 382 | ||
383 | 383 | ||
384 | ViewMail::~ViewMail() | 384 | ViewMail::~ViewMail() |
385 | { | 385 | { |
386 | m_recMail->Wrapper()->cleanMimeCache(); | 386 | m_recMail->Wrapper()->cleanMimeCache(); |
387 | hide(); | 387 | hide(); |
388 | } | 388 | } |
389 | 389 | ||
390 | void ViewMail::hide() | 390 | void ViewMail::hide() |
391 | { | 391 | { |
392 | QWidget::hide(); | 392 | QWidget::hide(); |
393 | 393 | ||
394 | if (_inLoop) | 394 | if (_inLoop) |
395 | { | 395 | { |
396 | _inLoop = false; | 396 | _inLoop = false; |
397 | qApp->exit_loop(); | 397 | qApp->exit_loop(); |
398 | 398 | ||
399 | } | 399 | } |
400 | 400 | ||
401 | } | 401 | } |
402 | 402 | ||
403 | void ViewMail::exec() | 403 | void ViewMail::exec() |
404 | { | 404 | { |
405 | show(); | 405 | show(); |
406 | 406 | ||
407 | if (!_inLoop) | 407 | if (!_inLoop) |
408 | { | 408 | { |
409 | _inLoop = true; | 409 | _inLoop = true; |
410 | qApp->enter_loop(); | 410 | qApp->enter_loop(); |
411 | } | 411 | } |
412 | 412 | ||
413 | } | 413 | } |
414 | 414 | ||
415 | QString ViewMail::deHtml(const QString &string) | 415 | QString ViewMail::deHtml(const QString &string) |
416 | { | 416 | { |
417 | QString string_ = string; | 417 | QString string_ = string; |
418 | string_.replace(QRegExp("&"), "&"); | 418 | string_.replace(QRegExp("&"), "&"); |
419 | string_.replace(QRegExp("<"), "<"); | 419 | string_.replace(QRegExp("<"), "<"); |
420 | string_.replace(QRegExp(">"), ">"); | 420 | string_.replace(QRegExp(">"), ">"); |
421 | string_.replace(QRegExp("\\n"), "<br>"); | 421 | string_.replace(QRegExp("\\n"), "<br>"); |
422 | return string_; | 422 | return string_; |
423 | } | 423 | } |
424 | 424 | ||
425 | void ViewMail::slotReply() | 425 | void ViewMail::slotReply() |
426 | { | 426 | { |
427 | if (!m_gotBody) | 427 | if (!m_gotBody) |
428 | { | 428 | { |
429 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); | 429 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot reply yet."), i18n("Ok")); |
430 | return; | 430 | return; |
431 | } | 431 | } |
432 | 432 | ||
433 | QString rtext; | 433 | QString rtext; |
434 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose | 434 | rtext += QString("* %1 wrote on %2:\n") // no i18n on purpose |
435 | .arg( m_mail[0] ) | 435 | .arg( m_mail[0] ) |
436 | .arg( m_mail[3] ); | 436 | .arg( m_mail[3] ); |
437 | 437 | ||
438 | QString text = m_mail[2]; | 438 | QString text = m_mail[2]; |
439 | QStringList lines = QStringList::split(QRegExp("\\n"), text); | 439 | QStringList lines = QStringList::split(QRegExp("\\n"), text); |
440 | QStringList::Iterator it; | 440 | QStringList::Iterator it; |
441 | for (it = lines.begin(); it != lines.end(); it++) | 441 | for (it = lines.begin(); it != lines.end(); it++) |
442 | { | 442 | { |
443 | rtext += "> " + *it + "\n"; | 443 | rtext += "> " + *it + "\n"; |
444 | } | 444 | } |
445 | rtext += "\n"; | 445 | rtext += "\n"; |
446 | 446 | ||
447 | QString prefix; | 447 | QString prefix; |
448 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; | 448 | if ( m_mail[1].find(QRegExp("^Re: .*$")) != -1) prefix = ""; |
449 | else prefix = "Re: "; // no i18n on purpose | 449 | else prefix = "Re: "; // no i18n on purpose |
450 | 450 | ||
451 | Settings *settings = new Settings(); | 451 | Settings *settings = new Settings(); |
452 | ComposeMail composer( settings ,this, 0, true); | 452 | ComposeMail composer( settings ,this, 0, true); |
453 | if (m_recMail->Replyto().isEmpty()) { | 453 | if (m_recMail->Replyto().isEmpty()) { |
454 | composer.setTo(m_recMail->getFrom()); | 454 | composer.setTo(m_recMail->getFrom()); |
455 | } else { | 455 | } else { |
456 | composer.setTo(m_recMail->Replyto()); | 456 | composer.setTo(m_recMail->Replyto()); |
457 | } | 457 | } |
458 | composer.setSubject( prefix + m_mail[1] ); | 458 | composer.setSubject( prefix + m_mail[1] ); |
459 | composer.setMessage( rtext ); | 459 | composer.setMessage( rtext ); |
460 | composer.setInReplyTo(m_recMail->Msgid()); | 460 | composer.setInReplyTo(m_recMail->Msgid()); |
461 | composer.setCharset( m_body->getCharset() ); | 461 | composer.setCharset( m_body->getCharset() ); |
462 | 462 | ||
463 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) | 463 | if ( QDialog::Accepted == KApplication::execDialog( &composer ) ) |
464 | { | 464 | { |
465 | m_recMail->Wrapper()->answeredMail(m_recMail); | 465 | m_recMail->Wrapper()->answeredMail(m_recMail); |
466 | } | 466 | } |
467 | delete settings; | 467 | delete settings; |
468 | } | 468 | } |
469 | 469 | ||
470 | void ViewMail::slotForward() | 470 | void ViewMail::slotForward() |
471 | { | 471 | { |
472 | if (!m_gotBody) | 472 | if (!m_gotBody) |
473 | { | 473 | { |
474 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); | 474 | QMessageBox::information(this, i18n("Error"), i18n("<p>The mail body is not yet downloaded, so you cannot forward yet."), i18n("Ok")); |
475 | return; | 475 | return; |
476 | } | 476 | } |
477 | 477 | ||
478 | QString ftext; | 478 | QString ftext; |
479 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") | 479 | ftext += QString("\n----- Forwarded message from %1 -----\n\n") |
480 | .arg( m_mail[0] ); | 480 | .arg( m_mail[0] ); |
481 | if (!m_mail[3].isNull()) | 481 | if (!m_mail[3].isNull()) |
482 | ftext += QString("Date: %1\n") | 482 | ftext += QString("Date: %1\n") |
483 | .arg( m_mail[3] ); | 483 | .arg( m_mail[3] ); |
484 | if (!m_mail[0].isNull()) | 484 | if (!m_mail[0].isNull()) |
485 | ftext += QString("From: %1\n") | 485 | ftext += QString("From: %1\n") |
486 | .arg( m_mail[0] ); | 486 | .arg( m_mail[0] ); |
487 | if (!m_mail[1].isNull()) | 487 | if (!m_mail[1].isNull()) |
488 | ftext += QString("Subject: %1\n") | 488 | ftext += QString("Subject: %1\n") |
489 | .arg( m_mail[1] ); | 489 | .arg( m_mail[1] ); |
490 | 490 | ||
491 | ftext += QString("\n%1\n") | 491 | ftext += QString("\n%1\n") |
492 | .arg( m_mail[2]); | 492 | .arg( m_mail[2]); |
493 | 493 | ||
494 | ftext += QString("----- End forwarded message -----\n"); | 494 | ftext += QString("----- End forwarded message -----\n"); |
495 | 495 | ||
496 | Settings *settings = new Settings(); | 496 | Settings *settings = new Settings(); |
497 | ComposeMail composer( settings ,this, 0, true); | 497 | ComposeMail composer( settings ,this, 0, true); |
498 | composer.setSubject( "Fwd: " + m_mail[1] ); | 498 | composer.setSubject( "Fwd: " + m_mail[1] ); |
499 | composer.setMessage( ftext ); | 499 | composer.setMessage( ftext ); |
500 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) | 500 | if ( QDialog::Accepted == KApplication::execDialog( &composer )) |
501 | { | 501 | { |
502 | } | 502 | } |
503 | } | 503 | } |
504 | 504 | ||
505 | void ViewMail::slotDeleteMail( ) | 505 | void ViewMail::slotDeleteMail( ) |
506 | { | 506 | { |
507 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 507 | if ( QMessageBox::warning(this, i18n("Delete Mail"), QString( i18n("<p>Do you really want to delete this mail? <br><br>" ) + m_mail[0] + " - " + m_mail[1] ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
508 | { | 508 | { |
509 | m_recMail->Wrapper()->deleteMail( m_recMail ); | 509 | emit deleteAndDisplayNextMail( this); |
510 | hide(); | 510 | //m_recMail->Wrapper()->deleteMail( m_recMail ); |
511 | //hide(); | ||
511 | deleted = true; | 512 | deleted = true; |
512 | } | 513 | } |
513 | } | 514 | } |
514 | 515 | ||
515 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) | 516 | MailImageDlg::MailImageDlg(const QString&fname,QWidget *parent, const char *name, bool modal, WFlags f) |
516 | : QDialog(parent,name,modal) | 517 | : QDialog(parent,name,modal) |
517 | { | 518 | { |
518 | QVBoxLayout*dlglayout = new QVBoxLayout(this); | 519 | QVBoxLayout*dlglayout = new QVBoxLayout(this); |
519 | dlglayout->setSpacing(2); | 520 | dlglayout->setSpacing(2); |
520 | dlglayout->setMargin(1); | 521 | dlglayout->setMargin(1); |
521 | //m_imageview = new Opie::MM::OImageScrollView(this); | 522 | //m_imageview = new Opie::MM::OImageScrollView(this); |
522 | //dlglayout->addWidget(m_imageview); | 523 | //dlglayout->addWidget(m_imageview); |
523 | } | 524 | } |
524 | 525 | ||
525 | MailImageDlg::~MailImageDlg() | 526 | MailImageDlg::~MailImageDlg() |
526 | { | 527 | { |
527 | } | 528 | } |
528 | 529 | ||
529 | void MailImageDlg::setName(const QString&fname) | 530 | void MailImageDlg::setName(const QString&fname) |
530 | { | 531 | { |
531 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); | 532 | qDebug("viewmail.cpp: MailImageDlg::setName Pending"); |
532 | // m_imageview->setImage(fname); | 533 | // m_imageview->setImage(fname); |
533 | } | 534 | } |
diff --git a/kmicromail/viewmail.h b/kmicromail/viewmail.h index c2c2ce3..d85b8b2 100644 --- a/kmicromail/viewmail.h +++ b/kmicromail/viewmail.h | |||
@@ -1,88 +1,89 @@ | |||
1 | #ifndef VIEWMAIL_H | 1 | #ifndef VIEWMAIL_H |
2 | #define VIEWMAIL_H | 2 | #define VIEWMAIL_H |
3 | 3 | ||
4 | #include "viewmailbase.h" | 4 | #include "viewmailbase.h" |
5 | #include <libmailwrapper/mailtypes.h> | 5 | #include <libmailwrapper/mailtypes.h> |
6 | 6 | ||
7 | #include <qdialog.h> | 7 | #include <qdialog.h> |
8 | 8 | ||
9 | #include <qlistview.h> | 9 | #include <qlistview.h> |
10 | #include <qmap.h> | 10 | #include <qmap.h> |
11 | #include <qstringlist.h> | 11 | #include <qstringlist.h> |
12 | #include <qvaluelist.h> | 12 | #include <qvaluelist.h> |
13 | 13 | ||
14 | //namespace Opie { namespace MM { class OImageScrollView; } } | 14 | //namespace Opie { namespace MM { class OImageScrollView; } } |
15 | 15 | ||
16 | class AttachItem : public QListViewItem | 16 | class AttachItem : public QListViewItem |
17 | { | 17 | { |
18 | public: | 18 | public: |
19 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 19 | AttachItem(QListView * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
20 | const QString&fsize,int num,const QValueList<int>&path); | 20 | const QString&fsize,int num,const QValueList<int>&path); |
21 | AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, | 21 | AttachItem(QListViewItem * parent,QListViewItem *after, const QString&mime,const QString&desc,const QString&file, |
22 | const QString&fsize,int num,const QValueList<int>&path); | 22 | const QString&fsize,int num,const QValueList<int>&path); |
23 | int Partnumber() { return _partNum; } | 23 | int Partnumber() { return _partNum; } |
24 | bool isParentof(const QValueList<int>&path); | 24 | bool isParentof(const QValueList<int>&path); |
25 | 25 | ||
26 | private: | 26 | private: |
27 | int _partNum; | 27 | int _partNum; |
28 | /* needed for a better display of attachments */ | 28 | /* needed for a better display of attachments */ |
29 | QValueList<int> _path; | 29 | QValueList<int> _path; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | class ViewMail : public ViewMailBase | 32 | class ViewMail : public ViewMailBase |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); | 37 | ViewMail( QWidget *parent = 0, const char *name = 0, WFlags fl = 0); |
38 | ~ViewMail(); | 38 | ~ViewMail(); |
39 | 39 | ||
40 | void hide(); | 40 | void hide(); |
41 | void exec(); | 41 | void exec(); |
42 | void setMail(const RecMailP&mail ); | 42 | void setMail(const RecMailP&mail ); |
43 | void setBody(const RecBodyP&body); | 43 | void setBody(const RecBodyP&body); |
44 | bool deleted; | 44 | bool deleted; |
45 | signals: | 45 | signals: |
46 | void showNextMail(ViewMail*); | 46 | void showNextMail(ViewMail*); |
47 | void deleteAndDisplayNextMail(ViewMail *); | ||
47 | protected: | 48 | protected: |
48 | QString deHtml(const QString &string); | 49 | QString deHtml(const QString &string); |
49 | AttachItem* searchParent(const QValueList<int>&path); | 50 | AttachItem* searchParent(const QValueList<int>&path); |
50 | AttachItem* lastChild(AttachItem*parent); | 51 | AttachItem* lastChild(AttachItem*parent); |
51 | 52 | ||
52 | protected slots: | 53 | protected slots: |
53 | void slotNextMail() { emit showNextMail(this); }; | 54 | void slotNextMail() { emit showNextMail(this); }; |
54 | void slotReply(); | 55 | void slotReply(); |
55 | void slotForward(); | 56 | void slotForward(); |
56 | void setText(); | 57 | void setText(); |
57 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); | 58 | void slotItemClicked( QListViewItem * item , const QPoint & point, int c ); |
58 | void slotDeleteMail( ); | 59 | void slotDeleteMail( ); |
59 | void slotShowHtml( bool ); | 60 | void slotShowHtml( bool ); |
60 | 61 | ||
61 | private: | 62 | private: |
62 | void readConfig(); | 63 | void readConfig(); |
63 | 64 | ||
64 | bool _inLoop; | 65 | bool _inLoop; |
65 | QString m_mailHtml; | 66 | QString m_mailHtml; |
66 | bool m_gotBody; | 67 | bool m_gotBody; |
67 | RecBodyP m_body; | 68 | RecBodyP m_body; |
68 | RecMailP m_recMail; | 69 | RecMailP m_recMail; |
69 | bool m_showHtml; | 70 | bool m_showHtml; |
70 | 71 | ||
71 | // 0 from 1 subject 2 bodytext 3 date | 72 | // 0 from 1 subject 2 bodytext 3 date |
72 | QMap <int,QString> m_mail; | 73 | QMap <int,QString> m_mail; |
73 | // 0 to 1 cc 2 bcc | 74 | // 0 to 1 cc 2 bcc |
74 | QMap <int,QStringList> m_mail2; | 75 | QMap <int,QStringList> m_mail2; |
75 | }; | 76 | }; |
76 | 77 | ||
77 | class MailImageDlg:public QDialog | 78 | class MailImageDlg:public QDialog |
78 | { | 79 | { |
79 | Q_OBJECT | 80 | Q_OBJECT |
80 | public: | 81 | public: |
81 | MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); | 82 | MailImageDlg(const QString&,QWidget *parent = 0, const char *name = 0, bool modal = true, WFlags f = 0); |
82 | ~MailImageDlg(); | 83 | ~MailImageDlg(); |
83 | void setName(const QString&); | 84 | void setName(const QString&); |
84 | protected: | 85 | protected: |
85 | //Opie::MM::OImageScrollView*m_imageview; | 86 | //Opie::MM::OImageScrollView*m_imageview; |
86 | }; | 87 | }; |
87 | 88 | ||
88 | #endif | 89 | #endif |
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 15c5dd9..a46cd87 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -2348,490 +2348,492 @@ void CalendarView::beamCalendar() | |||
2348 | //qDebug("beamCalendar() "); | 2348 | //qDebug("beamCalendar() "); |
2349 | beamIncidenceList( delSel ); | 2349 | beamIncidenceList( delSel ); |
2350 | } | 2350 | } |
2351 | void CalendarView::beamFilteredCalendar() | 2351 | void CalendarView::beamFilteredCalendar() |
2352 | { | 2352 | { |
2353 | QPtrList<Incidence> delSel = mCalendar->incidences(); | 2353 | QPtrList<Incidence> delSel = mCalendar->incidences(); |
2354 | //qDebug("beamFilteredCalendar() "); | 2354 | //qDebug("beamFilteredCalendar() "); |
2355 | beamIncidenceList( delSel ); | 2355 | beamIncidenceList( delSel ); |
2356 | } | 2356 | } |
2357 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) | 2357 | void CalendarView::beamIncidenceList(QPtrList<Incidence> delSel ) |
2358 | { | 2358 | { |
2359 | if ( beamDialog->exec () == QDialog::Rejected ) | 2359 | if ( beamDialog->exec () == QDialog::Rejected ) |
2360 | return; | 2360 | return; |
2361 | #ifdef DESKTOP_VERSION | 2361 | #ifdef DESKTOP_VERSION |
2362 | QString fn = locateLocal( "tmp", "kopibeamfile" ); | 2362 | QString fn = locateLocal( "tmp", "kopibeamfile" ); |
2363 | #else | 2363 | #else |
2364 | QString fn = "/tmp/kopibeamfile"; | 2364 | QString fn = "/tmp/kopibeamfile"; |
2365 | #endif | 2365 | #endif |
2366 | QString mes; | 2366 | QString mes; |
2367 | bool createbup = true; | 2367 | bool createbup = true; |
2368 | if ( createbup ) { | 2368 | if ( createbup ) { |
2369 | QString description = "\n"; | 2369 | QString description = "\n"; |
2370 | CalendarLocal* cal = new CalendarLocal(); | 2370 | CalendarLocal* cal = new CalendarLocal(); |
2371 | if ( beamDialog->beamLocal() ) | 2371 | if ( beamDialog->beamLocal() ) |
2372 | cal->setLocalTime(); | 2372 | cal->setLocalTime(); |
2373 | else | 2373 | else |
2374 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); | 2374 | cal->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); |
2375 | Incidence *incidence = delSel.first(); | 2375 | Incidence *incidence = delSel.first(); |
2376 | bool addText = false; | 2376 | bool addText = false; |
2377 | if ( delSel.count() < 10 ) | 2377 | if ( delSel.count() < 10 ) |
2378 | addText = true; | 2378 | addText = true; |
2379 | else { | 2379 | else { |
2380 | description.sprintf(i18n(" %d items?"),delSel.count() ); | 2380 | description.sprintf(i18n(" %d items?"),delSel.count() ); |
2381 | } | 2381 | } |
2382 | while ( incidence ) { | 2382 | while ( incidence ) { |
2383 | Incidence *in = incidence->clone(); | 2383 | Incidence *in = incidence->clone(); |
2384 | if ( ! in->summary().isEmpty() ) { | 2384 | if ( ! in->summary().isEmpty() ) { |
2385 | in->setDescription(""); | 2385 | in->setDescription(""); |
2386 | } else { | 2386 | } else { |
2387 | in->setSummary( in->description().left(20)); | 2387 | in->setSummary( in->description().left(20)); |
2388 | in->setDescription(""); | 2388 | in->setDescription(""); |
2389 | } | 2389 | } |
2390 | if ( addText ) | 2390 | if ( addText ) |
2391 | description += in->summary() + "\n"; | 2391 | description += in->summary() + "\n"; |
2392 | cal->addIncidence( in ); | 2392 | cal->addIncidence( in ); |
2393 | incidence = delSel.next(); | 2393 | incidence = delSel.next(); |
2394 | } | 2394 | } |
2395 | if ( beamDialog->beamVcal() ) { | 2395 | if ( beamDialog->beamVcal() ) { |
2396 | fn += ".vcs"; | 2396 | fn += ".vcs"; |
2397 | FileStorage storage( cal, fn, new VCalFormat ); | 2397 | FileStorage storage( cal, fn, new VCalFormat ); |
2398 | storage.save(); | 2398 | storage.save(); |
2399 | } else { | 2399 | } else { |
2400 | fn += ".ics"; | 2400 | fn += ".ics"; |
2401 | FileStorage storage( cal, fn, new ICalFormat( ) ); | 2401 | FileStorage storage( cal, fn, new ICalFormat( ) ); |
2402 | storage.save(); | 2402 | storage.save(); |
2403 | } | 2403 | } |
2404 | delete cal; | 2404 | delete cal; |
2405 | mes = i18n("KO/Pi: Ready for beaming"); | 2405 | mes = i18n("KO/Pi: Ready for beaming"); |
2406 | topLevelWidget()->setCaption(mes); | 2406 | topLevelWidget()->setCaption(mes); |
2407 | KApplication::convert2latin1( fn ); | 2407 | KApplication::convert2latin1( fn ); |
2408 | #ifndef DESKTOP_VERSION | 2408 | #ifndef DESKTOP_VERSION |
2409 | Ir *ir = new Ir( this ); | 2409 | Ir *ir = new Ir( this ); |
2410 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); | 2410 | connect( ir, SIGNAL( done( Ir * ) ), this, SLOT( beamDone( Ir * ) ) ); |
2411 | ir->send( fn, description, "text/x-vCalendar" ); | 2411 | ir->send( fn, description, "text/x-vCalendar" ); |
2412 | #endif | 2412 | #endif |
2413 | } | 2413 | } |
2414 | } | 2414 | } |
2415 | void CalendarView::beamDone( Ir *ir ) | 2415 | void CalendarView::beamDone( Ir *ir ) |
2416 | { | 2416 | { |
2417 | #ifndef DESKTOP_VERSION | 2417 | #ifndef DESKTOP_VERSION |
2418 | delete ir; | 2418 | delete ir; |
2419 | #endif | 2419 | #endif |
2420 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); | 2420 | topLevelWidget()->setCaption( i18n("KO/Pi: Beaming done.") ); |
2421 | topLevelWidget()->raise(); | 2421 | topLevelWidget()->raise(); |
2422 | } | 2422 | } |
2423 | 2423 | ||
2424 | void CalendarView::moveIncidence(Incidence * inc ) | 2424 | void CalendarView::moveIncidence(Incidence * inc ) |
2425 | { | 2425 | { |
2426 | if ( !inc ) return; | 2426 | if ( !inc ) return; |
2427 | // qDebug("showDatePickerForIncidence( ) "); | 2427 | // qDebug("showDatePickerForIncidence( ) "); |
2428 | if ( mDateFrame->isVisible() ) | 2428 | if ( mDateFrame->isVisible() ) |
2429 | mDateFrame->hide(); | 2429 | mDateFrame->hide(); |
2430 | else { | 2430 | else { |
2431 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; | 2431 | int w =mDatePicker->sizeHint().width()+2*mDateFrame->lineWidth() ; |
2432 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; | 2432 | int h = mDatePicker->sizeHint().height()+2*mDateFrame->lineWidth() ; |
2433 | int dw = QApplication::desktop()->width(); | 2433 | int dw = QApplication::desktop()->width(); |
2434 | int dh = QApplication::desktop()->height(); | 2434 | int dh = QApplication::desktop()->height(); |
2435 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2435 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2436 | mDateFrame->show(); | 2436 | mDateFrame->show(); |
2437 | } | 2437 | } |
2438 | mDatePickerMode = 2; | 2438 | mDatePickerMode = 2; |
2439 | mMoveIncidence = inc ; | 2439 | mMoveIncidence = inc ; |
2440 | QDate da; | 2440 | QDate da; |
2441 | if ( mMoveIncidence->type() == "Todo" ) { | 2441 | if ( mMoveIncidence->type() == "Todo" ) { |
2442 | Todo * to = (Todo *) mMoveIncidence; | 2442 | Todo * to = (Todo *) mMoveIncidence; |
2443 | if ( to->hasDueDate() ) | 2443 | if ( to->hasDueDate() ) |
2444 | da = to->dtDue().date(); | 2444 | da = to->dtDue().date(); |
2445 | else | 2445 | else |
2446 | da = QDate::currentDate(); | 2446 | da = QDate::currentDate(); |
2447 | } else { | 2447 | } else { |
2448 | da = mMoveIncidence->dtStart().date(); | 2448 | da = mMoveIncidence->dtStart().date(); |
2449 | } | 2449 | } |
2450 | //PENDING set date for recurring incidence to date of recurrence | 2450 | //PENDING set date for recurring incidence to date of recurrence |
2451 | //mMoveIncidenceOldDate; | 2451 | //mMoveIncidenceOldDate; |
2452 | mDatePicker->setDate( da ); | 2452 | mDatePicker->setDate( da ); |
2453 | } | 2453 | } |
2454 | void CalendarView::showDatePicker( ) | 2454 | void CalendarView::showDatePicker( ) |
2455 | { | 2455 | { |
2456 | //qDebug("CalendarView::showDatePicker( ) "); | 2456 | //qDebug("CalendarView::showDatePicker( ) "); |
2457 | if ( mDateFrame->isVisible() ) | 2457 | if ( mDateFrame->isVisible() ) |
2458 | mDateFrame->hide(); | 2458 | mDateFrame->hide(); |
2459 | else { | 2459 | else { |
2460 | int w =mDatePicker->sizeHint().width() ; | 2460 | int w =mDatePicker->sizeHint().width() ; |
2461 | int h = mDatePicker->sizeHint().height() ; | 2461 | int h = mDatePicker->sizeHint().height() ; |
2462 | int dw = QApplication::desktop()->width(); | 2462 | int dw = QApplication::desktop()->width(); |
2463 | int dh = QApplication::desktop()->height(); | 2463 | int dh = QApplication::desktop()->height(); |
2464 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); | 2464 | mDateFrame->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); |
2465 | mDateFrame->show(); | 2465 | mDateFrame->show(); |
2466 | } | 2466 | } |
2467 | mDatePickerMode = 1; | 2467 | mDatePickerMode = 1; |
2468 | mDatePicker->setDate( mNavigator->selectedDates().first() ); | 2468 | mDatePicker->setDate( mNavigator->selectedDates().first() ); |
2469 | } | 2469 | } |
2470 | 2470 | ||
2471 | void CalendarView::showEventEditor() | 2471 | void CalendarView::showEventEditor() |
2472 | { | 2472 | { |
2473 | #ifdef DESKTOP_VERSION | 2473 | #ifdef DESKTOP_VERSION |
2474 | mEventEditor->show(); | 2474 | mEventEditor->show(); |
2475 | #else | 2475 | #else |
2476 | if ( mEventEditor->width() != QApplication::desktop()->width() ) { | 2476 | if ( mEventEditor->width() < QApplication::desktop()->width() -60 || mEventEditor->width() > QApplication::desktop()->width() ) { |
2477 | qDebug("CalendarView: recreate mEventEditor "); | 2477 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2478 | qDebug("CalendarView: recreate mEventEditor %d %d", mEventEditor->width(), QApplication::desktop()->width() ); | ||
2478 | delete mEventEditor; | 2479 | delete mEventEditor; |
2479 | mEventEditor = mDialogManager->getEventEditor(); | 2480 | mEventEditor = mDialogManager->getEventEditor(); |
2480 | } | 2481 | } |
2481 | mEventEditor->showMaximized(); | 2482 | mEventEditor->showMaximized(); |
2482 | #endif | 2483 | #endif |
2483 | } | 2484 | } |
2484 | void CalendarView::showTodoEditor() | 2485 | void CalendarView::showTodoEditor() |
2485 | { | 2486 | { |
2486 | #ifdef DESKTOP_VERSION | 2487 | #ifdef DESKTOP_VERSION |
2487 | mTodoEditor->show(); | 2488 | mTodoEditor->show(); |
2488 | #else | 2489 | #else |
2489 | if ( mTodoEditor->width() != QApplication::desktop()->width() ) { | 2490 | if ( mTodoEditor->width() < QApplication::desktop()->width() -60|| mTodoEditor->width() > QApplication::desktop()->width() ) { |
2490 | qDebug("CalendarView: recreate mTodoEditor "); | 2491 | topLevelWidget()->setCaption( i18n("Recreating edit dialog. Please wait...") ); |
2492 | qDebug("CalendarView: recreate mTodoEditor %d %d ", mTodoEditor->width() ,QApplication::desktop()->width() ); | ||
2491 | delete mTodoEditor; | 2493 | delete mTodoEditor; |
2492 | mTodoEditor = mDialogManager->getTodoEditor(); | 2494 | mTodoEditor = mDialogManager->getTodoEditor(); |
2493 | } | 2495 | } |
2494 | mTodoEditor->showMaximized(); | 2496 | mTodoEditor->showMaximized(); |
2495 | #endif | 2497 | #endif |
2496 | } | 2498 | } |
2497 | 2499 | ||
2498 | void CalendarView::cloneIncidence() | 2500 | void CalendarView::cloneIncidence() |
2499 | { | 2501 | { |
2500 | Incidence *incidence = currentSelection(); | 2502 | Incidence *incidence = currentSelection(); |
2501 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2503 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2502 | if ( incidence ) { | 2504 | if ( incidence ) { |
2503 | cloneIncidence(incidence); | 2505 | cloneIncidence(incidence); |
2504 | } | 2506 | } |
2505 | } | 2507 | } |
2506 | void CalendarView::moveIncidence() | 2508 | void CalendarView::moveIncidence() |
2507 | { | 2509 | { |
2508 | Incidence *incidence = currentSelection(); | 2510 | Incidence *incidence = currentSelection(); |
2509 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2511 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2510 | if ( incidence ) { | 2512 | if ( incidence ) { |
2511 | moveIncidence(incidence); | 2513 | moveIncidence(incidence); |
2512 | } | 2514 | } |
2513 | } | 2515 | } |
2514 | void CalendarView::beamIncidence() | 2516 | void CalendarView::beamIncidence() |
2515 | { | 2517 | { |
2516 | Incidence *incidence = currentSelection(); | 2518 | Incidence *incidence = currentSelection(); |
2517 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2519 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2518 | if ( incidence ) { | 2520 | if ( incidence ) { |
2519 | beamIncidence(incidence); | 2521 | beamIncidence(incidence); |
2520 | } | 2522 | } |
2521 | } | 2523 | } |
2522 | void CalendarView::toggleCancelIncidence() | 2524 | void CalendarView::toggleCancelIncidence() |
2523 | { | 2525 | { |
2524 | Incidence *incidence = currentSelection(); | 2526 | Incidence *incidence = currentSelection(); |
2525 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); | 2527 | if ( !incidence ) incidence = mTodoList->selectedIncidences().first(); |
2526 | if ( incidence ) { | 2528 | if ( incidence ) { |
2527 | cancelIncidence(incidence); | 2529 | cancelIncidence(incidence); |
2528 | } | 2530 | } |
2529 | } | 2531 | } |
2530 | 2532 | ||
2531 | 2533 | ||
2532 | void CalendarView::cancelIncidence(Incidence * inc ) | 2534 | void CalendarView::cancelIncidence(Incidence * inc ) |
2533 | { | 2535 | { |
2534 | inc->setCancelled( ! inc->cancelled() ); | 2536 | inc->setCancelled( ! inc->cancelled() ); |
2535 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); | 2537 | changeIncidenceDisplay( inc,KOGlobals::EVENTEDITED ); |
2536 | updateView(); | 2538 | updateView(); |
2537 | } | 2539 | } |
2538 | void CalendarView::cloneIncidence(Incidence * orgInc ) | 2540 | void CalendarView::cloneIncidence(Incidence * orgInc ) |
2539 | { | 2541 | { |
2540 | Incidence * newInc = orgInc->clone(); | 2542 | Incidence * newInc = orgInc->clone(); |
2541 | newInc->recreate(); | 2543 | newInc->recreate(); |
2542 | 2544 | ||
2543 | if ( newInc->type() == "Todo" ) { | 2545 | if ( newInc->type() == "Todo" ) { |
2544 | Todo* t = (Todo*) newInc; | 2546 | Todo* t = (Todo*) newInc; |
2545 | mTodoEditor->editTodo( t ); | ||
2546 | showTodoEditor(); | 2547 | showTodoEditor(); |
2548 | mTodoEditor->editTodo( t ); | ||
2547 | if ( mTodoEditor->exec() ) { | 2549 | if ( mTodoEditor->exec() ) { |
2548 | mCalendar->addTodo( t ); | 2550 | mCalendar->addTodo( t ); |
2549 | updateView(); | 2551 | updateView(); |
2550 | } else { | 2552 | } else { |
2551 | delete t; | 2553 | delete t; |
2552 | } | 2554 | } |
2553 | } | 2555 | } |
2554 | else { | 2556 | else { |
2555 | Event* e = (Event*) newInc; | 2557 | Event* e = (Event*) newInc; |
2556 | mEventEditor->editEvent( e ); | ||
2557 | showEventEditor(); | 2558 | showEventEditor(); |
2559 | mEventEditor->editEvent( e ); | ||
2558 | if ( mEventEditor->exec() ) { | 2560 | if ( mEventEditor->exec() ) { |
2559 | mCalendar->addEvent( e ); | 2561 | mCalendar->addEvent( e ); |
2560 | updateView(); | 2562 | updateView(); |
2561 | } else { | 2563 | } else { |
2562 | delete e; | 2564 | delete e; |
2563 | } | 2565 | } |
2564 | } | 2566 | } |
2565 | } | 2567 | } |
2566 | 2568 | ||
2567 | void CalendarView::newEvent() | 2569 | void CalendarView::newEvent() |
2568 | { | 2570 | { |
2569 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. | 2571 | // TODO: Replace this code by a common eventDurationHint of KOBaseView. |
2570 | KOAgendaView *aView = mViewManager->agendaView(); | 2572 | KOAgendaView *aView = mViewManager->agendaView(); |
2571 | if (aView) { | 2573 | if (aView) { |
2572 | if (aView->selectionStart().isValid()) { | 2574 | if (aView->selectionStart().isValid()) { |
2573 | if (aView->selectedIsAllDay()) { | 2575 | if (aView->selectedIsAllDay()) { |
2574 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); | 2576 | newEvent(aView->selectionStart(),aView->selectionEnd(),true); |
2575 | } else { | 2577 | } else { |
2576 | newEvent(aView->selectionStart(),aView->selectionEnd()); | 2578 | newEvent(aView->selectionStart(),aView->selectionEnd()); |
2577 | } | 2579 | } |
2578 | return; | 2580 | return; |
2579 | } | 2581 | } |
2580 | } | 2582 | } |
2581 | 2583 | ||
2582 | QDate date = mNavigator->selectedDates().first(); | 2584 | QDate date = mNavigator->selectedDates().first(); |
2583 | QDateTime current = QDateTime::currentDateTime(); | 2585 | QDateTime current = QDateTime::currentDateTime(); |
2584 | if ( date <= current.date() ) { | 2586 | if ( date <= current.date() ) { |
2585 | int hour = current.time().hour() +1; | 2587 | int hour = current.time().hour() +1; |
2586 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), | 2588 | newEvent( QDateTime( current.date(), QTime( hour, 0, 0 ) ), |
2587 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2589 | QDateTime( current.date(), QTime( hour+ KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2588 | } else | 2590 | } else |
2589 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), | 2591 | newEvent( QDateTime( date, QTime( KOPrefs::instance()->mStartTime, 0, 0 ) ), |
2590 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + | 2592 | QDateTime( date, QTime( KOPrefs::instance()->mStartTime + |
2591 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); | 2593 | KOPrefs::instance()->mDefaultDuration, 0, 0 ) ) ); |
2592 | } | 2594 | } |
2593 | 2595 | ||
2594 | void CalendarView::newEvent(QDateTime fh) | 2596 | void CalendarView::newEvent(QDateTime fh) |
2595 | { | 2597 | { |
2596 | newEvent(fh, | 2598 | newEvent(fh, |
2597 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); | 2599 | QDateTime(fh.addSecs(3600*KOPrefs::instance()->mDefaultDuration))); |
2598 | } | 2600 | } |
2599 | 2601 | ||
2600 | void CalendarView::newEvent(QDate dt) | 2602 | void CalendarView::newEvent(QDate dt) |
2601 | { | 2603 | { |
2602 | newEvent(QDateTime(dt, QTime(0,0,0)), | 2604 | newEvent(QDateTime(dt, QTime(0,0,0)), |
2603 | QDateTime(dt, QTime(0,0,0)), true); | 2605 | QDateTime(dt, QTime(0,0,0)), true); |
2604 | } | 2606 | } |
2605 | 2607 | ||
2606 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) | 2608 | void CalendarView::newEvent(QDateTime fromHint, QDateTime toHint, bool allDay) |
2607 | { | 2609 | { |
2608 | 2610 | ||
2611 | showEventEditor(); | ||
2609 | mEventEditor->newEvent(fromHint,toHint,allDay); | 2612 | mEventEditor->newEvent(fromHint,toHint,allDay); |
2610 | if ( mFilterView->filtersEnabled() ) { | 2613 | if ( mFilterView->filtersEnabled() ) { |
2611 | CalFilter *filter = mFilterView->selectedFilter(); | 2614 | CalFilter *filter = mFilterView->selectedFilter(); |
2612 | if (filter && filter->showCategories()) { | 2615 | if (filter && filter->showCategories()) { |
2613 | mEventEditor->setCategories(filter->categoryList().join(",") ); | 2616 | mEventEditor->setCategories(filter->categoryList().join(",") ); |
2614 | } | 2617 | } |
2615 | if ( filter ) | 2618 | if ( filter ) |
2616 | mEventEditor->setSecrecy( filter->getSecrecy() ); | 2619 | mEventEditor->setSecrecy( filter->getSecrecy() ); |
2617 | } | 2620 | } |
2618 | showEventEditor(); | ||
2619 | } | 2621 | } |
2620 | void CalendarView::todoAdded(Todo * t) | 2622 | void CalendarView::todoAdded(Todo * t) |
2621 | { | 2623 | { |
2622 | 2624 | ||
2623 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); | 2625 | changeTodoDisplay ( t ,KOGlobals::EVENTADDED); |
2624 | updateTodoViews(); | 2626 | updateTodoViews(); |
2625 | } | 2627 | } |
2626 | void CalendarView::todoChanged(Todo * t) | 2628 | void CalendarView::todoChanged(Todo * t) |
2627 | { | 2629 | { |
2628 | emit todoModified( t, 4 ); | 2630 | emit todoModified( t, 4 ); |
2629 | // updateTodoViews(); | 2631 | // updateTodoViews(); |
2630 | } | 2632 | } |
2631 | void CalendarView::todoToBeDeleted(Todo *) | 2633 | void CalendarView::todoToBeDeleted(Todo *) |
2632 | { | 2634 | { |
2633 | //qDebug("todoToBeDeleted(Todo *) "); | 2635 | //qDebug("todoToBeDeleted(Todo *) "); |
2634 | updateTodoViews(); | 2636 | updateTodoViews(); |
2635 | } | 2637 | } |
2636 | void CalendarView::todoDeleted() | 2638 | void CalendarView::todoDeleted() |
2637 | { | 2639 | { |
2638 | //qDebug(" todoDeleted()"); | 2640 | //qDebug(" todoDeleted()"); |
2639 | updateTodoViews(); | 2641 | updateTodoViews(); |
2640 | } | 2642 | } |
2641 | 2643 | ||
2642 | 2644 | ||
2643 | 2645 | ||
2644 | void CalendarView::newTodo() | 2646 | void CalendarView::newTodo() |
2645 | { | 2647 | { |
2646 | 2648 | ||
2649 | showTodoEditor(); | ||
2647 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); | 2650 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),0,true); |
2648 | if ( mFilterView->filtersEnabled() ) { | 2651 | if ( mFilterView->filtersEnabled() ) { |
2649 | CalFilter *filter = mFilterView->selectedFilter(); | 2652 | CalFilter *filter = mFilterView->selectedFilter(); |
2650 | if (filter && filter->showCategories()) { | 2653 | if (filter && filter->showCategories()) { |
2651 | mTodoEditor->setCategories(filter->categoryList().join(",") ); | 2654 | mTodoEditor->setCategories(filter->categoryList().join(",") ); |
2652 | } | 2655 | } |
2653 | if ( filter ) | 2656 | if ( filter ) |
2654 | mTodoEditor->setSecrecy( filter->getSecrecy() ); | 2657 | mTodoEditor->setSecrecy( filter->getSecrecy() ); |
2655 | } | 2658 | } |
2656 | showTodoEditor(); | ||
2657 | } | 2659 | } |
2658 | 2660 | ||
2659 | void CalendarView::newSubTodo() | 2661 | void CalendarView::newSubTodo() |
2660 | { | 2662 | { |
2661 | Todo *todo = selectedTodo(); | 2663 | Todo *todo = selectedTodo(); |
2662 | if ( todo ) newSubTodo( todo ); | 2664 | if ( todo ) newSubTodo( todo ); |
2663 | } | 2665 | } |
2664 | 2666 | ||
2665 | void CalendarView::newSubTodo(Todo *parentEvent) | 2667 | void CalendarView::newSubTodo(Todo *parentEvent) |
2666 | { | 2668 | { |
2667 | 2669 | ||
2668 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); | ||
2669 | showTodoEditor(); | 2670 | showTodoEditor(); |
2671 | mTodoEditor->newTodo(QDateTime::currentDateTime().addDays(7),parentEvent,true); | ||
2670 | } | 2672 | } |
2671 | 2673 | ||
2672 | void CalendarView::newFloatingEvent() | 2674 | void CalendarView::newFloatingEvent() |
2673 | { | 2675 | { |
2674 | DateList tmpList = mNavigator->selectedDates(); | 2676 | DateList tmpList = mNavigator->selectedDates(); |
2675 | QDate date = tmpList.first(); | 2677 | QDate date = tmpList.first(); |
2676 | 2678 | ||
2677 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), | 2679 | newEvent( QDateTime( date, QTime( 12, 0, 0 ) ), |
2678 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); | 2680 | QDateTime( date, QTime( 12, 0, 0 ) ), true ); |
2679 | } | 2681 | } |
2680 | 2682 | ||
2681 | 2683 | ||
2682 | void CalendarView::editEvent( Event *event ) | 2684 | void CalendarView::editEvent( Event *event ) |
2683 | { | 2685 | { |
2684 | 2686 | ||
2685 | if ( !event ) return; | 2687 | if ( !event ) return; |
2686 | if ( event->isReadOnly() ) { | 2688 | if ( event->isReadOnly() ) { |
2687 | showEvent( event ); | 2689 | showEvent( event ); |
2688 | return; | 2690 | return; |
2689 | } | 2691 | } |
2690 | mEventEditor->editEvent( event , mFlagEditDescription); | ||
2691 | showEventEditor(); | 2692 | showEventEditor(); |
2693 | mEventEditor->editEvent( event , mFlagEditDescription); | ||
2692 | } | 2694 | } |
2693 | void CalendarView::editJournal( Journal *jour ) | 2695 | void CalendarView::editJournal( Journal *jour ) |
2694 | { | 2696 | { |
2695 | if ( !jour ) return; | 2697 | if ( !jour ) return; |
2696 | mDialogManager->hideSearchDialog(); | 2698 | mDialogManager->hideSearchDialog(); |
2697 | mViewManager->showJournalView(); | 2699 | mViewManager->showJournalView(); |
2698 | mNavigator->slotDaySelect( jour->dtStart().date() ); | 2700 | mNavigator->slotDaySelect( jour->dtStart().date() ); |
2699 | } | 2701 | } |
2700 | void CalendarView::editTodo( Todo *todo ) | 2702 | void CalendarView::editTodo( Todo *todo ) |
2701 | { | 2703 | { |
2702 | if ( !todo ) return; | 2704 | if ( !todo ) return; |
2703 | 2705 | ||
2704 | if ( todo->isReadOnly() ) { | 2706 | if ( todo->isReadOnly() ) { |
2705 | showTodo( todo ); | 2707 | showTodo( todo ); |
2706 | return; | 2708 | return; |
2707 | } | 2709 | } |
2708 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | ||
2709 | showTodoEditor(); | 2710 | showTodoEditor(); |
2711 | mTodoEditor->editTodo( todo ,mFlagEditDescription); | ||
2710 | 2712 | ||
2711 | } | 2713 | } |
2712 | 2714 | ||
2713 | KOEventViewerDialog* CalendarView::getEventViewerDialog() | 2715 | KOEventViewerDialog* CalendarView::getEventViewerDialog() |
2714 | { | 2716 | { |
2715 | if ( !mEventViewerDialog ) { | 2717 | if ( !mEventViewerDialog ) { |
2716 | mEventViewerDialog = new KOEventViewerDialog(this); | 2718 | mEventViewerDialog = new KOEventViewerDialog(this); |
2717 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); | 2719 | connect( mEventViewerDialog, SIGNAL( editIncidence( Incidence* )), this, SLOT(editIncidence( Incidence* ) ) ); |
2718 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); | 2720 | connect( this, SIGNAL(configChanged()), mEventViewerDialog, SLOT(updateConfig())); |
2719 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), | 2721 | connect( mEventViewerDialog, SIGNAL(jumpToTime( const QDate &)), |
2720 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); | 2722 | dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); |
2721 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), | 2723 | connect( mEventViewerDialog, SIGNAL(showAgendaView( bool ) ), |
2722 | viewManager(), SLOT( showAgendaView( bool ) ) ); | 2724 | viewManager(), SLOT( showAgendaView( bool ) ) ); |
2723 | mEventViewerDialog->resize( 640, 480 ); | 2725 | mEventViewerDialog->resize( 640, 480 ); |
2724 | 2726 | ||
2725 | } | 2727 | } |
2726 | return mEventViewerDialog; | 2728 | return mEventViewerDialog; |
2727 | } | 2729 | } |
2728 | void CalendarView::showEvent(Event *event) | 2730 | void CalendarView::showEvent(Event *event) |
2729 | { | 2731 | { |
2730 | getEventViewerDialog()->setEvent(event); | 2732 | getEventViewerDialog()->setEvent(event); |
2731 | getEventViewerDialog()->showMe(); | 2733 | getEventViewerDialog()->showMe(); |
2732 | } | 2734 | } |
2733 | 2735 | ||
2734 | void CalendarView::showTodo(Todo *event) | 2736 | void CalendarView::showTodo(Todo *event) |
2735 | { | 2737 | { |
2736 | getEventViewerDialog()->setTodo(event); | 2738 | getEventViewerDialog()->setTodo(event); |
2737 | getEventViewerDialog()->showMe(); | 2739 | getEventViewerDialog()->showMe(); |
2738 | } | 2740 | } |
2739 | void CalendarView::showJournal( Journal *jour ) | 2741 | void CalendarView::showJournal( Journal *jour ) |
2740 | { | 2742 | { |
2741 | getEventViewerDialog()->setJournal(jour); | 2743 | getEventViewerDialog()->setJournal(jour); |
2742 | getEventViewerDialog()->showMe(); | 2744 | getEventViewerDialog()->showMe(); |
2743 | 2745 | ||
2744 | } | 2746 | } |
2745 | // void CalendarView::todoModified (Todo *event, int changed) | 2747 | // void CalendarView::todoModified (Todo *event, int changed) |
2746 | // { | 2748 | // { |
2747 | // // if (mDialogList.find (event) != mDialogList.end ()) { | 2749 | // // if (mDialogList.find (event) != mDialogList.end ()) { |
2748 | // // kdDebug() << "Todo modified and open" << endl; | 2750 | // // kdDebug() << "Todo modified and open" << endl; |
2749 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; | 2751 | // // KOTodoEditor* temp = (KOTodoEditor *) mDialogList[event]; |
2750 | // // temp->modified (changed); | 2752 | // // temp->modified (changed); |
2751 | 2753 | ||
2752 | // // } | 2754 | // // } |
2753 | 2755 | ||
2754 | // mViewManager->updateView(); | 2756 | // mViewManager->updateView(); |
2755 | // } | 2757 | // } |
2756 | 2758 | ||
2757 | void CalendarView::appointment_show() | 2759 | void CalendarView::appointment_show() |
2758 | { | 2760 | { |
2759 | Event *anEvent = 0; | 2761 | Event *anEvent = 0; |
2760 | 2762 | ||
2761 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2763 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2762 | 2764 | ||
2763 | if (mViewManager->currentView()->isEventView()) { | 2765 | if (mViewManager->currentView()->isEventView()) { |
2764 | if ( incidence && incidence->type() == "Event" ) { | 2766 | if ( incidence && incidence->type() == "Event" ) { |
2765 | anEvent = static_cast<Event *>(incidence); | 2767 | anEvent = static_cast<Event *>(incidence); |
2766 | } | 2768 | } |
2767 | } | 2769 | } |
2768 | 2770 | ||
2769 | if (!anEvent) { | 2771 | if (!anEvent) { |
2770 | KNotifyClient::beep(); | 2772 | KNotifyClient::beep(); |
2771 | return; | 2773 | return; |
2772 | } | 2774 | } |
2773 | 2775 | ||
2774 | showEvent(anEvent); | 2776 | showEvent(anEvent); |
2775 | } | 2777 | } |
2776 | 2778 | ||
2777 | void CalendarView::appointment_edit() | 2779 | void CalendarView::appointment_edit() |
2778 | { | 2780 | { |
2779 | Event *anEvent = 0; | 2781 | Event *anEvent = 0; |
2780 | 2782 | ||
2781 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2783 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2782 | 2784 | ||
2783 | if (mViewManager->currentView()->isEventView()) { | 2785 | if (mViewManager->currentView()->isEventView()) { |
2784 | if ( incidence && incidence->type() == "Event" ) { | 2786 | if ( incidence && incidence->type() == "Event" ) { |
2785 | anEvent = static_cast<Event *>(incidence); | 2787 | anEvent = static_cast<Event *>(incidence); |
2786 | } | 2788 | } |
2787 | } | 2789 | } |
2788 | 2790 | ||
2789 | if (!anEvent) { | 2791 | if (!anEvent) { |
2790 | KNotifyClient::beep(); | 2792 | KNotifyClient::beep(); |
2791 | return; | 2793 | return; |
2792 | } | 2794 | } |
2793 | 2795 | ||
2794 | editEvent(anEvent); | 2796 | editEvent(anEvent); |
2795 | } | 2797 | } |
2796 | 2798 | ||
2797 | void CalendarView::appointment_delete() | 2799 | void CalendarView::appointment_delete() |
2798 | { | 2800 | { |
2799 | Event *anEvent = 0; | 2801 | Event *anEvent = 0; |
2800 | 2802 | ||
2801 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); | 2803 | Incidence *incidence = mViewManager->currentView()->selectedIncidences().first(); |
2802 | 2804 | ||
2803 | if (mViewManager->currentView()->isEventView()) { | 2805 | if (mViewManager->currentView()->isEventView()) { |
2804 | if ( incidence && incidence->type() == "Event" ) { | 2806 | if ( incidence && incidence->type() == "Event" ) { |
2805 | anEvent = static_cast<Event *>(incidence); | 2807 | anEvent = static_cast<Event *>(incidence); |
2806 | } | 2808 | } |
2807 | } | 2809 | } |
2808 | 2810 | ||
2809 | if (!anEvent) { | 2811 | if (!anEvent) { |
2810 | KNotifyClient::beep(); | 2812 | KNotifyClient::beep(); |
2811 | return; | 2813 | return; |
2812 | } | 2814 | } |
2813 | 2815 | ||
2814 | deleteEvent(anEvent); | 2816 | deleteEvent(anEvent); |
2815 | } | 2817 | } |
2816 | 2818 | ||
2817 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) | 2819 | void CalendarView::todo_resub( Todo * parent, Todo * sub ) |
2818 | { | 2820 | { |
2819 | if (!sub) return; | 2821 | if (!sub) return; |
2820 | if (!parent) return; | 2822 | if (!parent) return; |
2821 | if ( sub->relatedTo() ) | 2823 | if ( sub->relatedTo() ) |
2822 | sub->relatedTo()->removeRelation(sub); | 2824 | sub->relatedTo()->removeRelation(sub); |
2823 | sub->setRelatedTo(parent); | 2825 | sub->setRelatedTo(parent); |
2824 | sub->setRelatedToUid(parent->uid()); | 2826 | sub->setRelatedToUid(parent->uid()); |
2825 | parent->addRelation(sub); | 2827 | parent->addRelation(sub); |
2826 | sub->updated(); | 2828 | sub->updated(); |
2827 | parent->updated(); | 2829 | parent->updated(); |
2828 | setModified(true); | 2830 | setModified(true); |
2829 | updateView(); | 2831 | updateView(); |
2830 | } | 2832 | } |
2831 | void CalendarView::todo_unsub(Todo *anTodo ) | 2833 | void CalendarView::todo_unsub(Todo *anTodo ) |
2832 | { | 2834 | { |
2833 | // Todo *anTodo = selectedTodo(); | 2835 | // Todo *anTodo = selectedTodo(); |
2834 | if (!anTodo) return; | 2836 | if (!anTodo) return; |
2835 | if (!anTodo->relatedTo()) return; | 2837 | if (!anTodo->relatedTo()) return; |
2836 | anTodo->relatedTo()->removeRelation(anTodo); | 2838 | anTodo->relatedTo()->removeRelation(anTodo); |
2837 | anTodo->setRelatedTo(0); | 2839 | anTodo->setRelatedTo(0); |
diff --git a/qtcompat/qinputdialog.cpp b/qtcompat/qinputdialog.cpp index 770b281..64c581e 100644 --- a/qtcompat/qinputdialog.cpp +++ b/qtcompat/qinputdialog.cpp | |||
@@ -1,165 +1,167 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QInputDialog class | 4 | ** Implementation of QInputDialog class |
5 | ** | 5 | ** |
6 | ** Created : 991212 | 6 | ** Created : 991212 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the dialogs module of the Qt GUI Toolkit. | 10 | ** This file is part of the dialogs module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | //Edited Lutz Rogowski 2004-12-13 | ||
39 | |||
38 | #include "qinputdialog.h" | 40 | #include "qinputdialog.h" |
39 | 41 | ||
40 | #include <qlayout.h> | 42 | #include <qlayout.h> |
41 | #include <qlabel.h> | 43 | #include <qlabel.h> |
42 | #include <qlineedit.h> | 44 | #include <qlineedit.h> |
43 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
44 | #include <qspinbox.h> | 46 | #include <qspinbox.h> |
45 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
46 | #include <qwidgetstack.h> | 48 | #include <qwidgetstack.h> |
47 | #include <qvalidator.h> | 49 | #include <qvalidator.h> |
48 | #include <qapplication.h> | 50 | #include <qapplication.h> |
49 | 51 | ||
50 | class QInputDialogPrivate | 52 | class QInputDialogPrivate |
51 | { | 53 | { |
52 | public: | 54 | public: |
53 | friend class QInputDialog; | 55 | friend class QInputDialog; |
54 | QLineEdit *lineEdit; | 56 | QLineEdit *lineEdit; |
55 | QSpinBox *spinBox; | 57 | QSpinBox *spinBox; |
56 | QComboBox *comboBox, *editComboBox; | 58 | QComboBox *comboBox, *editComboBox; |
57 | QPushButton *ok; | 59 | QPushButton *ok; |
58 | QWidgetStack *stack; | 60 | QWidgetStack *stack; |
59 | QInputDialog::Type type; | 61 | QInputDialog::Type type; |
60 | }; | 62 | }; |
61 | 63 | ||
62 | /*! | 64 | /*! |
63 | \class QInputDialog qinputdialog.h | 65 | \class QInputDialog qinputdialog.h |
64 | \brief A convenience dialog to get a simple input from the user | 66 | \brief A convenience dialog to get a simple input from the user |
65 | \ingroup dialogs | 67 | \ingroup dialogs |
66 | 68 | ||
67 | The QInputDialog is a simple dialog which can be used if you | 69 | The QInputDialog is a simple dialog which can be used if you |
68 | need a simple input from the user. This can be text, a number or | 70 | need a simple input from the user. This can be text, a number or |
69 | an item from a list. Also a label has to be set to tell the user | 71 | an item from a list. Also a label has to be set to tell the user |
70 | what he/she should input. | 72 | what he/she should input. |
71 | 73 | ||
72 | In this Qt version only the 4 static convenience functions | 74 | In this Qt version only the 4 static convenience functions |
73 | getText(), getInteger(), getDouble() and getItem() of QInputDialog | 75 | getText(), getInteger(), getDouble() and getItem() of QInputDialog |
74 | are available. | 76 | are available. |
75 | 77 | ||
76 | Use it like this: | 78 | Use it like this: |
77 | 79 | ||
78 | \code | 80 | \code |
79 | bool ok = FALSE; | 81 | bool ok = FALSE; |
80 | QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this ); | 82 | QString text = QInputDialog::getText( tr( "Make an input" ), tr( "Please enter your name" ), QString::null, &ok, this ); |
81 | if ( ok && !text.isEmpty() ) | 83 | if ( ok && !text.isEmpty() ) |
82 | ;// user entered something and pressed ok | 84 | ;// user entered something and pressed ok |
83 | else | 85 | else |
84 | ;// user entered nothing or pressed cancel | 86 | ;// user entered nothing or pressed cancel |
85 | \endcode | 87 | \endcode |
86 | 88 | ||
87 | There are more static convenience methods! | 89 | There are more static convenience methods! |
88 | 90 | ||
89 | \sa getText(), getInteger(), getDouble(), getItem() | 91 | \sa getText(), getInteger(), getDouble(), getItem() |
90 | */ | 92 | */ |
91 | 93 | ||
92 | /*! | 94 | /*! |
93 | \enum QInputDialog::Type | 95 | \enum QInputDialog::Type |
94 | 96 | ||
95 | This enum type specifies the type of the dialog | 97 | This enum type specifies the type of the dialog |
96 | (which kind of input can be done): | 98 | (which kind of input can be done): |
97 | 99 | ||
98 | <ul> | 100 | <ul> |
99 | <li>\c LineEdit - A QLineEdit is used for taking the input, so a textual or | 101 | <li>\c LineEdit - A QLineEdit is used for taking the input, so a textual or |
100 | (e.g. using a QValidator) a numerical input can be done. Using lineEdit() | 102 | (e.g. using a QValidator) a numerical input can be done. Using lineEdit() |
101 | the QLineEdit can be accessed. | 103 | the QLineEdit can be accessed. |
102 | <li>\c SpinBox - A QSpinBox is used for taking the input, so a decimal | 104 | <li>\c SpinBox - A QSpinBox is used for taking the input, so a decimal |
103 | input can be done. Using spinBox() the QSpinBox can be accessed. | 105 | input can be done. Using spinBox() the QSpinBox can be accessed. |
104 | <li>\c ComboBox - A read-only QComboBox is used for taking the input, | 106 | <li>\c ComboBox - A read-only QComboBox is used for taking the input, |
105 | so one item of a list can be chosen. Using comboBox() the QComboBox | 107 | so one item of a list can be chosen. Using comboBox() the QComboBox |
106 | can be accessed. | 108 | can be accessed. |
107 | <li>\c EditableComboBox - An editable QComboBox is used for taking the input, | 109 | <li>\c EditableComboBox - An editable QComboBox is used for taking the input, |
108 | so either one item of a list can be chosen or a text can be entered. Using | 110 | so either one item of a list can be chosen or a text can be entered. Using |
109 | editableComboBox() the QComboBox can be accessed. | 111 | editableComboBox() the QComboBox can be accessed. |
110 | </ul> | 112 | </ul> |
111 | */ | 113 | */ |
112 | 114 | ||
113 | /*! | 115 | /*! |
114 | Constructs the dialog. \a label is the text which is shown to the user (it should mention | 116 | Constructs the dialog. \a label is the text which is shown to the user (it should mention |
115 | to the user what he/she should input), \a parent the parent widget of the dialog, \a name | 117 | to the user what he/she should input), \a parent the parent widget of the dialog, \a name |
116 | the name of it and if you set \a modal to TRUE, the dialog pops up modally, else it pops | 118 | the name of it and if you set \a modal to TRUE, the dialog pops up modally, else it pops |
117 | up modeless. With \a type you specify the type of the dialog. | 119 | up modeless. With \a type you specify the type of the dialog. |
118 | 120 | ||
119 | \sa getText(), getInteger(), getDouble(), getItem() | 121 | \sa getText(), getInteger(), getDouble(), getItem() |
120 | */ | 122 | */ |
121 | 123 | ||
122 | QInputDialog::QInputDialog( const QString &label, QWidget* parent, const char* name, | 124 | QInputDialog::QInputDialog( const QString &label, QWidget* parent, const char* name, |
123 | bool modal, Type type) | 125 | bool modal, Type type) |
124 | : QDialog( parent, name, modal ) | 126 | : QDialog( parent, name, modal ) |
125 | { | 127 | { |
126 | if ( parent && parent->icon() &&!parent->icon()->isNull() ) | 128 | if ( parent && parent->icon() &&!parent->icon()->isNull() ) |
127 | setIcon( *parent->icon() ); | 129 | setIcon( *parent->icon() ); |
128 | else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() ) | 130 | else if ( qApp->mainWidget() && qApp->mainWidget()->icon() && !qApp->mainWidget()->icon()->isNull() ) |
129 | QDialog::setIcon( *qApp->mainWidget()->icon() ); | 131 | QDialog::setIcon( *qApp->mainWidget()->icon() ); |
130 | 132 | ||
131 | d = new QInputDialogPrivate; | 133 | d = new QInputDialogPrivate; |
132 | d->lineEdit = 0; | 134 | d->lineEdit = 0; |
133 | d->spinBox = 0; | 135 | d->spinBox = 0; |
134 | d->comboBox = 0; | 136 | d->comboBox = 0; |
135 | 137 | ||
136 | QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); | 138 | QVBoxLayout *vbox = new QVBoxLayout( this, 6, 6 ); |
137 | 139 | ||
138 | QLabel* l = new QLabel( label, this ); | 140 | QLabel* l = new QLabel( label, this ); |
139 | vbox->addWidget( l ); | 141 | vbox->addWidget( l ); |
140 | 142 | ||
141 | d->stack = new QWidgetStack( this ); | 143 | d->stack = new QWidgetStack( this ); |
142 | vbox->addWidget( d->stack ); | 144 | vbox->addWidget( d->stack ); |
143 | d->lineEdit = new QLineEdit( d->stack ); | 145 | d->lineEdit = new QLineEdit( d->stack ); |
144 | d->spinBox = new QSpinBox( d->stack ); | 146 | d->spinBox = new QSpinBox( d->stack ); |
145 | d->comboBox = new QComboBox( FALSE, d->stack ); | 147 | d->comboBox = new QComboBox( FALSE, d->stack ); |
146 | d->editComboBox = new QComboBox( TRUE, d->stack ); | 148 | d->editComboBox = new QComboBox( TRUE, d->stack ); |
147 | 149 | ||
148 | QHBoxLayout *hbox = new QHBoxLayout( 6 ); | 150 | QHBoxLayout *hbox = new QHBoxLayout( 6 ); |
149 | vbox->addLayout( hbox, AlignRight ); | 151 | vbox->addLayout( hbox, AlignRight ); |
150 | 152 | ||
151 | d->ok = new QPushButton( tr( "&OK" ), this ); | 153 | d->ok = new QPushButton( tr( "&OK" ), this ); |
152 | d->ok->setDefault( TRUE ); | 154 | d->ok->setDefault( TRUE ); |
153 | QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this ); | 155 | QPushButton *cancel = new QPushButton( tr( "&Cancel" ), this ); |
154 | 156 | ||
155 | QSize bs( d->ok->sizeHint() ); | 157 | QSize bs( d->ok->sizeHint() ); |
156 | if ( cancel->sizeHint().width() > bs.width() ) | 158 | if ( cancel->sizeHint().width() > bs.width() ) |
157 | bs.setWidth( cancel->sizeHint().width() ); | 159 | bs.setWidth( cancel->sizeHint().width() ); |
158 | 160 | ||
159 | d->ok->setFixedSize( bs ); | 161 | d->ok->setFixedSize( bs ); |
160 | cancel->setFixedSize( bs ); | 162 | cancel->setFixedSize( bs ); |
161 | 163 | ||
162 | hbox->addWidget( new QWidget( this ) ); | 164 | hbox->addWidget( new QWidget( this ) ); |
163 | hbox->addWidget( d->ok ); | 165 | hbox->addWidget( d->ok ); |
164 | hbox->addWidget( cancel ); | 166 | hbox->addWidget( cancel ); |
165 | 167 | ||
@@ -328,168 +330,173 @@ QString QInputDialog::getText( const QString &caption, const QString &label, QLi | |||
328 | be increased/decreased by the spinbox, \a ok a pointer to | 330 | be increased/decreased by the spinbox, \a ok a pointer to |
329 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the | 331 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the |
330 | user pressed cancel, \a parent the parent widget of the dialog and \a name | 332 | user pressed cancel, \a parent the parent widget of the dialog and \a name |
331 | the name of it. The dialogs pops up modally! | 333 | the name of it. The dialogs pops up modally! |
332 | 334 | ||
333 | This method returns the number which has been entered by the user. | 335 | This method returns the number which has been entered by the user. |
334 | 336 | ||
335 | You will use this static method like this: | 337 | You will use this static method like this: |
336 | 338 | ||
337 | \code | 339 | \code |
338 | bool ok = FALSE; | 340 | bool ok = FALSE; |
339 | int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this ); | 341 | int res = QInputDialog::getInteger( tr( "Please enter a number" ), 22, 0, 1000, 2, &ok, this ); |
340 | if ( ok ) | 342 | if ( ok ) |
341 | ;// user entered something and pressed ok | 343 | ;// user entered something and pressed ok |
342 | else | 344 | else |
343 | ;// user pressed cancel | 345 | ;// user pressed cancel |
344 | \endcode | 346 | \endcode |
345 | */ | 347 | */ |
346 | 348 | ||
347 | int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step, | 349 | int QInputDialog::getInteger( const QString &caption, const QString &label, int num, int from, int to, int step, |
348 | bool *ok, QWidget *parent, const char *name ) | 350 | bool *ok, QWidget *parent, const char *name ) |
349 | { | 351 | { |
350 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox ); | 352 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, SpinBox ); |
351 | dlg->setCaption( caption ); | 353 | dlg->setCaption( caption ); |
352 | dlg->spinBox()->setRange( from, to ); | 354 | dlg->spinBox()->setRange( from, to ); |
353 | dlg->spinBox()->setSteps( step, 0 ); | 355 | dlg->spinBox()->setSteps( step, 0 ); |
354 | dlg->spinBox()->setValue( num ); | 356 | dlg->spinBox()->setValue( num ); |
355 | 357 | ||
356 | bool ok_ = FALSE; | 358 | bool ok_ = FALSE; |
357 | int result; | 359 | int result; |
358 | ok_ = dlg->exec() == QDialog::Accepted; | 360 | ok_ = dlg->exec() == QDialog::Accepted; |
359 | if ( ok ) | 361 | if ( ok ) |
360 | *ok = ok_; | 362 | *ok = ok_; |
361 | result = dlg->spinBox()->value(); | 363 | result = dlg->spinBox()->value(); |
362 | 364 | ||
363 | delete dlg; | 365 | delete dlg; |
364 | return result; | 366 | return result; |
365 | } | 367 | } |
366 | 368 | ||
367 | /*! | 369 | /*! |
368 | Static convenience function to get a decimal input from the user. \a caption is the text | 370 | Static convenience function to get a decimal input from the user. \a caption is the text |
369 | which is displayed in the title bar of the dialog. \a label is the text which | 371 | which is displayed in the title bar of the dialog. \a label is the text which |
370 | is shown to the user (it should mention to the user what he/she should input), \a num | 372 | is shown to the user (it should mention to the user what he/she should input), \a num |
371 | the default decimal number which will be initially set to the line edit, \a from and \a to the | 373 | the default decimal number which will be initially set to the line edit, \a from and \a to the |
372 | range in which the entered number has to be, \a decimals the number of decimal which | 374 | range in which the entered number has to be, \a decimals the number of decimal which |
373 | the number may have, \a ok a pointer to | 375 | the number may have, \a ok a pointer to |
374 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the | 376 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the |
375 | user pressed cancel, \a parent the parent widget of the dialog and \a name | 377 | user pressed cancel, \a parent the parent widget of the dialog and \a name |
376 | the name of it. The dialogs pops up modally! | 378 | the name of it. The dialogs pops up modally! |
377 | 379 | ||
378 | This method returns the number which has been entered by the user. | 380 | This method returns the number which has been entered by the user. |
379 | 381 | ||
380 | You will use this static method like this: | 382 | You will use this static method like this: |
381 | 383 | ||
382 | \code | 384 | \code |
383 | bool ok = FALSE; | 385 | bool ok = FALSE; |
384 | double res = QInputDialog::getDouble( tr( "Please enter a decimal number" ), 33.7, 0, 1000, 2, &ok, this ); | 386 | double res = QInputDialog::getDouble( tr( "Please enter a decimal number" ), 33.7, 0, 1000, 2, &ok, this ); |
385 | if ( ok ) | 387 | if ( ok ) |
386 | ;// user entered something and pressed ok | 388 | ;// user entered something and pressed ok |
387 | else | 389 | else |
388 | ;// user pressed cancel | 390 | ;// user pressed cancel |
389 | \endcode | 391 | \endcode |
390 | */ | 392 | */ |
391 | 393 | ||
392 | double QInputDialog::getDouble( const QString &caption, const QString &label, double num, | 394 | double QInputDialog::getDouble( const QString &caption, const QString &label, double num, |
393 | double from, double to, int decimals, | 395 | double from, double to, int decimals, |
394 | bool *ok, QWidget *parent, const char *name ) | 396 | bool *ok, QWidget *parent, const char *name ) |
395 | { | 397 | { |
396 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit ); | 398 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, LineEdit ); |
397 | dlg->setCaption( caption ); | 399 | dlg->setCaption( caption ); |
398 | dlg->lineEdit()->setValidator( new QDoubleValidator( from, to, decimals, dlg->lineEdit() ) ); | 400 | dlg->lineEdit()->setValidator( new QDoubleValidator( from, to, decimals, dlg->lineEdit() ) ); |
399 | dlg->lineEdit()->setText( QString::number( num, 'f', decimals ) ); | 401 | dlg->lineEdit()->setText( QString::number( num, 'f', decimals ) ); |
400 | dlg->lineEdit()->selectAll(); | 402 | dlg->lineEdit()->selectAll(); |
401 | 403 | ||
402 | bool accepted = ( dlg->exec() == QDialog::Accepted ); | 404 | bool accepted = ( dlg->exec() == QDialog::Accepted ); |
403 | if ( ok ) | 405 | if ( ok ) |
404 | *ok = accepted; | 406 | *ok = accepted; |
405 | 407 | ||
406 | double result = dlg->lineEdit()->text().toDouble(); | 408 | double result = dlg->lineEdit()->text().toDouble(); |
407 | 409 | ||
408 | delete dlg; | 410 | delete dlg; |
409 | return result; | 411 | return result; |
410 | } | 412 | } |
411 | 413 | ||
412 | /*! | 414 | /*! |
413 | Static convenience function to let the user select an item from a string list. \a caption is the text | 415 | Static convenience function to let the user select an item from a string list. \a caption is the text |
414 | which is displayed in the title bar of the dialog. \a label is the text which | 416 | which is displayed in the title bar of the dialog. \a label is the text which |
415 | is shown to the user (it should mention to the user what he/she should input), \a list the | 417 | is shown to the user (it should mention to the user what he/she should input), \a list the |
416 | string list which is inserted into the combobox, \a current the number of the item which should | 418 | string list which is inserted into the combobox, \a current the number of the item which should |
417 | be initially the current item, \a editable specifies if the combobox should be editable (if it is TRUE) | 419 | be initially the current item, \a editable specifies if the combobox should be editable (if it is TRUE) |
418 | or read-only (if \a editable is FALSE), \a ok a pointer to | 420 | or read-only (if \a editable is FALSE), \a ok a pointer to |
419 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the | 421 | a bool which will be (if not 0!) set to TRUE if the user pressed ok or to FALSE if the |
420 | user pressed cancel, \a parent the parent widget of the dialog and \a name | 422 | user pressed cancel, \a parent the parent widget of the dialog and \a name |
421 | the name of it. The dialogs pops up modally! | 423 | the name of it. The dialogs pops up modally! |
422 | 424 | ||
423 | This method returns the text of the current item, or if \a editable was TRUE, the current | 425 | This method returns the text of the current item, or if \a editable was TRUE, the current |
424 | text of the combobox. | 426 | text of the combobox. |
425 | 427 | ||
426 | You will use this static method like this: | 428 | You will use this static method like this: |
427 | 429 | ||
428 | \code | 430 | \code |
429 | QStringList lst; | 431 | QStringList lst; |
430 | lst << "First" << "Second" << "Third" << "Fourth" << "Fifth"; | 432 | lst << "First" << "Second" << "Third" << "Fourth" << "Fifth"; |
431 | bool ok = FALSE; | 433 | bool ok = FALSE; |
432 | QString res = QInputDialog::getItem( tr( "Please select an item" ), lst, 1, TRUE, &ok, this ); | 434 | QString res = QInputDialog::getItem( tr( "Please select an item" ), lst, 1, TRUE, &ok, this ); |
433 | if ( ok ) | 435 | if ( ok ) |
434 | ;// user selected an item and pressed ok | 436 | ;// user selected an item and pressed ok |
435 | else | 437 | else |
436 | ;// user pressed cancel | 438 | ;// user pressed cancel |
437 | \endcode | 439 | \endcode |
438 | */ | 440 | */ |
439 | 441 | ||
440 | QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list, | 442 | QString QInputDialog::getItem( const QString &caption, const QString &label, const QStringList &list, |
441 | int current, bool editable, | 443 | int current, bool editable, |
442 | bool *ok, QWidget *parent, const char *name ) | 444 | bool *ok, QWidget *parent, const char *name ) |
443 | { | 445 | { |
444 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, editable ? EditableComboBox : ComboBox ); | 446 | QInputDialog *dlg = new QInputDialog( label, parent, name, TRUE, editable ? EditableComboBox : ComboBox ); |
445 | dlg->setCaption( caption ); | 447 | dlg->setCaption( caption ); |
446 | if ( editable ) { | 448 | if ( editable ) { |
447 | dlg->editableComboBox()->insertStringList( list ); | 449 | dlg->editableComboBox()->insertStringList( list ); |
448 | dlg->editableComboBox()->setCurrentItem( current ); | 450 | dlg->editableComboBox()->setCurrentItem( current ); |
449 | } else { | 451 | } else { |
450 | dlg->comboBox()->insertStringList( list ); | 452 | dlg->comboBox()->insertStringList( list ); |
451 | dlg->comboBox()->setCurrentItem( current ); | 453 | dlg->comboBox()->setCurrentItem( current ); |
452 | } | 454 | } |
453 | 455 | ||
454 | bool ok_ = FALSE; | 456 | bool ok_ = FALSE; |
455 | QString result; | 457 | QString result; |
458 | int fixWid = 320; | ||
459 | if ( QApplication::desktop()->width() <= 240 ) { | ||
460 | fixWid = 230; | ||
461 | } | ||
462 | dlg->setFixedWidth( fixWid); | ||
456 | ok_ = dlg->exec() == QDialog::Accepted; | 463 | ok_ = dlg->exec() == QDialog::Accepted; |
457 | if ( ok ) | 464 | if ( ok ) |
458 | *ok = ok_; | 465 | *ok = ok_; |
459 | if ( editable ) | 466 | if ( editable ) |
460 | result = dlg->editableComboBox()->currentText(); | 467 | result = dlg->editableComboBox()->currentText(); |
461 | else | 468 | else |
462 | result = dlg->comboBox()->currentText(); | 469 | result = dlg->comboBox()->currentText(); |
463 | 470 | ||
464 | delete dlg; | 471 | delete dlg; |
465 | return result; | 472 | return result; |
466 | } | 473 | } |
467 | 474 | ||
468 | /*! | 475 | /*! |
469 | \internal | 476 | \internal |
470 | */ | 477 | */ |
471 | 478 | ||
472 | void QInputDialog::textChanged( const QString &s ) | 479 | void QInputDialog::textChanged( const QString &s ) |
473 | { | 480 | { |
474 | bool on; | 481 | bool on; |
475 | if ( d->lineEdit->validator() ) { | 482 | if ( d->lineEdit->validator() ) { |
476 | QString str = d->lineEdit->text(); | 483 | QString str = d->lineEdit->text(); |
477 | int index = d->lineEdit->cursorPosition(); | 484 | int index = d->lineEdit->cursorPosition(); |
478 | on = ( d->lineEdit->validator()->validate(str, index) == | 485 | on = ( d->lineEdit->validator()->validate(str, index) == |
479 | QValidator::Acceptable ); | 486 | QValidator::Acceptable ); |
480 | } else { | 487 | } else { |
481 | on = !s.isEmpty(); | 488 | on = !s.isEmpty(); |
482 | } | 489 | } |
483 | d->ok->setEnabled( on ); | 490 | d->ok->setEnabled( on ); |
484 | } | 491 | } |
485 | 492 | ||
486 | /*! | 493 | /*! |
487 | \internal | 494 | \internal |
488 | */ | 495 | */ |
489 | 496 | ||
490 | void QInputDialog::tryAccept() | 497 | void QInputDialog::tryAccept() |
491 | { | 498 | { |
492 | if ( !d->lineEdit->text().isEmpty() ) | 499 | if ( !d->lineEdit->text().isEmpty() ) |
493 | accept(); | 500 | accept(); |
494 | } | 501 | } |
495 | 502 | ||