-rw-r--r-- | kaddressbook/mainembedded.cpp | 7 | ||||
-rw-r--r-- | kmicromail/main.cpp | 3 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 1 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 10 | ||||
-rw-r--r-- | korganizer/main.cpp | 3 | ||||
-rw-r--r-- | libkdepim/externalapphandler.cpp | 12 | ||||
-rw-r--r-- | libkdepim/externalapphandler.h | 2 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 3 | ||||
-rw-r--r-- | microkde/kdeui/klistview.cpp | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/main.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 2 |
11 files changed, 28 insertions, 22 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index a8816f9..547d208 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,99 +1,100 @@ | |||
1 | #ifndef DESKTOP_VERSION | 1 | #ifndef DESKTOP_VERSION |
2 | #include <qpe/qpeapplication.h> | 2 | #include <qpe/qpeapplication.h> |
3 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #else | 5 | #else |
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qwindowsstyle.h> | 7 | #include <qwindowsstyle.h> |
8 | #include <qplatinumstyle.h> | 8 | #include <qplatinumstyle.h> |
9 | #include <qmainwindow.h> | 9 | #include <qmainwindow.h> |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #include <qtextcodec.h> | 12 | #include <qtextcodec.h> |
13 | #include <kstandarddirs.h> | 13 | #include <kstandarddirs.h> |
14 | #include <qregexp.h> | 14 | #include <qregexp.h> |
15 | #include <kglobal.h> | 15 | #include <kglobal.h> |
16 | #include <stdio.h> | 16 | #include <stdio.h> |
17 | #include <qdir.h> | 17 | #include <qdir.h> |
18 | #include "kabprefs.h" | 18 | #include "kabprefs.h" |
19 | #include "kaddressbookmain.h" | 19 | #include "kaddressbookmain.h" |
20 | #include "externalapphandler.h" | 20 | #include "externalapphandler.h" |
21 | #include <libkdepim/kpimglobalprefs.h> | 21 | #include <libkdepim/kpimglobalprefs.h> |
22 | void dumpMissing(); | 22 | void dumpMissing(); |
23 | int main( int argc, char **argv ) | 23 | int main( int argc, char **argv ) |
24 | { | 24 | { |
25 | #ifndef DESKTOP_VERSION | 25 | #ifndef DESKTOP_VERSION |
26 | QPEApplication a( argc, argv ); | 26 | QPEApplication a( argc, argv ); |
27 | a.setKeepRunning (); | 27 | a.setKeepRunning (); |
28 | #else | 28 | #else |
29 | QApplication a( argc, argv ); | 29 | QApplication a( argc, argv ); |
30 | QApplication::setStyle( new QPlatinumStyle ()); | 30 | QApplication::setStyle( new QPlatinumStyle ()); |
31 | QString hdir = QDir::homeDirPath(); | 31 | QString hdir = QDir::homeDirPath(); |
32 | // there is a bug when creating dirs for WIN 98 | 32 | // there is a bug when creating dirs for WIN 98 |
33 | // it is difficult to fix, because we have no WIN 98 runnung | 33 | // it is difficult to fix, because we have no WIN 98 runnung |
34 | // such that we try it to create the dirs at startup here | 34 | // such that we try it to create the dirs at startup here |
35 | if ( hdir == "C:\\" ) { // win 98 or ME | 35 | if ( hdir == "C:\\" ) { // win 98 or ME |
36 | QDir app_dir; | 36 | QDir app_dir; |
37 | if ( !app_dir.exists("C:\\kdepim") ) | 37 | if ( !app_dir.exists("C:\\kdepim") ) |
38 | app_dir.mkdir ("C:\\kdepim"); | 38 | app_dir.mkdir ("C:\\kdepim"); |
39 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 39 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
40 | app_dir.mkdir ("C:\\kdepim\\apps"); | 40 | app_dir.mkdir ("C:\\kdepim\\apps"); |
41 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 41 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
42 | app_dir.mkdir ("C:\\kdepim\\config"); | 42 | app_dir.mkdir ("C:\\kdepim\\config"); |
43 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) | 43 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) |
44 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); | 44 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); |
45 | } | 45 | } |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | bool exitHelp = false; | 48 | bool exitHelp = false; |
49 | if ( argc > 1 ) { | 49 | if ( argc > 1 ) { |
50 | QString command = argv[1]; | 50 | QString command = argv[1]; |
51 | if ( command == "-help" ){ | 51 | if ( command == "-help" ){ |
52 | printf("KA/E command line commands:\n"); | 52 | printf("KA/E command line commands:\n"); |
53 | printf(" no command: Start KA/E in usual way\n"); | 53 | printf(" no command: Start KA/E in usual way\n"); |
54 | printf(" -help: This output\n"); | 54 | printf(" -help: This output\n"); |
55 | printf(" KA/E is exiting now. Bye!\n"); | 55 | printf(" KA/E is exiting now. Bye!\n"); |
56 | exitHelp = true; | 56 | exitHelp = true; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | if ( ! exitHelp ) { | 59 | if ( ! exitHelp ) { |
60 | 60 | ||
61 | KGlobal::setAppName( "kaddressbook" ); | 61 | KGlobal::setAppName( "kaddressbook" ); |
62 | #ifndef DESKTOP_VERSION | 62 | #ifndef DESKTOP_VERSION |
63 | if ( QApplication::desktop()->width() > 320 ) | 63 | if ( QApplication::desktop()->width() > 320 ) |
64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 64 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
65 | else | 65 | else |
66 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 66 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
67 | #else | 67 | #else |
68 | QString fileName ; | 68 | QString fileName ; |
69 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 69 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
70 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 70 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
71 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 71 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
72 | 72 | ||
73 | #endif | 73 | #endif |
74 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 74 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
75 | // init language | 75 | // init language |
76 | KABPrefs::instance(); | 76 | KABPrefs::instance(); |
77 | KAddressBookMain m ; | 77 | KAddressBookMain m ; |
78 | //US MainWindow m; | 78 | //US MainWindow m; |
79 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 79 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
80 | 80 | ||
81 | { | 81 | |
82 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 82 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
83 | } | 83 | |
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | a.showMainWidget( &m ); | 85 | a.showMainWidget( &m ); |
86 | 86 | ||
87 | #else | 87 | #else |
88 | a.setMainWidget( &m ); | 88 | a.setMainWidget( &m ); |
89 | m.resize (640, 480 ); | 89 | m.resize (640, 480 ); |
90 | m.show(); | 90 | m.show(); |
91 | #endif | 91 | #endif |
92 | a.exec(); | 92 | a.exec(); |
93 | 93 | ||
94 | dumpMissing(); | 94 | dumpMissing(); |
95 | 95 | ||
96 | KPimGlobalPrefs::instance()->writeConfig(); | ||
96 | } | 97 | } |
97 | qDebug("KA: Bye! "); | 98 | qDebug("KA: Bye! "); |
98 | } | 99 | } |
99 | 100 | ||
diff --git a/kmicromail/main.cpp b/kmicromail/main.cpp index 8947ff8..8341c5a 100644 --- a/kmicromail/main.cpp +++ b/kmicromail/main.cpp | |||
@@ -1,63 +1,66 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | 2 | ||
3 | 3 | ||
4 | #ifndef DESKTOP_VERSION | 4 | #ifndef DESKTOP_VERSION |
5 | #include <qpe/qpeapplication.h> | 5 | #include <qpe/qpeapplication.h> |
6 | #include <libkdepim/externalapphandler.h> | 6 | #include <libkdepim/externalapphandler.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #else | 8 | #else |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
12 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
13 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
14 | #endif | 14 | #endif |
15 | #include "opiemail.h" | 15 | #include "opiemail.h" |
16 | #include <qdir.h> | 16 | #include <qdir.h> |
17 | #include <kstandarddirs.h> | 17 | #include <kstandarddirs.h> |
18 | #include <kglobal.h> | 18 | #include <kglobal.h> |
19 | #include <stdio.h> | 19 | #include <stdio.h> |
20 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
21 | #include "koprefs.h" | 21 | #include "koprefs.h" |
22 | #include <libkdepim/kpimglobalprefs.h> | ||
22 | void dumpMissing(); | 23 | void dumpMissing(); |
23 | //using namespace Opie::Core; | 24 | //using namespace Opie::Core; |
24 | int main( int argc, char **argv ) { | 25 | int main( int argc, char **argv ) { |
25 | 26 | ||
26 | #ifndef DESKTOP_VERSION | 27 | #ifndef DESKTOP_VERSION |
27 | QPEApplication a( argc, argv ); | 28 | QPEApplication a( argc, argv ); |
28 | a.setKeepRunning (); | 29 | a.setKeepRunning (); |
29 | #else | 30 | #else |
30 | QApplication a( argc, argv ); | 31 | QApplication a( argc, argv ); |
31 | QApplication::setStyle( new QPlatinumStyle ()); | 32 | QApplication::setStyle( new QPlatinumStyle ()); |
32 | #endif | 33 | #endif |
33 | a.setFont( KOPrefs::instance()->mAppFont ); | 34 | a.setFont( KOPrefs::instance()->mAppFont ); |
34 | KGlobal::setAppName( "kopiemail" ); | 35 | KGlobal::setAppName( "kopiemail" ); |
35 | QString fileName ; | 36 | QString fileName ; |
36 | #ifndef DESKTOP_VERSION | 37 | #ifndef DESKTOP_VERSION |
37 | fileName = getenv("QPEDIR"); | 38 | fileName = getenv("QPEDIR"); |
38 | if ( QApplication::desktop()->width() > 320 ) | 39 | if ( QApplication::desktop()->width() > 320 ) |
39 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); | 40 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/icons22/"); |
40 | else | 41 | else |
41 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); | 42 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/kopiemail/"); |
42 | #else | 43 | #else |
43 | fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; | 44 | fileName = qApp->applicationDirPath () + "/kdepim/kopiemail/"; |
44 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 45 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
45 | #endif | 46 | #endif |
46 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); | 47 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kopiemail"))); |
47 | OpieMail mw; | 48 | OpieMail mw; |
48 | #ifndef DESKTOP_VERSION | 49 | #ifndef DESKTOP_VERSION |
49 | //qDebug("CONNECT "); | 50 | //qDebug("CONNECT "); |
50 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); | 51 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&mw, SLOT(message( const QCString&, const QByteArray& ))); |
51 | // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 52 | // QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
52 | a.showMainWidget(&mw ); | 53 | a.showMainWidget(&mw ); |
53 | #else | 54 | #else |
54 | a.setMainWidget(&mw ); | 55 | a.setMainWidget(&mw ); |
55 | mw.show(); | 56 | mw.show(); |
56 | //m.resize( 800, 600 ); | 57 | //m.resize( 800, 600 ); |
57 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 58 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
58 | #endif | 59 | #endif |
59 | int rv = a.exec(); | 60 | int rv = a.exec(); |
60 | dumpMissing(); | 61 | dumpMissing(); |
62 | |||
63 | KPimGlobalPrefs::instance()->writeConfig(); | ||
61 | return rv; | 64 | return rv; |
62 | 65 | ||
63 | } | 66 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index d3aa650..3d4acb7 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -753,321 +753,322 @@ void KOListView::addIncidence(Incidence *incidence) | |||
753 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 753 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
754 | ListItemVisitor v(item, mStartDate ); | 754 | ListItemVisitor v(item, mStartDate ); |
755 | if (incidence->accept(v)) return; | 755 | if (incidence->accept(v)) return; |
756 | else delete item; | 756 | else delete item; |
757 | //qDebug("delete item "); | 757 | //qDebug("delete item "); |
758 | } | 758 | } |
759 | 759 | ||
760 | void KOListView::showEvents(QPtrList<Event> eventList) | 760 | void KOListView::showEvents(QPtrList<Event> eventList) |
761 | { | 761 | { |
762 | clear(); | 762 | clear(); |
763 | 763 | ||
764 | addEvents(eventList); | 764 | addEvents(eventList); |
765 | 765 | ||
766 | // After new creation of list view no events are selected. | 766 | // After new creation of list view no events are selected. |
767 | emit incidenceSelected( 0 ); | 767 | emit incidenceSelected( 0 ); |
768 | } | 768 | } |
769 | int KOListView::count() | 769 | int KOListView::count() |
770 | { | 770 | { |
771 | return mListView->childCount(); | 771 | return mListView->childCount(); |
772 | } | 772 | } |
773 | 773 | ||
774 | void KOListView::changeEventDisplay(Event *event, int action) | 774 | void KOListView::changeEventDisplay(Event *event, int action) |
775 | { | 775 | { |
776 | KOListViewItem *item; | 776 | KOListViewItem *item; |
777 | 777 | ||
778 | switch(action) { | 778 | switch(action) { |
779 | case KOGlobals::EVENTADDED: | 779 | case KOGlobals::EVENTADDED: |
780 | addIncidence( event ); | 780 | addIncidence( event ); |
781 | break; | 781 | break; |
782 | case KOGlobals::EVENTEDITED: | 782 | case KOGlobals::EVENTEDITED: |
783 | item = getItemForEvent(event); | 783 | item = getItemForEvent(event); |
784 | if (item) { | 784 | if (item) { |
785 | mUidDict.remove( event->uid() ); | 785 | mUidDict.remove( event->uid() ); |
786 | delete item; | 786 | delete item; |
787 | addIncidence( event ); | 787 | addIncidence( event ); |
788 | } | 788 | } |
789 | break; | 789 | break; |
790 | case KOGlobals::EVENTDELETED: | 790 | case KOGlobals::EVENTDELETED: |
791 | item = getItemForEvent(event); | 791 | item = getItemForEvent(event); |
792 | if (item) { | 792 | if (item) { |
793 | mUidDict.remove( event->uid() ); | 793 | mUidDict.remove( event->uid() ); |
794 | delete item; | 794 | delete item; |
795 | } | 795 | } |
796 | break; | 796 | break; |
797 | default: | 797 | default: |
798 | ; | 798 | ; |
799 | } | 799 | } |
800 | } | 800 | } |
801 | 801 | ||
802 | KOListViewItem *KOListView::getItemForEvent(Event *event) | 802 | KOListViewItem *KOListView::getItemForEvent(Event *event) |
803 | { | 803 | { |
804 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 804 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
805 | while (item) { | 805 | while (item) { |
806 | if (item->data() == event) return item; | 806 | if (item->data() == event) return item; |
807 | item = (KOListViewItem *)item->nextSibling(); | 807 | item = (KOListViewItem *)item->nextSibling(); |
808 | } | 808 | } |
809 | return 0; | 809 | return 0; |
810 | } | 810 | } |
811 | 811 | ||
812 | void KOListView::defaultItemAction(QListViewItem *i) | 812 | void KOListView::defaultItemAction(QListViewItem *i) |
813 | { | 813 | { |
814 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 814 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
815 | if ( item ) defaultAction( item->data() ); | 815 | if ( item ) defaultAction( item->data() ); |
816 | 816 | ||
817 | } | 817 | } |
818 | 818 | ||
819 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 819 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
820 | { | 820 | { |
821 | mActiveItem = (KOListViewItem *)item; | 821 | mActiveItem = (KOListViewItem *)item; |
822 | if (mActiveItem) { | 822 | if (mActiveItem) { |
823 | Incidence *incidence = mActiveItem->data(); | 823 | Incidence *incidence = mActiveItem->data(); |
824 | mPopupMenu->showIncidencePopup(incidence); | 824 | mPopupMenu->showIncidencePopup(incidence); |
825 | 825 | ||
826 | /* | 826 | /* |
827 | if ( incidence && incidence->type() == "Event" ) { | 827 | if ( incidence && incidence->type() == "Event" ) { |
828 | Event *event = static_cast<Event *>( incidence ); | 828 | Event *event = static_cast<Event *>( incidence ); |
829 | mPopupMenu->showEventPopup(event); | 829 | mPopupMenu->showEventPopup(event); |
830 | } | 830 | } |
831 | */ | 831 | */ |
832 | } | 832 | } |
833 | } | 833 | } |
834 | 834 | ||
835 | void KOListView::readSettings(KConfig *config, QString setting) | 835 | void KOListView::readSettings(KConfig *config, QString setting) |
836 | { | 836 | { |
837 | // qDebug("KOListView::readSettings "); | 837 | // qDebug("KOListView::readSettings "); |
838 | mListView->restoreLayout(config,setting); | 838 | mListView->restoreLayout(config,setting); |
839 | } | 839 | } |
840 | 840 | ||
841 | void KOListView::writeSettings(KConfig *config, QString setting) | 841 | void KOListView::writeSettings(KConfig *config, QString setting) |
842 | { | 842 | { |
843 | // qDebug("KOListView::writeSettings "); | 843 | // qDebug("KOListView::writeSettings "); |
844 | mListView->saveLayout(config, setting); | 844 | mListView->saveLayout(config, setting); |
845 | } | 845 | } |
846 | 846 | ||
847 | void KOListView::processSelectionChange(QListViewItem *) | 847 | void KOListView::processSelectionChange(QListViewItem *) |
848 | { | 848 | { |
849 | 849 | ||
850 | KOListViewItem *item = | 850 | KOListViewItem *item = |
851 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 851 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
852 | 852 | ||
853 | if ( !item ) { | 853 | if ( !item ) { |
854 | emit incidenceSelected( 0 ); | 854 | emit incidenceSelected( 0 ); |
855 | } else { | 855 | } else { |
856 | emit incidenceSelected( item->data() ); | 856 | emit incidenceSelected( item->data() ); |
857 | } | 857 | } |
858 | } | 858 | } |
859 | 859 | ||
860 | void KOListView::clearSelection() | 860 | void KOListView::clearSelection() |
861 | { | 861 | { |
862 | mListView->selectAll( false ); | 862 | mListView->selectAll( false ); |
863 | } | 863 | } |
864 | void KOListView::allSelection() | 864 | void KOListView::allSelection() |
865 | { | 865 | { |
866 | mListView->selectAll( true ); | 866 | mListView->selectAll( true ); |
867 | } | 867 | } |
868 | 868 | ||
869 | void KOListView::clear() | 869 | void KOListView::clear() |
870 | { | 870 | { |
871 | mListView->clear(); | 871 | mListView->clear(); |
872 | mUidDict.clear(); | 872 | mUidDict.clear(); |
873 | } | 873 | } |
874 | 874 | ||
875 | Incidence* KOListView::currentItem() | 875 | Incidence* KOListView::currentItem() |
876 | { | 876 | { |
877 | if ( mListView->currentItem() ) | 877 | if ( mListView->currentItem() ) |
878 | return ((KOListViewItem*) mListView->currentItem())->data(); | 878 | return ((KOListViewItem*) mListView->currentItem())->data(); |
879 | return 0; | 879 | return 0; |
880 | } | 880 | } |
881 | void KOListView::keyPressEvent ( QKeyEvent *e) | 881 | void KOListView::keyPressEvent ( QKeyEvent *e) |
882 | { | 882 | { |
883 | 883 | ||
884 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 884 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
885 | deleteAll(); | 885 | deleteAll(); |
886 | return; | 886 | return; |
887 | } | 887 | } |
888 | 888 | ||
889 | e->ignore(); | 889 | e->ignore(); |
890 | } | 890 | } |
891 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 891 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
892 | { | 892 | { |
893 | 893 | ||
894 | switch ( e->key() ) { | 894 | switch ( e->key() ) { |
895 | case Qt::Key_Down: | 895 | case Qt::Key_Down: |
896 | if ( e->state() == ShiftButton ) { | 896 | if ( e->state() == ShiftButton ) { |
897 | QListViewItem* cn = currentItem(); | 897 | QListViewItem* cn = currentItem(); |
898 | if ( !cn ) | 898 | if ( !cn ) |
899 | cn = firstChild(); | 899 | cn = firstChild(); |
900 | if ( !cn ) | 900 | if ( !cn ) |
901 | return; | 901 | return; |
902 | while ( cn->nextSibling() ) | 902 | while ( cn->nextSibling() ) |
903 | cn = cn->nextSibling(); | 903 | cn = cn->nextSibling(); |
904 | setCurrentItem ( cn ); | 904 | setCurrentItem ( cn ); |
905 | ensureItemVisible ( cn ); | 905 | ensureItemVisible ( cn ); |
906 | 906 | ||
907 | e->accept(); | 907 | e->accept(); |
908 | return; | 908 | return; |
909 | } | 909 | } |
910 | if ( e->state() == ControlButton ) { | 910 | if ( e->state() == ControlButton ) { |
911 | int count = childCount (); | 911 | int count = childCount (); |
912 | int jump = count / 5; | 912 | int jump = count / 5; |
913 | QListViewItem* cn; | 913 | QListViewItem* cn; |
914 | cn = currentItem(); | 914 | cn = currentItem(); |
915 | if ( ! cn ) | 915 | if ( ! cn ) |
916 | return; | 916 | return; |
917 | if ( jump == 0 ) | 917 | if ( jump == 0 ) |
918 | jump = 1; | 918 | jump = 1; |
919 | while ( jump && cn->nextSibling() ) { | 919 | while ( jump && cn->nextSibling() ) { |
920 | cn = cn->nextSibling(); | 920 | cn = cn->nextSibling(); |
921 | --jump; | 921 | --jump; |
922 | } | 922 | } |
923 | setCurrentItem ( cn ); | 923 | setCurrentItem ( cn ); |
924 | ensureItemVisible ( cn ); | 924 | ensureItemVisible ( cn ); |
925 | 925 | ||
926 | } else | 926 | } else |
927 | QListView::keyPressEvent ( e ) ; | 927 | QListView::keyPressEvent ( e ) ; |
928 | e->accept(); | 928 | e->accept(); |
929 | break; | 929 | break; |
930 | 930 | ||
931 | case Qt::Key_Up: | 931 | case Qt::Key_Up: |
932 | if ( e->state() == ShiftButton ) { | 932 | if ( e->state() == ShiftButton ) { |
933 | QListViewItem* cn = firstChild(); | 933 | QListViewItem* cn = firstChild(); |
934 | if ( cn ) { | 934 | if ( cn ) { |
935 | setCurrentItem ( cn ); | 935 | setCurrentItem ( cn ); |
936 | ensureItemVisible ( cn ); | 936 | ensureItemVisible ( cn ); |
937 | } | 937 | } |
938 | e->accept(); | 938 | e->accept(); |
939 | return; | 939 | return; |
940 | } | 940 | } |
941 | if ( e->state() == ControlButton ) { | 941 | if ( e->state() == ControlButton ) { |
942 | int count = childCount (); | 942 | int count = childCount (); |
943 | int jump = count / 5; | 943 | int jump = count / 5; |
944 | QListViewItem* cn; | 944 | QListViewItem* cn; |
945 | cn = currentItem(); | 945 | cn = currentItem(); |
946 | if ( ! cn ) | 946 | if ( ! cn ) |
947 | return; | 947 | return; |
948 | if ( jump == 0 ) | 948 | if ( jump == 0 ) |
949 | jump = 1; | 949 | jump = 1; |
950 | while ( jump && cn->itemAbove ()) { | 950 | while ( jump && cn->itemAbove ()) { |
951 | cn = cn->itemAbove (); | 951 | cn = cn->itemAbove (); |
952 | --jump; | 952 | --jump; |
953 | } | 953 | } |
954 | setCurrentItem ( cn ); | 954 | setCurrentItem ( cn ); |
955 | ensureItemVisible ( cn ); | 955 | ensureItemVisible ( cn ); |
956 | } else | 956 | } else |
957 | QListView::keyPressEvent ( e ) ; | 957 | QListView::keyPressEvent ( e ) ; |
958 | e->accept(); | 958 | e->accept(); |
959 | break; | 959 | break; |
960 | case Qt::Key_I: { | 960 | case Qt::Key_I: { |
961 | QListViewItem* cn; | 961 | QListViewItem* cn; |
962 | cn = currentItem(); | 962 | cn = currentItem(); |
963 | if ( cn ) { | 963 | if ( cn ) { |
964 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 964 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
965 | if ( ci ){ | 965 | if ( ci ){ |
966 | emit showIncidence( ci->data()); | 966 | emit showIncidence( ci->data()); |
967 | cn = cn->nextSibling(); | 967 | cn = cn->nextSibling(); |
968 | if ( cn ) { | 968 | if ( cn ) { |
969 | setCurrentItem ( cn ); | 969 | setCurrentItem ( cn ); |
970 | ensureItemVisible ( cn ); | 970 | ensureItemVisible ( cn ); |
971 | } | 971 | } |
972 | } | 972 | } |
973 | } | 973 | } |
974 | e->accept(); | 974 | e->accept(); |
975 | } | 975 | } |
976 | break; | 976 | break; |
977 | case Qt::Key_Return: | 977 | case Qt::Key_Return: |
978 | case Qt::Key_Enter: | 978 | case Qt::Key_Enter: |
979 | { | 979 | { |
980 | QListViewItem* cn; | 980 | QListViewItem* cn; |
981 | cn = currentItem(); | 981 | cn = currentItem(); |
982 | if ( cn ) { | 982 | if ( cn ) { |
983 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 983 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
984 | if ( ci ){ | 984 | if ( ci ){ |
985 | if ( e->state() == ShiftButton ) | 985 | if ( e->state() == ShiftButton ) |
986 | ci->setSelected( false ); | 986 | ci->setSelected( false ); |
987 | else | 987 | else |
988 | ci->setSelected( true ); | 988 | ci->setSelected( true ); |
989 | cn = cn->nextSibling(); | 989 | cn = cn->nextSibling(); |
990 | if ( cn ) { | 990 | if ( cn ) { |
991 | setCurrentItem ( cn ); | 991 | setCurrentItem ( cn ); |
992 | ensureItemVisible ( cn ); | 992 | ensureItemVisible ( cn ); |
993 | } | 993 | } |
994 | } | 994 | } |
995 | } | 995 | } |
996 | e->accept(); | 996 | e->accept(); |
997 | } | 997 | } |
998 | break; | 998 | break; |
999 | default: | 999 | default: |
1000 | e->ignore(); | 1000 | e->ignore(); |
1001 | } | 1001 | } |
1002 | } | 1002 | } |
1003 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1003 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1004 | : KListView( lv ) | 1004 | : KListView( lv ) |
1005 | { | 1005 | { |
1006 | #ifndef DESKTOP_VERSION | 1006 | #ifndef DESKTOP_VERSION |
1007 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1007 | QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1008 | #endif | 1008 | #endif |
1009 | mYMousePos = -1000; | ||
1009 | setSelectionMode( QListView::Multi ); | 1010 | setSelectionMode( QListView::Multi ); |
1010 | setMultiSelection( true); | 1011 | setMultiSelection( true); |
1011 | mAllowPopupMenu = true; | 1012 | mAllowPopupMenu = true; |
1012 | mMouseDown = false; | 1013 | mMouseDown = false; |
1013 | 1014 | ||
1014 | } | 1015 | } |
1015 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1016 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1016 | { | 1017 | { |
1017 | if (!e) return; | 1018 | if (!e) return; |
1018 | QPoint vp = contentsToViewport(e->pos()); | 1019 | QPoint vp = contentsToViewport(e->pos()); |
1019 | QListViewItem *item = itemAt(vp); | 1020 | QListViewItem *item = itemAt(vp); |
1020 | if (!item) { | 1021 | if (!item) { |
1021 | emit newEvent(); | 1022 | emit newEvent(); |
1022 | return; | 1023 | return; |
1023 | } | 1024 | } |
1024 | KListView::contentsMouseDoubleClickEvent(e); | 1025 | KListView::contentsMouseDoubleClickEvent(e); |
1025 | } | 1026 | } |
1026 | 1027 | ||
1027 | 1028 | ||
1028 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1029 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1029 | { | 1030 | { |
1030 | //qDebug("contentsMousePressEvent++++ "); | 1031 | //qDebug("contentsMousePressEvent++++ "); |
1031 | if (! mMouseDown ) { | 1032 | if (! mMouseDown ) { |
1032 | mAllowPopupMenu = true; | 1033 | mAllowPopupMenu = true; |
1033 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1034 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1034 | } | 1035 | } |
1035 | if ( e->button() == RightButton && mMouseDown ) | 1036 | if ( e->button() == RightButton && mMouseDown ) |
1036 | return; | 1037 | return; |
1037 | if ( e->button() == LeftButton ) | 1038 | if ( e->button() == LeftButton ) |
1038 | mMouseDown = true; | 1039 | mMouseDown = true; |
1039 | KListView::contentsMousePressEvent( e ); | 1040 | KListView::contentsMousePressEvent( e ); |
1040 | } | 1041 | } |
1041 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1042 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1042 | { | 1043 | { |
1043 | //qDebug("contentsMouseReleaseEv---- "); | 1044 | //qDebug("contentsMouseReleaseEv---- "); |
1044 | if ( ! mMouseDown ) { | 1045 | if ( ! mMouseDown ) { |
1045 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1046 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1046 | return; | 1047 | return; |
1047 | QListViewItem* ci = currentItem(); | 1048 | QListViewItem* ci = currentItem(); |
1048 | if ( ci ) | 1049 | if ( ci ) |
1049 | ci->setSelected( true ); | 1050 | ci->setSelected( true ); |
1050 | KListView::contentsMouseReleaseEvent(e); | 1051 | KListView::contentsMouseReleaseEvent(e); |
1051 | return; | 1052 | return; |
1052 | } | 1053 | } |
1053 | if ( e->button() == LeftButton ) | 1054 | if ( e->button() == LeftButton ) |
1054 | mMouseDown = false; | 1055 | mMouseDown = false; |
1055 | if ( e->button() == RightButton && ! mAllowPopupMenu ) | 1056 | if ( e->button() == RightButton && ! mAllowPopupMenu ) |
1056 | return; | 1057 | return; |
1057 | if ( e->button() == RightButton ) { | 1058 | if ( e->button() == RightButton ) { |
1058 | QListViewItem* ci = currentItem(); | 1059 | QListViewItem* ci = currentItem(); |
1059 | if ( ci ) | 1060 | if ( ci ) |
1060 | ci->setSelected( true ); | 1061 | ci->setSelected( true ); |
1061 | } | 1062 | } |
1062 | KListView::contentsMouseReleaseEvent(e); | 1063 | KListView::contentsMouseReleaseEvent(e); |
1063 | } | 1064 | } |
1064 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1065 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1065 | { | 1066 | { |
1066 | // qDebug("contentsMouseMoveEv....... "); | 1067 | // qDebug("contentsMouseMoveEv....... "); |
1067 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1068 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1068 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1069 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1069 | if ( diff < 0 ) diff = -diff; | 1070 | if ( diff < 0 ) diff = -diff; |
1070 | if ( diff > 20 ) | 1071 | if ( diff > 20 ) |
1071 | mAllowPopupMenu = false; | 1072 | mAllowPopupMenu = false; |
1072 | KListView::contentsMouseMoveEvent(e); | 1073 | KListView::contentsMouseMoveEvent(e); |
1073 | } | 1074 | } |
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index f44debc..8dca3ae 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp | |||
@@ -1,436 +1,426 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KOrganizer. | 2 | This file is part of KOrganizer. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
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 | #include <time.h> | 24 | #include <time.h> |
25 | #ifndef _WIN32_ | 25 | #ifndef _WIN32_ |
26 | #include <unistd.h> | 26 | #include <unistd.h> |
27 | #endif | 27 | #endif |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qtextstream.h> | 29 | #include <qtextstream.h> |
30 | #include <qtextcodec.h> | 30 | #include <qtextcodec.h> |
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qregexp.h> | 32 | #include <qregexp.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qcolor.h> | 34 | #include <qcolor.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> |
37 | 37 | ||
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kconfig.h> | 39 | #include <kconfig.h> |
40 | #include <klocale.h> | 40 | #include <klocale.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <kemailsettings.h> | 42 | #include <kemailsettings.h> |
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "koprefs.h" | 46 | #include "koprefs.h" |
47 | #include "mainwindow.h" | 47 | #include "mainwindow.h" |
48 | 48 | ||
49 | KOPrefs *KOPrefs::mInstance = 0; | 49 | KOPrefs *KOPrefs::mInstance = 0; |
50 | static KStaticDeleter<KOPrefs> insd; | 50 | static KStaticDeleter<KOPrefs> insd; |
51 | 51 | ||
52 | KOPrefs::KOPrefs() : | 52 | KOPrefs::KOPrefs() : |
53 | KPimPrefs("korganizerrc") | 53 | KPimPrefs("korganizerrc") |
54 | { | 54 | { |
55 | mCategoryColors.setAutoDelete(true); | 55 | mCategoryColors.setAutoDelete(true); |
56 | fillMailDefaults(); | 56 | fillMailDefaults(); |
57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); | 57 | mDefaultCategoryColor = QColor(175,210,255);//196,196,196); |
58 | QColor defaultHolidayColor = QColor(255,0,0); | 58 | QColor defaultHolidayColor = QColor(255,0,0); |
59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); | 59 | QColor defaultHighlightColor = QColor(129,112,255);//64,64,255); |
60 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); | 60 | QColor defaultAgendaBgColor = QColor(239,241,169);//128,128,128); |
61 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); | 61 | QColor defaultWorkingHoursColor = QColor(170,223,150);//160,160,160); |
62 | QColor defaultTodoDueTodayColor = QColor(255,220,100); | 62 | QColor defaultTodoDueTodayColor = QColor(255,220,100); |
63 | QColor defaultTodoOverdueColor = QColor(255,153,125); | 63 | QColor defaultTodoOverdueColor = QColor(255,153,125); |
64 | 64 | ||
65 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); | 65 | mTimeBarFont = QFont("helvetica",10);//,QFont::Bold); |
66 | mDefaultViewFont = QFont("helvetica",10); | 66 | mDefaultViewFont = QFont("helvetica",10); |
67 | mDefaultMonthViewFont = QFont("helvetica",8); | 67 | mDefaultMonthViewFont = QFont("helvetica",8); |
68 | mMarcusBainsFont= QFont("helvetica",10); | 68 | mMarcusBainsFont= QFont("helvetica",10); |
69 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); | 69 | mDateNavigatorFont= QFont("helvetica",10, QFont::Bold); |
70 | mEditBoxFont = QFont("helvetica",12); | 70 | mEditBoxFont = QFont("helvetica",12); |
71 | mJornalViewFont = QFont("helvetica",12); | 71 | mJornalViewFont = QFont("helvetica",12); |
72 | 72 | ||
73 | KPrefs::setCurrentGroup("General"); | 73 | KPrefs::setCurrentGroup("General"); |
74 | 74 | ||
75 | 75 | ||
76 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 76 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
77 | 77 | ||
78 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); | 78 | addItemBool("ShowIconNewTodo",&mShowIconNewTodo,true); |
79 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); | 79 | addItemBool("ShowIconNewEvent",&mShowIconNewEvent,true); |
80 | addItemBool("ShowIconSearch",&mShowIconSearch,true); | 80 | addItemBool("ShowIconSearch",&mShowIconSearch,true); |
81 | addItemBool("ShowIconList",&mShowIconList,true); | 81 | addItemBool("ShowIconList",&mShowIconList,true); |
82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); | 82 | addItemBool("ShowIconDay1",&mShowIconDay1,true); |
83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); | 83 | addItemBool("ShowIconDay5",&mShowIconDay5,true); |
84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); | 84 | addItemBool("ShowIconDay7",&mShowIconDay7,true); |
85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); | 85 | addItemBool("ShowIconMonth",&mShowIconMonth,true); |
86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); | 86 | addItemBool("ShowIconTodoview",&mShowIconTodoview,true); |
87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); | 87 | addItemBool("ShowIconBackFast",&mShowIconBackFast,true); |
88 | addItemBool("ShowIconBack",&mShowIconBack,true); | 88 | addItemBool("ShowIconBack",&mShowIconBack,true); |
89 | addItemBool("ShowIconToday",&mShowIconToday,true); | 89 | addItemBool("ShowIconToday",&mShowIconToday,true); |
90 | addItemBool("ShowIconForward",&mShowIconForward,true); | 90 | addItemBool("ShowIconForward",&mShowIconForward,true); |
91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); | 91 | addItemBool("ShowIconForwardFast",&mShowIconForwardFast,true); |
92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); | 92 | addItemBool("ShowIconWhatsThis",&mShowIconWhatsThis,false); |
93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); | 93 | addItemBool("ShowIconNextDays",&mShowIconNextDays,true); |
94 | addItemBool("ShowIconNext",&mShowIconNext,true); | 94 | addItemBool("ShowIconNext",&mShowIconNext,true); |
95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); | 95 | addItemBool("ShowIconJournal",&mShowIconJournal,true); |
96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); | 96 | addItemBool("ShowIconStretch",&mShowIconStretch,true); |
97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); | 97 | addItemInt("LastLoadedLanguage",&mOldLanguage,0); |
98 | 98 | ||
99 | addItemBool("AskForQuit",&mAskForQuit,false); | 99 | addItemBool("AskForQuit",&mAskForQuit,false); |
100 | 100 | ||
101 | #ifndef DESKTOP_VERSION | 101 | #ifndef DESKTOP_VERSION |
102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); | 102 | addItemBool("ShowFullMenu",&mShowFullMenu,false); |
103 | #else | 103 | #else |
104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); | 104 | addItemBool("ShowFullMenu",&mShowFullMenu,true); |
105 | #endif | 105 | #endif |
106 | addItemBool("ToolBarHor",&mToolBarHor, true ); | 106 | addItemBool("ToolBarHor",&mToolBarHor, true ); |
107 | addItemBool("ToolBarUp",&mToolBarUp, false ); | 107 | addItemBool("ToolBarUp",&mToolBarUp, false ); |
108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); | 108 | addItemBool("ToolBarMiniIcons",&mToolBarMiniIcons, false ); |
109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); | 109 | addItemInt("Whats Next Days",&mWhatsNextDays,3); |
110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); | 110 | addItemInt("Whats Next Prios",&mWhatsNextPrios,1); |
111 | 111 | ||
112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); | 112 | addItemBool("ShowTodoInAgenda",&mShowTodoInAgenda,true); |
113 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); | 113 | addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true); |
114 | addItemInt("AllDay Size",&mAllDaySize,28); | 114 | addItemInt("AllDay Size",&mAllDaySize,28); |
115 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; | 115 | QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav"; |
116 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); | 116 | addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm ); |
117 | 117 | ||
118 | addItemStringList("LocationDefaults",&mLocationDefaults ); | 118 | addItemStringList("LocationDefaults",&mLocationDefaults ); |
119 | addItemStringList("EventSummary User",&mEventSummaryUser); | 119 | addItemStringList("EventSummary User",&mEventSummaryUser); |
120 | addItemStringList("TodoSummary User",&mTodoSummaryUser); | 120 | addItemStringList("TodoSummary User",&mTodoSummaryUser); |
121 | 121 | ||
122 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); | 122 | addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); |
123 | addItemBool("Enable Project View",&mEnableProjectView,false); | 123 | addItemBool("Enable Project View",&mEnableProjectView,false); |
124 | addItemBool("Auto Save",&mAutoSave,false); | 124 | addItemBool("Auto Save",&mAutoSave,false); |
125 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); | 125 | addItemInt("Auto Save Interval",&mAutoSaveInterval,3); |
126 | addItemBool("Confirm Deletes",&mConfirm,true); | 126 | addItemBool("Confirm Deletes",&mConfirm,true); |
127 | addItemString("Archive File",&mArchiveFile); | 127 | addItemString("Archive File",&mArchiveFile); |
128 | addItemString("Html Export File",&mHtmlExportFile, | 128 | addItemString("Html Export File",&mHtmlExportFile, |
129 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); | 129 | QDir::homeDirPath() + "/" + i18n("Default export file", "calendar.html")); |
130 | addItemBool("Html With Save",&mHtmlWithSave,false); | 130 | addItemBool("Html With Save",&mHtmlWithSave,false); |
131 | 131 | ||
132 | KPrefs::setCurrentGroup("Personal Settings"); | 132 | KPrefs::setCurrentGroup("Personal Settings"); |
133 | 133 | ||
134 | addItemInt("Mail Client",&mMailClient,MailClientKMail); | 134 | addItemInt("Mail Client",&mMailClient,MailClientKMail); |
135 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); | 135 | addItemBool("Use Control Center Email",&mEmailControlCenter,false); |
136 | addItemBool("Bcc",&mBcc,false); | 136 | addItemBool("Bcc",&mBcc,false); |
137 | 137 | ||
138 | KPrefs::setCurrentGroup("Time & Date"); | 138 | KPrefs::setCurrentGroup("Time & Date"); |
139 | 139 | ||
140 | 140 | ||
141 | addItemInt("Default Start Time",&mStartTime,10); | 141 | addItemInt("Default Start Time",&mStartTime,10); |
142 | addItemInt("Default Duration",&mDefaultDuration,2); | 142 | addItemInt("Default Duration",&mDefaultDuration,2); |
143 | addItemInt("Default Alarm Time",&mAlarmTime,3); | 143 | addItemInt("Default Alarm Time",&mAlarmTime,3); |
144 | KPrefs::setCurrentGroup("AlarmSettings"); | 144 | KPrefs::setCurrentGroup("AlarmSettings"); |
145 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); | 145 | addItemInt("AlarmPlayBeeps",&mAlarmPlayBeeps,20); |
146 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); | 146 | addItemInt("AlarmSuspendTime",&mAlarmSuspendTime,7); |
147 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); | 147 | addItemInt("AlarmSuspendCount",&mAlarmSuspendCount,5); |
148 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); | 148 | addItemInt("AlarmBeepInterval",&mAlarmBeepInterval,3); |
149 | 149 | ||
150 | 150 | ||
151 | KPrefs::setCurrentGroup("Calendar"); | 151 | KPrefs::setCurrentGroup("Calendar"); |
152 | 152 | ||
153 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); | 153 | addItemInt("Default Calendar Format",&mDefaultFormat,FormatICalendar); |
154 | 154 | ||
155 | KPrefs::setCurrentGroup("Fonts"); | 155 | KPrefs::setCurrentGroup("Fonts"); |
156 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); | 156 | // qDebug(" KPrefs::setCurrentGroup(Fonts); "); |
157 | addItemFont("TimeBar Font",&mTimeBarFont); | 157 | addItemFont("TimeBar Font",&mTimeBarFont); |
158 | addItemFont("MonthView Font",&mMonthViewFont); | 158 | addItemFont("MonthView Font",&mMonthViewFont); |
159 | addItemFont("AgendaView Font",&mAgendaViewFont); | 159 | addItemFont("AgendaView Font",&mAgendaViewFont); |
160 | addItemFont("MarcusBains Font",&mMarcusBainsFont); | 160 | addItemFont("MarcusBains Font",&mMarcusBainsFont); |
161 | addItemFont("TimeLabels Font",&mTimeLabelsFont); | 161 | addItemFont("TimeLabels Font",&mTimeLabelsFont); |
162 | addItemFont("TodoView Font",&mTodoViewFont); | 162 | addItemFont("TodoView Font",&mTodoViewFont); |
163 | addItemFont("ListView Font",&mListViewFont); | 163 | addItemFont("ListView Font",&mListViewFont); |
164 | addItemFont("DateNavigator Font",&mDateNavigatorFont); | 164 | addItemFont("DateNavigator Font",&mDateNavigatorFont); |
165 | addItemFont("EditBox Font",&mEditBoxFont); | 165 | addItemFont("EditBox Font",&mEditBoxFont); |
166 | addItemFont("JournalView Font",&mJornalViewFont); | 166 | addItemFont("JournalView Font",&mJornalViewFont); |
167 | addItemFont("WhatsNextView Font",&mWhatsNextFont); | 167 | addItemFont("WhatsNextView Font",&mWhatsNextFont); |
168 | addItemFont("EventView Font",&mEventViewFont); | 168 | addItemFont("EventView Font",&mEventViewFont); |
169 | 169 | ||
170 | // KPrefs::setCurrentGroup("SyncProfiles"); | ||
171 | // addItemString("LocalMachineName",&mLocalMachineName, "undefined"); | ||
172 | // addItemStringList("SyncProfileNames",&mSyncProfileNames); | ||
173 | // addItemStringList("ExternSyncProfiles",&mExternSyncProfileNames); | ||
174 | |||
175 | KPrefs::setCurrentGroup("RemoteSyncing"); | 170 | KPrefs::setCurrentGroup("RemoteSyncing"); |
176 | // addItemBool("UsePasswd",&mUsePassWd,false); | ||
177 | // addItemBool("WriteBackFile",&mWriteBackFile,true); | ||
178 | // addItemBool("WriteBackExistingOnly",&mWriteBackExistingOnly,false); | ||
179 | // addItemBool("AskForPreferences",&mAskForPreferences,true); | ||
180 | // addItemBool("ShowSyncSummary",&mShowSyncSummary,true); | ||
181 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); | 171 | addItemString("ActiveSyncPort",&mActiveSyncPort,"9197" ); |
182 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); | 172 | addItemString("ActiveSyncIP",&mActiveSyncIP,"192.168.0.40" ); |
183 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); | 173 | addItemBool("ShowSyncEvents",&mShowSyncEvents,false); |
184 | addItemInt("LastSyncTime",&mLastSyncTime,0); | 174 | addItemInt("LastSyncTime",&mLastSyncTime,0); |
185 | 175 | ||
186 | #ifdef _WIN32_ | 176 | #ifdef _WIN32_ |
187 | QString hdp= locateLocal("data","korganizer")+"\\\\"; | 177 | QString hdp= locateLocal("data","korganizer")+"\\\\"; |
188 | #else | 178 | #else |
189 | QString hdp= locateLocal("data","korganizer")+"/"; | 179 | QString hdp= locateLocal("data","korganizer")+"/"; |
190 | #endif | 180 | #endif |
191 | 181 | ||
192 | KPrefs::setCurrentGroup("LoadSaveFileNames"); | 182 | KPrefs::setCurrentGroup("LoadSaveFileNames"); |
193 | 183 | ||
194 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); | 184 | addItemString("LastImportFile", &mLastImportFile ,hdp +"import.ics" ); |
195 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); | 185 | addItemString("LastVcalFile", &mLastVcalFile ,hdp +"export.vcs" ); |
196 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); | 186 | addItemString("LastSaveFile", &mLastSaveFile ,hdp +"mybackup.ics" ); |
197 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); | 187 | addItemString("LastLoadFile", &mLastLoadFile ,hdp +"mybackup.ics" ); |
198 | 188 | ||
199 | 189 | ||
200 | KPrefs::setCurrentGroup("Locale"); | 190 | KPrefs::setCurrentGroup("Locale"); |
201 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); | 191 | addItemBool("ShortDateInViewer",&mShortDateInViewer,false); |
202 | 192 | ||
203 | 193 | ||
204 | KPrefs::setCurrentGroup("Colors"); | 194 | KPrefs::setCurrentGroup("Colors"); |
205 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); | 195 | addItemColor("Holiday Color",&mHolidayColor,defaultHolidayColor); |
206 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); | 196 | addItemColor("Highlight Color",&mHighlightColor,defaultHighlightColor); |
207 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); | 197 | addItemColor("Event Color",&mEventColor,mDefaultCategoryColor); |
208 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); | 198 | addItemColor("Agenda Background Color",&mAgendaBgColor,defaultAgendaBgColor); |
209 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); | 199 | addItemColor("WorkingHours Color",&mWorkingHoursColor,defaultWorkingHoursColor); |
210 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); | 200 | addItemColor("Todo due today Color",&mTodoDueTodayColor,defaultTodoDueTodayColor); |
211 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); | 201 | addItemColor("Todo overdue Color",&mTodoOverdueColor,defaultTodoOverdueColor); |
212 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); | 202 | addItemColor("MonthViewEvenColor",&mMonthViewEvenColor,QColor( 160,160,255 )); |
213 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); | 203 | addItemColor("MonthViewOddColor",&mMonthViewOddColor,QColor( 160,255,160 )); |
214 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); | 204 | addItemColor("MonthViewHolidayColor",&mMonthViewHolidayColor,QColor( 255,160,160 )); |
215 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); | 205 | addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); |
216 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); | 206 | addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); |
217 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); | 207 | addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); |
218 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); | 208 | addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); |
219 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); | 209 | addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); |
220 | addItemBool("UseAppColors",&mUseAppColors,false); | 210 | addItemBool("UseAppColors",&mUseAppColors,false); |
221 | 211 | ||
222 | 212 | ||
223 | 213 | ||
224 | KPrefs::setCurrentGroup("Views"); | 214 | KPrefs::setCurrentGroup("Views"); |
225 | addItemInt("Hour Size",&mHourSize,8); | 215 | addItemInt("Hour Size",&mHourSize,8); |
226 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); | 216 | addItemBool("Show Daily Recurrences",&mDailyRecur,true); |
227 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); | 217 | addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); |
228 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); | 218 | addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); |
229 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); | 219 | addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); |
230 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); | 220 | addItemBool("ShowShortMonthName",&mMonthShowShort,false); |
231 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); | 221 | addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); |
232 | addItemBool("Enable ToolTips",&mEnableToolTips,false); | 222 | addItemBool("Enable ToolTips",&mEnableToolTips,false); |
233 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); | 223 | addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); |
234 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); | 224 | addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); |
235 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); | 225 | addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); |
236 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); | 226 | addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); |
237 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); | 227 | addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,false); |
238 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); | 228 | addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false); |
239 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); | 229 | addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); |
240 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); | 230 | addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); |
241 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); | 231 | addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); |
242 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); | 232 | addItemBool("WNViewShowsParents",&mWNViewShowsParents,true); |
243 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); | 233 | addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); |
244 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); | 234 | addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); |
245 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); | 235 | addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); |
246 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); | 236 | addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); |
247 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); | 237 | addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); |
248 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); | 238 | addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); |
249 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); | 239 | addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); |
250 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); | 240 | addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); |
251 | #ifdef DESKTOP_VERSION | 241 | #ifdef DESKTOP_VERSION |
252 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); | 242 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); |
253 | #else | 243 | #else |
254 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); | 244 | addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); |
255 | #endif | 245 | #endif |
256 | addItemInt("Day Begins",&mDayBegins,7); | 246 | addItemInt("Day Begins",&mDayBegins,7); |
257 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); | 247 | addItemInt("Working Hours Start",&mWorkingHoursStart,8); |
258 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); | 248 | addItemInt("Working Hours End",&mWorkingHoursEnd,17); |
259 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); | 249 | addItemBool("Exclude Holidays",&mExcludeHolidays,true); |
260 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); | 250 | addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); |
261 | 251 | ||
262 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); | 252 | addItemBool("Month View Uses Category Color",&mMonthViewUsesCategoryColor,false); |
263 | addItemBool("Full View Month",&mFullViewMonth,true); | 253 | addItemBool("Full View Month",&mFullViewMonth,true); |
264 | addItemBool("Full View Todo",&mFullViewTodo,true); | 254 | addItemBool("Full View Todo",&mFullViewTodo,true); |
265 | addItemBool("Quick Todo",&mEnableQuickTodo,false); | 255 | addItemBool("Quick Todo",&mEnableQuickTodo,false); |
266 | 256 | ||
267 | addItemInt("Next X Days",&mNextXDays,3); | 257 | addItemInt("Next X Days",&mNextXDays,3); |
268 | 258 | ||
269 | KPrefs::setCurrentGroup("Printer"); | 259 | KPrefs::setCurrentGroup("Printer"); |
270 | 260 | ||
271 | KPrefs::setCurrentGroup("Layout"); | 261 | KPrefs::setCurrentGroup("Layout"); |
272 | 262 | ||
273 | addItemBool("CompactDialogs",&mCompactDialogs,false); | 263 | addItemBool("CompactDialogs",&mCompactDialogs,false); |
274 | addItemBool("VerticalScreen",&mVerticalScreen,true); | 264 | addItemBool("VerticalScreen",&mVerticalScreen,true); |
275 | 265 | ||
276 | KPrefs::setCurrentGroup("KOrganizer Plugins"); | 266 | KPrefs::setCurrentGroup("KOrganizer Plugins"); |
277 | 267 | ||
278 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); | 268 | addItemStringList("SelectedPlugins",&mSelectedPlugins,"holidays"); |
279 | 269 | ||
280 | KPrefs::setCurrentGroup("Group Scheduling"); | 270 | KPrefs::setCurrentGroup("Group Scheduling"); |
281 | 271 | ||
282 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); | 272 | addItemInt("IMIPScheduler",&mIMIPScheduler,IMIPKMail); |
283 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); | 273 | addItemInt("IMIPSend",&mIMIPSend,IMIPdirectsend); |
284 | addItemStringList("AdditionalMails",&mAdditionalMails,""); | 274 | addItemStringList("AdditionalMails",&mAdditionalMails,""); |
285 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); | 275 | addItemInt("IMIP auto refresh",&mIMIPAutoRefresh,neverAuto); |
286 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); | 276 | addItemInt("IMIP auto insert request",&mIMIPAutoInsertRequest,neverAuto); |
287 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); | 277 | addItemInt("IMIP auto insert reply",&mIMIPAutoInsertReply,neverAuto); |
288 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); | 278 | addItemInt("IMIP auto FreeBusy",&mIMIPAutoFreeBusy,neverAuto); |
289 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); | 279 | addItemInt("IMIP auto save FreeBusy",&mIMIPAutoFreeBusyReply,neverAuto); |
290 | 280 | ||
291 | KPrefs::setCurrentGroup( "Editors" ); | 281 | KPrefs::setCurrentGroup( "Editors" ); |
292 | 282 | ||
293 | addItemStringList( "EventTemplates", &mEventTemplates ); | 283 | addItemStringList( "EventTemplates", &mEventTemplates ); |
294 | addItemStringList( "TodoTemplates", &mTodoTemplates ); | 284 | addItemStringList( "TodoTemplates", &mTodoTemplates ); |
295 | 285 | ||
296 | addItemInt("DestinationPolicy",&mDestination,standardDestination); | 286 | addItemInt("DestinationPolicy",&mDestination,standardDestination); |
297 | 287 | ||
298 | 288 | ||
299 | 289 | ||
300 | } | 290 | } |
301 | 291 | ||
302 | 292 | ||
303 | KOPrefs::~KOPrefs() | 293 | KOPrefs::~KOPrefs() |
304 | { | 294 | { |
305 | if (mInstance == this) | 295 | if (mInstance == this) |
306 | mInstance = insd.setObject(0); | 296 | mInstance = insd.setObject(0); |
307 | 297 | ||
308 | //qDebug("KOPrefs::~KOPrefs() "); | 298 | //qDebug("KOPrefs::~KOPrefs() "); |
309 | } | 299 | } |
310 | 300 | ||
311 | 301 | ||
312 | KOPrefs *KOPrefs::instance() | 302 | KOPrefs *KOPrefs::instance() |
313 | { | 303 | { |
314 | if (!mInstance) { | 304 | if (!mInstance) { |
315 | mInstance = insd.setObject(new KOPrefs()); | 305 | mInstance = insd.setObject(new KOPrefs()); |
316 | mInstance->readConfig(); | 306 | mInstance->readConfig(); |
317 | } | 307 | } |
318 | 308 | ||
319 | return mInstance; | 309 | return mInstance; |
320 | } | 310 | } |
321 | 311 | ||
322 | void KOPrefs::usrSetDefaults() | 312 | void KOPrefs::usrSetDefaults() |
323 | { | 313 | { |
324 | 314 | ||
325 | } | 315 | } |
326 | 316 | ||
327 | void KOPrefs::fillMailDefaults() | 317 | void KOPrefs::fillMailDefaults() |
328 | { | 318 | { |
329 | if (mName.isEmpty()) mName = i18n("Anonymous"); | 319 | if (mName.isEmpty()) mName = i18n("Anonymous"); |
330 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); | 320 | if (mEmail.isEmpty()) mEmail = i18n("nobody@nowhere"); |
331 | } | 321 | } |
332 | 322 | ||
333 | void KOPrefs::setTimeZoneIdDefault() | 323 | void KOPrefs::setTimeZoneIdDefault() |
334 | { | 324 | { |
335 | ; | 325 | ; |
336 | } | 326 | } |
337 | 327 | ||
338 | void KOPrefs::setCategoryDefaults() | 328 | void KOPrefs::setCategoryDefaults() |
339 | { | 329 | { |
340 | mCustomCategories.clear(); | 330 | mCustomCategories.clear(); |
341 | mCustomCategories = getDefaultList(); | 331 | mCustomCategories = getDefaultList(); |
342 | 332 | ||
343 | QStringList::Iterator it; | 333 | QStringList::Iterator it; |
344 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 334 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
345 | setCategoryColor(*it,mDefaultCategoryColor); | 335 | setCategoryColor(*it,mDefaultCategoryColor); |
346 | } | 336 | } |
347 | } | 337 | } |
348 | 338 | ||
349 | QStringList KOPrefs::getDefaultList() | 339 | QStringList KOPrefs::getDefaultList() |
350 | { | 340 | { |
351 | QStringList retval ; | 341 | QStringList retval ; |
352 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") | 342 | retval << i18n("Anniversary") << i18n("Appointment") << i18n("Birthday") << i18n("Business") << i18n("Business Travel") << i18n("Cinema") << i18n("Customer") |
353 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") | 343 | << i18n("Break")<< i18n("Breakfast")<< i18n("Competition")<< i18n("Dinner") |
354 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") | 344 | << i18n("Education")<< i18n("Family") << i18n("Favorites") << i18n("Festival")<< i18n("Fishing")<< i18n("Flight") << i18n("Gifts") |
355 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") | 345 | << i18n("Holiday") << i18n("Holiday Cards")<< i18n("Hot Contacts") << i18n("Hiking") << i18n("Hunting") << i18n("Key Customer") << i18n("Kids") |
356 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") | 346 | << i18n("Lunch") << i18n("Meeting") << i18n("Miscellaneous") << i18n("Partner")<< i18n("Party") << i18n("Personal") << i18n("Personal Travel") |
357 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") | 347 | << i18n("PHB") << i18n("Phone Calls") << i18n("Projects") << i18n("Recurring") << i18n("School") << i18n("Shopping") |
358 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") | 348 | << i18n("Speach") << i18n("Special Occasion") << i18n("Sports") << i18n("Talk") << i18n("Travel") << i18n("TV")<< i18n("University") |
359 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; | 349 | << i18n("Vacation") << i18n("VIP") << i18n("SyncEvent") ; |
360 | retval.sort(); | 350 | retval.sort(); |
361 | return retval; | 351 | return retval; |
362 | } | 352 | } |
363 | 353 | ||
364 | void KOPrefs::usrReadConfig() | 354 | void KOPrefs::usrReadConfig() |
365 | { | 355 | { |
366 | config()->setGroup("General"); | 356 | config()->setGroup("General"); |
367 | 357 | ||
368 | mCustomCategories = config()->readListEntry("Custom Categories"); | 358 | mCustomCategories = config()->readListEntry("Custom Categories"); |
369 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { | 359 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != mOldLanguage ) { |
370 | mLocationDefaults.clear(); | 360 | mLocationDefaults.clear(); |
371 | mEventSummaryUser.clear(); | 361 | mEventSummaryUser.clear(); |
372 | mTodoSummaryUser.clear(); | 362 | mTodoSummaryUser.clear(); |
373 | } | 363 | } |
374 | mOldLoadedLanguage = mOldLanguage ; | 364 | mOldLoadedLanguage = mOldLanguage ; |
375 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; | 365 | mOldLanguage = KPimGlobalPrefs::instance()->mPreferredLanguage; |
376 | if (mLocationDefaults.isEmpty()) { | 366 | if (mLocationDefaults.isEmpty()) { |
377 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") | 367 | mLocationDefaults << i18n("Home") << i18n("Office") << i18n("Library") << i18n("School") << i18n("Doctor") << i18n("Beach") |
378 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") | 368 | << i18n("University") << i18n("Restaurant") << i18n("Bar") << i18n("Conference room") << i18n("Cinema") << i18n("Lake") << i18n("Kindergarten") |
379 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; | 369 | << i18n("Germany") << i18n("Sweden") << i18n("Forest") << i18n("Desert") << i18n("Kitchen") ; |
380 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") | 370 | // << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") << i18n("") |
381 | mLocationDefaults.sort(); | 371 | mLocationDefaults.sort(); |
382 | } | 372 | } |
383 | 373 | ||
384 | if (mEventSummaryUser.isEmpty()) { | 374 | if (mEventSummaryUser.isEmpty()) { |
385 | mEventSummaryUser = getDefaultList() ; | 375 | mEventSummaryUser = getDefaultList() ; |
386 | } | 376 | } |
387 | if (mTodoSummaryUser.isEmpty()) { | 377 | if (mTodoSummaryUser.isEmpty()) { |
388 | mTodoSummaryUser = getDefaultList() ; | 378 | mTodoSummaryUser = getDefaultList() ; |
389 | } | 379 | } |
390 | 380 | ||
391 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); | 381 | if (mCustomCategories.isEmpty()) setCategoryDefaults(); |
392 | 382 | ||
393 | config()->setGroup("Personal Settings"); | 383 | config()->setGroup("Personal Settings"); |
394 | mName = config()->readEntry("user_name",""); | 384 | mName = config()->readEntry("user_name",""); |
395 | mEmail = config()->readEntry("user_email",""); | 385 | mEmail = config()->readEntry("user_email",""); |
396 | fillMailDefaults(); | 386 | fillMailDefaults(); |
397 | 387 | ||
398 | config()->setGroup("Category Colors"); | 388 | config()->setGroup("Category Colors"); |
399 | QStringList::Iterator it; | 389 | QStringList::Iterator it; |
400 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { | 390 | for (it = mCustomCategories.begin();it != mCustomCategories.end();++it ) { |
401 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); | 391 | setCategoryColor(*it,config()->readColorEntry(*it,&mDefaultCategoryColor)); |
402 | 392 | ||
403 | } | 393 | } |
404 | 394 | ||
405 | KPimPrefs::usrReadConfig(); | 395 | KPimPrefs::usrReadConfig(); |
406 | } | 396 | } |
407 | 397 | ||
408 | 398 | ||
409 | void KOPrefs::usrWriteConfig() | 399 | void KOPrefs::usrWriteConfig() |
410 | { | 400 | { |
411 | config()->setGroup("General"); | 401 | config()->setGroup("General"); |
412 | config()->writeEntry("Custom Categories",mCustomCategories); | 402 | config()->writeEntry("Custom Categories",mCustomCategories); |
413 | 403 | ||
414 | config()->setGroup("Personal Settings"); | 404 | config()->setGroup("Personal Settings"); |
415 | config()->writeEntry("user_name",mName); | 405 | config()->writeEntry("user_name",mName); |
416 | config()->writeEntry("user_email",mEmail); | 406 | config()->writeEntry("user_email",mEmail); |
417 | 407 | ||
418 | config()->setGroup("Category Colors"); | 408 | config()->setGroup("Category Colors"); |
419 | QDictIterator<QColor> it(mCategoryColors); | 409 | QDictIterator<QColor> it(mCategoryColors); |
420 | while (it.current()) { | 410 | while (it.current()) { |
421 | config()->writeEntry(it.currentKey(),*(it.current())); | 411 | config()->writeEntry(it.currentKey(),*(it.current())); |
422 | ++it; | 412 | ++it; |
423 | } | 413 | } |
424 | 414 | ||
425 | 415 | ||
426 | KPimPrefs::usrWriteConfig(); | 416 | KPimPrefs::usrWriteConfig(); |
427 | } | 417 | } |
428 | 418 | ||
429 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) | 419 | void KOPrefs::setCategoryColor(QString cat,const QColor & color) |
430 | { | 420 | { |
431 | mCategoryColors.replace(cat,new QColor(color)); | 421 | mCategoryColors.replace(cat,new QColor(color)); |
432 | } | 422 | } |
433 | 423 | ||
434 | QColor *KOPrefs::categoryColor(QString cat) | 424 | QColor *KOPrefs::categoryColor(QString cat) |
435 | { | 425 | { |
436 | QColor *color = 0; | 426 | QColor *color = 0; |
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 4194d12..2481ca4 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -1,106 +1,109 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qcopchannel_qws.h> | 5 | #include <qcopchannel_qws.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #else | 8 | #else |
9 | #include <qapplication.h> | 9 | #include <qapplication.h> |
10 | #include <qstring.h> | 10 | #include <qstring.h> |
11 | #include <qwindowsstyle.h> | 11 | #include <qwindowsstyle.h> |
12 | #include <qplatinumstyle.h> | 12 | #include <qplatinumstyle.h> |
13 | #include <qsgistyle.h> | 13 | #include <qsgistyle.h> |
14 | #endif | 14 | #endif |
15 | #include <qtextcodec.h> | 15 | #include <qtextcodec.h> |
16 | 16 | ||
17 | #include <qdir.h> | 17 | #include <qdir.h> |
18 | #include <kstandarddirs.h> | 18 | #include <kstandarddirs.h> |
19 | #include <kglobal.h> | 19 | #include <kglobal.h> |
20 | #include <stdio.h> | 20 | #include <stdio.h> |
21 | #include "mainwindow.h" | 21 | #include "mainwindow.h" |
22 | #include <libkdepim/kpimglobalprefs.h> | ||
22 | void dumpMissing(); | 23 | void dumpMissing(); |
23 | int main( int argc, char **argv ) | 24 | int main( int argc, char **argv ) |
24 | { | 25 | { |
25 | #ifndef DESKTOP_VERSION | 26 | #ifndef DESKTOP_VERSION |
26 | QPEApplication a( argc, argv ); | 27 | QPEApplication a( argc, argv ); |
27 | a.setKeepRunning (); | 28 | a.setKeepRunning (); |
28 | #else | 29 | #else |
29 | QApplication a( argc, argv ); | 30 | QApplication a( argc, argv ); |
30 | QApplication::setStyle( new QPlatinumStyle ()); | 31 | QApplication::setStyle( new QPlatinumStyle ()); |
31 | QString hdir = QDir::homeDirPath(); | 32 | QString hdir = QDir::homeDirPath(); |
32 | // there is a bug when creating dirs for WIN 98 | 33 | // there is a bug when creating dirs for WIN 98 |
33 | // it is difficult to fix, because we have no WIN 98 runnung | 34 | // it is difficult to fix, because we have no WIN 98 runnung |
34 | // such that we try it to create the dirs at startup here | 35 | // such that we try it to create the dirs at startup here |
35 | if ( hdir == "C:\\" ) { // win 98 or ME | 36 | if ( hdir == "C:\\" ) { // win 98 or ME |
36 | QDir app_dir; | 37 | QDir app_dir; |
37 | if ( !app_dir.exists("C:\\kdepim") ) | 38 | if ( !app_dir.exists("C:\\kdepim") ) |
38 | app_dir.mkdir ("C:\\kdepim"); | 39 | app_dir.mkdir ("C:\\kdepim"); |
39 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 40 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
40 | app_dir.mkdir ("C:\\kdepim\\apps"); | 41 | app_dir.mkdir ("C:\\kdepim\\apps"); |
41 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 42 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
42 | app_dir.mkdir ("C:\\kdepim\\config"); | 43 | app_dir.mkdir ("C:\\kdepim\\config"); |
43 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) | 44 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) |
44 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); | 45 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); |
45 | } | 46 | } |
46 | #endif | 47 | #endif |
47 | bool exitHelp = false; | 48 | bool exitHelp = false; |
48 | if ( argc > 1 ) { | 49 | if ( argc > 1 ) { |
49 | QString command = argv[1]; | 50 | QString command = argv[1]; |
50 | if ( command == "-help" ){ | 51 | if ( command == "-help" ){ |
51 | printf("KO/Pi command line commands:\n"); | 52 | printf("KO/Pi command line commands:\n"); |
52 | printf(" no command: Start KO/Pi in usual way\n"); | 53 | printf(" no command: Start KO/Pi in usual way\n"); |
53 | printf(" -help: This output\n"); | 54 | printf(" -help: This output\n"); |
54 | printf("Next Option: Open or Show after start:\n"); | 55 | printf("Next Option: Open or Show after start:\n"); |
55 | printf(" -newTodo: New Todo dialog\n"); | 56 | printf(" -newTodo: New Todo dialog\n"); |
56 | printf(" -newEvent: New Event dialog\n"); | 57 | printf(" -newEvent: New Event dialog\n"); |
57 | printf(" -showList: List view\n"); | 58 | printf(" -showList: List view\n"); |
58 | printf(" -showDay: Day view\n"); | 59 | printf(" -showDay: Day view\n"); |
59 | printf(" -showWWeek: Work Week view\n"); | 60 | printf(" -showWWeek: Work Week view\n"); |
60 | printf(" -showWeek: Week view\n"); | 61 | printf(" -showWeek: Week view\n"); |
61 | printf(" -showTodo: Todo view\n"); | 62 | printf(" -showTodo: Todo view\n"); |
62 | printf(" -showJournal: Journal view\n"); | 63 | printf(" -showJournal: Journal view\n"); |
63 | printf(" -showKO: Next Days view\n"); | 64 | printf(" -showKO: Next Days view\n"); |
64 | printf(" -showWNext: What's Next view\n"); | 65 | printf(" -showWNext: What's Next view\n"); |
65 | printf(" -showNextXView: Next X View\n"); | 66 | printf(" -showNextXView: Next X View\n"); |
66 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 67 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
67 | printf(" KO/Pi is exiting now. Bye!\n"); | 68 | printf(" KO/Pi is exiting now. Bye!\n"); |
68 | exitHelp = true; | 69 | exitHelp = true; |
69 | } | 70 | } |
70 | } | 71 | } |
71 | if ( ! exitHelp ) { | 72 | if ( ! exitHelp ) { |
72 | KGlobal::setAppName( "korganizer" ); | 73 | KGlobal::setAppName( "korganizer" ); |
73 | QString fileName ; | 74 | QString fileName ; |
74 | #ifndef DESKTOP_VERSION | 75 | #ifndef DESKTOP_VERSION |
75 | fileName = getenv("QPEDIR"); | 76 | fileName = getenv("QPEDIR"); |
76 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 77 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
77 | #else | 78 | #else |
78 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 79 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
79 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 80 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
80 | #endif | 81 | #endif |
81 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 82 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
82 | MainWindow m; | 83 | MainWindow m; |
83 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
84 | 85 | ||
85 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 86 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
86 | a.showMainWidget(&m ); | 87 | a.showMainWidget(&m ); |
87 | #else | 88 | #else |
88 | a.setMainWidget(&m ); | 89 | a.setMainWidget(&m ); |
89 | m.show(); | 90 | m.show(); |
90 | //m.resize( 800, 600 ); | 91 | //m.resize( 800, 600 ); |
91 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 92 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
92 | #endif | 93 | #endif |
93 | if ( argc > 1 ) { | 94 | if ( argc > 1 ) { |
94 | QCString command = argv[1]; | 95 | QCString command = argv[1]; |
95 | if ( argc > 2 ) | 96 | if ( argc > 2 ) |
96 | command += argv[2]; | 97 | command += argv[2]; |
97 | qApp->processEvents(); | 98 | qApp->processEvents(); |
98 | m.recieve(command, QByteArray() ); | 99 | m.recieve(command, QByteArray() ); |
99 | 100 | ||
100 | } | 101 | } |
101 | 102 | ||
102 | a.exec(); | 103 | a.exec(); |
103 | dumpMissing(); | 104 | dumpMissing(); |
105 | |||
106 | KPimGlobalPrefs::instance()->writeConfig(); | ||
104 | } | 107 | } |
105 | qDebug("KO: Bye! "); | 108 | qDebug("KO: Bye! "); |
106 | } | 109 | } |
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 779b20e..9085673 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -1,634 +1,642 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
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 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | 31 | ||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | 35 | ||
36 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #else | 39 | #else |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
45 | 45 | ||
46 | 46 | ||
47 | #include "externalapphandler.h" | 47 | #include "externalapphandler.h" |
48 | 48 | ||
49 | #include "kpimglobalprefs.h" | 49 | #include "kpimglobalprefs.h" |
50 | 50 | ||
51 | //uncomment line to get debug output | 51 | //uncomment line to get debug output |
52 | //#define DEBUG_EXT_APP_HANDLER | 52 | //#define DEBUG_EXT_APP_HANDLER |
53 | 53 | ||
54 | /********************************************************************************* | 54 | /********************************************************************************* |
55 | * | 55 | * |
56 | ********************************************************************************/ | 56 | ********************************************************************************/ |
57 | 57 | ||
58 | 58 | ||
59 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 59 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
60 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) | 60 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) |
61 | { | 61 | { |
62 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 | 62 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 |
63 | if (_usedSourceParameters == 0) | 63 | if (_usedSourceParameters == 0) |
64 | _sourceMessageParameters = "(QString,QString)"; | 64 | _sourceMessageParameters = "QString,QString)"; |
65 | else if (_usedSourceParameters == 1) | 65 | else if (_usedSourceParameters == 1) |
66 | _sourceMessageParameters = "(QString,QString,QString)"; | 66 | _sourceMessageParameters = "(QString,QString,QString)"; |
67 | else if (_usedSourceParameters == 2) | 67 | else if (_usedSourceParameters == 2) |
68 | _sourceMessageParameters = "(QString,QString,QString,QString)"; | 68 | _sourceMessageParameters = "(QString,QString,QString,QString)"; |
69 | else if (_usedSourceParameters == 3) | 69 | else if (_usedSourceParameters == 3) |
70 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; | 70 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; |
71 | } | 71 | } |
72 | 72 | ||
73 | /*********************************************************************************/ | 73 | /*********************************************************************************/ |
74 | 74 | ||
75 | QCopTransferItem::QCopTransferItem() | 75 | QCopTransferItem::QCopTransferItem() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | /*********************************************************************************/ | 79 | /*********************************************************************************/ |
80 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) | 80 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) |
81 | { | 81 | { |
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | //sourceMessage passes two parameters: sourceChannel, uid | 84 | //sourceMessage passes two parameters: sourceChannel, uid |
85 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; | 85 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; |
86 | #ifdef DEBUG_EXT_APP_HANDLER | 86 | #ifdef DEBUG_EXT_APP_HANDLER |
87 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); | 87 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); |
88 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); | 88 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); | 91 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); |
92 | 92 | ||
93 | e << _sourceChannel << uid; | 93 | e << _sourceChannel << uid; |
94 | 94 | ||
95 | if (_usedSourceParameters == 1) | 95 | if (_usedSourceParameters == 1) |
96 | e << param1; | 96 | e << param1; |
97 | else if (_usedSourceParameters == 2) | 97 | else if (_usedSourceParameters == 2) |
98 | e << param1 << param2; | 98 | e << param1 << param2; |
99 | else if (_usedSourceParameters == 3) | 99 | else if (_usedSourceParameters == 3) |
100 | e << param1 << param2 << param3; | 100 | e << param1 << param2 << param3; |
101 | 101 | ||
102 | qApp->processEvents(); | 102 | qApp->processEvents(); |
103 | 103 | ||
104 | return true; | 104 | return true; |
105 | 105 | ||
106 | #else | 106 | #else |
107 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 107 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
108 | return false; | 108 | return false; |
109 | #endif | 109 | #endif |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | /*********************************************************************************/ | 114 | /*********************************************************************************/ |
115 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) | 115 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) |
116 | { | 116 | { |
117 | 117 | ||
118 | if ( !sourceChannel.isEmpty()) | 118 | if ( !sourceChannel.isEmpty()) |
119 | _sourceChannel = sourceChannel; | 119 | _sourceChannel = sourceChannel; |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | /*********************************************************************************/ | 123 | /*********************************************************************************/ |
124 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 124 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
125 | { | 125 | { |
126 | 126 | ||
127 | // copied from old mail2 | 127 | // copied from old mail2 |
128 | /* | 128 | /* |
129 | static int ii = 0; | 129 | static int ii = 0; |
130 | 130 | ||
131 | // block second call | 131 | // block second call |
132 | if ( ii < 2 ) { | 132 | if ( ii < 2 ) { |
133 | ++ii; | 133 | ++ii; |
134 | if ( ii > 1 ) { | 134 | if ( ii > 1 ) { |
135 | qDebug("qcop call blocked "); | 135 | qDebug("qcop call blocked "); |
136 | return true; | 136 | return true; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | */ | 139 | */ |
140 | 140 | ||
141 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | 141 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); |
142 | 142 | ||
143 | //we are in the target and get a request from the source | 143 | //we are in the target and get a request from the source |
144 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) | 144 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) |
145 | { | 145 | { |
146 | 146 | ||
147 | QDataStream stream( data, IO_ReadOnly ); | 147 | QDataStream stream( data, IO_ReadOnly ); |
148 | 148 | ||
149 | 149 | ||
150 | QString sourceChannel; | 150 | QString sourceChannel; |
151 | QString uid; | 151 | QString uid; |
152 | QString param1; | 152 | QString param1; |
153 | QString param2; | 153 | QString param2; |
154 | QString param3; | 154 | QString param3; |
155 | 155 | ||
156 | stream >> sourceChannel >> uid; | 156 | stream >> sourceChannel >> uid; |
157 | 157 | ||
158 | if (_usedSourceParameters == 0) | 158 | if (_usedSourceParameters == 0) |
159 | { | 159 | { |
160 | emit receivedMessageFromSource(sourceChannel, uid); | 160 | emit receivedMessageFromSource(sourceChannel, uid); |
161 | } | 161 | } |
162 | else if (_usedSourceParameters == 1) | 162 | else if (_usedSourceParameters == 1) |
163 | { | 163 | { |
164 | stream >> param1; | 164 | stream >> param1; |
165 | emit receivedMessageFromSource(sourceChannel, uid, param1); | 165 | emit receivedMessageFromSource(sourceChannel, uid, param1); |
166 | } | 166 | } |
167 | else if (_usedSourceParameters == 2) | 167 | else if (_usedSourceParameters == 2) |
168 | { | 168 | { |
169 | stream >> param1 >> param2; | 169 | stream >> param1 >> param2; |
170 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); | 170 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); |
171 | } | 171 | } |
172 | else if (_usedSourceParameters == 3) | 172 | else if (_usedSourceParameters == 3) |
173 | { | 173 | { |
174 | stream >> param1 >> param2 >> param3; | 174 | stream >> param1 >> param2 >> param3; |
175 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); | 175 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); |
176 | } | 176 | } |
177 | 177 | ||
178 | return true; | 178 | return true; |
179 | } | 179 | } |
180 | 180 | ||
181 | return false; | 181 | return false; |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | /********************************************************************************* | 185 | /********************************************************************************* |
186 | * | 186 | * |
187 | ********************************************************************************/ | 187 | ********************************************************************************/ |
188 | 188 | ||
189 | 189 | ||
190 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 190 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
191 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 191 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
192 | { | 192 | { |
193 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> | 193 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> |
194 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; | 194 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; |
195 | } | 195 | } |
196 | 196 | ||
197 | /*********************************************************************************/ | 197 | /*********************************************************************************/ |
198 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) | 198 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) |
199 | { | 199 | { |
200 | #ifndef DESKTOP_VERSION | 200 | #ifndef DESKTOP_VERSION |
201 | //targetMessage passes two parameters: uid, map | 201 | //targetMessage passes two parameters: uid, map |
202 | QString targetMessage = _targetMessage + _targetMessageParameters; | 202 | QString targetMessage = _targetMessage + _targetMessageParameters; |
203 | 203 | ||
204 | #ifdef DEBUG_EXT_APP_HANDLER | 204 | #ifdef DEBUG_EXT_APP_HANDLER |
205 | qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 205 | qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
206 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); | 206 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); |
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 209 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
210 | //US we need no names in the To field. The emailadresses are enough | 210 | //US we need no names in the To field. The emailadresses are enough |
211 | 211 | ||
212 | e << uid << nameEmailMap; | 212 | e << uid << nameEmailMap; |
213 | 213 | ||
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | 215 | ||
216 | return true; | 216 | return true; |
217 | 217 | ||
218 | #else | 218 | #else |
219 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 219 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
220 | return false; | 220 | return false; |
221 | #endif | 221 | #endif |
222 | 222 | ||
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | /*********************************************************************************/ | 226 | /*********************************************************************************/ |
227 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 227 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
228 | { | 228 | { |
229 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 229 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
230 | 230 | ||
231 | if (res == false) | 231 | if (res == false) |
232 | { | 232 | { |
233 | QDataStream stream( data, IO_ReadOnly ); | 233 | QDataStream stream( data, IO_ReadOnly ); |
234 | 234 | ||
235 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 235 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
236 | 236 | ||
237 | //we are in the source and get an answer from the target | 237 | //we are in the source and get an answer from the target |
238 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 238 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
239 | { | 239 | { |
240 | QMap<QString,QString> adrMap; | 240 | QMap<QString,QString> adrMap; |
241 | QString uid; | 241 | QString uid; |
242 | 242 | ||
243 | stream >> uid >> adrMap; | 243 | stream >> uid >> adrMap; |
244 | 244 | ||
245 | emit receivedMessageFromTarget(uid, adrMap); | 245 | emit receivedMessageFromTarget(uid, adrMap); |
246 | 246 | ||
247 | 247 | ||
248 | return true; | 248 | return true; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | return false; | 252 | return false; |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | /********************************************************************************* | 256 | /********************************************************************************* |
257 | * | 257 | * |
258 | ********************************************************************************/ | 258 | ********************************************************************************/ |
259 | 259 | ||
260 | QCopListTransferItem::~QCopListTransferItem() | ||
261 | { | ||
262 | |||
263 | } | ||
260 | 264 | ||
261 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 265 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
262 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 266 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
263 | { | 267 | { |
264 | //targetMessage returns later two parameters: uid, and three lists | 268 | //targetMessage returns later two parameters: uid, and three lists |
265 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; | 269 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; |
266 | } | 270 | } |
267 | 271 | ||
268 | /*********************************************************************************/ | 272 | /*********************************************************************************/ |
269 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) | 273 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) |
270 | { | 274 | { |
271 | #ifndef DESKTOP_VERSION | 275 | #ifndef DESKTOP_VERSION |
272 | //targetMessage passes two parameters: uid, map | 276 | //targetMessage passes two parameters: uid, map |
273 | QString targetMessage = _targetMessage + _targetMessageParameters; | 277 | QString targetMessage = _targetMessage + _targetMessageParameters; |
274 | 278 | ||
275 | #ifdef DEBUG_EXT_APP_HANDLER | 279 | #ifdef DEBUG_EXT_APP_HANDLER |
276 | qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 280 | qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
277 | qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); | 281 | qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); |
278 | 282 | ||
279 | 283 | ||
280 | for ( int i = 0; i < list3.count(); i++) | 284 | for ( int i = 0; i < list3.count(); i++) |
281 | qDebug("listentry list3: %s",list3[i].latin1()); | 285 | qDebug("listentry list3: %s",list3[i].latin1()); |
282 | #endif | 286 | #endif |
283 | 287 | ||
284 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 288 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
285 | //US we need no names in the To field. The emailadresses are enough | 289 | //US we need no names in the To field. The emailadresses are enough |
286 | 290 | ||
287 | e << uid << list1 << list2 << list3 << list4 << list5 << list6; | 291 | e << uid << list1 << list2 << list3 << list4 << list5 << list6; |
288 | 292 | ||
289 | qApp->processEvents(); | 293 | qApp->processEvents(); |
290 | 294 | ||
291 | return true; | 295 | return true; |
292 | 296 | ||
293 | #else | 297 | #else |
294 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 298 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
295 | return false; | 299 | return false; |
296 | #endif | 300 | #endif |
297 | 301 | ||
298 | } | 302 | } |
299 | 303 | ||
300 | 304 | ||
301 | /*********************************************************************************/ | 305 | /*********************************************************************************/ |
302 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 306 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
303 | { | 307 | { |
304 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 308 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
305 | #ifdef DEBUG_EXT_APP_HANDLER | 309 | #ifdef DEBUG_EXT_APP_HANDLER |
306 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 310 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
307 | #endif | 311 | #endif |
308 | 312 | ||
309 | if (res == false) | 313 | if (res == false) |
310 | { | 314 | { |
311 | QDataStream stream( data, IO_ReadOnly ); | 315 | QDataStream stream( data, IO_ReadOnly ); |
312 | 316 | ||
313 | #ifdef DEBUG_EXT_APP_HANDLER | 317 | #ifdef DEBUG_EXT_APP_HANDLER |
314 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 318 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
315 | #endif | 319 | #endif |
316 | 320 | ||
317 | //we are in the source and get an answer from the target | 321 | //we are in the source and get an answer from the target |
318 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 322 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
319 | { | 323 | { |
320 | QStringList list1; | 324 | QStringList list1; |
321 | QStringList list2; | 325 | QStringList list2; |
322 | QStringList list3; | 326 | QStringList list3; |
323 | QStringList list4; | 327 | QStringList list4; |
324 | QStringList list5; | 328 | QStringList list5; |
325 | QStringList list6; | 329 | QStringList list6; |
326 | QString uid; | 330 | QString uid; |
327 | 331 | ||
328 | #ifdef DEBUG_EXT_APP_HANDLER | 332 | #ifdef DEBUG_EXT_APP_HANDLER |
329 | qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 333 | qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
330 | #endif | 334 | #endif |
331 | 335 | ||
332 | stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; | 336 | stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; |
333 | emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); | 337 | emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); |
334 | 338 | ||
335 | 339 | ||
336 | return true; | 340 | return true; |
337 | } | 341 | } |
338 | } | 342 | } |
339 | 343 | ||
340 | return false; | 344 | return false; |
341 | } | 345 | } |
342 | 346 | ||
343 | 347 | ||
344 | 348 | ||
345 | /********************************************************************************* | 349 | /********************************************************************************* |
346 | * | 350 | * |
347 | ********************************************************************************/ | 351 | ********************************************************************************/ |
348 | 352 | ||
349 | 353 | ||
350 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; | 354 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; |
351 | static KStaticDeleter<ExternalAppHandler> staticDeleter; | 355 | static KStaticDeleter<ExternalAppHandler> staticDeleter; |
352 | 356 | ||
353 | ExternalAppHandler::ExternalAppHandler() | 357 | ExternalAppHandler::ExternalAppHandler() |
354 | { | 358 | { |
355 | mDefaultItems.setAutoDelete(true); | 359 | mDefaultItems.setAutoDelete(true); |
356 | 360 | ||
357 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); | 361 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); |
358 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); | 362 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); |
359 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 363 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
360 | 364 | ||
361 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); | 365 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); |
362 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); | 366 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); |
363 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 367 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
364 | 368 | ||
365 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); | 369 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); |
366 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 370 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
367 | 371 | ||
368 | 372 | ||
369 | 373 | ||
370 | mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); | 374 | mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); |
371 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); | 375 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); |
372 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 376 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
373 | 377 | ||
374 | 378 | ||
375 | } | 379 | } |
376 | 380 | ||
377 | ExternalAppHandler::~ExternalAppHandler() | 381 | ExternalAppHandler::~ExternalAppHandler() |
378 | { | 382 | { |
383 | delete mNameEmailUidListFromKAPITransfer; | ||
384 | //delete mFindByEmailFromKAPITransfer; | ||
385 | delete mDisplayDetails; | ||
386 | delete mBirthdayListFromKAPITransfer; | ||
379 | } | 387 | } |
380 | 388 | ||
381 | void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, | 389 | void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, |
382 | const QStringList& nameList, | 390 | const QStringList& nameList, |
383 | const QStringList& emailList, | 391 | const QStringList& emailList, |
384 | const QStringList& uidList, | 392 | const QStringList& uidList, |
385 | const QStringList&, | 393 | const QStringList&, |
386 | const QStringList&, | 394 | const QStringList&, |
387 | const QStringList& ) | 395 | const QStringList& ) |
388 | { | 396 | { |
389 | // this method is a conevnient way to reduce the number of parameters I have to pass | 397 | // this method is a conevnient way to reduce the number of parameters I have to pass |
390 | emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); | 398 | emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); |
391 | } | 399 | } |
392 | 400 | ||
393 | 401 | ||
394 | void ExternalAppHandler::loadConfig() | 402 | void ExternalAppHandler::loadConfig() |
395 | { | 403 | { |
396 | 404 | ||
397 | mDefaultItems.clear(); | 405 | mDefaultItems.clear(); |
398 | mEmailAppAvailable = UNDEFINED; | 406 | mEmailAppAvailable = UNDEFINED; |
399 | mPhoneAppAvailable = UNDEFINED; | 407 | mPhoneAppAvailable = UNDEFINED; |
400 | mFaxAppAvailable = UNDEFINED; | 408 | mFaxAppAvailable = UNDEFINED; |
401 | mSMSAppAvailable = UNDEFINED; | 409 | mSMSAppAvailable = UNDEFINED; |
402 | mPagerAppAvailable = UNDEFINED; | 410 | mPagerAppAvailable = UNDEFINED; |
403 | mSIPAppAvailable = UNDEFINED; | 411 | mSIPAppAvailable = UNDEFINED; |
404 | 412 | ||
405 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 413 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); |
406 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 414 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); |
407 | 415 | ||
408 | if (opiepath.isEmpty()) | 416 | if (opiepath.isEmpty()) |
409 | opiepath = qtopiapath; | 417 | opiepath = qtopiapath; |
410 | 418 | ||
411 | //mailclients | 419 | //mailclients |
412 | QString mailmsg1 = "writeMail(QString,QString)"; | 420 | QString mailmsg1 = "writeMail(QString,QString)"; |
413 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; | 421 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; |
414 | 422 | ||
415 | QString undefined = ""; | 423 | QString undefined = ""; |
416 | 424 | ||
417 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); | 425 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); |
418 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); | 426 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); |
419 | 427 | ||
420 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 428 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
421 | ( QFile::exists( opiepath + "/bin/ompi" ))) | 429 | ( QFile::exists( opiepath + "/bin/ompi" ))) |
422 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 430 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
423 | 431 | ||
424 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) | 432 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) |
425 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 433 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
426 | 434 | ||
427 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | 435 | if ( QFile::exists( opiepath + "/bin/opiemail" )) |
428 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 436 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
429 | 437 | ||
430 | 438 | ||
431 | 439 | ||
432 | //phoneclients | 440 | //phoneclients |
433 | 441 | ||
434 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); | 442 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); |
435 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); | 443 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); |
436 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 444 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
437 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 445 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
438 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 446 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
439 | 447 | ||
440 | //faxclients | 448 | //faxclients |
441 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); | 449 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); |
442 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); | 450 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); |
443 | 451 | ||
444 | //smsclients | 452 | //smsclients |
445 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); | 453 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); |
446 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); | 454 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); |
447 | 455 | ||
448 | //pagerclients | 456 | //pagerclients |
449 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); | 457 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); |
450 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); | 458 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); |
451 | 459 | ||
452 | //sipclients | 460 | //sipclients |
453 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); | 461 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); |
454 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); | 462 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); |
455 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 463 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
456 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 464 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
457 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 465 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
458 | 466 | ||
459 | } | 467 | } |
460 | 468 | ||
461 | ExternalAppHandler *ExternalAppHandler::instance() | 469 | ExternalAppHandler *ExternalAppHandler::instance() |
462 | { | 470 | { |
463 | if ( !sInstance ) { | 471 | if ( !sInstance ) { |
464 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); | 472 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); |
465 | sInstance->loadConfig(); | 473 | sInstance->loadConfig(); |
466 | } | 474 | } |
467 | 475 | ||
468 | return sInstance; | 476 | return sInstance; |
469 | } | 477 | } |
470 | 478 | ||
471 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) | 479 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) |
472 | { | 480 | { |
473 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); | 481 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); |
474 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); | 482 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); |
475 | mDefaultItems.append(dai); | 483 | mDefaultItems.append(dai); |
476 | } | 484 | } |
477 | 485 | ||
478 | 486 | ||
479 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) | 487 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) |
480 | { | 488 | { |
481 | QList<DefaultAppItem> list; | 489 | QList<DefaultAppItem> list; |
482 | 490 | ||
483 | DefaultAppItem* dai; | 491 | DefaultAppItem* dai; |
484 | 492 | ||
485 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 493 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
486 | { | 494 | { |
487 | if (dai->_type == type) | 495 | if (dai->_type == type) |
488 | list.append(dai); | 496 | list.append(dai); |
489 | } | 497 | } |
490 | 498 | ||
491 | return list; | 499 | return list; |
492 | } | 500 | } |
493 | 501 | ||
494 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | 502 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) |
495 | { | 503 | { |
496 | DefaultAppItem* dai; | 504 | DefaultAppItem* dai; |
497 | 505 | ||
498 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 506 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
499 | { | 507 | { |
500 | if (dai->_type == type && dai->_id == clientid) | 508 | if (dai->_type == type && dai->_id == clientid) |
501 | return dai; | 509 | return dai; |
502 | } | 510 | } |
503 | 511 | ||
504 | return 0; | 512 | return 0; |
505 | } | 513 | } |
506 | 514 | ||
507 | bool ExternalAppHandler::isEmailAppAvailable() | 515 | bool ExternalAppHandler::isEmailAppAvailable() |
508 | { | 516 | { |
509 | #ifndef DESKTOP_VERSION | 517 | #ifndef DESKTOP_VERSION |
510 | if (mEmailAppAvailable == UNDEFINED) | 518 | if (mEmailAppAvailable == UNDEFINED) |
511 | { | 519 | { |
512 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 520 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
513 | if (client == KPimGlobalPrefs::NONE_EMC) | 521 | if (client == KPimGlobalPrefs::NONE_EMC) |
514 | mEmailAppAvailable = UNAVAILABLE; | 522 | mEmailAppAvailable = UNAVAILABLE; |
515 | else | 523 | else |
516 | mEmailAppAvailable = AVAILABLE; | 524 | mEmailAppAvailable = AVAILABLE; |
517 | } | 525 | } |
518 | return (mEmailAppAvailable == AVAILABLE); | 526 | return (mEmailAppAvailable == AVAILABLE); |
519 | 527 | ||
520 | #else //DESKTOP_VERSION | 528 | #else //DESKTOP_VERSION |
521 | return false; | 529 | return false; |
522 | #endif //DESKTOP_VERSION | 530 | #endif //DESKTOP_VERSION |
523 | } | 531 | } |
524 | 532 | ||
525 | bool ExternalAppHandler::isSMSAppAvailable() | 533 | bool ExternalAppHandler::isSMSAppAvailable() |
526 | { | 534 | { |
527 | #ifndef DESKTOP_VERSION | 535 | #ifndef DESKTOP_VERSION |
528 | if (mSMSAppAvailable == UNDEFINED) | 536 | if (mSMSAppAvailable == UNDEFINED) |
529 | { | 537 | { |
530 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 538 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
531 | if (client == KPimGlobalPrefs::NONE_SMC) | 539 | if (client == KPimGlobalPrefs::NONE_SMC) |
532 | mSMSAppAvailable = UNAVAILABLE; | 540 | mSMSAppAvailable = UNAVAILABLE; |
533 | else | 541 | else |
534 | mSMSAppAvailable = AVAILABLE; | 542 | mSMSAppAvailable = AVAILABLE; |
535 | } | 543 | } |
536 | 544 | ||
537 | return (mSMSAppAvailable == AVAILABLE); | 545 | return (mSMSAppAvailable == AVAILABLE); |
538 | #else //DESKTOP_VERSION | 546 | #else //DESKTOP_VERSION |
539 | return false; | 547 | return false; |
540 | #endif //DESKTOP_VERSION | 548 | #endif //DESKTOP_VERSION |
541 | } | 549 | } |
542 | 550 | ||
543 | bool ExternalAppHandler::isPhoneAppAvailable() | 551 | bool ExternalAppHandler::isPhoneAppAvailable() |
544 | { | 552 | { |
545 | #ifndef DESKTOP_VERSION | 553 | #ifndef DESKTOP_VERSION |
546 | if (mPhoneAppAvailable == UNDEFINED) | 554 | if (mPhoneAppAvailable == UNDEFINED) |
547 | { | 555 | { |
548 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 556 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
549 | if (client == KPimGlobalPrefs::NONE_PHC) | 557 | if (client == KPimGlobalPrefs::NONE_PHC) |
550 | mPhoneAppAvailable = UNAVAILABLE; | 558 | mPhoneAppAvailable = UNAVAILABLE; |
551 | else | 559 | else |
552 | mPhoneAppAvailable = AVAILABLE; | 560 | mPhoneAppAvailable = AVAILABLE; |
553 | } | 561 | } |
554 | 562 | ||
555 | return (mPhoneAppAvailable == AVAILABLE); | 563 | return (mPhoneAppAvailable == AVAILABLE); |
556 | #else //DESKTOP_VERSION | 564 | #else //DESKTOP_VERSION |
557 | return false; | 565 | return false; |
558 | #endif //DESKTOP_VERSION | 566 | #endif //DESKTOP_VERSION |
559 | } | 567 | } |
560 | 568 | ||
561 | bool ExternalAppHandler::isFaxAppAvailable() | 569 | bool ExternalAppHandler::isFaxAppAvailable() |
562 | { | 570 | { |
563 | #ifndef DESKTOP_VERSION | 571 | #ifndef DESKTOP_VERSION |
564 | if (mFaxAppAvailable == UNDEFINED) | 572 | if (mFaxAppAvailable == UNDEFINED) |
565 | { | 573 | { |
566 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 574 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
567 | if (client == KPimGlobalPrefs::NONE_FAC) | 575 | if (client == KPimGlobalPrefs::NONE_FAC) |
568 | mFaxAppAvailable = UNAVAILABLE; | 576 | mFaxAppAvailable = UNAVAILABLE; |
569 | else | 577 | else |
570 | mFaxAppAvailable = AVAILABLE; | 578 | mFaxAppAvailable = AVAILABLE; |
571 | } | 579 | } |
572 | 580 | ||
573 | return (mFaxAppAvailable == AVAILABLE); | 581 | return (mFaxAppAvailable == AVAILABLE); |
574 | #else //DESKTOP_VERSION | 582 | #else //DESKTOP_VERSION |
575 | return false; | 583 | return false; |
576 | #endif //DESKTOP_VERSION | 584 | #endif //DESKTOP_VERSION |
577 | } | 585 | } |
578 | 586 | ||
579 | bool ExternalAppHandler::isPagerAppAvailable() | 587 | bool ExternalAppHandler::isPagerAppAvailable() |
580 | { | 588 | { |
581 | #ifndef DESKTOP_VERSION | 589 | #ifndef DESKTOP_VERSION |
582 | if (mPagerAppAvailable == UNDEFINED) | 590 | if (mPagerAppAvailable == UNDEFINED) |
583 | { | 591 | { |
584 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 592 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
585 | if (client == KPimGlobalPrefs::NONE_PAC) | 593 | if (client == KPimGlobalPrefs::NONE_PAC) |
586 | mPagerAppAvailable = UNAVAILABLE; | 594 | mPagerAppAvailable = UNAVAILABLE; |
587 | else | 595 | else |
588 | mPagerAppAvailable = AVAILABLE; | 596 | mPagerAppAvailable = AVAILABLE; |
589 | } | 597 | } |
590 | 598 | ||
591 | return (mPagerAppAvailable == AVAILABLE); | 599 | return (mPagerAppAvailable == AVAILABLE); |
592 | #else //DESKTOP_VERSION | 600 | #else //DESKTOP_VERSION |
593 | return false; | 601 | return false; |
594 | #endif //DESKTOP_VERSION | 602 | #endif //DESKTOP_VERSION |
595 | } | 603 | } |
596 | 604 | ||
597 | 605 | ||
598 | bool ExternalAppHandler::isSIPAppAvailable() | 606 | bool ExternalAppHandler::isSIPAppAvailable() |
599 | { | 607 | { |
600 | #ifndef DESKTOP_VERSION | 608 | #ifndef DESKTOP_VERSION |
601 | if (mSIPAppAvailable == UNDEFINED) | 609 | if (mSIPAppAvailable == UNDEFINED) |
602 | { | 610 | { |
603 | int client = KPimGlobalPrefs::instance()->mSipClient; | 611 | int client = KPimGlobalPrefs::instance()->mSipClient; |
604 | if (client == KPimGlobalPrefs::NONE_SIC) | 612 | if (client == KPimGlobalPrefs::NONE_SIC) |
605 | mSIPAppAvailable = UNAVAILABLE; | 613 | mSIPAppAvailable = UNAVAILABLE; |
606 | else | 614 | else |
607 | mSIPAppAvailable = AVAILABLE; | 615 | mSIPAppAvailable = AVAILABLE; |
608 | } | 616 | } |
609 | 617 | ||
610 | return (mSIPAppAvailable == AVAILABLE); | 618 | return (mSIPAppAvailable == AVAILABLE); |
611 | #else //DESKTOP_VERSION | 619 | #else //DESKTOP_VERSION |
612 | return false; | 620 | return false; |
613 | #endif //DESKTOP_VERSION | 621 | #endif //DESKTOP_VERSION |
614 | } | 622 | } |
615 | 623 | ||
616 | /************************************************************************** | 624 | /************************************************************************** |
617 | * | 625 | * |
618 | **************************************************************************/ | 626 | **************************************************************************/ |
619 | 627 | ||
620 | 628 | ||
621 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) | 629 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) |
622 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) | 630 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) |
623 | { | 631 | { |
624 | 632 | ||
625 | #ifndef DESKTOP_VERSION | 633 | #ifndef DESKTOP_VERSION |
626 | QString channel; | 634 | QString channel; |
627 | QString message2; | 635 | QString message2; |
628 | QString parameters2; | 636 | QString parameters2; |
629 | 637 | ||
630 | 638 | ||
631 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 639 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
632 | if (client == KPimGlobalPrefs::OTHER_EMC) | 640 | if (client == KPimGlobalPrefs::OTHER_EMC) |
633 | { | 641 | { |
634 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 642 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 4c6f1ea..6f5d345 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -1,291 +1,291 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
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 | #ifndef EXTERNALAPPHANDLER_H | 31 | #ifndef EXTERNALAPPHANDLER_H |
32 | #define EXTERNALAPPHANDLER_H | 32 | #define EXTERNALAPPHANDLER_H |
33 | 33 | ||
34 | #include <qobject.h> | 34 | #include <qobject.h> |
35 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | 37 | ||
38 | class QCopEnvelope; | 38 | class QCopEnvelope; |
39 | 39 | ||
40 | 40 | ||
41 | class ExternalAppHandler; | 41 | class ExternalAppHandler; |
42 | class QCopTransferItem : public QObject | 42 | class QCopTransferItem : public QObject |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | 46 | QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); |
47 | QCopTransferItem(); | 47 | QCopTransferItem(); |
48 | 48 | ||
49 | bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); | 49 | bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); |
50 | 50 | ||
51 | void setSourceChannel(const QString& sourceChannel); | 51 | void setSourceChannel(const QString& sourceChannel); |
52 | 52 | ||
53 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 53 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); |
54 | 54 | ||
55 | 55 | ||
56 | signals: | 56 | signals: |
57 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid); | 57 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid); |
58 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); | 58 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); |
59 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2); | 59 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2); |
60 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3); | 60 | void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3); |
61 | 61 | ||
62 | public: | 62 | public: |
63 | int _usedSourceParameters; | 63 | int _usedSourceParameters; |
64 | QString _sourceChannel; | 64 | QString _sourceChannel; |
65 | QString _sourceMessage; | 65 | QString _sourceMessage; |
66 | QString _sourceMessageParameters; | 66 | QString _sourceMessageParameters; |
67 | QString _targetChannel; | 67 | QString _targetChannel; |
68 | QString _targetMessage; | 68 | QString _targetMessage; |
69 | QString _targetMessageParameters; | 69 | QString _targetMessageParameters; |
70 | 70 | ||
71 | }; | 71 | }; |
72 | 72 | ||
73 | /********************************************************************************* | 73 | /********************************************************************************* |
74 | * | 74 | * |
75 | ********************************************************************************/ | 75 | ********************************************************************************/ |
76 | 76 | ||
77 | class QCopMapTransferItem : public QCopTransferItem | 77 | class QCopMapTransferItem : public QCopTransferItem |
78 | { | 78 | { |
79 | Q_OBJECT | 79 | Q_OBJECT |
80 | public: | 80 | public: |
81 | QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | 81 | QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); |
82 | 82 | ||
83 | bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); | 83 | bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); |
84 | 84 | ||
85 | 85 | ||
86 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 86 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); |
87 | 87 | ||
88 | 88 | ||
89 | signals: | 89 | signals: |
90 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); | 90 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); |
91 | 91 | ||
92 | }; | 92 | }; |
93 | 93 | ||
94 | /********************************************************************************* | 94 | /********************************************************************************* |
95 | * | 95 | * |
96 | ********************************************************************************/ | 96 | ********************************************************************************/ |
97 | 97 | ||
98 | class QCopListTransferItem : public QCopTransferItem | 98 | class QCopListTransferItem : public QCopTransferItem |
99 | { | 99 | { |
100 | Q_OBJECT | 100 | Q_OBJECT |
101 | public: | 101 | public: |
102 | QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | 102 | QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); |
103 | 103 | ~QCopListTransferItem(); | |
104 | bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); | 104 | bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); |
105 | 105 | ||
106 | 106 | ||
107 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 107 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); |
108 | 108 | ||
109 | 109 | ||
110 | signals: | 110 | signals: |
111 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); | 111 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); |
112 | 112 | ||
113 | }; | 113 | }; |
114 | 114 | ||
115 | /********************************************************************************* | 115 | /********************************************************************************* |
116 | * | 116 | * |
117 | ********************************************************************************/ | 117 | ********************************************************************************/ |
118 | 118 | ||
119 | 119 | ||
120 | class DefaultAppItem | 120 | class DefaultAppItem |
121 | { | 121 | { |
122 | public: | 122 | public: |
123 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) | 123 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) |
124 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) | 124 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) |
125 | {} | 125 | {} |
126 | 126 | ||
127 | DefaultAppItem() | 127 | DefaultAppItem() |
128 | { } | 128 | { } |
129 | 129 | ||
130 | public: | 130 | public: |
131 | int _type; | 131 | int _type; |
132 | int _id; | 132 | int _id; |
133 | QString _label; | 133 | QString _label; |
134 | QString _channel; | 134 | QString _channel; |
135 | QString _message; | 135 | QString _message; |
136 | QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; | 136 | QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; |
137 | QString _message2; | 137 | QString _message2; |
138 | QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; | 138 | QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; |
139 | 139 | ||
140 | }; | 140 | }; |
141 | 141 | ||
142 | /********************************************************************************* | 142 | /********************************************************************************* |
143 | * | 143 | * |
144 | ********************************************************************************/ | 144 | ********************************************************************************/ |
145 | 145 | ||
146 | class ExternalAppHandler : public QObject | 146 | class ExternalAppHandler : public QObject |
147 | { | 147 | { |
148 | Q_OBJECT | 148 | Q_OBJECT |
149 | public: | 149 | public: |
150 | virtual ~ExternalAppHandler(); | 150 | virtual ~ExternalAppHandler(); |
151 | 151 | ||
152 | static ExternalAppHandler *instance(); | 152 | static ExternalAppHandler *instance(); |
153 | 153 | ||
154 | enum Types { | 154 | enum Types { |
155 | EMAIL = 0, | 155 | EMAIL = 0, |
156 | PHONE = 1, | 156 | PHONE = 1, |
157 | SMS = 2, | 157 | SMS = 2, |
158 | FAX = 3, | 158 | FAX = 3, |
159 | PAGER = 4, | 159 | PAGER = 4, |
160 | SIP = 5 | 160 | SIP = 5 |
161 | }; | 161 | }; |
162 | 162 | ||
163 | enum Availability { | 163 | enum Availability { |
164 | UNDEFINED = -1, | 164 | UNDEFINED = -1, |
165 | UNAVAILABLE = 0, | 165 | UNAVAILABLE = 0, |
166 | AVAILABLE = 1 | 166 | AVAILABLE = 1 |
167 | }; | 167 | }; |
168 | 168 | ||
169 | //calls the emailapplication with a number of attachments that need to be send. | 169 | //calls the emailapplication with a number of attachments that need to be send. |
170 | //either parameter can be left empty. | 170 | //either parameter can be left empty. |
171 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); | 171 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); |
172 | 172 | ||
173 | //calls the emailapplication and creates a mail with parameter emailadress as recipients | 173 | //calls the emailapplication and creates a mail with parameter emailadress as recipients |
174 | bool mailToOneContact( const QString& name, const QString& emailadress ); | 174 | bool mailToOneContact( const QString& name, const QString& emailadress ); |
175 | 175 | ||
176 | //calls the emailapplication and creates a mail with parameter as recipients | 176 | //calls the emailapplication and creates a mail with parameter as recipients |
177 | // parameters format is | 177 | // parameters format is |
178 | // NAME <EMAIL>:SUBJECT | 178 | // NAME <EMAIL>:SUBJECT |
179 | bool mailToOneContact( const QString& adressline ); | 179 | bool mailToOneContact( const QString& adressline ); |
180 | 180 | ||
181 | //calls the phoneapplication with the number | 181 | //calls the phoneapplication with the number |
182 | bool callByPhone( const QString& phonenumber ); | 182 | bool callByPhone( const QString& phonenumber ); |
183 | 183 | ||
184 | //calls the smsapplication with the number | 184 | //calls the smsapplication with the number |
185 | bool callBySMS( const QString& phonenumber ); | 185 | bool callBySMS( const QString& phonenumber ); |
186 | 186 | ||
187 | //calls the pagerapplication with the number | 187 | //calls the pagerapplication with the number |
188 | bool callByPager( const QString& pagernumber ); | 188 | bool callByPager( const QString& pagernumber ); |
189 | 189 | ||
190 | //calls the faxapplication with the number | 190 | //calls the faxapplication with the number |
191 | bool callByFax( const QString& faxnumber ); | 191 | bool callByFax( const QString& faxnumber ); |
192 | 192 | ||
193 | //calls the sipapplication with the number | 193 | //calls the sipapplication with the number |
194 | bool callBySIP( const QString& sipnumber ); | 194 | bool callBySIP( const QString& sipnumber ); |
195 | 195 | ||
196 | bool isEmailAppAvailable(); | 196 | bool isEmailAppAvailable(); |
197 | bool isSMSAppAvailable(); | 197 | bool isSMSAppAvailable(); |
198 | bool isPhoneAppAvailable(); | 198 | bool isPhoneAppAvailable(); |
199 | bool isFaxAppAvailable(); | 199 | bool isFaxAppAvailable(); |
200 | bool isPagerAppAvailable(); | 200 | bool isPagerAppAvailable(); |
201 | bool isSIPAppAvailable(); | 201 | bool isSIPAppAvailable(); |
202 | 202 | ||
203 | 203 | ||
204 | //Call this method on the source when you want to select names from the addressbook by using QCop | 204 | //Call this method on the source when you want to select names from the addressbook by using QCop |
205 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); | 205 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); |
206 | //Call this method on the target when you want to return the name/email map to the source (client). | 206 | //Call this method on the target when you want to return the name/email map to the source (client). |
207 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); | 207 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); | 211 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); |
212 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); | 212 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); |
213 | 213 | ||
214 | bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); | 214 | bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); |
215 | 215 | ||
216 | 216 | ||
217 | 217 | ||
218 | bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); | 218 | bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); |
219 | bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, | 219 | bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, |
220 | const QStringList& birthdayList, const QStringList& anniversaryList, | 220 | const QStringList& birthdayList, const QStringList& anniversaryList, |
221 | const QStringList& realNameList, const QStringList& emailList, | 221 | const QStringList& realNameList, const QStringList& emailList, |
222 | const QStringList& assembledNameList, const QStringList& uidList); | 222 | const QStringList& assembledNameList, const QStringList& uidList); |
223 | 223 | ||
224 | 224 | ||
225 | //loadConfig clears the cache and checks again if the applications are available or not | 225 | //loadConfig clears the cache and checks again if the applications are available or not |
226 | void loadConfig(); | 226 | void loadConfig(); |
227 | 227 | ||
228 | QList<DefaultAppItem> getAvailableDefaultItems(Types); | 228 | QList<DefaultAppItem> getAvailableDefaultItems(Types); |
229 | DefaultAppItem* getDefaultItem(Types, int); | 229 | DefaultAppItem* getDefaultItem(Types, int); |
230 | 230 | ||
231 | public slots: | 231 | public slots: |
232 | void appMessage( const QCString& msg, const QByteArray& data ); | 232 | void appMessage( const QCString& msg, const QByteArray& data ); |
233 | 233 | ||
234 | 234 | ||
235 | signals: | 235 | signals: |
236 | // Emmitted when the target app receives a request from the source app | 236 | // Emmitted when the target app receives a request from the source app |
237 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); | 237 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); |
238 | 238 | ||
239 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi | 239 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi |
240 | // The first parameter is a uniqueid. It can be used to identify the event | 240 | // The first parameter is a uniqueid. It can be used to identify the event |
241 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 241 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
242 | 242 | ||
243 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); | 243 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); |
244 | void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 244 | void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
245 | 245 | ||
246 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 246 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
247 | 247 | ||
248 | 248 | ||
249 | // Emmitted when the target app receives a request from the source app | 249 | // Emmitted when the target app receives a request from the source app |
250 | void requestForBirthdayList(const QString& sourceChannel, const QString& uid); | 250 | void requestForBirthdayList(const QString& sourceChannel, const QString& uid); |
251 | 251 | ||
252 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi | 252 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi |
253 | // The first parameter is a uniqueid. It can be used to identify the event | 253 | // The first parameter is a uniqueid. It can be used to identify the event |
254 | void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, | 254 | void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, |
255 | const QStringList& anniversaryList, const QStringList& realNameList, | 255 | const QStringList& anniversaryList, const QStringList& realNameList, |
256 | const QStringList& emailList, const QStringList& assembledNameList, | 256 | const QStringList& emailList, const QStringList& assembledNameList, |
257 | const QStringList& uidList); | 257 | const QStringList& uidList); |
258 | 258 | ||
259 | 259 | ||
260 | private: | 260 | private: |
261 | ExternalAppHandler(); | 261 | ExternalAppHandler(); |
262 | QList<DefaultAppItem> mDefaultItems; | 262 | QList<DefaultAppItem> mDefaultItems; |
263 | 263 | ||
264 | Availability mEmailAppAvailable; | 264 | Availability mEmailAppAvailable; |
265 | Availability mPhoneAppAvailable; | 265 | Availability mPhoneAppAvailable; |
266 | Availability mFaxAppAvailable; | 266 | Availability mFaxAppAvailable; |
267 | Availability mSMSAppAvailable; | 267 | Availability mSMSAppAvailable; |
268 | Availability mPagerAppAvailable; | 268 | Availability mPagerAppAvailable; |
269 | Availability mSIPAppAvailable; | 269 | Availability mSIPAppAvailable; |
270 | 270 | ||
271 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; | 271 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; |
272 | QCopListTransferItem* mFindByEmailFromKAPITransfer; | 272 | QCopListTransferItem* mFindByEmailFromKAPITransfer; |
273 | QCopTransferItem* mDisplayDetails; | 273 | QCopTransferItem* mDisplayDetails; |
274 | QCopListTransferItem* mBirthdayListFromKAPITransfer; | 274 | QCopListTransferItem* mBirthdayListFromKAPITransfer; |
275 | 275 | ||
276 | 276 | ||
277 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); | 277 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); |
278 | 278 | ||
279 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; | 279 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; |
280 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; | 280 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; |
281 | 281 | ||
282 | 282 | ||
283 | static ExternalAppHandler *sInstance; | 283 | static ExternalAppHandler *sInstance; |
284 | 284 | ||
285 | private slots: | 285 | private slots: |
286 | void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); | 286 | void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); |
287 | 287 | ||
288 | }; | 288 | }; |
289 | 289 | ||
290 | 290 | ||
291 | #endif | 291 | #endif |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 3771569..0fdc3e4 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -1,205 +1,204 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
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 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | #include <kconfig.h> | 32 | #include <kconfig.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <kstaticdeleter.h> | 35 | #include <kstaticdeleter.h> |
36 | 36 | ||
37 | #include <qregexp.h> | 37 | #include <qregexp.h> |
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qtextstream.h> | 39 | #include <qtextstream.h> |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #include "kpimglobalprefs.h" | 41 | #include "kpimglobalprefs.h" |
42 | 42 | ||
43 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; | 43 | KPimGlobalPrefs *KPimGlobalPrefs::sInstance = 0; |
44 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; | 44 | static KStaticDeleter<KPimGlobalPrefs> staticDeleterGP; |
45 | 45 | ||
46 | 46 | ||
47 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) | 47 | KPimGlobalPrefs::KPimGlobalPrefs( const QString &name ) |
48 | : KPrefs("microkdeglobalrc") | 48 | : KPrefs("microkdeglobalrc") |
49 | { | 49 | { |
50 | mLocaleDict = 0; | 50 | mLocaleDict = 0; |
51 | KPrefs::setCurrentGroup("Locale"); | 51 | KPrefs::setCurrentGroup("Locale"); |
52 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); | 52 | addItemInt("PreferredLanguage",&mPreferredLanguage,0); |
53 | addItemInt("PreferredTime",&mPreferredTime,0); | 53 | addItemInt("PreferredTime",&mPreferredTime,0); |
54 | addItemInt("PreferredDate",&mPreferredDate,0); | 54 | addItemInt("PreferredDate",&mPreferredDate,0); |
55 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); | 55 | addItemBool("WeekStartsOnSunday",&mWeekStartsOnSunday,false); |
56 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); | 56 | addItemString("UserDateFormatLong", &mUserDateFormatLong, "%A %d %b %y"); |
57 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); | 57 | addItemString("UserDateFormatShort", &mUserDateFormatShort, "%aK %d.%m.%y"); |
58 | 58 | ||
59 | KPrefs::setCurrentGroup("Time & Date"); | 59 | KPrefs::setCurrentGroup("Time & Date"); |
60 | 60 | ||
61 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); | 61 | addItemString("TimeZoneName",&mTimeZoneId, ("+01:00 Europe/Oslo(CET)") ); |
62 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); | 62 | addItemBool("UseDaylightsaving",&mUseDaylightsaving,true); |
63 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); | 63 | addItemBool("TimeZoneAdd30min",&mTimeZoneAdd30min,false); |
64 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); | 64 | addItemInt("DaylightsavingStart",&mDaylightsavingStart,90); |
65 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); | 65 | addItemInt("DaylightsavingEnd",&mDaylightsavingEnd,304); |
66 | 66 | ||
67 | KPrefs::setCurrentGroup( "ExternalApplications" ); | 67 | KPrefs::setCurrentGroup( "ExternalApplications" ); |
68 | 68 | ||
69 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); | 69 | addItemInt( "EmailChannelType", &mEmailClient, OMPI_EMC ); |
70 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); | 70 | addItemString( "EmailChannel", &mEmailOtherChannel, "" ); |
71 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); | 71 | addItemString( "EmailChannelMessage", &mEmailOtherMessage, "" ); |
72 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); | 72 | addItemString( "EmailChannelParameters", &mEmailOtherMessageParameters, "" ); |
73 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); | 73 | addItemString( "EmailChannelMessage2", &mEmailOtherMessage2, "" ); |
74 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); | 74 | addItemString( "EmailChannelParameters2", &mEmailOtherMessageParameters2, "" ); |
75 | 75 | ||
76 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); | 76 | addItemInt( "PhoneChannelType", &mPhoneClient, KPPI_PHC ); |
77 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); | 77 | addItemString( "PhoneChannel", &mPhoneOtherChannel, "" ); |
78 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); | 78 | addItemString( "PhoneChannelMessage", &mPhoneOtherMessage, "" ); |
79 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); | 79 | addItemString( "PhoneChannelParameters", &mPhoneOtherMessageParameters, "" ); |
80 | 80 | ||
81 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); | 81 | addItemInt( "FaxChannelType", &mFaxClient, NONE_FAC ); |
82 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); | 82 | addItemString( "FaxChannel", &mFaxOtherChannel, "" ); |
83 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); | 83 | addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); |
84 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); | 84 | addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); |
85 | 85 | ||
86 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); | 86 | addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); |
87 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); | 87 | addItemString( "SMSChannel", &mSMSOtherChannel, "" ); |
88 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); | 88 | addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); |
89 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); | 89 | addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); |
90 | 90 | ||
91 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); | 91 | addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); |
92 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); | 92 | addItemString( "PagerChannel", &mPagerOtherChannel, "" ); |
93 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); | 93 | addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); |
94 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); | 94 | addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); |
95 | 95 | ||
96 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); | 96 | addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); |
97 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); | 97 | addItemString( "SIPChannel", &mSipOtherChannel, "" ); |
98 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); | 98 | addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); |
99 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); | 99 | addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); |
100 | 100 | ||
101 | KPrefs::setCurrentGroup( "PhoneAccess" ); | 101 | KPrefs::setCurrentGroup( "PhoneAccess" ); |
102 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); | 102 | addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); |
103 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); | 103 | addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); |
104 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); | 104 | addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); |
105 | 105 | ||
106 | } | 106 | } |
107 | 107 | ||
108 | void KPimGlobalPrefs::setGlobalConfig() | 108 | void KPimGlobalPrefs::setGlobalConfig() |
109 | { | 109 | { |
110 | if ( mLocaleDict == 0 ) { | 110 | if ( mLocaleDict == 0 ) { |
111 | QString fileName ; | 111 | QString fileName ; |
112 | QString name = KGlobal::getAppName() +"/"; | 112 | QString name = KGlobal::getAppName() +"/"; |
113 | #ifndef DESKTOP_VERSION | 113 | #ifndef DESKTOP_VERSION |
114 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name | 114 | fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name |
115 | #else | 115 | #else |
116 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; | 116 | fileName = qApp->applicationDirPath () + "/kdepim/"+ name; |
117 | #endif | 117 | #endif |
118 | mLocaleDict = 0; | 118 | mLocaleDict = 0; |
119 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { | 119 | if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { |
120 | 120 | ||
121 | if ( mPreferredLanguage == 1 ) | 121 | if ( mPreferredLanguage == 1 ) |
122 | fileName = fileName+"germantranslation.txt"; | 122 | fileName = fileName+"germantranslation.txt"; |
123 | else if ( mPreferredLanguage == 4 ) | 123 | else if ( mPreferredLanguage == 4 ) |
124 | fileName = fileName+"usertranslation.txt"; | 124 | fileName = fileName+"usertranslation.txt"; |
125 | else if ( mPreferredLanguage == 2 ) | 125 | else if ( mPreferredLanguage == 2 ) |
126 | fileName = fileName+"frenchtranslation.txt"; | 126 | fileName = fileName+"frenchtranslation.txt"; |
127 | else if ( mPreferredLanguage == 3 ) | 127 | else if ( mPreferredLanguage == 3 ) |
128 | fileName = fileName+"italiantranslation.txt"; | 128 | fileName = fileName+"italiantranslation.txt"; |
129 | QFile file( fileName ); | 129 | QFile file( fileName ); |
130 | if (file.open( IO_ReadOnly ) ) { | 130 | if (file.open( IO_ReadOnly ) ) { |
131 | QTextStream ts( &file ); | 131 | QTextStream ts( &file ); |
132 | ts.setEncoding( QTextStream::Latin1 ); | 132 | ts.setEncoding( QTextStream::Latin1 ); |
133 | //ts.setCodec( QTextCodec::latin1 ); | 133 | //ts.setCodec( QTextCodec::latin1 ); |
134 | QString text = ts.read(); | 134 | QString text = ts.read(); |
135 | file.close(); | 135 | file.close(); |
136 | text.replace( QRegExp("\\\\n"), "\n" ); | 136 | text.replace( QRegExp("\\\\n"), "\n" ); |
137 | QString line; | 137 | QString line; |
138 | QString we; | 138 | QString we; |
139 | QString wt; | 139 | QString wt; |
140 | int br = 0; | 140 | int br = 0; |
141 | int nbr; | 141 | int nbr; |
142 | nbr = text.find ( "},", br ); | 142 | nbr = text.find ( "},", br ); |
143 | line = text.mid( br, nbr - br ); | 143 | line = text.mid( br, nbr - br ); |
144 | br = nbr+1; | 144 | br = nbr+1; |
145 | int se, ee, st, et; | 145 | int se, ee, st, et; |
146 | mLocaleDict = new QDict<QString>; | 146 | mLocaleDict = new QDict<QString>; |
147 | mLocaleDict->setAutoDelete( true ); | ||
147 | QString end = "{ \"\",\"\" }"; | 148 | QString end = "{ \"\",\"\" }"; |
148 | while ( (line != end) && (br > 1) ) { | 149 | while ( (line != end) && (br > 1) ) { |
149 | //qDebug("%d *%s* ", br, line.latin1()); | 150 | //qDebug("%d *%s* ", br, line.latin1()); |
150 | se = line.find("\"")+1; | 151 | se = line.find("\"")+1; |
151 | et = line.findRev("\"",-1); | 152 | et = line.findRev("\"",-1); |
152 | ee = line.find("\",\""); | 153 | ee = line.find("\",\""); |
153 | st = ee+3; | 154 | st = ee+3; |
154 | we = line.mid( se, ee-se ); | 155 | we = line.mid( se, ee-se ); |
155 | wt = line.mid( st, et-st ); | 156 | wt = line.mid( st, et-st ); |
156 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); | 157 | //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); |
157 | mLocaleDict->insert( we, new QString (wt) ); | 158 | mLocaleDict->insert( we, new QString (wt) ); |
158 | nbr = text.find ( "}", br ); | 159 | nbr = text.find ( "}", br ); |
159 | line = text.mid( br, nbr - br ); | 160 | line = text.mid( br, nbr - br ); |
160 | br = nbr+1; | 161 | br = nbr+1; |
161 | } | 162 | } |
162 | //qDebug("end *%s* ", end.latin1()); | 163 | //qDebug("end *%s* ", end.latin1()); |
163 | 164 | ||
164 | setLocaleDict( mLocaleDict ); | 165 | setLocaleDict( mLocaleDict ); |
165 | } else { | 166 | } else { |
166 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); | 167 | qDebug("KO: Cannot find translation file %s",fileName.latin1() ); |
167 | } | 168 | } |
168 | } | 169 | } |
169 | } | 170 | } |
170 | 171 | ||
171 | KGlobal::locale()->setHore24Format( !mPreferredTime ); | 172 | KGlobal::locale()->setHore24Format( !mPreferredTime ); |
172 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); | 173 | KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); |
173 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); | 174 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); |
174 | KGlobal::locale()->setLanguage( mPreferredLanguage ); | 175 | KGlobal::locale()->setLanguage( mPreferredLanguage ); |
175 | QString dummy = mUserDateFormatLong; | 176 | QString dummy = mUserDateFormatLong; |
176 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 177 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
177 | dummy = mUserDateFormatShort; | 178 | dummy = mUserDateFormatShort; |
178 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 179 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
179 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, | 180 | KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, |
180 | mDaylightsavingStart, | 181 | mDaylightsavingStart, |
181 | mDaylightsavingEnd ); | 182 | mDaylightsavingEnd ); |
182 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); | 183 | KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); |
183 | 184 | ||
184 | } | 185 | } |
185 | KPimGlobalPrefs::~KPimGlobalPrefs() | 186 | KPimGlobalPrefs::~KPimGlobalPrefs() |
186 | { | 187 | { |
187 | if (sInstance == this) | 188 | if (sInstance == this) |
188 | sInstance = staticDeleterGP.setObject(0); | 189 | sInstance = staticDeleterGP.setObject(0); |
189 | else | 190 | else |
190 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); | 191 | qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); |
191 | //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() "); | ||
192 | writeConfig(); | ||
193 | if ( mLocaleDict ) | 192 | if ( mLocaleDict ) |
194 | delete mLocaleDict; | 193 | delete mLocaleDict; |
195 | } | 194 | } |
196 | 195 | ||
197 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 196 | KPimGlobalPrefs *KPimGlobalPrefs::instance() |
198 | { | 197 | { |
199 | if ( !sInstance ) { | 198 | if ( !sInstance ) { |
200 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); | 199 | sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); |
201 | sInstance->readConfig(); | 200 | sInstance->readConfig(); |
202 | } | 201 | } |
203 | 202 | ||
204 | return sInstance; | 203 | return sInstance; |
205 | } | 204 | } |
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp index 5b50ba9..3c809b4 100644 --- a/microkde/kdeui/klistview.cpp +++ b/microkde/kdeui/klistview.cpp | |||
@@ -1,371 +1,370 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org> | 2 | Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org> |
3 | Copyright (C) 2000 Charles Samuels <charles@kde.org> | 3 | Copyright (C) 2000 Charles Samuels <charles@kde.org> |
4 | Copyright (C) 2000 Peter Putzer | 4 | Copyright (C) 2000 Peter Putzer |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License version 2 as published by the Free Software Foundation. | 8 | License version 2 as published by the Free Software Foundation. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library 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 GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qdragobject.h> | 21 | #include <qdragobject.h> |
22 | #include <qtimer.h> | 22 | #include <qtimer.h> |
23 | #include <qheader.h> | 23 | #include <qheader.h> |
24 | #include <qcursor.h> | 24 | #include <qcursor.h> |
25 | #include <qtooltip.h> | 25 | #include <qtooltip.h> |
26 | #include <qstyle.h> | 26 | #include <qstyle.h> |
27 | #include <qpainter.h> | 27 | #include <qpainter.h> |
28 | 28 | ||
29 | #include <kglobalsettings.h> | 29 | #include <kglobalsettings.h> |
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | #include <kconfigbase.h> | 31 | #include <kconfigbase.h> |
32 | //US #include <kcursor.h> | 32 | //US #include <kcursor.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | //US #include <kipc.h> | 34 | //US #include <kipc.h> |
35 | #include <kdebug.h> | 35 | #include <kdebug.h> |
36 | #ifdef _WIN32_ | 36 | #ifdef _WIN32_ |
37 | #define Q_WS_QWS | 37 | #define Q_WS_QWS |
38 | #endif | 38 | #endif |
39 | #ifndef _WIN32_ | 39 | #ifndef _WIN32_ |
40 | #define private public | 40 | #define private public |
41 | #include <qlistview.h> | 41 | #include <qlistview.h> |
42 | #undef private | 42 | #undef private |
43 | #endif | 43 | #endif |
44 | #include "klistview.h" | 44 | #include "klistview.h" |
45 | //US #include "klistviewlineedit.h" | 45 | //US #include "klistviewlineedit.h" |
46 | #ifndef DESKTOP_VERSION | 46 | #ifndef DESKTOP_VERSION |
47 | #include <qpe/qpeapplication.h> | 47 | #include <qpe/qpeapplication.h> |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | // /*US | 50 | // /*US |
51 | class KListView::Tooltip : public QToolTip | 51 | class KListView::Tooltip : public QToolTip |
52 | { | 52 | { |
53 | public: | 53 | public: |
54 | Tooltip (KListView* parent, QToolTipGroup* group = 0L); | 54 | Tooltip (KListView* parent, QToolTipGroup* group = 0L); |
55 | virtual ~Tooltip () {} | 55 | virtual ~Tooltip () {} |
56 | 56 | ||
57 | protected: | 57 | protected: |
58 | // */ | 58 | // */ |
59 | /** | 59 | /** |
60 | * Reimplemented from QToolTip for internal reasons. | 60 | * Reimplemented from QToolTip for internal reasons. |
61 | */ | 61 | */ |
62 | // /*US | 62 | // /*US |
63 | virtual void maybeTip (const QPoint&); | 63 | virtual void maybeTip (const QPoint&); |
64 | 64 | ||
65 | private: | 65 | private: |
66 | KListView* mParent; | 66 | KListView* mParent; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group) | 69 | KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group) |
70 | : QToolTip (parent, group), | 70 | : QToolTip (parent, group), |
71 | mParent (parent) | 71 | mParent (parent) |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | void KListView::Tooltip::maybeTip (const QPoint&) | 75 | void KListView::Tooltip::maybeTip (const QPoint&) |
76 | { | 76 | { |
77 | // FIXME | 77 | // FIXME |
78 | } | 78 | } |
79 | // */ | 79 | // */ |
80 | 80 | ||
81 | class KListView::KListViewPrivate | 81 | class KListView::KListViewPrivate |
82 | { | 82 | { |
83 | public: | 83 | public: |
84 | KListViewPrivate (KListView* listview) | 84 | KListViewPrivate (KListView* listview) |
85 | : pCurrentItem (0L), | 85 | : pCurrentItem (0L), |
86 | autoSelectDelay(1), | 86 | autoSelectDelay(1), |
87 | //US dragDelay (KGlobalSettings::dndEventDelay()), | 87 | //US dragDelay (KGlobalSettings::dndEventDelay()), |
88 | 88 | ||
89 | dragDelay (10), | 89 | dragDelay (10), |
90 | //US editor (new KListViewLineEdit (listview)), | 90 | //US editor (new KListViewLineEdit (listview)), |
91 | cursorInExecuteArea(false), | 91 | cursorInExecuteArea(false), |
92 | bUseSingle(false), | 92 | bUseSingle(false), |
93 | bChangeCursorOverItem(false), | 93 | bChangeCursorOverItem(false), |
94 | itemsMovable (true), | 94 | itemsMovable (true), |
95 | selectedBySimpleMove(false), | 95 | selectedBySimpleMove(false), |
96 | selectedUsingMouse(false), | 96 | selectedUsingMouse(false), |
97 | showContextMenusOnPress(true), | ||
98 | itemsRenameable (false), | 97 | itemsRenameable (false), |
99 | validDrag (false), | 98 | validDrag (false), |
100 | dragEnabled (false), | 99 | dragEnabled (false), |
101 | autoOpen (true), | 100 | autoOpen (true), |
102 | dropVisualizer (true), | 101 | dropVisualizer (true), |
103 | dropHighlighter (false), | 102 | dropHighlighter (false), |
104 | createChildren (true), | 103 | createChildren (true), |
105 | pressedOnSelected (false), | 104 | pressedOnSelected (false), |
106 | wasShiftEvent (false), | 105 | wasShiftEvent (false), |
107 | fullWidth (false), | 106 | fullWidth (false), |
108 | sortAscending(true), | 107 | sortAscending(true), |
109 | tabRename(true), | 108 | tabRename(true), |
110 | sortColumn(0), | 109 | sortColumn(0), |
111 | selectionDirection(0), | 110 | selectionDirection(0), |
112 | tooltipColumn (0), | 111 | tooltipColumn (0), |
113 | selectionMode (Single), | 112 | selectionMode (Single), |
114 | //US contextMenuKey (KGlobalSettings::contextMenuKey()), | 113 | contextMenuKey ( Qt::Key_Menu ),//KGlobalSettings::contextMenuKey()), |
115 | //US showContextMenusOnPress (KGlobalSettings::showContextMenusOnPress()), | 114 | showContextMenusOnPress (true),//showContextMenusOnPress (KGlobalSettings::showContextMenusOnPress()), |
116 | mDropVisualizerWidth (4) | 115 | mDropVisualizerWidth (4) |
117 | { | 116 | { |
118 | renameable += 0; | 117 | renameable += 0; |
119 | //US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int))); | 118 | //US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int))); |
120 | } | 119 | } |
121 | 120 | ||
122 | ~KListViewPrivate () | 121 | ~KListViewPrivate () |
123 | { | 122 | { |
124 | //US delete editor; | 123 | //US delete editor; |
125 | } | 124 | } |
126 | 125 | ||
127 | QListViewItem* pCurrentItem; | 126 | QListViewItem* pCurrentItem; |
128 | 127 | ||
129 | QTimer autoSelect; | 128 | QTimer autoSelect; |
130 | int autoSelectDelay; | 129 | int autoSelectDelay; |
131 | 130 | ||
132 | QTimer dragExpand; | 131 | QTimer dragExpand; |
133 | QListViewItem* dragOverItem; | 132 | QListViewItem* dragOverItem; |
134 | QPoint dragOverPoint; | 133 | QPoint dragOverPoint; |
135 | 134 | ||
136 | QPoint startDragPos; | 135 | QPoint startDragPos; |
137 | int dragDelay; | 136 | int dragDelay; |
138 | 137 | ||
139 | //US KListViewLineEdit *editor; | 138 | //US KListViewLineEdit *editor; |
140 | QValueList<int> renameable; | 139 | QValueList<int> renameable; |
141 | 140 | ||
142 | bool cursorInExecuteArea:1; | 141 | bool cursorInExecuteArea:1; |
143 | bool bUseSingle:1; | 142 | bool bUseSingle:1; |
144 | bool bChangeCursorOverItem:1; | 143 | bool bChangeCursorOverItem:1; |
145 | bool itemsMovable:1; | 144 | bool itemsMovable:1; |
146 | bool selectedBySimpleMove : 1; | 145 | bool selectedBySimpleMove : 1; |
147 | bool selectedUsingMouse:1; | 146 | bool selectedUsingMouse:1; |
148 | bool itemsRenameable:1; | 147 | bool itemsRenameable:1; |
149 | bool validDrag:1; | 148 | bool validDrag:1; |
150 | bool dragEnabled:1; | 149 | bool dragEnabled:1; |
151 | bool autoOpen:1; | 150 | bool autoOpen:1; |
152 | bool dropVisualizer:1; | 151 | bool dropVisualizer:1; |
153 | bool dropHighlighter:1; | 152 | bool dropHighlighter:1; |
154 | bool createChildren:1; | 153 | bool createChildren:1; |
155 | bool pressedOnSelected:1; | 154 | bool pressedOnSelected:1; |
156 | bool wasShiftEvent:1; | 155 | bool wasShiftEvent:1; |
157 | bool fullWidth:1; | 156 | bool fullWidth:1; |
158 | bool sortAscending:1; | 157 | bool sortAscending:1; |
159 | bool tabRename:1; | 158 | bool tabRename:1; |
160 | 159 | ||
161 | int sortColumn; | 160 | int sortColumn; |
162 | 161 | ||
163 | //+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX | 162 | //+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX |
164 | int selectionDirection; | 163 | int selectionDirection; |
165 | int tooltipColumn; | 164 | int tooltipColumn; |
166 | 165 | ||
167 | SelectionModeExt selectionMode; | 166 | SelectionModeExt selectionMode; |
168 | int contextMenuKey; | 167 | int contextMenuKey; |
169 | bool showContextMenusOnPress; | 168 | bool showContextMenusOnPress; |
170 | 169 | ||
171 | QRect mOldDropVisualizer; | 170 | QRect mOldDropVisualizer; |
172 | int mDropVisualizerWidth; | 171 | int mDropVisualizerWidth; |
173 | QRect mOldDropHighlighter; | 172 | QRect mOldDropHighlighter; |
174 | QListViewItem *afterItemDrop; | 173 | QListViewItem *afterItemDrop; |
175 | QListViewItem *parentItemDrop; | 174 | QListViewItem *parentItemDrop; |
176 | 175 | ||
177 | QColor alternateBackground; | 176 | QColor alternateBackground; |
178 | }; | 177 | }; |
179 | 178 | ||
180 | /*US | 179 | /*US |
181 | KListViewLineEdit::KListViewLineEdit(KListView *parent) | 180 | KListViewLineEdit::KListViewLineEdit(KListView *parent) |
182 | : KLineEdit(parent->viewport()), item(0), col(0), p(parent) | 181 | : KLineEdit(parent->viewport()), item(0), col(0), p(parent) |
183 | { | 182 | { |
184 | setFrame( false ); | 183 | setFrame( false ); |
185 | hide(); | 184 | hide(); |
186 | connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() )); | 185 | connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() )); |
187 | } | 186 | } |
188 | 187 | ||
189 | KListViewLineEdit::~KListViewLineEdit() | 188 | KListViewLineEdit::~KListViewLineEdit() |
190 | { | 189 | { |
191 | } | 190 | } |
192 | 191 | ||
193 | void KListViewLineEdit::load(QListViewItem *i, int c) | 192 | void KListViewLineEdit::load(QListViewItem *i, int c) |
194 | { | 193 | { |
195 | item=i; | 194 | item=i; |
196 | col=c; | 195 | col=c; |
197 | 196 | ||
198 | QRect rect(p->itemRect(i)); | 197 | QRect rect(p->itemRect(i)); |
199 | setText(item->text(c)); | 198 | setText(item->text(c)); |
200 | 199 | ||
201 | int fieldX = rect.x() - 1; | 200 | int fieldX = rect.x() - 1; |
202 | int fieldW = p->columnWidth(col) + 2; | 201 | int fieldW = p->columnWidth(col) + 2; |
203 | 202 | ||
204 | int pos = p->header()->mapToIndex(col); | 203 | int pos = p->header()->mapToIndex(col); |
205 | for ( int index = 0; index < pos; index++ ) | 204 | for ( int index = 0; index < pos; index++ ) |
206 | fieldX += p->columnWidth( p->header()->mapToSection( index )); | 205 | fieldX += p->columnWidth( p->header()->mapToSection( index )); |
207 | 206 | ||
208 | if ( col == 0 ) { | 207 | if ( col == 0 ) { |
209 | int d = i->depth() + (p->rootIsDecorated() ? 1 : 0); | 208 | int d = i->depth() + (p->rootIsDecorated() ? 1 : 0); |
210 | d *= p->treeStepSize(); | 209 | d *= p->treeStepSize(); |
211 | fieldX += d; | 210 | fieldX += d; |
212 | fieldW -= d; | 211 | fieldW -= d; |
213 | } | 212 | } |
214 | 213 | ||
215 | if ( i->pixmap( col ) ) {// add width of pixmap | 214 | if ( i->pixmap( col ) ) {// add width of pixmap |
216 | int d = i->pixmap( col )->width(); | 215 | int d = i->pixmap( col )->width(); |
217 | fieldX += d; | 216 | fieldX += d; |
218 | fieldW -= d; | 217 | fieldW -= d; |
219 | } | 218 | } |
220 | 219 | ||
221 | setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2); | 220 | setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2); |
222 | show(); | 221 | show(); |
223 | setFocus(); | 222 | setFocus(); |
224 | } | 223 | } |
225 | */ | 224 | */ |
226 | /*Helper functions to for | 225 | /*Helper functions to for |
227 | *tabOrderedRename functionality. | 226 | *tabOrderedRename functionality. |
228 | */ | 227 | */ |
229 | 228 | ||
230 | static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir) | 229 | static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir) |
231 | { | 230 | { |
232 | if (pi) | 231 | if (pi) |
233 | { | 232 | { |
234 | //Find the next renameable column in the current row | 233 | //Find the next renameable column in the current row |
235 | for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir) | 234 | for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir) |
236 | if (pl->isRenameable(start)) | 235 | if (pl->isRenameable(start)) |
237 | return start; | 236 | return start; |
238 | } | 237 | } |
239 | 238 | ||
240 | return -1; | 239 | return -1; |
241 | } | 240 | } |
242 | 241 | ||
243 | static QListViewItem *prevItem (QListViewItem *pi) | 242 | static QListViewItem *prevItem (QListViewItem *pi) |
244 | { | 243 | { |
245 | QListViewItem *pa = pi->itemAbove(); | 244 | QListViewItem *pa = pi->itemAbove(); |
246 | 245 | ||
247 | /*Does what the QListViewItem::previousSibling() | 246 | /*Does what the QListViewItem::previousSibling() |
248 | *of my dreams would do. | 247 | *of my dreams would do. |
249 | */ | 248 | */ |
250 | if (pa && pa->parent() == pi->parent()) | 249 | if (pa && pa->parent() == pi->parent()) |
251 | return pa; | 250 | return pa; |
252 | 251 | ||
253 | return NULL; | 252 | return NULL; |
254 | } | 253 | } |
255 | 254 | ||
256 | static QListViewItem *lastQChild (QListViewItem *pi) | 255 | static QListViewItem *lastQChild (QListViewItem *pi) |
257 | { | 256 | { |
258 | if (pi) | 257 | if (pi) |
259 | { | 258 | { |
260 | /*Since there's no QListViewItem::lastChild(). | 259 | /*Since there's no QListViewItem::lastChild(). |
261 | *This finds the last sibling for the given | 260 | *This finds the last sibling for the given |
262 | *item. | 261 | *item. |
263 | */ | 262 | */ |
264 | for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) | 263 | for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling()) |
265 | pi = pt; | 264 | pi = pt; |
266 | } | 265 | } |
267 | 266 | ||
268 | return pi; | 267 | return pi; |
269 | } | 268 | } |
270 | /*US | 269 | /*US |
271 | void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward) | 270 | void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward) |
272 | { | 271 | { |
273 | const int ncols = p->columns(); | 272 | const int ncols = p->columns(); |
274 | const int dir = forward ? +1 : -1; | 273 | const int dir = forward ? +1 : -1; |
275 | const int restart = forward ? 0 : (ncols - 1); | 274 | const int restart = forward ? 0 : (ncols - 1); |
276 | QListViewItem *top = (pitem && pitem->parent()) | 275 | QListViewItem *top = (pitem && pitem->parent()) |
277 | ? pitem->parent()->firstChild() | 276 | ? pitem->parent()->firstChild() |
278 | : p->firstChild(); | 277 | : p->firstChild(); |
279 | QListViewItem *pi = pitem; | 278 | QListViewItem *pi = pitem; |
280 | 279 | ||
281 | terminate(); //Save current changes | 280 | terminate(); //Save current changes |
282 | 281 | ||
283 | do | 282 | do |
284 | { | 283 | { |
285 | */ | 284 | */ |
286 | /*Check the rest of the current row for an editable column, | 285 | /*Check the rest of the current row for an editable column, |
287 | *if that fails, check the entire next/previous row. The | 286 | *if that fails, check the entire next/previous row. The |
288 | *last case goes back to the first item in the current branch | 287 | *last case goes back to the first item in the current branch |
289 | *or the last item in the current branch depending on the | 288 | *or the last item in the current branch depending on the |
290 | *direction. | 289 | *direction. |
291 | */ | 290 | */ |
292 | /*US | 291 | /*US |
293 | if ((column = nextCol(p, pi, column + dir, dir)) != -1 || | 292 | if ((column = nextCol(p, pi, column + dir, dir)) != -1 || |
294 | (column = nextCol(p, (pi = (forward ? pi->nextSibling() : prevItem(pi))), restart, dir)) != -1 || | 293 | (column = nextCol(p, (pi = (forward ? pi->nextSibling() : prevItem(pi))), restart, dir)) != -1 || |
295 | (column = nextCol(p, (pi = (forward ? top : lastQChild(pitem))), restart, dir)) != -1) | 294 | (column = nextCol(p, (pi = (forward ? top : lastQChild(pitem))), restart, dir)) != -1) |
296 | { | 295 | { |
297 | if (pi) | 296 | if (pi) |
298 | { | 297 | { |
299 | p->setCurrentItem(pi); //Calls terminate | 298 | p->setCurrentItem(pi); //Calls terminate |
300 | p->rename(pi, column); | 299 | p->rename(pi, column); |
301 | */ | 300 | */ |
302 | /*Some listviews may override rename() to | 301 | /*Some listviews may override rename() to |
303 | *prevent certain items from being renamed, | 302 | *prevent certain items from being renamed, |
304 | *if this is done, [m_]item will be NULL | 303 | *if this is done, [m_]item will be NULL |
305 | *after the rename() call... try again. | 304 | *after the rename() call... try again. |
306 | */ | 305 | */ |
307 | /*US | 306 | /*US |
308 | if (!item) | 307 | if (!item) |
309 | continue; | 308 | continue; |
310 | 309 | ||
311 | break; | 310 | break; |
312 | } | 311 | } |
313 | } | 312 | } |
314 | } | 313 | } |
315 | while (pi && !item); | 314 | while (pi && !item); |
316 | } | 315 | } |
317 | */ | 316 | */ |
318 | 317 | ||
319 | /*US | 318 | /*US |
320 | #ifdef KeyPress | 319 | #ifdef KeyPress |
321 | #undef KeyPress | 320 | #undef KeyPress |
322 | #endif | 321 | #endif |
323 | 322 | ||
324 | bool KListViewLineEdit::event (QEvent *pe) | 323 | bool KListViewLineEdit::event (QEvent *pe) |
325 | { | 324 | { |
326 | if (pe->type() == QEvent::KeyPress) | 325 | if (pe->type() == QEvent::KeyPress) |
327 | { | 326 | { |
328 | QKeyEvent *k = (QKeyEvent *) pe; | 327 | QKeyEvent *k = (QKeyEvent *) pe; |
329 | 328 | ||
330 | if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && | 329 | if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) && |
331 | p->tabOrderedRenaming() && p->itemsRenameable() && | 330 | p->tabOrderedRenaming() && p->itemsRenameable() && |
332 | !(k->state() & ControlButton || k->state() & AltButton)) | 331 | !(k->state() & ControlButton || k->state() & AltButton)) |
333 | { | 332 | { |
334 | selectNextCell(item, col, | 333 | selectNextCell(item, col, |
335 | (k->key() == Key_Tab && !(k->state() & ShiftButton))); | 334 | (k->key() == Key_Tab && !(k->state() & ShiftButton))); |
336 | return true; | 335 | return true; |
337 | } | 336 | } |
338 | } | 337 | } |
339 | 338 | ||
340 | return KLineEdit::event(pe); | 339 | return KLineEdit::event(pe); |
341 | } | 340 | } |
342 | 341 | ||
343 | void KListViewLineEdit::keyPressEvent(QKeyEvent *e) | 342 | void KListViewLineEdit::keyPressEvent(QKeyEvent *e) |
344 | { | 343 | { |
345 | if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) | 344 | if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter ) |
346 | terminate(true); | 345 | terminate(true); |
347 | else if(e->key() == Qt::Key_Escape) | 346 | else if(e->key() == Qt::Key_Escape) |
348 | terminate(false); | 347 | terminate(false); |
349 | else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up) | 348 | else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up) |
350 | { | 349 | { |
351 | terminate(true); | 350 | terminate(true); |
352 | KLineEdit::keyPressEvent(e); | 351 | KLineEdit::keyPressEvent(e); |
353 | } | 352 | } |
354 | else | 353 | else |
355 | KLineEdit::keyPressEvent(e); | 354 | KLineEdit::keyPressEvent(e); |
356 | } | 355 | } |
357 | 356 | ||
358 | void KListViewLineEdit::terminate() | 357 | void KListViewLineEdit::terminate() |
359 | { | 358 | { |
360 | terminate(true); | 359 | terminate(true); |
361 | } | 360 | } |
362 | 361 | ||
363 | void KListViewLineEdit::terminate(bool commit) | 362 | void KListViewLineEdit::terminate(bool commit) |
364 | { | 363 | { |
365 | if ( item ) | 364 | if ( item ) |
366 | { | 365 | { |
367 | //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; | 366 | //kdDebug() << "KListViewLineEdit::terminate " << commit << endl; |
368 | if (commit) | 367 | if (commit) |
369 | item->setText(col, text()); | 368 | item->setText(col, text()); |
370 | int c=col; | 369 | int c=col; |
371 | QListViewItem *i=item; | 370 | QListViewItem *i=item; |
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp index 3f2d055..81e257f 100644 --- a/pwmanager/pwmanager/main.cpp +++ b/pwmanager/pwmanager/main.cpp | |||
@@ -1,213 +1,213 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef PWM_EMBEDDED | 20 | #ifndef PWM_EMBEDDED |
21 | #include <kcmdlineargs.h> | 21 | #include <kcmdlineargs.h> |
22 | #include <kaboutdata.h> | 22 | #include <kaboutdata.h> |
23 | #else | 23 | #else |
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include <kpimglobalprefs.h> | 25 | #include <kpimglobalprefs.h> |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | #include <kstandarddirs.h> | 29 | #include <kstandarddirs.h> |
30 | 30 | ||
31 | #include "pwmexception.h" | 31 | #include "pwmexception.h" |
32 | #include "pwminit.h" | 32 | #include "pwminit.h" |
33 | 33 | ||
34 | #define LICENSE_FILE(::locate("data", "pwmanager/pwmanager_license_text")) | 34 | #define LICENSE_FILE(::locate("data", "pwmanager/pwmanager_license_text")) |
35 | 35 | ||
36 | int PwMApplication::newInstance() | 36 | int PwMApplication::newInstance() |
37 | { | 37 | { |
38 | static bool initial = true; | 38 | static bool initial = true; |
39 | if (initial) { | 39 | if (initial) { |
40 | initial = false; | 40 | initial = false; |
41 | init = new PwMInit(this); | 41 | init = new PwMInit(this); |
42 | init->initializeApp(); | 42 | init->initializeApp(); |
43 | } else { | 43 | } else { |
44 | BUG_ON(!init); | 44 | BUG_ON(!init); |
45 | printInfo("passing parameters to old instance."); | 45 | printInfo("passing parameters to old instance."); |
46 | init->handleCmdLineArgs(false); | 46 | init->handleCmdLineArgs(false); |
47 | } | 47 | } |
48 | return EXIT_SUCCESS; | 48 | return EXIT_SUCCESS; |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | static const char *description = I18N_NOOP("PwManager\n" | 52 | static const char *description = I18N_NOOP("PwManager\n" |
53 | "The convenient way of managing passwords"); | 53 | "The convenient way of managing passwords"); |
54 | 54 | ||
55 | #ifndef PWM_EMBEDDED | 55 | #ifndef PWM_EMBEDDED |
56 | static KCmdLineOptions options[] = | 56 | static KCmdLineOptions options[] = |
57 | { | 57 | { |
58 | { "minimized", I18N_NOOP("Windows minimized"), 0 }, | 58 | { "minimized", I18N_NOOP("Windows minimized"), 0 }, |
59 | { "mintray", I18N_NOOP("Windows minimized to tray"),0 }, | 59 | { "mintray", I18N_NOOP("Windows minimized to tray"),0 }, |
60 | { "open-deeplocked", I18N_NOOP("Open all \"files\" deeplocked"),0 }, | 60 | { "open-deeplocked", I18N_NOOP("Open all \"files\" deeplocked"),0 }, |
61 | { "skip-self-test", I18N_NOOP("Don't run a self-test on startup"),0 }, | 61 | { "skip-self-test", I18N_NOOP("Don't run a self-test on startup"),0 }, |
62 | { "+[files...]", I18N_NOOP("Files to open on startup"), 0 }, | 62 | { "+[files...]", I18N_NOOP("Files to open on startup"), 0 }, |
63 | { 0, 0, 0 } | 63 | { 0, 0, 0 } |
64 | }; | 64 | }; |
65 | #endif | 65 | #endif |
66 | 66 | ||
67 | #ifdef PWM_DEBUG | 67 | #ifdef PWM_DEBUG |
68 | static void printDebugConfigureInfo() | 68 | static void printDebugConfigureInfo() |
69 | { | 69 | { |
70 | cout << "================================" << endl; | 70 | cout << "================================" << endl; |
71 | cout << PROG_NAME " version " PACKAGE_VER << endl; | 71 | cout << PROG_NAME " version " PACKAGE_VER << endl; |
72 | #ifdef CONFIG_KEYCARD | 72 | #ifdef CONFIG_KEYCARD |
73 | cout << "CONFIG_KEYCARD: enabled" << endl; | 73 | cout << "CONFIG_KEYCARD: enabled" << endl; |
74 | #else | 74 | #else |
75 | cout << "CONFIG_KEYCARD: disabled" << endl; | 75 | cout << "CONFIG_KEYCARD: disabled" << endl; |
76 | #endif | 76 | #endif |
77 | #ifdef CONFIG_KWALLETIF | 77 | #ifdef CONFIG_KWALLETIF |
78 | cout << "CONFIG_KWALLETIF: enabled" << endl; | 78 | cout << "CONFIG_KWALLETIF: enabled" << endl; |
79 | #else | 79 | #else |
80 | cout << "CONFIG_KWALLETIF: disabled" << endl; | 80 | cout << "CONFIG_KWALLETIF: disabled" << endl; |
81 | #endif | 81 | #endif |
82 | #ifdef BIG_ENDIAN_HOST | 82 | #ifdef BIG_ENDIAN_HOST |
83 | cout << "Endianess: big-endian" << endl; | 83 | cout << "Endianess: big-endian" << endl; |
84 | #else | 84 | #else |
85 | cout << "Endianess: little-endian" << endl; | 85 | cout << "Endianess: little-endian" << endl; |
86 | #endif | 86 | #endif |
87 | cout << "sizeof(long): " << sizeof(long) << endl; | 87 | cout << "sizeof(long): " << sizeof(long) << endl; |
88 | cout << "================================" << endl; | 88 | cout << "================================" << endl; |
89 | } | 89 | } |
90 | #else // PWM_DEBUG | 90 | #else // PWM_DEBUG |
91 | static inline void printDebugConfigureInfo() { /* nothing */ } | 91 | static inline void printDebugConfigureInfo() { /* nothing */ } |
92 | #endif // PWM_DEBUG | 92 | #endif // PWM_DEBUG |
93 | 93 | ||
94 | #ifndef PWM_EMBEDDED | 94 | #ifndef PWM_EMBEDDED |
95 | static void addAuthors(KAboutData *aboutData) | 95 | static void addAuthors(KAboutData *aboutData) |
96 | { | 96 | { |
97 | aboutData->addAuthor("Michael Buesch", | 97 | aboutData->addAuthor("Michael Buesch", |
98 | I18N_NOOP( | 98 | I18N_NOOP( |
99 | "main programming and current maintainer"), | 99 | "main programming and current maintainer"), |
100 | "mbuesch@freenet.de"); | 100 | "mbuesch@freenet.de"); |
101 | aboutData->addAuthor("Matt Scifo", | 101 | aboutData->addAuthor("Matt Scifo", |
102 | I18N_NOOP( | 102 | I18N_NOOP( |
103 | "original implementaion of \n" | 103 | "original implementaion of \n" |
104 | "\"categories\" and the password-tree \n" | 104 | "\"categories\" and the password-tree \n" |
105 | "in the system-tray. Original implementations of \n" | 105 | "in the system-tray. Original implementations of \n" |
106 | "numerous view-improvements."), | 106 | "numerous view-improvements."), |
107 | "mscifo@o1.com"); | 107 | "mscifo@o1.com"); |
108 | aboutData->addCredit("Elias Probst", | 108 | aboutData->addCredit("Elias Probst", |
109 | I18N_NOOP( | 109 | I18N_NOOP( |
110 | "Gentoo ebuild maintainer."), | 110 | "Gentoo ebuild maintainer."), |
111 | "elias.probst@gmx.de"); | 111 | "elias.probst@gmx.de"); |
112 | aboutData->addCredit("George Staikos", | 112 | aboutData->addCredit("George Staikos", |
113 | I18N_NOOP("KWallet"), | 113 | I18N_NOOP("KWallet"), |
114 | "staikos@kde.org"); | 114 | "staikos@kde.org"); |
115 | aboutData->addCredit("Matthew Palmer", | 115 | aboutData->addCredit("Matthew Palmer", |
116 | I18N_NOOP("rc2 code"), | 116 | I18N_NOOP("rc2 code"), |
117 | "mjp16@uow.edu.au"); | 117 | "mjp16@uow.edu.au"); |
118 | aboutData->addCredit("Olivier Sessink", | 118 | aboutData->addCredit("Olivier Sessink", |
119 | I18N_NOOP("gpasman"), | 119 | I18N_NOOP("gpasman"), |
120 | "gpasman@nl.linux.org"); | 120 | "gpasman@nl.linux.org"); |
121 | aboutData->addCredit("The libgcrypt developers", | 121 | aboutData->addCredit("The libgcrypt developers", |
122 | I18N_NOOP("Blowfish and SHA1 algorithms"), | 122 | I18N_NOOP("Blowfish and SHA1 algorithms"), |
123 | 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); | 123 | 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); |
124 | aboutData->addCredit("Troy Engel", | 124 | aboutData->addCredit("Troy Engel", |
125 | I18N_NOOP("kpasman"), | 125 | I18N_NOOP("kpasman"), |
126 | "tengel@sonic.net"); | 126 | "tengel@sonic.net"); |
127 | aboutData->addCredit("Wickey", | 127 | aboutData->addCredit("Wickey", |
128 | I18N_NOOP("graphics-design in older versions."), | 128 | I18N_NOOP("graphics-design in older versions."), |
129 | "wickey@gmx.at"); | 129 | "wickey@gmx.at"); |
130 | aboutData->addCredit("Ian MacGregor", | 130 | aboutData->addCredit("Ian MacGregor", |
131 | I18N_NOOP( | 131 | I18N_NOOP( |
132 | "original documentation author.")); | 132 | "original documentation author.")); |
133 | } | 133 | } |
134 | #endif | 134 | #endif |
135 | 135 | ||
136 | int main(int argc, char *argv[]) | 136 | int main(int argc, char *argv[]) |
137 | { | 137 | { |
138 | printDebugConfigureInfo(); | 138 | printDebugConfigureInfo(); |
139 | #ifndef PWM_EMBEDDED | 139 | #ifndef PWM_EMBEDDED |
140 | KAboutData aboutData(PACKAGE_NAME, PROG_NAME, | 140 | KAboutData aboutData(PACKAGE_NAME, PROG_NAME, |
141 | PACKAGE_VER, description, KAboutData::License_File, | 141 | PACKAGE_VER, description, KAboutData::License_File, |
142 | "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, | 142 | "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, |
143 | "http://passwordmanager.sourceforge.net/", | 143 | "http://passwordmanager.sourceforge.net/", |
144 | "mbuesch@freenet.de"); | 144 | "mbuesch@freenet.de"); |
145 | addAuthors(&aboutData); | 145 | addAuthors(&aboutData); |
146 | 146 | ||
147 | KCmdLineArgs::init(argc, argv, &aboutData); | 147 | KCmdLineArgs::init(argc, argv, &aboutData); |
148 | KCmdLineArgs::addCmdLineOptions(options); | 148 | KCmdLineArgs::addCmdLineOptions(options); |
149 | 149 | ||
150 | KUniqueApplication::addCmdLineOptions(); | 150 | KUniqueApplication::addCmdLineOptions(); |
151 | if (!KUniqueApplication::start()) { | 151 | if (!KUniqueApplication::start()) { |
152 | printInfo("already running."); | 152 | printInfo("already running."); |
153 | return EXIT_SUCCESS; | 153 | return EXIT_SUCCESS; |
154 | } | 154 | } |
155 | PwMApplication a; | 155 | PwMApplication a; |
156 | aboutData.setLicenseTextFile(LICENSE_FILE); | 156 | aboutData.setLicenseTextFile(LICENSE_FILE); |
157 | return a.exec(); | 157 | return a.exec(); |
158 | #else | 158 | #else |
159 | 159 | ||
160 | bool exitHelp = false; | 160 | bool exitHelp = false; |
161 | if ( argc > 1 ) { | 161 | if ( argc > 1 ) { |
162 | QString command = argv[1]; | 162 | QString command = argv[1]; |
163 | if ( command == "-help" ){ | 163 | if ( command == "-help" ){ |
164 | printf("PWM/PI command line commands:\n"); | 164 | printf("PWM/PI command line commands:\n"); |
165 | printf(" no command: Start PWM/PI in usual way\n"); | 165 | printf(" no command: Start PWM/PI in usual way\n"); |
166 | printf(" -help: This output\n"); | 166 | printf(" -help: This output\n"); |
167 | printf(" PWM/PI is exiting now. Bye!\n"); | 167 | printf(" PWM/PI is exiting now. Bye!\n"); |
168 | exitHelp = true; | 168 | exitHelp = true; |
169 | } | 169 | } |
170 | } | 170 | } |
171 | if ( ! exitHelp ) { | 171 | if ( ! exitHelp ) { |
172 | 172 | ||
173 | PwMApplication a(argc, argv); | 173 | PwMApplication a(argc, argv); |
174 | 174 | ||
175 | KGlobal::setAppName( "pwmanager" ); | 175 | KGlobal::setAppName( "pwmanager" ); |
176 | #ifndef DESKTOP_VERSION | 176 | #ifndef DESKTOP_VERSION |
177 | //qDebug("width %d ",QApplication::desktop()->width() ); | 177 | //qDebug("width %d ",QApplication::desktop()->width() ); |
178 | if ( QApplication::desktop()->width() > 320 ) | 178 | if ( QApplication::desktop()->width() > 320 ) |
179 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); | 179 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons22/"); |
180 | else | 180 | else |
181 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); | 181 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/pwmanager/icons16/"); |
182 | #else | 182 | #else |
183 | QString fileName ; | 183 | QString fileName ; |
184 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; | 184 | fileName = qApp->applicationDirPath () + "/kdepim/pwmanager/icons22/"; |
185 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 185 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
186 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 186 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
187 | 187 | ||
188 | #endif | 188 | #endif |
189 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); | 189 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "pwmanager"))); |
190 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 190 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
191 | 191 | ||
192 | a.newInstance(); | 192 | a.newInstance(); |
193 | 193 | ||
194 | //US KAddressBookMain m ; | 194 | //US KAddressBookMain m ; |
195 | 195 | ||
196 | //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 196 | //US QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
197 | /*US | 197 | /*US |
198 | #ifndef DESKTOP_VERSION | 198 | #ifndef DESKTOP_VERSION |
199 | a.showMainWidget( &m ); | 199 | a.showMainWidget( &m ); |
200 | #else | 200 | #else |
201 | a.setMainWidget( &m ); | 201 | a.setMainWidget( &m ); |
202 | m.resize (640, 480 ); | 202 | m.resize (640, 480 ); |
203 | m.show(); | 203 | m.show(); |
204 | #endif | 204 | #endif |
205 | */ | 205 | */ |
206 | a.exec(); | 206 | a.exec(); |
207 | 207 | KPimGlobalPrefs::instance()->writeConfig(); | |
208 | } | 208 | } |
209 | qDebug("PWMPI: Bye! "); | 209 | qDebug("PWMPI: Bye! "); |
210 | 210 | ||
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | } | 213 | } |
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index b7b5307..d92c90d 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -1,457 +1,459 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <klistview.h> | 21 | #include <klistview.h> |
22 | #include <ktoolbar.h> | 22 | #include <ktoolbar.h> |
23 | #include <kfiledialog.h> | 23 | #include <kfiledialog.h> |
24 | #include <kiconloader.h> | 24 | #include <kiconloader.h> |
25 | #include <kmessagebox.h> | 25 | #include <kmessagebox.h> |
26 | 26 | ||
27 | #include <qstatusbar.h> | 27 | #include <qstatusbar.h> |
28 | 28 | ||
29 | #ifndef PWM_EMBEDDED | 29 | #ifndef PWM_EMBEDDED |
30 | #include <kmenubar.h> | 30 | #include <kmenubar.h> |
31 | #include <kstatusbar.h> | 31 | #include <kstatusbar.h> |
32 | #include <dcopclient.h> | 32 | #include <dcopclient.h> |
33 | #include "configwndimpl.h" | 33 | #include "configwndimpl.h" |
34 | #include "configuration.h" | 34 | #include "configuration.h" |
35 | #else | 35 | #else |
36 | #include <qmenubar.h> | 36 | #include <qmenubar.h> |
37 | #include <qmessagebox.h> | 37 | #include <qmessagebox.h> |
38 | #include <pwmprefs.h> | 38 | #include <pwmprefs.h> |
39 | #include <kpimglobalprefs.h> | 39 | #include <kpimglobalprefs.h> |
40 | #include <kcmconfigs/kcmpwmconfig.h> | 40 | #include <kcmconfigs/kcmpwmconfig.h> |
41 | #include <kcmconfigs/kcmkdepimconfig.h> | 41 | #include <kcmconfigs/kcmkdepimconfig.h> |
42 | #include <kcmultidialog.h> | 42 | #include <kcmultidialog.h> |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | 45 | ||
46 | #ifndef DESKTOP_VERSION | 46 | #ifndef DESKTOP_VERSION |
47 | #include <qpe/global.h> | 47 | #include <qpe/global.h> |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #include <qpixmap.h> | 50 | #include <qpixmap.h> |
51 | #include <qcheckbox.h> | 51 | #include <qcheckbox.h> |
52 | #include <qspinbox.h> | 52 | #include <qspinbox.h> |
53 | #include <qlineedit.h> | 53 | #include <qlineedit.h> |
54 | #include <qfileinfo.h> | 54 | #include <qfileinfo.h> |
55 | #include <qclipboard.h> | 55 | #include <qclipboard.h> |
56 | 56 | ||
57 | 57 | ||
58 | #include <stdio.h> | 58 | #include <stdio.h> |
59 | 59 | ||
60 | #include "pwm.h" | 60 | #include "pwm.h" |
61 | #include "pwminit.h" | 61 | #include "pwminit.h" |
62 | #include "pwmprint.h" | 62 | #include "pwmprint.h" |
63 | #include "addentrywndimpl.h" | 63 | #include "addentrywndimpl.h" |
64 | #include "globalstuff.h" | 64 | #include "globalstuff.h" |
65 | #include "findwndimpl.h" | 65 | #include "findwndimpl.h" |
66 | #include "csv.h" | 66 | #include "csv.h" |
67 | 67 | ||
68 | #ifdef CONFIG_KWALLETIF | 68 | #ifdef CONFIG_KWALLETIF |
69 | # include "kwalletif.h" | 69 | # include "kwalletif.h" |
70 | # include "kwalletemu.h" | 70 | # include "kwalletemu.h" |
71 | #endif | 71 | #endif |
72 | #ifdef CONFIG_KEYCARD | 72 | #ifdef CONFIG_KEYCARD |
73 | # include "pwmkeycard.h" | 73 | # include "pwmkeycard.h" |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | 76 | ||
77 | #define DEFAULT_SIZE (QSize(700, 400)) | 77 | #define DEFAULT_SIZE (QSize(700, 400)) |
78 | 78 | ||
79 | // Button IDs for "file" popup menu | 79 | // Button IDs for "file" popup menu |
80 | enum { | 80 | enum { |
81 | BUTTON_POPUP_FILE_NEW = 0, | 81 | BUTTON_POPUP_FILE_NEW = 0, |
82 | BUTTON_POPUP_FILE_OPEN, | 82 | BUTTON_POPUP_FILE_OPEN, |
83 | BUTTON_POPUP_FILE_CLOSE, | 83 | BUTTON_POPUP_FILE_CLOSE, |
84 | BUTTON_POPUP_FILE_SAVE, | 84 | BUTTON_POPUP_FILE_SAVE, |
85 | BUTTON_POPUP_FILE_SAVEAS, | 85 | BUTTON_POPUP_FILE_SAVEAS, |
86 | BUTTON_POPUP_FILE_EXPORT, | 86 | BUTTON_POPUP_FILE_EXPORT, |
87 | BUTTON_POPUP_FILE_IMPORT, | 87 | BUTTON_POPUP_FILE_IMPORT, |
88 | BUTTON_POPUP_FILE_PRINT, | 88 | BUTTON_POPUP_FILE_PRINT, |
89 | BUTTON_POPUP_FILE_QUIT | 89 | BUTTON_POPUP_FILE_QUIT |
90 | }; | 90 | }; |
91 | // Button IDs for "manage" popup menu | 91 | // Button IDs for "manage" popup menu |
92 | enum { | 92 | enum { |
93 | BUTTON_POPUP_MANAGE_ADD = 0, | 93 | BUTTON_POPUP_MANAGE_ADD = 0, |
94 | BUTTON_POPUP_MANAGE_EDIT, | 94 | BUTTON_POPUP_MANAGE_EDIT, |
95 | BUTTON_POPUP_MANAGE_DEL, | 95 | BUTTON_POPUP_MANAGE_DEL, |
96 | BUTTON_POPUP_MANAGE_CHANGEMP | 96 | BUTTON_POPUP_MANAGE_CHANGEMP |
97 | }; | 97 | }; |
98 | // Button IDs for chipcard popup menu | 98 | // Button IDs for chipcard popup menu |
99 | enum { | 99 | enum { |
100 | #ifdef CONFIG_KEYCARD | 100 | #ifdef CONFIG_KEYCARD |
101 | BUTTON_POPUP_CHIPCARD_GENNEW = 0, | 101 | BUTTON_POPUP_CHIPCARD_GENNEW = 0, |
102 | BUTTON_POPUP_CHIPCARD_DEL, | 102 | BUTTON_POPUP_CHIPCARD_DEL, |
103 | BUTTON_POPUP_CHIPCARD_READID, | 103 | BUTTON_POPUP_CHIPCARD_READID, |
104 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP, | 104 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP, |
105 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP | 105 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP |
106 | #else // CONFIG_KEYCARD | 106 | #else // CONFIG_KEYCARD |
107 | BUTTON_POPUP_CHIPCARD_NO = 0 | 107 | BUTTON_POPUP_CHIPCARD_NO = 0 |
108 | #endif // CONFIG_KEYCARD | 108 | #endif // CONFIG_KEYCARD |
109 | }; | 109 | }; |
110 | // Button IDs for "view" popup menu | 110 | // Button IDs for "view" popup menu |
111 | enum { | 111 | enum { |
112 | BUTTON_POPUP_VIEW_FIND = 0, | 112 | BUTTON_POPUP_VIEW_FIND = 0, |
113 | BUTTON_POPUP_VIEW_LOCK, | 113 | BUTTON_POPUP_VIEW_LOCK, |
114 | BUTTON_POPUP_VIEW_DEEPLOCK, | 114 | BUTTON_POPUP_VIEW_DEEPLOCK, |
115 | BUTTON_POPUP_VIEW_UNLOCK | 115 | BUTTON_POPUP_VIEW_UNLOCK |
116 | }; | 116 | }; |
117 | // Button IDs for "options" popup menu | 117 | // Button IDs for "options" popup menu |
118 | enum { | 118 | enum { |
119 | BUTTON_POPUP_OPTIONS_CONFIG = 0 | 119 | BUTTON_POPUP_OPTIONS_CONFIG = 0 |
120 | }; | 120 | }; |
121 | // Button IDs for "export" popup menu (in "file" popup menu) | 121 | // Button IDs for "export" popup menu (in "file" popup menu) |
122 | enum { | 122 | enum { |
123 | BUTTON_POPUP_EXPORT_TEXT = 0, | 123 | BUTTON_POPUP_EXPORT_TEXT = 0, |
124 | BUTTON_POPUP_EXPORT_GPASMAN, | 124 | BUTTON_POPUP_EXPORT_GPASMAN, |
125 | BUTTON_POPUP_EXPORT_CSV | 125 | BUTTON_POPUP_EXPORT_CSV |
126 | #ifdef CONFIG_KWALLETIF | 126 | #ifdef CONFIG_KWALLETIF |
127 | ,BUTTON_POPUP_EXPORT_KWALLET | 127 | ,BUTTON_POPUP_EXPORT_KWALLET |
128 | #endif | 128 | #endif |
129 | }; | 129 | }; |
130 | // Button IDs for "import" popup menu (in "file" popup menu) | 130 | // Button IDs for "import" popup menu (in "file" popup menu) |
131 | enum { | 131 | enum { |
132 | BUTTON_POPUP_IMPORT_TEXT = 0, | 132 | BUTTON_POPUP_IMPORT_TEXT = 0, |
133 | BUTTON_POPUP_IMPORT_GPASMAN, | 133 | BUTTON_POPUP_IMPORT_GPASMAN, |
134 | BUTTON_POPUP_IMPORT_CSV | 134 | BUTTON_POPUP_IMPORT_CSV |
135 | #ifdef CONFIG_KWALLETIF | 135 | #ifdef CONFIG_KWALLETIF |
136 | ,BUTTON_POPUP_IMPORT_KWALLET | 136 | ,BUTTON_POPUP_IMPORT_KWALLET |
137 | #endif | 137 | #endif |
138 | }; | 138 | }; |
139 | 139 | ||
140 | #ifdef PWM_EMBEDDED | 140 | #ifdef PWM_EMBEDDED |
141 | // Button IDs for "help" popup menu | 141 | // Button IDs for "help" popup menu |
142 | enum { | 142 | enum { |
143 | BUTTON_POPUP_HELP_LICENSE = 0, | 143 | BUTTON_POPUP_HELP_LICENSE = 0, |
144 | BUTTON_POPUP_HELP_FAQ, | 144 | BUTTON_POPUP_HELP_FAQ, |
145 | BUTTON_POPUP_HELP_ABOUT, | 145 | BUTTON_POPUP_HELP_ABOUT, |
146 | BUTTON_POPUP_HELP_SYNC, | 146 | BUTTON_POPUP_HELP_SYNC, |
147 | BUTTON_POPUP_HELP_WHATSNEW | 147 | BUTTON_POPUP_HELP_WHATSNEW |
148 | }; | 148 | }; |
149 | #endif | 149 | #endif |
150 | 150 | ||
151 | // Button IDs for toolbar | 151 | // Button IDs for toolbar |
152 | enum { | 152 | enum { |
153 | BUTTON_TOOL_NEW = 0, | 153 | BUTTON_TOOL_NEW = 0, |
154 | BUTTON_TOOL_OPEN, | 154 | BUTTON_TOOL_OPEN, |
155 | BUTTON_TOOL_SAVE, | 155 | BUTTON_TOOL_SAVE, |
156 | BUTTON_TOOL_SAVEAS, | 156 | BUTTON_TOOL_SAVEAS, |
157 | BUTTON_TOOL_PRINT, | 157 | BUTTON_TOOL_PRINT, |
158 | BUTTON_TOOL_ADD, | 158 | BUTTON_TOOL_ADD, |
159 | BUTTON_TOOL_EDIT, | 159 | BUTTON_TOOL_EDIT, |
160 | BUTTON_TOOL_DEL, | 160 | BUTTON_TOOL_DEL, |
161 | BUTTON_TOOL_FIND, | 161 | BUTTON_TOOL_FIND, |
162 | BUTTON_TOOL_LOCK, | 162 | BUTTON_TOOL_LOCK, |
163 | BUTTON_TOOL_DEEPLOCK, | 163 | BUTTON_TOOL_DEEPLOCK, |
164 | BUTTON_TOOL_UNLOCK | 164 | BUTTON_TOOL_UNLOCK |
165 | }; | 165 | }; |
166 | 166 | ||
167 | 167 | ||
168 | PwM::PwM(PwMInit *_init, PwMDoc *doc, | 168 | PwM::PwM(PwMInit *_init, PwMDoc *doc, |
169 | bool virginity, | 169 | bool virginity, |
170 | QWidget *parent, const char *name) | 170 | QWidget *parent, const char *name) |
171 | : KMainWindow(parent, "HALLO") | 171 | : KMainWindow(parent, "HALLO") |
172 | , forceQuit (false) | 172 | , forceQuit (false) |
173 | , forceMinimizeToTray (false) | 173 | , forceMinimizeToTray (false) |
174 | { | 174 | { |
175 | syncManager = 0; | ||
175 | virgin = !virginity; | 176 | virgin = !virginity; |
176 | init = _init; | 177 | init = _init; |
177 | connect(doc, SIGNAL(docClosed(PwMDoc *)), | 178 | connect(doc, SIGNAL(docClosed(PwMDoc *)), |
178 | this, SLOT(docClosed(PwMDoc *))); | 179 | this, SLOT(docClosed(PwMDoc *))); |
179 | initMenubar(); | 180 | initMenubar(); |
180 | initToolbar(); | 181 | initToolbar(); |
181 | initMetrics(); | 182 | initMetrics(); |
182 | setVirgin(virginity); | 183 | setVirgin(virginity); |
183 | setFocusPolicy(QWidget::WheelFocus); | 184 | setFocusPolicy(QWidget::WheelFocus); |
184 | #ifndef PWM_EMBEDDED | 185 | #ifndef PWM_EMBEDDED |
185 | statusBar()->show(); | 186 | statusBar()->show(); |
186 | #endif | 187 | #endif |
187 | view = makeNewListView(doc); | 188 | view = makeNewListView(doc); |
188 | setCentralWidget(view); | 189 | setCentralWidget(view); |
189 | updateCaption(); | 190 | updateCaption(); |
190 | showStatMsg(i18n("Ready.")); | 191 | showStatMsg(i18n("Ready.")); |
191 | } | 192 | } |
192 | 193 | ||
193 | PwM::~PwM() | 194 | PwM::~PwM() |
194 | { | 195 | { |
195 | //qDebug("PwM::~PwM()"); | 196 | //qDebug("PwM::~PwM()"); |
196 | disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), | 197 | disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), |
197 | this, SLOT(docClosed(PwMDoc *))); | 198 | this, SLOT(docClosed(PwMDoc *))); |
198 | conf()->confWndMainWndSize(size()); | 199 | conf()->confWndMainWndSize(size()); |
199 | emit closed(this); | 200 | emit closed(this); |
200 | //qDebug("PwM::~PwM() emited closed(this)"); | 201 | //qDebug("PwM::~PwM() emited closed(this)"); |
201 | delete view; | 202 | delete view; |
203 | delete syncManager; | ||
202 | } | 204 | } |
203 | 205 | ||
204 | void PwM::initMenubar() | 206 | void PwM::initMenubar() |
205 | { | 207 | { |
206 | KIconLoader* picons; | 208 | KIconLoader* picons; |
207 | #ifndef PWM_EMBEDDED | 209 | #ifndef PWM_EMBEDDED |
208 | KIconLoader icons; | 210 | KIconLoader icons; |
209 | picons = &icons; | 211 | picons = &icons; |
210 | #else | 212 | #else |
211 | picons = KGlobal::iconLoader(); | 213 | picons = KGlobal::iconLoader(); |
212 | 214 | ||
213 | 215 | ||
214 | syncPopup = new KPopupMenu(this); | 216 | syncPopup = new KPopupMenu(this); |
215 | 217 | ||
216 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); | 218 | syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); |
217 | syncManager->setBlockSave(false); | 219 | syncManager->setBlockSave(false); |
218 | 220 | ||
219 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 221 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
220 | syncManager->fillSyncMenu(); | 222 | syncManager->fillSyncMenu(); |
221 | 223 | ||
222 | #endif | 224 | #endif |
223 | filePopup = new KPopupMenu(this); | 225 | filePopup = new KPopupMenu(this); |
224 | importPopup = new KPopupMenu(filePopup); | 226 | importPopup = new KPopupMenu(filePopup); |
225 | exportPopup = new KPopupMenu(filePopup); | 227 | exportPopup = new KPopupMenu(filePopup); |
226 | managePopup = new KPopupMenu(this); | 228 | managePopup = new KPopupMenu(this); |
227 | #ifdef CONFIG_KEYCARD | 229 | #ifdef CONFIG_KEYCARD |
228 | chipcardPopup = new KPopupMenu(this); | 230 | chipcardPopup = new KPopupMenu(this); |
229 | #endif // CONFIG_KEYCARD | 231 | #endif // CONFIG_KEYCARD |
230 | viewPopup = new KPopupMenu(this); | 232 | viewPopup = new KPopupMenu(this); |
231 | optionsPopup = new KPopupMenu(this); | 233 | optionsPopup = new KPopupMenu(this); |
232 | 234 | ||
233 | // "file" popup menu | 235 | // "file" popup menu |
234 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 236 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), |
235 | i18n("&New"), this, | 237 | i18n("&New"), this, |
236 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); | 238 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); |
237 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), | 239 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), |
238 | i18n("&Open"), this, | 240 | i18n("&Open"), this, |
239 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); | 241 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); |
240 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), | 242 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), |
241 | i18n("&Close"), this, | 243 | i18n("&Close"), this, |
242 | SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); | 244 | SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); |
243 | filePopup->insertSeparator(); | 245 | filePopup->insertSeparator(); |
244 | filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), | 246 | filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), |
245 | i18n("&Save"), this, | 247 | i18n("&Save"), this, |
246 | SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); | 248 | SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); |
247 | filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), | 249 | filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), |
248 | i18n("Save &as..."), | 250 | i18n("Save &as..."), |
249 | this, SLOT(saveAs_slot()), 0, | 251 | this, SLOT(saveAs_slot()), 0, |
250 | BUTTON_POPUP_FILE_SAVEAS); | 252 | BUTTON_POPUP_FILE_SAVEAS); |
251 | filePopup->insertSeparator(); | 253 | filePopup->insertSeparator(); |
252 | // "file/export" popup menu | 254 | // "file/export" popup menu |
253 | exportPopup->insertItem(i18n("&Text-file..."), this, | 255 | exportPopup->insertItem(i18n("&Text-file..."), this, |
254 | SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); | 256 | SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); |
255 | exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, | 257 | exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, |
256 | SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); | 258 | SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); |
257 | exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, | 259 | exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, |
258 | SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); | 260 | SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); |
259 | #ifdef CONFIG_KWALLETIF | 261 | #ifdef CONFIG_KWALLETIF |
260 | exportPopup->insertItem(i18n("&KWallet..."), this, | 262 | exportPopup->insertItem(i18n("&KWallet..."), this, |
261 | SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); | 263 | SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); |
262 | #endif | 264 | #endif |
263 | filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), | 265 | filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), |
264 | i18n("E&xport"), exportPopup, | 266 | i18n("E&xport"), exportPopup, |
265 | BUTTON_POPUP_FILE_EXPORT); | 267 | BUTTON_POPUP_FILE_EXPORT); |
266 | // "file/import" popup menu | 268 | // "file/import" popup menu |
267 | importPopup->insertItem(i18n("&Text-file..."), this, | 269 | importPopup->insertItem(i18n("&Text-file..."), this, |
268 | SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); | 270 | SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); |
269 | importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, | 271 | importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, |
270 | SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); | 272 | SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); |
271 | importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, | 273 | importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, |
272 | SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); | 274 | SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); |
273 | #ifdef CONFIG_KWALLETIF | 275 | #ifdef CONFIG_KWALLETIF |
274 | importPopup->insertItem(i18n("&KWallet..."), this, | 276 | importPopup->insertItem(i18n("&KWallet..."), this, |
275 | SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); | 277 | SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); |
276 | #endif | 278 | #endif |
277 | filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), | 279 | filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), |
278 | i18n("I&mport"), importPopup, | 280 | i18n("I&mport"), importPopup, |
279 | BUTTON_POPUP_FILE_IMPORT); | 281 | BUTTON_POPUP_FILE_IMPORT); |
280 | filePopup->insertSeparator(); | 282 | filePopup->insertSeparator(); |
281 | filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), | 283 | filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), |
282 | i18n("&Print..."), this, | 284 | i18n("&Print..."), this, |
283 | SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); | 285 | SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); |
284 | filePopup->insertSeparator(); | 286 | filePopup->insertSeparator(); |
285 | filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), | 287 | filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), |
286 | i18n("&Quit"), this, | 288 | i18n("&Quit"), this, |
287 | SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); | 289 | SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); |
288 | menuBar()->insertItem(i18n("&File"), filePopup); | 290 | menuBar()->insertItem(i18n("&File"), filePopup); |
289 | // "manage" popup menu | 291 | // "manage" popup menu |
290 | managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), | 292 | managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), |
291 | i18n("&Add password"), this, | 293 | i18n("&Add password"), this, |
292 | SLOT(addPwd_slot()), 0, | 294 | SLOT(addPwd_slot()), 0, |
293 | BUTTON_POPUP_MANAGE_ADD); | 295 | BUTTON_POPUP_MANAGE_ADD); |
294 | managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), | 296 | managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), |
295 | i18n("&Edit"), this, SLOT(editPwd_slot()), 0, | 297 | i18n("&Edit"), this, SLOT(editPwd_slot()), 0, |
296 | BUTTON_POPUP_MANAGE_EDIT); | 298 | BUTTON_POPUP_MANAGE_EDIT); |
297 | managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), | 299 | managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), |
298 | i18n("&Delete"), this, SLOT(deletePwd_slot()), | 300 | i18n("&Delete"), this, SLOT(deletePwd_slot()), |
299 | 0, BUTTON_POPUP_MANAGE_DEL); | 301 | 0, BUTTON_POPUP_MANAGE_DEL); |
300 | managePopup->insertSeparator(); | 302 | managePopup->insertSeparator(); |
301 | managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), | 303 | managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), |
302 | i18n("Change &Master Password"), this, | 304 | i18n("Change &Master Password"), this, |
303 | SLOT(changeMasterPwd_slot()), 0, | 305 | SLOT(changeMasterPwd_slot()), 0, |
304 | BUTTON_POPUP_MANAGE_CHANGEMP); | 306 | BUTTON_POPUP_MANAGE_CHANGEMP); |
305 | menuBar()->insertItem(i18n("&Manage"), managePopup); | 307 | menuBar()->insertItem(i18n("&Manage"), managePopup); |
306 | // "chipcard" popup menu | 308 | // "chipcard" popup menu |
307 | #ifdef CONFIG_KEYCARD | 309 | #ifdef CONFIG_KEYCARD |
308 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 310 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), |
309 | i18n("&Generate new key-card"), this, | 311 | i18n("&Generate new key-card"), this, |
310 | SLOT(genNewCard_slot()), 0, | 312 | SLOT(genNewCard_slot()), 0, |
311 | BUTTON_POPUP_CHIPCARD_GENNEW); | 313 | BUTTON_POPUP_CHIPCARD_GENNEW); |
312 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), | 314 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), |
313 | i18n("&Erase key-card"), this, | 315 | i18n("&Erase key-card"), this, |
314 | SLOT(eraseCard_slot()), 0, | 316 | SLOT(eraseCard_slot()), 0, |
315 | BUTTON_POPUP_CHIPCARD_DEL); | 317 | BUTTON_POPUP_CHIPCARD_DEL); |
316 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), | 318 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), |
317 | i18n("Read card-&ID"), this, | 319 | i18n("Read card-&ID"), this, |
318 | SLOT(readCardId_slot()), 0, | 320 | SLOT(readCardId_slot()), 0, |
319 | BUTTON_POPUP_CHIPCARD_READID); | 321 | BUTTON_POPUP_CHIPCARD_READID); |
320 | chipcardPopup->insertSeparator(); | 322 | chipcardPopup->insertSeparator(); |
321 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), | 323 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), |
322 | i18n("&Make card backup-image"), this, | 324 | i18n("&Make card backup-image"), this, |
323 | SLOT(makeCardBackup_slot()), 0, | 325 | SLOT(makeCardBackup_slot()), 0, |
324 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP); | 326 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP); |
325 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), | 327 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), |
326 | i18n("&Replay card backup-image"), this, | 328 | i18n("&Replay card backup-image"), this, |
327 | SLOT(replayCardBackup_slot()), 0, | 329 | SLOT(replayCardBackup_slot()), 0, |
328 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); | 330 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); |
329 | menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); | 331 | menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); |
330 | #endif // CONFIG_KEYCARD | 332 | #endif // CONFIG_KEYCARD |
331 | // "view" popup menu | 333 | // "view" popup menu |
332 | viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), | 334 | viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), |
333 | i18n("&Find"), this, | 335 | i18n("&Find"), this, |
334 | SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); | 336 | SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); |
335 | viewPopup->insertSeparator(); | 337 | viewPopup->insertSeparator(); |
336 | viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), | 338 | viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), |
337 | i18n("&Lock all entries"), this, | 339 | i18n("&Lock all entries"), this, |
338 | SLOT(lockWnd_slot()), 0, | 340 | SLOT(lockWnd_slot()), 0, |
339 | BUTTON_POPUP_VIEW_LOCK); | 341 | BUTTON_POPUP_VIEW_LOCK); |
340 | viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), | 342 | viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), |
341 | i18n("&Deep-lock all entries"), this, | 343 | i18n("&Deep-lock all entries"), this, |
342 | SLOT(deepLockWnd_slot()), 0, | 344 | SLOT(deepLockWnd_slot()), 0, |
343 | BUTTON_POPUP_VIEW_DEEPLOCK); | 345 | BUTTON_POPUP_VIEW_DEEPLOCK); |
344 | viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), | 346 | viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), |
345 | i18n("&Unlock all entries"), this, | 347 | i18n("&Unlock all entries"), this, |
346 | SLOT(unlockWnd_slot()), 0, | 348 | SLOT(unlockWnd_slot()), 0, |
347 | BUTTON_POPUP_VIEW_UNLOCK); | 349 | BUTTON_POPUP_VIEW_UNLOCK); |
348 | menuBar()->insertItem(i18n("&View"), viewPopup); | 350 | menuBar()->insertItem(i18n("&View"), viewPopup); |
349 | // "options" popup menu | 351 | // "options" popup menu |
350 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), | 352 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), |
351 | i18n("&Configure..."), this, | 353 | i18n("&Configure..."), this, |
352 | SLOT(config_slot()), | 354 | SLOT(config_slot()), |
353 | BUTTON_POPUP_OPTIONS_CONFIG); | 355 | BUTTON_POPUP_OPTIONS_CONFIG); |
354 | menuBar()->insertItem(i18n("&Options"), optionsPopup); | 356 | menuBar()->insertItem(i18n("&Options"), optionsPopup); |
355 | // "help" popup menu | 357 | // "help" popup menu |
356 | #ifndef PWM_EMBEDDED | 358 | #ifndef PWM_EMBEDDED |
357 | helpPopup = helpMenu(QString::null, false); | 359 | helpPopup = helpMenu(QString::null, false); |
358 | #else | 360 | #else |
359 | menuBar()->insertItem(i18n("&Sync"), syncPopup); | 361 | menuBar()->insertItem(i18n("&Sync"), syncPopup); |
360 | 362 | ||
361 | 363 | ||
362 | 364 | ||
363 | 365 | ||
364 | 366 | ||
365 | helpPopup = new KPopupMenu(this); | 367 | helpPopup = new KPopupMenu(this); |
366 | 368 | ||
367 | 369 | ||
368 | helpPopup->insertItem(i18n("&License"), this, | 370 | helpPopup->insertItem(i18n("&License"), this, |
369 | SLOT(showLicense_slot()), 0, | 371 | SLOT(showLicense_slot()), 0, |
370 | BUTTON_POPUP_HELP_LICENSE); | 372 | BUTTON_POPUP_HELP_LICENSE); |
371 | 373 | ||
372 | helpPopup->insertItem(i18n("&Faq"), this, | 374 | helpPopup->insertItem(i18n("&Faq"), this, |
373 | SLOT(faq_slot()), 0, | 375 | SLOT(faq_slot()), 0, |
374 | BUTTON_POPUP_HELP_FAQ); | 376 | BUTTON_POPUP_HELP_FAQ); |
375 | 377 | ||
376 | helpPopup->insertItem(i18n("&About PwManager"), this, | 378 | helpPopup->insertItem(i18n("&About PwManager"), this, |
377 | SLOT(createAboutData_slot()), 0, | 379 | SLOT(createAboutData_slot()), 0, |
378 | BUTTON_POPUP_HELP_ABOUT); | 380 | BUTTON_POPUP_HELP_ABOUT); |
379 | 381 | ||
380 | helpPopup->insertItem(i18n("&Sync HowTo"), this, | 382 | helpPopup->insertItem(i18n("&Sync HowTo"), this, |
381 | SLOT(syncHowTo_slot()), 0, | 383 | SLOT(syncHowTo_slot()), 0, |
382 | BUTTON_POPUP_HELP_SYNC); | 384 | BUTTON_POPUP_HELP_SYNC); |
383 | 385 | ||
384 | helpPopup->insertItem(i18n("&What's New"), this, | 386 | helpPopup->insertItem(i18n("&What's New"), this, |
385 | SLOT(whatsnew_slot()), 0, | 387 | SLOT(whatsnew_slot()), 0, |
386 | BUTTON_POPUP_HELP_WHATSNEW); | 388 | BUTTON_POPUP_HELP_WHATSNEW); |
387 | 389 | ||
388 | #endif | 390 | #endif |
389 | menuBar()->insertItem(i18n("&Help"), helpPopup); | 391 | menuBar()->insertItem(i18n("&Help"), helpPopup); |
390 | 392 | ||
391 | } | 393 | } |
392 | 394 | ||
393 | void PwM::initToolbar() | 395 | void PwM::initToolbar() |
394 | { | 396 | { |
395 | KIconLoader* picons; | 397 | KIconLoader* picons; |
396 | #ifndef PWM_EMBEDDED | 398 | #ifndef PWM_EMBEDDED |
397 | KIconLoader icons; | 399 | KIconLoader icons; |
398 | picons = &icons; | 400 | picons = &icons; |
399 | #else | 401 | #else |
400 | picons = KGlobal::iconLoader(); | 402 | picons = KGlobal::iconLoader(); |
401 | #endif | 403 | #endif |
402 | 404 | ||
403 | #ifdef PWM_EMBEDDED | 405 | #ifdef PWM_EMBEDDED |
404 | if ( QApplication::desktop()->width() > 320 ) | 406 | if ( QApplication::desktop()->width() > 320 ) |
405 | #endif | 407 | #endif |
406 | { | 408 | { |
407 | toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), | 409 | toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), |
408 | BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, | 410 | BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, |
409 | SLOT(new_slot()), true, i18n("New")); | 411 | SLOT(new_slot()), true, i18n("New")); |
410 | toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), | 412 | toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), |
411 | BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, | 413 | BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, |
412 | SLOT(open_slot()), true, i18n("Open")); | 414 | SLOT(open_slot()), true, i18n("Open")); |
413 | toolBar()->insertSeparator(); | 415 | toolBar()->insertSeparator(); |
414 | } | 416 | } |
415 | toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), | 417 | toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), |
416 | BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, | 418 | BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, |
417 | SLOT(save_slot()), true, i18n("Save")); | 419 | SLOT(save_slot()), true, i18n("Save")); |
418 | toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), | 420 | toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), |
419 | BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, | 421 | BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, |
420 | SLOT(saveAs_slot()), true, i18n("Save as")); | 422 | SLOT(saveAs_slot()), true, i18n("Save as")); |
421 | toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), | 423 | toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), |
422 | BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, | 424 | BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, |
423 | SLOT(print_slot()), true, i18n("Print...")); | 425 | SLOT(print_slot()), true, i18n("Print...")); |
424 | toolBar()->insertSeparator(); | 426 | toolBar()->insertSeparator(); |
425 | toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), | 427 | toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), |
426 | BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, | 428 | BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, |
427 | SLOT(addPwd_slot()), true, | 429 | SLOT(addPwd_slot()), true, |
428 | i18n("Add password")); | 430 | i18n("Add password")); |
429 | toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), | 431 | toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), |
430 | BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, | 432 | BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, |
431 | SLOT(editPwd_slot()), true, | 433 | SLOT(editPwd_slot()), true, |
432 | i18n("Edit password")); | 434 | i18n("Edit password")); |
433 | toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), | 435 | toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), |
434 | BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, | 436 | BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, |
435 | SLOT(deletePwd_slot()), true, | 437 | SLOT(deletePwd_slot()), true, |
436 | i18n("Delete password")); | 438 | i18n("Delete password")); |
437 | toolBar()->insertSeparator(); | 439 | toolBar()->insertSeparator(); |
438 | toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), | 440 | toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), |
439 | BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, | 441 | BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, |
440 | SLOT(find_slot()), true, i18n("Find entry")); | 442 | SLOT(find_slot()), true, i18n("Find entry")); |
441 | toolBar()->insertSeparator(); | 443 | toolBar()->insertSeparator(); |
442 | toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), | 444 | toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), |
443 | BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, | 445 | BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, |
444 | SLOT(lockWnd_slot()), true, | 446 | SLOT(lockWnd_slot()), true, |
445 | i18n("Lock all entries")); | 447 | i18n("Lock all entries")); |
446 | toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), | 448 | toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), |
447 | BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, | 449 | BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, |
448 | SLOT(deepLockWnd_slot()), true, | 450 | SLOT(deepLockWnd_slot()), true, |
449 | i18n("Deep-Lock all entries")); | 451 | i18n("Deep-Lock all entries")); |
450 | toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), | 452 | toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), |
451 | BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, | 453 | BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, |
452 | SLOT(unlockWnd_slot()), true, | 454 | SLOT(unlockWnd_slot()), true, |
453 | i18n("Unlock all entries")); | 455 | i18n("Unlock all entries")); |
454 | } | 456 | } |
455 | 457 | ||
456 | void PwM::initMetrics() | 458 | void PwM::initMetrics() |
457 | { | 459 | { |