-rw-r--r-- | kaddressbook/kabcore.cpp | 7 | ||||
-rw-r--r-- | kmicromail/composemail.cpp | 24 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 77 | ||||
-rw-r--r-- | kmicromail/mailistviewitem.h | 7 | ||||
-rw-r--r-- | kmicromail/mainwindow.cpp | 10 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 2 |
6 files changed, 80 insertions, 47 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index a6d722d..68d3d2d 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -820,787 +820,790 @@ void KABCore::addEmail( QString aStr ) | |||
820 | (*it).setNameFromString( fullName ); | 820 | (*it).setNameFromString( fullName ); |
821 | editContact( (*it).uid() ); | 821 | editContact( (*it).uid() ); |
822 | } | 822 | } |
823 | } | 823 | } |
824 | 824 | ||
825 | if ( !found ) { | 825 | if ( !found ) { |
826 | KABC::Addressee addr; | 826 | KABC::Addressee addr; |
827 | addr.setNameFromString( fullName ); | 827 | addr.setNameFromString( fullName ); |
828 | addr.insertEmail( email, true ); | 828 | addr.insertEmail( email, true ); |
829 | 829 | ||
830 | mAddressBook->insertAddressee( addr ); | 830 | mAddressBook->insertAddressee( addr ); |
831 | mViewManager->refreshView( addr.uid() ); | 831 | mViewManager->refreshView( addr.uid() ); |
832 | editContact( addr.uid() ); | 832 | editContact( addr.uid() ); |
833 | } | 833 | } |
834 | #else //KAB_EMBEDDED | 834 | #else //KAB_EMBEDDED |
835 | qDebug("KABCore::addEmail finsih method"); | 835 | qDebug("KABCore::addEmail finsih method"); |
836 | #endif //KAB_EMBEDDED | 836 | #endif //KAB_EMBEDDED |
837 | } | 837 | } |
838 | 838 | ||
839 | void KABCore::importVCard( const KURL &url, bool showPreview ) | 839 | void KABCore::importVCard( const KURL &url, bool showPreview ) |
840 | { | 840 | { |
841 | mXXPortManager->importVCard( url, showPreview ); | 841 | mXXPortManager->importVCard( url, showPreview ); |
842 | } | 842 | } |
843 | 843 | ||
844 | void KABCore::importVCard( const QString &vCard, bool showPreview ) | 844 | void KABCore::importVCard( const QString &vCard, bool showPreview ) |
845 | { | 845 | { |
846 | mXXPortManager->importVCard( vCard, showPreview ); | 846 | mXXPortManager->importVCard( vCard, showPreview ); |
847 | } | 847 | } |
848 | 848 | ||
849 | //US added a second method without defaultparameter | 849 | //US added a second method without defaultparameter |
850 | void KABCore::editContact2() { | 850 | void KABCore::editContact2() { |
851 | editContact( QString::null ); | 851 | editContact( QString::null ); |
852 | } | 852 | } |
853 | 853 | ||
854 | void KABCore::editContact( const QString &uid ) | 854 | void KABCore::editContact( const QString &uid ) |
855 | { | 855 | { |
856 | 856 | ||
857 | if ( mExtensionManager->isQuickEditVisible() ) | 857 | if ( mExtensionManager->isQuickEditVisible() ) |
858 | return; | 858 | return; |
859 | 859 | ||
860 | // First, locate the contact entry | 860 | // First, locate the contact entry |
861 | QString localUID = uid; | 861 | QString localUID = uid; |
862 | if ( localUID.isNull() ) { | 862 | if ( localUID.isNull() ) { |
863 | QStringList uidList = mViewManager->selectedUids(); | 863 | QStringList uidList = mViewManager->selectedUids(); |
864 | if ( uidList.count() > 0 ) | 864 | if ( uidList.count() > 0 ) |
865 | localUID = *( uidList.at( 0 ) ); | 865 | localUID = *( uidList.at( 0 ) ); |
866 | } | 866 | } |
867 | 867 | ||
868 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); | 868 | KABC::Addressee addr = mAddressBook->findByUid( localUID ); |
869 | if ( !addr.isEmpty() ) { | 869 | if ( !addr.isEmpty() ) { |
870 | AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); | 870 | AddresseeEditorDialog *dialog = mEditorDict.find( addr.uid() ); |
871 | if ( !dialog ) { | 871 | if ( !dialog ) { |
872 | dialog = createAddresseeEditorDialog( this ); | 872 | dialog = createAddresseeEditorDialog( this ); |
873 | 873 | ||
874 | mEditorDict.insert( addr.uid(), dialog ); | 874 | mEditorDict.insert( addr.uid(), dialog ); |
875 | 875 | ||
876 | dialog->setAddressee( addr ); | 876 | dialog->setAddressee( addr ); |
877 | } | 877 | } |
878 | 878 | ||
879 | dialog->raise(); | 879 | dialog->raise(); |
880 | dialog->show(); | 880 | dialog->show(); |
881 | } | 881 | } |
882 | } | 882 | } |
883 | 883 | ||
884 | void KABCore::save() | 884 | void KABCore::save() |
885 | { | 885 | { |
886 | if ( !mModified ) | 886 | if ( !mModified ) |
887 | return; | 887 | return; |
888 | QString text = i18n( "There was an error while attempting to save\n the " | 888 | QString text = i18n( "There was an error while attempting to save\n the " |
889 | "address book. Please check that some \nother application is " | 889 | "address book. Please check that some \nother application is " |
890 | "not using it. " ); | 890 | "not using it. " ); |
891 | statusMessage(i18n("Saving addressbook ... ")); | 891 | statusMessage(i18n("Saving addressbook ... ")); |
892 | #ifndef KAB_EMBEDDED | 892 | #ifndef KAB_EMBEDDED |
893 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); | 893 | KABC::StdAddressBook *b = dynamic_cast<KABC::StdAddressBook*>( mAddressBook ); |
894 | if ( !b || !b->save() ) { | 894 | if ( !b || !b->save() ) { |
895 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); | 895 | KMessageBox::error( this, text, i18n( "Unable to Save" ) ); |
896 | } | 896 | } |
897 | #else //KAB_EMBEDDED | 897 | #else //KAB_EMBEDDED |
898 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); | 898 | KABC::StdAddressBook *b = (KABC::StdAddressBook*)( mAddressBook ); |
899 | if ( !b || !b->save() ) { | 899 | if ( !b || !b->save() ) { |
900 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); | 900 | QMessageBox::critical( this, i18n( "Unable to Save" ), text, i18n("Ok")); |
901 | } | 901 | } |
902 | #endif //KAB_EMBEDDED | 902 | #endif //KAB_EMBEDDED |
903 | 903 | ||
904 | statusMessage(i18n("Addressbook saved!")); | 904 | statusMessage(i18n("Addressbook saved!")); |
905 | setModified( false ); | 905 | setModified( false ); |
906 | } | 906 | } |
907 | 907 | ||
908 | void KABCore::statusMessage(QString mess , int time ) | 908 | void KABCore::statusMessage(QString mess , int time ) |
909 | { | 909 | { |
910 | //topLevelWidget()->setCaption( mess ); | 910 | //topLevelWidget()->setCaption( mess ); |
911 | // pending setting timer to revome message | 911 | // pending setting timer to revome message |
912 | } | 912 | } |
913 | void KABCore::undo() | 913 | void KABCore::undo() |
914 | { | 914 | { |
915 | UndoStack::instance()->undo(); | 915 | UndoStack::instance()->undo(); |
916 | 916 | ||
917 | // Refresh the view | 917 | // Refresh the view |
918 | mViewManager->refreshView(); | 918 | mViewManager->refreshView(); |
919 | } | 919 | } |
920 | 920 | ||
921 | void KABCore::redo() | 921 | void KABCore::redo() |
922 | { | 922 | { |
923 | RedoStack::instance()->redo(); | 923 | RedoStack::instance()->redo(); |
924 | 924 | ||
925 | // Refresh the view | 925 | // Refresh the view |
926 | mViewManager->refreshView(); | 926 | mViewManager->refreshView(); |
927 | } | 927 | } |
928 | 928 | ||
929 | void KABCore::setJumpButtonBarVisible( bool visible ) | 929 | void KABCore::setJumpButtonBarVisible( bool visible ) |
930 | { | 930 | { |
931 | if ( visible ) | 931 | if ( visible ) |
932 | mJumpButtonBar->show(); | 932 | mJumpButtonBar->show(); |
933 | else | 933 | else |
934 | mJumpButtonBar->hide(); | 934 | mJumpButtonBar->hide(); |
935 | } | 935 | } |
936 | void KABCore::setDetailsToState() | 936 | void KABCore::setDetailsToState() |
937 | { | 937 | { |
938 | setDetailsVisible( mActionDetails->isChecked() ); | 938 | setDetailsVisible( mActionDetails->isChecked() ); |
939 | } | 939 | } |
940 | 940 | ||
941 | void KABCore::setDetailsVisible( bool visible ) | 941 | void KABCore::setDetailsVisible( bool visible ) |
942 | { | 942 | { |
943 | if ( visible ) | 943 | if ( visible ) |
944 | mDetails->show(); | 944 | mDetails->show(); |
945 | else | 945 | else |
946 | mDetails->hide(); | 946 | mDetails->hide(); |
947 | } | 947 | } |
948 | 948 | ||
949 | void KABCore::extensionModified( const KABC::Addressee::List &list ) | 949 | void KABCore::extensionModified( const KABC::Addressee::List &list ) |
950 | { | 950 | { |
951 | 951 | ||
952 | if ( list.count() != 0 ) { | 952 | if ( list.count() != 0 ) { |
953 | KABC::Addressee::List::ConstIterator it; | 953 | KABC::Addressee::List::ConstIterator it; |
954 | for ( it = list.begin(); it != list.end(); ++it ) | 954 | for ( it = list.begin(); it != list.end(); ++it ) |
955 | mAddressBook->insertAddressee( *it ); | 955 | mAddressBook->insertAddressee( *it ); |
956 | if ( list.count() > 1 ) | 956 | if ( list.count() > 1 ) |
957 | setModified(); | 957 | setModified(); |
958 | else | 958 | else |
959 | setModifiedWOrefresh(); | 959 | setModifiedWOrefresh(); |
960 | } | 960 | } |
961 | if ( list.count() == 0 ) | 961 | if ( list.count() == 0 ) |
962 | mViewManager->refreshView(); | 962 | mViewManager->refreshView(); |
963 | else | 963 | else |
964 | mViewManager->refreshView( list[ 0 ].uid() ); | 964 | mViewManager->refreshView( list[ 0 ].uid() ); |
965 | 965 | ||
966 | 966 | ||
967 | 967 | ||
968 | } | 968 | } |
969 | 969 | ||
970 | QString KABCore::getNameByPhone( const QString &phone ) | 970 | QString KABCore::getNameByPhone( const QString &phone ) |
971 | { | 971 | { |
972 | #ifndef KAB_EMBEDDED | 972 | #ifndef KAB_EMBEDDED |
973 | QRegExp r( "[/*/-/ ]" ); | 973 | QRegExp r( "[/*/-/ ]" ); |
974 | QString localPhone( phone ); | 974 | QString localPhone( phone ); |
975 | 975 | ||
976 | bool found = false; | 976 | bool found = false; |
977 | QString ownerName = ""; | 977 | QString ownerName = ""; |
978 | KABC::AddressBook::Iterator iter; | 978 | KABC::AddressBook::Iterator iter; |
979 | KABC::PhoneNumber::List::Iterator phoneIter; | 979 | KABC::PhoneNumber::List::Iterator phoneIter; |
980 | KABC::PhoneNumber::List phoneList; | 980 | KABC::PhoneNumber::List phoneList; |
981 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { | 981 | for ( iter = mAddressBook->begin(); !found && ( iter != mAddressBook->end() ); ++iter ) { |
982 | phoneList = (*iter).phoneNumbers(); | 982 | phoneList = (*iter).phoneNumbers(); |
983 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); | 983 | for ( phoneIter = phoneList.begin(); !found && ( phoneIter != phoneList.end() ); |
984 | ++phoneIter) { | 984 | ++phoneIter) { |
985 | // Get rid of separator chars so just the numbers are compared. | 985 | // Get rid of separator chars so just the numbers are compared. |
986 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { | 986 | if ( (*phoneIter).number().replace( r, "" ) == localPhone.replace( r, "" ) ) { |
987 | ownerName = (*iter).formattedName(); | 987 | ownerName = (*iter).formattedName(); |
988 | found = true; | 988 | found = true; |
989 | } | 989 | } |
990 | } | 990 | } |
991 | } | 991 | } |
992 | 992 | ||
993 | return ownerName; | 993 | return ownerName; |
994 | #else //KAB_EMBEDDED | 994 | #else //KAB_EMBEDDED |
995 | qDebug("KABCore::getNameByPhone finsih method"); | 995 | qDebug("KABCore::getNameByPhone finsih method"); |
996 | return ""; | 996 | return ""; |
997 | #endif //KAB_EMBEDDED | 997 | #endif //KAB_EMBEDDED |
998 | 998 | ||
999 | } | 999 | } |
1000 | 1000 | ||
1001 | void KABCore::openConfigDialog() | 1001 | void KABCore::openConfigDialog() |
1002 | { | 1002 | { |
1003 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); | 1003 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"kabconfigdialog", true ); |
1004 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); | 1004 | KCMKabConfig* kabcfg = new KCMKabConfig( ConfigureDialog->getNewVBoxPage(i18n( "Addressbook")) , "KCMKabConfig" ); |
1005 | ConfigureDialog->addModule(kabcfg ); | 1005 | ConfigureDialog->addModule(kabcfg ); |
1006 | connect( ConfigureDialog, SIGNAL( applyClicked() ), | 1006 | connect( ConfigureDialog, SIGNAL( applyClicked() ), |
1007 | this, SLOT( configurationChanged() ) ); | 1007 | this, SLOT( configurationChanged() ) ); |
1008 | connect( ConfigureDialog, SIGNAL( okClicked() ), | 1008 | connect( ConfigureDialog, SIGNAL( okClicked() ), |
1009 | this, SLOT( configurationChanged() ) ); | 1009 | this, SLOT( configurationChanged() ) ); |
1010 | saveSettings(); | 1010 | saveSettings(); |
1011 | ConfigureDialog->showMaximized(); | 1011 | ConfigureDialog->showMaximized(); |
1012 | ConfigureDialog->exec(); | 1012 | if ( ConfigureDialog->exec() ) |
1013 | KMessageBox::information( this, i18n("If you configured \nExtensions,\nplease restart!\n") ); | ||
1013 | delete ConfigureDialog; | 1014 | delete ConfigureDialog; |
1014 | } | 1015 | } |
1015 | 1016 | ||
1016 | void KABCore::openLDAPDialog() | 1017 | void KABCore::openLDAPDialog() |
1017 | { | 1018 | { |
1018 | #ifndef KAB_EMBEDDED | 1019 | #ifndef KAB_EMBEDDED |
1019 | if ( !mLdapSearchDialog ) { | 1020 | if ( !mLdapSearchDialog ) { |
1020 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); | 1021 | mLdapSearchDialog = new LDAPSearchDialog( mAddressBook, this ); |
1021 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, | 1022 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), mViewManager, |
1022 | SLOT( refreshView() ) ); | 1023 | SLOT( refreshView() ) ); |
1023 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, | 1024 | connect( mLdapSearchDialog, SIGNAL( addresseesAdded() ), this, |
1024 | SLOT( setModified() ) ); | 1025 | SLOT( setModified() ) ); |
1025 | } else | 1026 | } else |
1026 | mLdapSearchDialog->restoreSettings(); | 1027 | mLdapSearchDialog->restoreSettings(); |
1027 | 1028 | ||
1028 | if ( mLdapSearchDialog->isOK() ) | 1029 | if ( mLdapSearchDialog->isOK() ) |
1029 | mLdapSearchDialog->exec(); | 1030 | mLdapSearchDialog->exec(); |
1030 | #else //KAB_EMBEDDED | 1031 | #else //KAB_EMBEDDED |
1031 | qDebug("KABCore::openLDAPDialog() finsih method"); | 1032 | qDebug("KABCore::openLDAPDialog() finsih method"); |
1032 | #endif //KAB_EMBEDDED | 1033 | #endif //KAB_EMBEDDED |
1033 | } | 1034 | } |
1034 | 1035 | ||
1035 | void KABCore::print() | 1036 | void KABCore::print() |
1036 | { | 1037 | { |
1037 | #ifndef KAB_EMBEDDED | 1038 | #ifndef KAB_EMBEDDED |
1038 | KPrinter printer; | 1039 | KPrinter printer; |
1039 | if ( !printer.setup( this ) ) | 1040 | if ( !printer.setup( this ) ) |
1040 | return; | 1041 | return; |
1041 | 1042 | ||
1042 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, | 1043 | KABPrinting::PrintingWizard wizard( &printer, mAddressBook, |
1043 | mViewManager->selectedUids(), this ); | 1044 | mViewManager->selectedUids(), this ); |
1044 | 1045 | ||
1045 | wizard.exec(); | 1046 | wizard.exec(); |
1046 | #else //KAB_EMBEDDED | 1047 | #else //KAB_EMBEDDED |
1047 | qDebug("KABCore::print() finsih method"); | 1048 | qDebug("KABCore::print() finsih method"); |
1048 | #endif //KAB_EMBEDDED | 1049 | #endif //KAB_EMBEDDED |
1049 | 1050 | ||
1050 | } | 1051 | } |
1051 | 1052 | ||
1052 | 1053 | ||
1053 | void KABCore::addGUIClient( KXMLGUIClient *client ) | 1054 | void KABCore::addGUIClient( KXMLGUIClient *client ) |
1054 | { | 1055 | { |
1055 | if ( mGUIClient ) | 1056 | if ( mGUIClient ) |
1056 | mGUIClient->insertChildClient( client ); | 1057 | mGUIClient->insertChildClient( client ); |
1057 | else | 1058 | else |
1058 | KMessageBox::error( this, "no KXMLGUICLient"); | 1059 | KMessageBox::error( this, "no KXMLGUICLient"); |
1059 | } | 1060 | } |
1060 | 1061 | ||
1061 | 1062 | ||
1062 | void KABCore::configurationChanged() | 1063 | void KABCore::configurationChanged() |
1063 | { | 1064 | { |
1064 | mExtensionManager->reconfigure(); | 1065 | mExtensionManager->reconfigure(); |
1065 | } | 1066 | } |
1066 | 1067 | ||
1067 | void KABCore::addressBookChanged() | 1068 | void KABCore::addressBookChanged() |
1068 | { | 1069 | { |
1069 | #ifndef KAB_EMBEDDED | 1070 | #ifndef KAB_EMBEDDED |
1070 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); | 1071 | QDictIterator<AddresseeEditorDialog> it( mEditorDict ); |
1071 | while ( it.current() ) { | 1072 | while ( it.current() ) { |
1072 | if ( it.current()->dirty() ) { | 1073 | if ( it.current()->dirty() ) { |
1073 | QString text = i18n( "Data has been changed externally. Unsaved " | 1074 | QString text = i18n( "Data has been changed externally. Unsaved " |
1074 | "changes will be lost." ); | 1075 | "changes will be lost." ); |
1075 | KMessageBox::information( this, text ); | 1076 | KMessageBox::information( this, text ); |
1076 | } | 1077 | } |
1077 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); | 1078 | it.current()->setAddressee( mAddressBook->findByUid( it.currentKey() ) ); |
1078 | ++it; | 1079 | ++it; |
1079 | } | 1080 | } |
1080 | 1081 | ||
1081 | mViewManager->refreshView(); | 1082 | mViewManager->refreshView(); |
1082 | #else //KAB_EMBEDDED | 1083 | #else //KAB_EMBEDDED |
1083 | qDebug("KABCore::addressBookChanged() finsih method"); | 1084 | qDebug("KABCore::addressBookChanged() finsih method"); |
1084 | #endif //KAB_EMBEDDED | 1085 | #endif //KAB_EMBEDDED |
1085 | } | 1086 | } |
1086 | 1087 | ||
1087 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, | 1088 | AddresseeEditorDialog *KABCore::createAddresseeEditorDialog( QWidget *parent, |
1088 | const char *name ) | 1089 | const char *name ) |
1089 | { | 1090 | { |
1090 | AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, | 1091 | AddresseeEditorDialog *dialog = new AddresseeEditorDialog( this, parent, |
1091 | name ? name : "editorDialog" ); | 1092 | name ? name : "editorDialog" ); |
1092 | 1093 | ||
1093 | //US | 1094 | //US |
1094 | dialog->setMaximumSize( 640, 480 ); | 1095 | dialog->setMaximumSize( 640, 480 ); |
1095 | dialog->showMaximized(); | 1096 | dialog->showMaximized(); |
1096 | 1097 | ||
1097 | connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), | 1098 | connect( dialog, SIGNAL( contactModified( const KABC::Addressee& ) ), |
1098 | SLOT( contactModified( const KABC::Addressee& ) ) ); | 1099 | SLOT( contactModified( const KABC::Addressee& ) ) ); |
1099 | connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), | 1100 | connect( dialog, SIGNAL( editorDestroyed( const QString& ) ), |
1100 | SLOT( slotEditorDestroyed( const QString& ) ) ); | 1101 | SLOT( slotEditorDestroyed( const QString& ) ) ); |
1101 | 1102 | ||
1102 | return dialog; | 1103 | return dialog; |
1103 | } | 1104 | } |
1104 | 1105 | ||
1105 | void KABCore::slotEditorDestroyed( const QString &uid ) | 1106 | void KABCore::slotEditorDestroyed( const QString &uid ) |
1106 | { | 1107 | { |
1107 | mEditorDict.remove( uid ); | 1108 | mEditorDict.remove( uid ); |
1108 | } | 1109 | } |
1109 | 1110 | ||
1110 | void KABCore::initGUI() | 1111 | void KABCore::initGUI() |
1111 | { | 1112 | { |
1112 | #ifndef KAB_EMBEDDED | 1113 | #ifndef KAB_EMBEDDED |
1113 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1114 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1114 | topLayout->setSpacing( KDialogBase::spacingHint() ); | 1115 | topLayout->setSpacing( KDialogBase::spacingHint() ); |
1115 | 1116 | ||
1116 | mExtensionBarSplitter = new QSplitter( this ); | 1117 | mExtensionBarSplitter = new QSplitter( this ); |
1117 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); | 1118 | mExtensionBarSplitter->setOrientation( Qt::Vertical ); |
1118 | 1119 | ||
1119 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); | 1120 | mDetailsSplitter = new QSplitter( mExtensionBarSplitter ); |
1120 | 1121 | ||
1121 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1122 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1122 | mIncSearchWidget = new IncSearchWidget( viewSpace ); | 1123 | mIncSearchWidget = new IncSearchWidget( viewSpace ); |
1123 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1124 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1124 | SLOT( incrementalSearch( const QString& ) ) ); | 1125 | SLOT( incrementalSearch( const QString& ) ) ); |
1125 | 1126 | ||
1126 | mViewManager = new ViewManager( this, viewSpace ); | 1127 | mViewManager = new ViewManager( this, viewSpace ); |
1127 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1128 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1128 | 1129 | ||
1129 | mDetails = new ViewContainer( mDetailsSplitter ); | 1130 | mDetails = new ViewContainer( mDetailsSplitter ); |
1130 | 1131 | ||
1131 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1132 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1132 | 1133 | ||
1133 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1134 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1134 | 1135 | ||
1135 | topLayout->addWidget( mExtensionBarSplitter ); | 1136 | topLayout->addWidget( mExtensionBarSplitter ); |
1136 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); | 1137 | topLayout->setStretchFactor( mExtensionBarSplitter, 100 ); |
1137 | topLayout->addWidget( mJumpButtonBar ); | 1138 | topLayout->addWidget( mJumpButtonBar ); |
1138 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); | 1139 | topLayout->setStretchFactor( mJumpButtonBar, 1 ); |
1139 | 1140 | ||
1140 | mXXPortManager = new XXPortManager( this, this ); | 1141 | mXXPortManager = new XXPortManager( this, this ); |
1141 | 1142 | ||
1142 | #else //KAB_EMBEDDED | 1143 | #else //KAB_EMBEDDED |
1143 | //US initialize viewMenu before settingup viewmanager. | 1144 | //US initialize viewMenu before settingup viewmanager. |
1144 | // Viewmanager needs this menu to plugin submenues. | 1145 | // Viewmanager needs this menu to plugin submenues. |
1145 | viewMenu = new QPopupMenu( this ); | 1146 | viewMenu = new QPopupMenu( this ); |
1146 | settingsMenu = new QPopupMenu( this ); | 1147 | settingsMenu = new QPopupMenu( this ); |
1147 | //filterMenu = new QPopupMenu( this ); | 1148 | //filterMenu = new QPopupMenu( this ); |
1148 | ImportMenu = new QPopupMenu( this ); | 1149 | ImportMenu = new QPopupMenu( this ); |
1149 | ExportMenu = new QPopupMenu( this ); | 1150 | ExportMenu = new QPopupMenu( this ); |
1150 | 1151 | ||
1151 | 1152 | ||
1152 | //US since we have no splitter for the embedded system, setup | 1153 | //US since we have no splitter for the embedded system, setup |
1153 | // a layout with two frames. One left and one right. | 1154 | // a layout with two frames. One left and one right. |
1154 | 1155 | ||
1155 | QBoxLayout *topLayout; | 1156 | QBoxLayout *topLayout; |
1156 | 1157 | ||
1157 | // = new QHBoxLayout( this ); | 1158 | // = new QHBoxLayout( this ); |
1158 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); | 1159 | // QBoxLayout *topLayout = (QBoxLayout*)layout(); |
1159 | 1160 | ||
1160 | // QWidget *mainBox = new QWidget( this ); | 1161 | // QWidget *mainBox = new QWidget( this ); |
1161 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); | 1162 | // QBoxLayout * mainBoxLayout = new QHBoxLayout(mainBox); |
1162 | 1163 | ||
1163 | #ifdef DESKTOP_VERSION | 1164 | #ifdef DESKTOP_VERSION |
1164 | topLayout = new QHBoxLayout( this ); | 1165 | topLayout = new QHBoxLayout( this ); |
1165 | 1166 | ||
1166 | 1167 | ||
1167 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1168 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1168 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1169 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1169 | 1170 | ||
1170 | topLayout->addWidget(mMiniSplitter ); | 1171 | topLayout->addWidget(mMiniSplitter ); |
1171 | 1172 | ||
1172 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); | 1173 | mExtensionBarSplitter = new KDGanttMinimizeSplitter( Qt::Vertical,mMiniSplitter ); |
1173 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1174 | mExtensionBarSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1174 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); | 1175 | mViewManager = new ViewManager( this, mExtensionBarSplitter ); |
1175 | mDetails = new ViewContainer( mMiniSplitter ); | 1176 | mDetails = new ViewContainer( mMiniSplitter ); |
1176 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); | 1177 | mExtensionManager = new ExtensionManager( this, mExtensionBarSplitter ); |
1177 | #else | 1178 | #else |
1178 | if ( QApplication::desktop()->width() > 480 ) { | 1179 | if ( QApplication::desktop()->width() > 480 ) { |
1179 | topLayout = new QHBoxLayout( this ); | 1180 | topLayout = new QHBoxLayout( this ); |
1180 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 1181 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
1181 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 1182 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
1182 | } else { | 1183 | } else { |
1183 | 1184 | ||
1184 | topLayout = new QVBoxLayout( this ); | 1185 | topLayout = new QVBoxLayout( this ); |
1185 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 1186 | mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
1186 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 1187 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
1187 | } | 1188 | } |
1188 | 1189 | ||
1189 | topLayout->addWidget(mMiniSplitter ); | 1190 | topLayout->addWidget(mMiniSplitter ); |
1190 | mViewManager = new ViewManager( this, mMiniSplitter ); | 1191 | mViewManager = new ViewManager( this, mMiniSplitter ); |
1191 | mDetails = new ViewContainer( mMiniSplitter ); | 1192 | mDetails = new ViewContainer( mMiniSplitter ); |
1192 | 1193 | ||
1193 | 1194 | ||
1194 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); | 1195 | mExtensionManager = new ExtensionManager( this, mMiniSplitter ); |
1195 | #endif | 1196 | #endif |
1196 | //eh->hide(); | 1197 | //eh->hide(); |
1197 | // topLayout->addWidget(mExtensionManager ); | 1198 | // topLayout->addWidget(mExtensionManager ); |
1198 | 1199 | ||
1199 | 1200 | ||
1200 | /*US | 1201 | /*US |
1201 | #ifndef KAB_NOSPLITTER | 1202 | #ifndef KAB_NOSPLITTER |
1202 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1203 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1203 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1204 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1204 | topLayout->setSpacing( 10 ); | 1205 | topLayout->setSpacing( 10 ); |
1205 | 1206 | ||
1206 | mDetailsSplitter = new QSplitter( this ); | 1207 | mDetailsSplitter = new QSplitter( this ); |
1207 | 1208 | ||
1208 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); | 1209 | QVBox *viewSpace = new QVBox( mDetailsSplitter ); |
1209 | 1210 | ||
1210 | mViewManager = new ViewManager( this, viewSpace ); | 1211 | mViewManager = new ViewManager( this, viewSpace ); |
1211 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1212 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1212 | 1213 | ||
1213 | mDetails = new ViewContainer( mDetailsSplitter ); | 1214 | mDetails = new ViewContainer( mDetailsSplitter ); |
1214 | 1215 | ||
1215 | topLayout->addWidget( mDetailsSplitter ); | 1216 | topLayout->addWidget( mDetailsSplitter ); |
1216 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1217 | topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1217 | #else //KAB_NOSPLITTER | 1218 | #else //KAB_NOSPLITTER |
1218 | QHBoxLayout *topLayout = new QHBoxLayout( this ); | 1219 | QHBoxLayout *topLayout = new QHBoxLayout( this ); |
1219 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); | 1220 | //US topLayout->setSpacing( KDialogBase::spacingHint() ); |
1220 | topLayout->setSpacing( 10 ); | 1221 | topLayout->setSpacing( 10 ); |
1221 | 1222 | ||
1222 | // mDetailsSplitter = new QSplitter( this ); | 1223 | // mDetailsSplitter = new QSplitter( this ); |
1223 | 1224 | ||
1224 | QVBox *viewSpace = new QVBox( this ); | 1225 | QVBox *viewSpace = new QVBox( this ); |
1225 | 1226 | ||
1226 | mViewManager = new ViewManager( this, viewSpace ); | 1227 | mViewManager = new ViewManager( this, viewSpace ); |
1227 | viewSpace->setStretchFactor( mViewManager, 1 ); | 1228 | viewSpace->setStretchFactor( mViewManager, 1 ); |
1228 | 1229 | ||
1229 | mDetails = new ViewContainer( this ); | 1230 | mDetails = new ViewContainer( this ); |
1230 | 1231 | ||
1231 | topLayout->addWidget( viewSpace ); | 1232 | topLayout->addWidget( viewSpace ); |
1232 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); | 1233 | // topLayout->setStretchFactor( mDetailsSplitter, 100 ); |
1233 | topLayout->addWidget( mDetails ); | 1234 | topLayout->addWidget( mDetails ); |
1234 | #endif //KAB_NOSPLITTER | 1235 | #endif //KAB_NOSPLITTER |
1235 | */ | 1236 | */ |
1236 | 1237 | ||
1237 | 1238 | ||
1238 | #endif //KAB_EMBEDDED | 1239 | #endif //KAB_EMBEDDED |
1239 | initActions(); | 1240 | initActions(); |
1240 | 1241 | ||
1241 | #ifdef KAB_EMBEDDED | 1242 | #ifdef KAB_EMBEDDED |
1242 | addActionsManually(); | 1243 | addActionsManually(); |
1243 | //US make sure the export and import menues are initialized before creating the xxPortManager. | 1244 | //US make sure the export and import menues are initialized before creating the xxPortManager. |
1244 | mXXPortManager = new XXPortManager( this, this ); | 1245 | mXXPortManager = new XXPortManager( this, this ); |
1245 | 1246 | ||
1246 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); | 1247 | // LR mIncSearchWidget = new IncSearchWidget( mMainWindow->getIconToolBar() ); |
1247 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); | 1248 | //mMainWindow->toolBar()->insertWidget(-1, 4, mIncSearchWidget); |
1248 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1249 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1249 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); | 1250 | //mIncSearchWidget = new IncSearchWidget( mMainWindow->toolBar() ); |
1250 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); | 1251 | //mMainWindow->toolBar()->insertWidget(-1, 0, mIncSearchWidget); |
1251 | // mIncSearchWidget->hide(); | 1252 | // mIncSearchWidget->hide(); |
1252 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1253 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1253 | SLOT( incrementalSearch( const QString& ) ) ); | 1254 | SLOT( incrementalSearch( const QString& ) ) ); |
1254 | 1255 | ||
1255 | 1256 | ||
1256 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1257 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1257 | 1258 | ||
1258 | topLayout->addWidget( mJumpButtonBar ); | 1259 | topLayout->addWidget( mJumpButtonBar ); |
1259 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); | 1260 | //US topLayout->setStretchFactor( mJumpButtonBar, 10 ); |
1260 | 1261 | ||
1261 | // mMainWindow->getIconToolBar()->raise(); | 1262 | // mMainWindow->getIconToolBar()->raise(); |
1262 | 1263 | ||
1263 | #endif //KAB_EMBEDDED | 1264 | #endif //KAB_EMBEDDED |
1264 | 1265 | ||
1265 | } | 1266 | } |
1266 | void KABCore::initActions() | 1267 | void KABCore::initActions() |
1267 | { | 1268 | { |
1268 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1269 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1269 | 1270 | ||
1270 | #ifndef KAB_EMBEDDED | 1271 | #ifndef KAB_EMBEDDED |
1271 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), | 1272 | connect( QApplication::clipboard(), SIGNAL( dataChanged() ), |
1272 | SLOT( clipboardDataChanged() ) ); | 1273 | SLOT( clipboardDataChanged() ) ); |
1273 | #endif //KAB_EMBEDDED | 1274 | #endif //KAB_EMBEDDED |
1274 | 1275 | ||
1275 | // file menu | 1276 | // file menu |
1276 | if ( mIsPart ) { | 1277 | if ( mIsPart ) { |
1277 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, | 1278 | mActionMail = new KAction( i18n( "&Mail" ), "mail_generic", 0, this, |
1278 | SLOT( sendMail() ), actionCollection(), | 1279 | SLOT( sendMail() ), actionCollection(), |
1279 | "kaddressbook_mail" ); | 1280 | "kaddressbook_mail" ); |
1280 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, | 1281 | mActionPrint = new KAction( i18n( "&Print" ), "fileprint", CTRL + Key_P, this, |
1281 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); | 1282 | SLOT( print() ), actionCollection(), "kaddressbook_print" ); |
1282 | 1283 | ||
1283 | } else { | 1284 | } else { |
1284 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); | 1285 | mActionMail = KStdAction::mail( this, SLOT( sendMail() ), actionCollection() ); |
1285 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); | 1286 | mActionPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); |
1286 | } | 1287 | } |
1287 | 1288 | ||
1288 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, | 1289 | mActionSave = new KAction( i18n( "&Save" ), "filesave", CTRL+Key_S, this, |
1289 | SLOT( save() ), actionCollection(), "file_sync" ); | 1290 | SLOT( save() ), actionCollection(), "file_sync" ); |
1290 | 1291 | ||
1291 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, | 1292 | mActionNewContact = new KAction( i18n( "&New Contact..." ), "filenew", CTRL+Key_N, this, |
1292 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); | 1293 | SLOT( newContact() ), actionCollection(), "file_new_contact" ); |
1293 | 1294 | ||
1294 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, | 1295 | mActionMailVCard = new KAction(i18n("Mail &vCard..."), "mail_post_to", 0, |
1295 | this, SLOT( mailVCard() ), | 1296 | this, SLOT( mailVCard() ), |
1296 | actionCollection(), "file_mail_vcard"); | 1297 | actionCollection(), "file_mail_vcard"); |
1297 | 1298 | ||
1298 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, | 1299 | mActionEditAddressee = new KAction( i18n( "&Edit Contact..." ), "edit", 0, |
1299 | this, SLOT( editContact2() ), | 1300 | this, SLOT( editContact2() ), |
1300 | actionCollection(), "file_properties" ); | 1301 | actionCollection(), "file_properties" ); |
1301 | 1302 | ||
1302 | #ifdef KAB_EMBEDDED | 1303 | #ifdef KAB_EMBEDDED |
1303 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); | 1304 | // mActionQuit = KStdAction::quit( mMainWindow, SLOT( exit() ), actionCollection() ); |
1304 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, | 1305 | mActionQuit = new KAction( i18n( "&Exit" ), "exit", 0, |
1305 | mMainWindow, SLOT( exit() ), | 1306 | mMainWindow, SLOT( exit() ), |
1306 | actionCollection(), "quit" ); | 1307 | actionCollection(), "quit" ); |
1307 | #endif //KAB_EMBEDDED | 1308 | #endif //KAB_EMBEDDED |
1308 | 1309 | ||
1309 | // edit menu | 1310 | // edit menu |
1310 | if ( mIsPart ) { | 1311 | if ( mIsPart ) { |
1311 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, | 1312 | mActionCopy = new KAction( i18n( "&Copy" ), "editcopy", CTRL + Key_C, this, |
1312 | SLOT( copyContacts() ), actionCollection(), | 1313 | SLOT( copyContacts() ), actionCollection(), |
1313 | "kaddressbook_copy" ); | 1314 | "kaddressbook_copy" ); |
1314 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, | 1315 | mActionCut = new KAction( i18n( "Cu&t" ), "editcut", CTRL + Key_X, this, |
1315 | SLOT( cutContacts() ), actionCollection(), | 1316 | SLOT( cutContacts() ), actionCollection(), |
1316 | "kaddressbook_cut" ); | 1317 | "kaddressbook_cut" ); |
1317 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, | 1318 | mActionPaste = new KAction( i18n( "&Paste" ), "editpaste", CTRL + Key_V, this, |
1318 | SLOT( pasteContacts() ), actionCollection(), | 1319 | SLOT( pasteContacts() ), actionCollection(), |
1319 | "kaddressbook_paste" ); | 1320 | "kaddressbook_paste" ); |
1320 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, | 1321 | mActionSelectAll = new KAction( i18n( "Select &All" ), CTRL + Key_A, this, |
1321 | SLOT( selectAllContacts() ), actionCollection(), | 1322 | SLOT( selectAllContacts() ), actionCollection(), |
1322 | "kaddressbook_select_all" ); | 1323 | "kaddressbook_select_all" ); |
1323 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, | 1324 | mActionUndo = new KAction( i18n( "&Undo" ), "undo", CTRL + Key_Z, this, |
1324 | SLOT( undo() ), actionCollection(), | 1325 | SLOT( undo() ), actionCollection(), |
1325 | "kaddressbook_undo" ); | 1326 | "kaddressbook_undo" ); |
1326 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, | 1327 | mActionRedo = new KAction( i18n( "Re&do" ), "redo", CTRL + SHIFT + Key_Z, |
1327 | this, SLOT( redo() ), actionCollection(), | 1328 | this, SLOT( redo() ), actionCollection(), |
1328 | "kaddressbook_redo" ); | 1329 | "kaddressbook_redo" ); |
1329 | } else { | 1330 | } else { |
1330 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); | 1331 | mActionCopy = KStdAction::copy( this, SLOT( copyContacts() ), actionCollection() ); |
1331 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); | 1332 | mActionCut = KStdAction::cut( this, SLOT( cutContacts() ), actionCollection() ); |
1332 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); | 1333 | mActionPaste = KStdAction::paste( this, SLOT( pasteContacts() ), actionCollection() ); |
1333 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); | 1334 | mActionSelectAll = KStdAction::selectAll( this, SLOT( selectAllContacts() ), actionCollection() ); |
1334 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); | 1335 | mActionUndo = KStdAction::undo( this, SLOT( undo() ), actionCollection() ); |
1335 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); | 1336 | mActionRedo = KStdAction::redo( this, SLOT( redo() ), actionCollection() ); |
1336 | } | 1337 | } |
1337 | 1338 | ||
1338 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", | 1339 | mActionDelete = new KAction( i18n( "&Delete Contact" ), "editdelete", |
1339 | Key_Delete, this, SLOT( deleteContacts() ), | 1340 | Key_Delete, this, SLOT( deleteContacts() ), |
1340 | actionCollection(), "edit_delete" ); | 1341 | actionCollection(), "edit_delete" ); |
1341 | 1342 | ||
1342 | mActionUndo->setEnabled( false ); | 1343 | mActionUndo->setEnabled( false ); |
1343 | mActionRedo->setEnabled( false ); | 1344 | mActionRedo->setEnabled( false ); |
1344 | 1345 | ||
1345 | // settings menu | 1346 | // settings menu |
1346 | #ifdef KAB_EMBEDDED | 1347 | #ifdef KAB_EMBEDDED |
1347 | //US special menuentry to configure the addressbook resources. On KDE | 1348 | //US special menuentry to configure the addressbook resources. On KDE |
1348 | // you do that through the control center !!! | 1349 | // you do that through the control center !!! |
1349 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, | 1350 | mActionConfigResources = new KAction( i18n( "Configure &Resources..." ), "configure_resources", 0, this, |
1350 | SLOT( configureResources() ), actionCollection(), | 1351 | SLOT( configureResources() ), actionCollection(), |
1351 | "kaddressbook_configure_resources" ); | 1352 | "kaddressbook_configure_resources" ); |
1352 | #endif //KAB_EMBEDDED | 1353 | #endif //KAB_EMBEDDED |
1353 | 1354 | ||
1354 | if ( mIsPart ) { | 1355 | if ( mIsPart ) { |
1355 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, | 1356 | mActionConfigKAddressbook = new KAction( i18n( "&Configure KAddressBook..." ), "configure", 0, this, |
1356 | SLOT( openConfigDialog() ), actionCollection(), | 1357 | SLOT( openConfigDialog() ), actionCollection(), |
1357 | "kaddressbook_configure" ); | 1358 | "kaddressbook_configure" ); |
1358 | 1359 | ||
1359 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, | 1360 | mActionConfigShortcuts = new KAction( i18n( "Configure S&hortcuts..." ), "configure_shortcuts", 0, |
1360 | this, SLOT( configureKeyBindings() ), actionCollection(), | 1361 | this, SLOT( configureKeyBindings() ), actionCollection(), |
1361 | "kaddressbook_configure_shortcuts" ); | 1362 | "kaddressbook_configure_shortcuts" ); |
1362 | #ifdef KAB_EMBEDDED | 1363 | #ifdef KAB_EMBEDDED |
1363 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); | 1364 | mActionConfigureToolbars = KStdAction::configureToolbars( this, SLOT( mMainWindow->configureToolbars() ), actionCollection() ); |
1365 | mActionConfigureToolbars->setEnabled( false ); | ||
1364 | #endif //KAB_EMBEDDED | 1366 | #endif //KAB_EMBEDDED |
1365 | 1367 | ||
1366 | } else { | 1368 | } else { |
1367 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); | 1369 | mActionConfigKAddressbook = KStdAction::preferences( this, SLOT( openConfigDialog() ), actionCollection() ); |
1368 | 1370 | ||
1369 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); | 1371 | mActionKeyBindings = KStdAction::keyBindings( this, SLOT( configureKeyBindings() ), actionCollection() ); |
1370 | } | 1372 | } |
1371 | 1373 | ||
1372 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, | 1374 | mActionJumpBar = new KToggleAction( i18n( "Show Jump Bar" ), 0, 0, |
1373 | actionCollection(), "options_show_jump_bar" ); | 1375 | actionCollection(), "options_show_jump_bar" ); |
1374 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); | 1376 | connect( mActionJumpBar, SIGNAL( toggled( bool ) ), SLOT( setJumpButtonBarVisible( bool ) ) ); |
1375 | 1377 | ||
1376 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, | 1378 | mActionDetails = new KToggleAction( i18n( "Show Details" ), 0, 0, |
1377 | actionCollection(), "options_show_details" ); | 1379 | actionCollection(), "options_show_details" ); |
1378 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); | 1380 | connect( mActionDetails, SIGNAL( toggled( bool ) ), SLOT( setDetailsVisible( bool ) ) ); |
1379 | 1381 | ||
1380 | // misc | 1382 | // misc |
1381 | // only enable LDAP lookup if we can handle the protocol | 1383 | // only enable LDAP lookup if we can handle the protocol |
1382 | #ifndef KAB_EMBEDDED | 1384 | #ifndef KAB_EMBEDDED |
1383 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { | 1385 | if ( KProtocolInfo::isKnownProtocol( KURL( "ldap://localhost" ) ) ) { |
1384 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, | 1386 | new KAction( i18n( "&Lookup Addresses in Directory" ), "find", 0, |
1385 | this, SLOT( openLDAPDialog() ), actionCollection(), | 1387 | this, SLOT( openLDAPDialog() ), actionCollection(), |
1386 | "ldap_lookup" ); | 1388 | "ldap_lookup" ); |
1387 | } | 1389 | } |
1388 | #else //KAB_EMBEDDED | 1390 | #else //KAB_EMBEDDED |
1389 | //qDebug("KABCore::initActions() LDAP has to be implemented"); | 1391 | //qDebug("KABCore::initActions() LDAP has to be implemented"); |
1390 | #endif //KAB_EMBEDDED | 1392 | #endif //KAB_EMBEDDED |
1391 | 1393 | ||
1392 | 1394 | ||
1393 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, | 1395 | mActionWhoAmI = new KAction( i18n( "Set Who Am I" ), "personal", 0, this, |
1394 | SLOT( setWhoAmI() ), actionCollection(), | 1396 | SLOT( setWhoAmI() ), actionCollection(), |
1395 | "set_personal" ); | 1397 | "set_personal" ); |
1396 | 1398 | ||
1397 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, | 1399 | mActionCategories = new KAction( i18n( "Set Categories" ), 0, this, |
1398 | SLOT( setCategories() ), actionCollection(), | 1400 | SLOT( setCategories() ), actionCollection(), |
1399 | "edit_set_categories" ); | 1401 | "edit_set_categories" ); |
1400 | 1402 | ||
1401 | #ifdef KAB_EMBEDDED | 1403 | #ifdef KAB_EMBEDDED |
1402 | 1404 | ||
1403 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, | 1405 | mActionAboutKAddressbook = new KAction( i18n( "&About KAddressBook" ), "kaddressbook2", 0, |
1404 | this, SLOT( createAboutData() ), actionCollection(), | 1406 | this, SLOT( createAboutData() ), actionCollection(), |
1405 | "kaddressbook_about_data" ); | 1407 | "kaddressbook_about_data" ); |
1406 | #endif //KAB_EMBEDDED | 1408 | #endif //KAB_EMBEDDED |
1407 | 1409 | ||
1408 | clipboardDataChanged(); | 1410 | clipboardDataChanged(); |
1409 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1411 | connect( UndoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1410 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); | 1412 | connect( RedoStack::instance(), SIGNAL( changed() ), SLOT( updateActionMenu() ) ); |
1411 | } | 1413 | } |
1412 | 1414 | ||
1413 | //US we need this function, to plug all actions into the correct menues. | 1415 | //US we need this function, to plug all actions into the correct menues. |
1414 | // KDE uses a XML format to plug the actions, but we work her without this overhead. | 1416 | // KDE uses a XML format to plug the actions, but we work her without this overhead. |
1415 | void KABCore::addActionsManually() | 1417 | void KABCore::addActionsManually() |
1416 | { | 1418 | { |
1417 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); | 1419 | //US qDebug("KABCore::initActions(): mIsPart %i", mIsPart); |
1418 | 1420 | ||
1419 | #ifdef KAB_EMBEDDED | 1421 | #ifdef KAB_EMBEDDED |
1420 | QPopupMenu *fileMenu = new QPopupMenu( this ); | 1422 | QPopupMenu *fileMenu = new QPopupMenu( this ); |
1421 | QPopupMenu *editMenu = new QPopupMenu( this ); | 1423 | QPopupMenu *editMenu = new QPopupMenu( this ); |
1422 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 1424 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
1423 | 1425 | ||
1424 | KToolBar* tb = mMainWindow->toolBar(); | 1426 | KToolBar* tb = mMainWindow->toolBar(); |
1425 | 1427 | ||
1426 | #ifdef DESKTOP_VERSION | 1428 | #ifdef DESKTOP_VERSION |
1427 | QMenuBar* mb = mMainWindow->menuBar(); | 1429 | QMenuBar* mb = mMainWindow->menuBar(); |
1428 | 1430 | ||
1429 | //US setup menubar. | 1431 | //US setup menubar. |
1430 | //Disable the following block if you do not want to have a menubar. | 1432 | //Disable the following block if you do not want to have a menubar. |
1431 | mb->insertItem( "&File", fileMenu ); | 1433 | mb->insertItem( "&File", fileMenu ); |
1432 | mb->insertItem( "&Edit", editMenu ); | 1434 | mb->insertItem( "&Edit", editMenu ); |
1433 | mb->insertItem( "&View", viewMenu ); | 1435 | mb->insertItem( "&View", viewMenu ); |
1434 | mb->insertItem( "&Settings", settingsMenu ); | 1436 | mb->insertItem( "&Settings", settingsMenu ); |
1435 | mb->insertItem( "&Help", helpMenu ); | 1437 | mb->insertItem( "&Help", helpMenu ); |
1436 | mIncSearchWidget = new IncSearchWidget( tb ); | 1438 | mIncSearchWidget = new IncSearchWidget( tb ); |
1437 | // tb->insertWidget(-1, 0, mIncSearchWidget); | 1439 | // tb->insertWidget(-1, 0, mIncSearchWidget); |
1438 | 1440 | ||
1439 | #else | 1441 | #else |
1440 | //US setup toolbar | 1442 | //US setup toolbar |
1441 | QMenuBar *menuBarTB = new QMenuBar( tb ); | 1443 | QMenuBar *menuBarTB = new QMenuBar( tb ); |
1442 | QPopupMenu *popupBarTB = new QPopupMenu( this ); | 1444 | QPopupMenu *popupBarTB = new QPopupMenu( this ); |
1443 | menuBarTB->insertItem( "ME", popupBarTB); | 1445 | menuBarTB->insertItem( "ME", popupBarTB); |
1444 | tb->insertWidget(-1, 0, menuBarTB); | 1446 | tb->insertWidget(-1, 0, menuBarTB); |
1445 | mIncSearchWidget = new IncSearchWidget( tb ); | 1447 | mIncSearchWidget = new IncSearchWidget( tb ); |
1446 | 1448 | ||
1447 | tb->enableMoving(false); | 1449 | tb->enableMoving(false); |
1448 | popupBarTB->insertItem( "&File", fileMenu ); | 1450 | popupBarTB->insertItem( "&File", fileMenu ); |
1449 | popupBarTB->insertItem( "&Edit", editMenu ); | 1451 | popupBarTB->insertItem( "&Edit", editMenu ); |
1450 | popupBarTB->insertItem( "&View", viewMenu ); | 1452 | popupBarTB->insertItem( "&View", viewMenu ); |
1451 | popupBarTB->insertItem( "&Settings", settingsMenu ); | 1453 | popupBarTB->insertItem( "&Settings", settingsMenu ); |
1452 | mViewManager->getFilterAction()->plug ( popupBarTB); | 1454 | mViewManager->getFilterAction()->plug ( popupBarTB); |
1453 | popupBarTB->insertItem( "&Help", helpMenu ); | 1455 | popupBarTB->insertItem( "&Help", helpMenu ); |
1454 | if (QApplication::desktop()->width() > 320 ) { | 1456 | if (QApplication::desktop()->width() > 320 ) { |
1455 | // mViewManager->getFilterAction()->plug ( tb); | 1457 | // mViewManager->getFilterAction()->plug ( tb); |
1456 | } | 1458 | } |
1457 | #endif | 1459 | #endif |
1458 | // mActionQuit->plug ( mMainWindow->toolBar()); | 1460 | // mActionQuit->plug ( mMainWindow->toolBar()); |
1459 | 1461 | ||
1460 | 1462 | ||
1461 | 1463 | ||
1462 | //US Now connect the actions with the menue entries. | 1464 | //US Now connect the actions with the menue entries. |
1463 | mActionPrint->plug( fileMenu ); | 1465 | mActionPrint->plug( fileMenu ); |
1464 | mActionMail->plug( fileMenu ); | 1466 | mActionMail->plug( fileMenu ); |
1465 | fileMenu->insertSeparator(); | 1467 | fileMenu->insertSeparator(); |
1466 | 1468 | ||
1467 | mActionNewContact->plug( fileMenu ); | 1469 | mActionNewContact->plug( fileMenu ); |
1468 | mActionNewContact->plug( tb ); | 1470 | mActionNewContact->plug( tb ); |
1469 | 1471 | ||
1470 | mActionEditAddressee->plug( fileMenu ); | 1472 | mActionEditAddressee->plug( fileMenu ); |
1471 | fileMenu->insertSeparator(); | 1473 | fileMenu->insertSeparator(); |
1472 | mActionSave->plug( fileMenu ); | 1474 | mActionSave->plug( fileMenu ); |
1473 | fileMenu->insertItem( "&Import", ImportMenu ); | 1475 | fileMenu->insertItem( "&Import", ImportMenu ); |
1474 | fileMenu->insertItem( "&Emport", ExportMenu ); | 1476 | fileMenu->insertItem( "&Emport", ExportMenu ); |
1475 | fileMenu->insertSeparator(); | 1477 | fileMenu->insertSeparator(); |
1476 | mActionMailVCard->plug( fileMenu ); | 1478 | mActionMailVCard->plug( fileMenu ); |
1477 | fileMenu->insertSeparator(); | 1479 | fileMenu->insertSeparator(); |
1478 | mActionQuit->plug( fileMenu ); | 1480 | mActionQuit->plug( fileMenu ); |
1479 | 1481 | ||
1480 | 1482 | ||
1481 | // edit menu | 1483 | // edit menu |
1482 | mActionUndo->plug( editMenu ); | 1484 | mActionUndo->plug( editMenu ); |
1483 | mActionRedo->plug( editMenu ); | 1485 | mActionRedo->plug( editMenu ); |
1484 | editMenu->insertSeparator(); | 1486 | editMenu->insertSeparator(); |
1485 | mActionCut->plug( editMenu ); | 1487 | mActionCut->plug( editMenu ); |
1486 | mActionCopy->plug( editMenu ); | 1488 | mActionCopy->plug( editMenu ); |
1487 | mActionPaste->plug( editMenu ); | 1489 | mActionPaste->plug( editMenu ); |
1488 | mActionDelete->plug( editMenu ); | 1490 | mActionDelete->plug( editMenu ); |
1489 | editMenu->insertSeparator(); | 1491 | editMenu->insertSeparator(); |
1490 | mActionSelectAll->plug( editMenu ); | 1492 | mActionSelectAll->plug( editMenu ); |
1491 | 1493 | ||
1492 | 1494 | ||
1493 | // settings menu | 1495 | // settings menu |
1494 | //US special menuentry to configure the addressbook resources. On KDE | 1496 | //US special menuentry to configure the addressbook resources. On KDE |
1495 | // you do that through the control center !!! | 1497 | // you do that through the control center !!! |
1496 | mActionConfigResources->plug( settingsMenu ); | 1498 | mActionConfigResources->plug( settingsMenu ); |
1497 | settingsMenu->insertSeparator(); | 1499 | settingsMenu->insertSeparator(); |
1498 | 1500 | ||
1499 | mActionConfigKAddressbook->plug( settingsMenu ); | 1501 | mActionConfigKAddressbook->plug( settingsMenu ); |
1500 | 1502 | ||
1501 | if ( mIsPart ) { | 1503 | if ( mIsPart ) { |
1502 | mActionConfigShortcuts->plug( settingsMenu ); | 1504 | mActionConfigShortcuts->plug( settingsMenu ); |
1503 | mActionConfigureToolbars->plug( settingsMenu ); | 1505 | mActionConfigureToolbars->plug( settingsMenu ); |
1504 | 1506 | ||
1505 | } else { | 1507 | } else { |
1506 | mActionKeyBindings->plug( settingsMenu ); | 1508 | mActionKeyBindings->plug( settingsMenu ); |
1507 | } | 1509 | } |
1508 | 1510 | ||
1509 | settingsMenu->insertSeparator(); | 1511 | settingsMenu->insertSeparator(); |
1510 | 1512 | ||
1511 | mActionJumpBar->plug( settingsMenu ); | 1513 | mActionJumpBar->plug( settingsMenu ); |
1512 | mActionDetails->plug( settingsMenu ); | 1514 | mActionDetails->plug( settingsMenu ); |
1513 | settingsMenu->insertSeparator(); | 1515 | settingsMenu->insertSeparator(); |
1514 | 1516 | ||
1515 | mActionWhoAmI->plug( settingsMenu ); | 1517 | mActionWhoAmI->plug( settingsMenu ); |
1516 | mActionCategories->plug( settingsMenu ); | 1518 | mActionCategories->plug( settingsMenu ); |
1517 | 1519 | ||
1518 | mActionAboutKAddressbook->plug( helpMenu ); | 1520 | mActionAboutKAddressbook->plug( helpMenu ); |
1519 | 1521 | ||
1520 | 1522 | ||
1521 | if (QApplication::desktop()->width() > 320 ) { | 1523 | if (QApplication::desktop()->width() > 320 ) { |
1522 | 1524 | ||
1523 | mActionEditAddressee->plug( tb ); | 1525 | mActionEditAddressee->plug( tb ); |
1524 | mActionSave->plug( tb ); | 1526 | mActionSave->plug( tb ); |
1525 | mViewManager->getFilterAction()->plug ( tb); | 1527 | mViewManager->getFilterAction()->plug ( tb); |
1526 | if (QApplication::desktop()->width() > 480 ) { | 1528 | if (QApplication::desktop()->width() > 480 ) { |
1527 | mActionUndo->plug( tb ); | 1529 | mActionUndo->plug( tb ); |
1528 | mActionDelete->plug( tb ); | 1530 | mActionDelete->plug( tb ); |
1529 | mActionRedo->plug( tb ); | 1531 | mActionRedo->plug( tb ); |
1530 | } | 1532 | } |
1531 | } | 1533 | } |
1532 | //mActionQuit->plug ( tb ); | 1534 | //mActionQuit->plug ( tb ); |
1533 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); | 1535 | // tb->insertWidget(-1, 0, mIncSearchWidget, 6); |
1534 | 1536 | ||
1535 | //US link the searchwidget first to this. | 1537 | //US link the searchwidget first to this. |
1536 | // The real linkage to the toolbar happens later. | 1538 | // The real linkage to the toolbar happens later. |
1537 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); | 1539 | //US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); |
1538 | //US tb->insertItem( mIncSearchWidget ); | 1540 | //US tb->insertItem( mIncSearchWidget ); |
1539 | /*US | 1541 | /*US |
1540 | mIncSearchWidget = new IncSearchWidget( tb ); | 1542 | mIncSearchWidget = new IncSearchWidget( tb ); |
1541 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1543 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1542 | SLOT( incrementalSearch( const QString& ) ) ); | 1544 | SLOT( incrementalSearch( const QString& ) ) ); |
1543 | 1545 | ||
1544 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1546 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1545 | 1547 | ||
1546 | //US topLayout->addWidget( mJumpButtonBar ); | 1548 | //US topLayout->addWidget( mJumpButtonBar ); |
1547 | this->layout()->add( mJumpButtonBar ); | 1549 | this->layout()->add( mJumpButtonBar ); |
1548 | */ | 1550 | */ |
1549 | 1551 | ||
1550 | #endif //KAB_EMBEDDED | 1552 | #endif //KAB_EMBEDDED |
1551 | } | 1553 | } |
1552 | 1554 | ||
1553 | 1555 | ||
1554 | 1556 | ||
1555 | void KABCore::clipboardDataChanged() | 1557 | void KABCore::clipboardDataChanged() |
1556 | { | 1558 | { |
1557 | 1559 | ||
1558 | if ( mReadWrite ) | 1560 | if ( mReadWrite ) |
1559 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); | 1561 | mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); |
1560 | 1562 | ||
1561 | } | 1563 | } |
1562 | 1564 | ||
1563 | void KABCore::updateActionMenu() | 1565 | void KABCore::updateActionMenu() |
1564 | { | 1566 | { |
1565 | UndoStack *undo = UndoStack::instance(); | 1567 | UndoStack *undo = UndoStack::instance(); |
1566 | RedoStack *redo = RedoStack::instance(); | 1568 | RedoStack *redo = RedoStack::instance(); |
1567 | 1569 | ||
1568 | if ( undo->isEmpty() ) | 1570 | if ( undo->isEmpty() ) |
1569 | mActionUndo->setText( i18n( "Undo" ) ); | 1571 | mActionUndo->setText( i18n( "Undo" ) ); |
1570 | else | 1572 | else |
1571 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); | 1573 | mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); |
1572 | 1574 | ||
1573 | mActionUndo->setEnabled( !undo->isEmpty() ); | 1575 | mActionUndo->setEnabled( !undo->isEmpty() ); |
1574 | 1576 | ||
1575 | if ( !redo->top() ) | 1577 | if ( !redo->top() ) |
1576 | mActionRedo->setText( i18n( "Redo" ) ); | 1578 | mActionRedo->setText( i18n( "Redo" ) ); |
1577 | else | 1579 | else |
1578 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); | 1580 | mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); |
1579 | 1581 | ||
1580 | mActionRedo->setEnabled( !redo->isEmpty() ); | 1582 | mActionRedo->setEnabled( !redo->isEmpty() ); |
1581 | } | 1583 | } |
1582 | 1584 | ||
1583 | void KABCore::configureKeyBindings() | 1585 | void KABCore::configureKeyBindings() |
1584 | { | 1586 | { |
1585 | #ifndef KAB_EMBEDDED | 1587 | #ifndef KAB_EMBEDDED |
1586 | KKeyDialog::configure( actionCollection(), true ); | 1588 | KKeyDialog::configure( actionCollection(), true ); |
1587 | #else //KAB_EMBEDDED | 1589 | #else //KAB_EMBEDDED |
1588 | qDebug("KABCore::configureKeyBindings() not implemented"); | 1590 | qDebug("KABCore::configureKeyBindings() not implemented"); |
1589 | #endif //KAB_EMBEDDED | 1591 | #endif //KAB_EMBEDDED |
1590 | } | 1592 | } |
1591 | 1593 | ||
1592 | #ifdef KAB_EMBEDDED | 1594 | #ifdef KAB_EMBEDDED |
1593 | void KABCore::configureResources() | 1595 | void KABCore::configureResources() |
1594 | { | 1596 | { |
1595 | KRES::KCMKResources dlg( this, "" , 0 ); | 1597 | KRES::KCMKResources dlg( this, "" , 0 ); |
1596 | 1598 | ||
1597 | if ( !dlg.exec() ) | 1599 | if ( !dlg.exec() ) |
1598 | return; | 1600 | return; |
1601 | KMessageBox::information( this, i18n("Please restart to get the \nchanged resources (re)loaded!\n") ); | ||
1599 | } | 1602 | } |
1600 | #endif //KAB_EMBEDDED | 1603 | #endif //KAB_EMBEDDED |
1601 | 1604 | ||
1602 | 1605 | ||
1603 | 1606 | ||
1604 | #ifndef KAB_EMBEDDED | 1607 | #ifndef KAB_EMBEDDED |
1605 | #include "kabcore.moc" | 1608 | #include "kabcore.moc" |
1606 | #endif //KAB_EMBEDDED | 1609 | #endif //KAB_EMBEDDED |
diff --git a/kmicromail/composemail.cpp b/kmicromail/composemail.cpp index ca4f247..c1b58a4 100644 --- a/kmicromail/composemail.cpp +++ b/kmicromail/composemail.cpp | |||
@@ -1,363 +1,363 @@ | |||
1 | 1 | ||
2 | #include "composemail.h" | 2 | #include "composemail.h" |
3 | 3 | ||
4 | #include <libmailwrapper/smtpwrapper.h> | 4 | #include <libmailwrapper/smtpwrapper.h> |
5 | #include <libmailwrapper/storemail.h> | 5 | #include <libmailwrapper/storemail.h> |
6 | #include <libmailwrapper/abstractmail.h> | 6 | #include <libmailwrapper/abstractmail.h> |
7 | #include <libmailwrapper/mailtypes.h> | 7 | #include <libmailwrapper/mailtypes.h> |
8 | 8 | ||
9 | /* OPIE */ | 9 | /* OPIE */ |
10 | //#include <opie2/ofiledialog.h> | 10 | //#include <opie2/ofiledialog.h> |
11 | //#include <opie2/odebug.h> | 11 | //#include <opie2/odebug.h> |
12 | #include <kfiledialog.h> | 12 | #include <kfiledialog.h> |
13 | //#include <qpe/resource.h> | 13 | //#include <qpe/resource.h> |
14 | #include <qpe/config.h> | 14 | #include <qpe/config.h> |
15 | #include <qpe/global.h> | 15 | #include <qpe/global.h> |
16 | //#include <qpe/contact.h> | 16 | //#include <qpe/contact.h> |
17 | 17 | ||
18 | 18 | ||
19 | #include <qcombobox.h> | 19 | #include <qcombobox.h> |
20 | #include <qcheckbox.h> | 20 | #include <qcheckbox.h> |
21 | #include <qtimer.h> | 21 | #include <qtimer.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qmultilineedit.h> | 24 | #include <qmultilineedit.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
27 | #include <qlistview.h> | 27 | #include <qlistview.h> |
28 | #include <kabc/addresseedialog.h> | 28 | #include <kabc/addresseedialog.h> |
29 | #include <kabc/stdaddressbook.h> | 29 | #include <kabc/stdaddressbook.h> |
30 | #include <kabc/addressee.h> | 30 | #include <kabc/addressee.h> |
31 | 31 | ||
32 | 32 | ||
33 | 33 | ||
34 | //using namespace Opie::Core; | 34 | //using namespace Opie::Core; |
35 | //using namespace Opie::Ui; | 35 | //using namespace Opie::Ui; |
36 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) | 36 | ComposeMail::ComposeMail( Settings *s, QWidget *parent, const char *name, bool modal, WFlags flags ) |
37 | : ComposeMailUI( parent, name, modal, flags ) | 37 | : ComposeMailUI( parent, name, modal, flags ) |
38 | { | 38 | { |
39 | 39 | ||
40 | settings = s; | 40 | settings = s; |
41 | m_replyid = ""; | 41 | m_replyid = ""; |
42 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); | 42 | KABC::Addressee con = KABC::StdAddressBook::self()->whoAmI( ); |
43 | QStringList mails = con.emails(); | 43 | QStringList mails = con.emails(); |
44 | QString defmail = con.preferredEmail(); | 44 | QString defmail = con.preferredEmail(); |
45 | if ( mails.count() == 0) | 45 | if ( mails.count() == 0) |
46 | QMessageBox::information( parentWidget(), tr( "Hint" ), | 46 | QMessageBox::information( 0, tr( "Hint" ), |
47 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!" ), | 47 | tr( "Please apply\n\"Set Who Am I\"\nin KA/Pi to get the from\nfield automatically filled out!\n" ), |
48 | tr( "Ok" ) ); | 48 | tr( "Ok" ) ); |
49 | if (defmail.length()!=0) { | 49 | if (defmail.length()!=0) { |
50 | fromBox->insertItem(defmail); | 50 | fromBox->insertItem(defmail); |
51 | } | 51 | } |
52 | QStringList::ConstIterator sit = mails.begin(); | 52 | QStringList::ConstIterator sit = mails.begin(); |
53 | for (;sit!=mails.end();++sit) { | 53 | for (;sit!=mails.end();++sit) { |
54 | if ( (*sit)==defmail) | 54 | if ( (*sit)==defmail) |
55 | continue; | 55 | continue; |
56 | fromBox->insertItem((*sit)); | 56 | fromBox->insertItem((*sit)); |
57 | } | 57 | } |
58 | senderNameEdit->setText(con.formattedName()); | 58 | senderNameEdit->setText(con.formattedName()); |
59 | Config cfg( "mail" ); | 59 | Config cfg( "mail" ); |
60 | cfg.setGroup( "Compose" ); | 60 | cfg.setGroup( "Compose" ); |
61 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); | 61 | checkBoxLater->setChecked( cfg.readBoolEntry( "sendLater", false ) ); |
62 | 62 | ||
63 | attList->addColumn( tr( "Name" ) ); | 63 | attList->addColumn( tr( "Name" ) ); |
64 | attList->addColumn( tr( "Size" ) ); | 64 | attList->addColumn( tr( "Size" ) ); |
65 | 65 | ||
66 | QList<Account> accounts = settings->getAccounts(); | 66 | QList<Account> accounts = settings->getAccounts(); |
67 | 67 | ||
68 | Account *it; | 68 | Account *it; |
69 | for ( it = accounts.first(); it; it = accounts.next() ) { | 69 | for ( it = accounts.first(); it; it = accounts.next() ) { |
70 | if ( it->getType()==MAILLIB::A_SMTP ) { | 70 | if ( it->getType()==MAILLIB::A_SMTP ) { |
71 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); | 71 | SMTPaccount *smtp = static_cast<SMTPaccount *>(it); |
72 | smtpAccountBox->insertItem( smtp->getAccountName() ); | 72 | smtpAccountBox->insertItem( smtp->getAccountName() ); |
73 | smtpAccounts.append( smtp ); | 73 | smtpAccounts.append( smtp ); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | if ( smtpAccounts.count() > 0 ) { | ||
77 | fillValues( smtpAccountBox->currentItem() ); | ||
78 | } else { | ||
79 | QMessageBox::information( parentWidget(), tr( "Problem" ), | ||
80 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail." ), | ||
81 | tr( "Ok" ) ); | ||
82 | return; | ||
83 | } | ||
84 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); | 76 | connect( smtpAccountBox, SIGNAL( activated(int) ), SLOT( fillValues(int) ) ); |
85 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); | 77 | connect( toButton, SIGNAL( clicked() ), SLOT( pickAddressTo() ) ); |
86 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); | 78 | connect( ccButton, SIGNAL( clicked() ), SLOT( pickAddressCC() ) ); |
87 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); | 79 | connect( bccButton, SIGNAL( clicked() ), SLOT( pickAddressBCC() ) ); |
88 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); | 80 | connect( replyButton, SIGNAL( clicked() ), SLOT( pickAddressReply() ) ); |
89 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); | 81 | connect( addButton, SIGNAL( clicked() ), SLOT( addAttachment() ) ); |
90 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); | 82 | connect( deleteButton, SIGNAL( clicked() ), SLOT( removeAttachment() ) ); |
91 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); | 83 | connect( SaveButton, SIGNAL( clicked() ), SLOT( saveAsDraft()) ); |
92 | mMail = 0; | 84 | mMail = 0; |
93 | warnAttach = true; | 85 | warnAttach = true; |
86 | if ( smtpAccounts.count() > 0 ) { | ||
87 | fillValues( smtpAccountBox->currentItem() ); | ||
88 | } else { | ||
89 | QMessageBox::information( 0, tr( "Problem" ), | ||
90 | tr( "Please create an SMTP account first.\nThe SMTP is needed for sending mail.\n" ), | ||
91 | tr( "Ok" ) ); | ||
92 | return; | ||
93 | } | ||
94 | } | 94 | } |
95 | void ComposeMail::saveAsDraft() | 95 | void ComposeMail::saveAsDraft() |
96 | { | 96 | { |
97 | 97 | ||
98 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); | 98 | Opie::Core::OSmartPointer<Mail> mail= new Mail(); |
99 | mail->setMail(fromBox->currentText()); | 99 | mail->setMail(fromBox->currentText()); |
100 | mail->setTo( toLine->text() ); | 100 | mail->setTo( toLine->text() ); |
101 | mail->setName(senderNameEdit->text()); | 101 | mail->setName(senderNameEdit->text()); |
102 | mail->setCC( ccLine->text() ); | 102 | mail->setCC( ccLine->text() ); |
103 | mail->setBCC( bccLine->text() ); | 103 | mail->setBCC( bccLine->text() ); |
104 | mail->setReply( replyLine->text() ); | 104 | mail->setReply( replyLine->text() ); |
105 | mail->setSubject( subjectLine->text() ); | 105 | mail->setSubject( subjectLine->text() ); |
106 | if (!m_replyid.isEmpty()) { | 106 | if (!m_replyid.isEmpty()) { |
107 | QStringList ids; | 107 | QStringList ids; |
108 | ids.append(m_replyid); | 108 | ids.append(m_replyid); |
109 | mail->setInreply(ids); | 109 | mail->setInreply(ids); |
110 | } | 110 | } |
111 | QString txt = message->text(); | 111 | QString txt = message->text(); |
112 | if ( !sigMultiLine->text().isEmpty() ) { | 112 | if ( !sigMultiLine->text().isEmpty() ) { |
113 | txt.append( "\n--\n" ); | 113 | txt.append( "\n--\n" ); |
114 | txt.append( sigMultiLine->text() ); | 114 | txt.append( sigMultiLine->text() ); |
115 | } | 115 | } |
116 | mail->setMessage( txt ); | 116 | mail->setMessage( txt ); |
117 | 117 | ||
118 | /* only use the default drafts folder name! */ | 118 | /* only use the default drafts folder name! */ |
119 | Storemail wrapper(AbstractMail::draftFolder()); | 119 | Storemail wrapper(AbstractMail::draftFolder()); |
120 | wrapper.storeMail(mail); | 120 | wrapper.storeMail(mail); |
121 | 121 | ||
122 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 122 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
123 | /* attachments we will ignore! */ | 123 | /* attachments we will ignore! */ |
124 | if ( it != 0 ) { | 124 | if ( it != 0 ) { |
125 | if ( warnAttach ) | 125 | if ( warnAttach ) |
126 | QMessageBox::warning(0,tr("Store message"), | 126 | QMessageBox::warning(0,tr("Store message"), |
127 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); | 127 | tr("<center>Attachments will not be stored in \"Draft\" folder</center>")); |
128 | warnAttach = false; | 128 | warnAttach = false; |
129 | } | 129 | } |
130 | setStatus( tr("Mail saved as draft!") ); | 130 | setStatus( tr("Mail saved as draft!") ); |
131 | } | 131 | } |
132 | void ComposeMail::clearStatus() | 132 | void ComposeMail::clearStatus() |
133 | { | 133 | { |
134 | topLevelWidget()->setCaption( tr("Compose mail") ); | 134 | topLevelWidget()->setCaption( tr("Compose mail") ); |
135 | } | 135 | } |
136 | void ComposeMail::setStatus( QString status ) | 136 | void ComposeMail::setStatus( QString status ) |
137 | { | 137 | { |
138 | topLevelWidget()->setCaption( status ); | 138 | topLevelWidget()->setCaption( status ); |
139 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; | 139 | QTimer::singleShot ( 10000, this, SLOT( clearStatus() ) ) ; |
140 | } | 140 | } |
141 | void ComposeMail::pickAddress( QLineEdit *line ) | 141 | void ComposeMail::pickAddress( QLineEdit *line ) |
142 | { | 142 | { |
143 | //qDebug(" ComposeMail::pickAddress "); | 143 | //qDebug(" ComposeMail::pickAddress "); |
144 | QString names ;//= AddressPicker::getNames(); | 144 | QString names ;//= AddressPicker::getNames(); |
145 | 145 | ||
146 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); | 146 | KABC::Addressee::List list = KABC::AddresseeDialog::getAddressees(this); |
147 | uint i=0; | 147 | uint i=0; |
148 | for (i=0; i < list.count(); i++) { | 148 | for (i=0; i < list.count(); i++) { |
149 | if ( !list[i].preferredEmail().isEmpty()) { | 149 | if ( !list[i].preferredEmail().isEmpty()) { |
150 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; | 150 | names+= "\""+list[i].realName() +"\"<" +list[i].preferredEmail() +">"; |
151 | if ( i < list.count() -1 ) | 151 | if ( i < list.count() -1 ) |
152 | names+= ","; | 152 | names+= ","; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | if ( line->text().isEmpty() ) { | 157 | if ( line->text().isEmpty() ) { |
158 | line->setText( names ); | 158 | line->setText( names ); |
159 | } else if ( !names.isEmpty() ) { | 159 | } else if ( !names.isEmpty() ) { |
160 | line->setText( line->text() + ", " + names ); | 160 | line->setText( line->text() + ", " + names ); |
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | 164 | ||
165 | void ComposeMail::setTo( const QString & to ) | 165 | void ComposeMail::setTo( const QString & to ) |
166 | { | 166 | { |
167 | toLine->setText( to ); | 167 | toLine->setText( to ); |
168 | } | 168 | } |
169 | 169 | ||
170 | void ComposeMail::setSubject( const QString & subject ) | 170 | void ComposeMail::setSubject( const QString & subject ) |
171 | { | 171 | { |
172 | subjectLine->setText( subject ); | 172 | subjectLine->setText( subject ); |
173 | } | 173 | } |
174 | 174 | ||
175 | void ComposeMail::setInReplyTo( const QString & messageId ) | 175 | void ComposeMail::setInReplyTo( const QString & messageId ) |
176 | { | 176 | { |
177 | m_replyid = messageId; | 177 | m_replyid = messageId; |
178 | } | 178 | } |
179 | 179 | ||
180 | void ComposeMail::setMessage( const QString & text ) | 180 | void ComposeMail::setMessage( const QString & text ) |
181 | { | 181 | { |
182 | message->setText( text ); | 182 | message->setText( text ); |
183 | } | 183 | } |
184 | 184 | ||
185 | 185 | ||
186 | void ComposeMail::pickAddressTo() | 186 | void ComposeMail::pickAddressTo() |
187 | { | 187 | { |
188 | pickAddress( toLine ); | 188 | pickAddress( toLine ); |
189 | } | 189 | } |
190 | 190 | ||
191 | void ComposeMail::pickAddressCC() | 191 | void ComposeMail::pickAddressCC() |
192 | { | 192 | { |
193 | pickAddress( ccLine ); | 193 | pickAddress( ccLine ); |
194 | } | 194 | } |
195 | 195 | ||
196 | void ComposeMail::pickAddressBCC() | 196 | void ComposeMail::pickAddressBCC() |
197 | { | 197 | { |
198 | pickAddress( bccLine ); | 198 | pickAddress( bccLine ); |
199 | } | 199 | } |
200 | 200 | ||
201 | void ComposeMail::pickAddressReply() | 201 | void ComposeMail::pickAddressReply() |
202 | { | 202 | { |
203 | pickAddress( replyLine ); | 203 | pickAddress( replyLine ); |
204 | } | 204 | } |
205 | 205 | ||
206 | void ComposeMail::fillValues( int ) | 206 | void ComposeMail::fillValues( int ) |
207 | { | 207 | { |
208 | #if 0 | 208 | #if 0 |
209 | SMTPaccount *smtp = smtpAccounts.at( current ); | 209 | SMTPaccount *smtp = smtpAccounts.at( current ); |
210 | ccLine->clear(); | 210 | ccLine->clear(); |
211 | if ( smtp->getUseCC() ) { | 211 | if ( smtp->getUseCC() ) { |
212 | ccLine->setText( smtp->getCC() ); | 212 | ccLine->setText( smtp->getCC() ); |
213 | } | 213 | } |
214 | bccLine->clear(); | 214 | bccLine->clear(); |
215 | if ( smtp->getUseBCC() ) { | 215 | if ( smtp->getUseBCC() ) { |
216 | bccLine->setText( smtp->getBCC() ); | 216 | bccLine->setText( smtp->getBCC() ); |
217 | } | 217 | } |
218 | replyLine->clear(); | 218 | replyLine->clear(); |
219 | if ( smtp->getUseReply() ) { | 219 | if ( smtp->getUseReply() ) { |
220 | replyLine->setText( smtp->getReply() ); | 220 | replyLine->setText( smtp->getReply() ); |
221 | } | 221 | } |
222 | sigMultiLine->setText( smtp->getSignature() ); | 222 | sigMultiLine->setText( smtp->getSignature() ); |
223 | #endif | 223 | #endif |
224 | } | 224 | } |
225 | 225 | ||
226 | void ComposeMail::slotAdjustColumns() | 226 | void ComposeMail::slotAdjustColumns() |
227 | { | 227 | { |
228 | int currPage = tabWidget->currentPageIndex(); | 228 | int currPage = tabWidget->currentPageIndex(); |
229 | 229 | ||
230 | tabWidget->showPage( attachTab ); | 230 | tabWidget->showPage( attachTab ); |
231 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); | 231 | attList->setColumnWidth( 0, attList->visibleWidth() - 80 ); |
232 | attList->setColumnWidth( 1, 80 ); | 232 | attList->setColumnWidth( 1, 80 ); |
233 | 233 | ||
234 | tabWidget->setCurrentPage( currPage ); | 234 | tabWidget->setCurrentPage( currPage ); |
235 | } | 235 | } |
236 | 236 | ||
237 | void ComposeMail::addAttachment() | 237 | void ComposeMail::addAttachment() |
238 | { | 238 | { |
239 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); | 239 | QString lnk = KFileDialog::getOpenFileName( "", "Add Attachment", this ); |
240 | if ( !lnk.isEmpty() ) { | 240 | if ( !lnk.isEmpty() ) { |
241 | Attachment *att = new Attachment( lnk ); | 241 | Attachment *att = new Attachment( lnk ); |
242 | (void) new AttachViewItem( attList, att ); | 242 | (void) new AttachViewItem( attList, att ); |
243 | } | 243 | } |
244 | } | 244 | } |
245 | 245 | ||
246 | void ComposeMail::removeAttachment() | 246 | void ComposeMail::removeAttachment() |
247 | { | 247 | { |
248 | if ( !attList->currentItem() ) { | 248 | if ( !attList->currentItem() ) { |
249 | QMessageBox::information( this, tr( "Error" ), | 249 | QMessageBox::information( this, tr( "Error" ), |
250 | tr( "<p>Please select a File.</p>" ), | 250 | tr( "<p>Please select a File.</p>" ), |
251 | tr( "Ok" ) ); | 251 | tr( "Ok" ) ); |
252 | } else { | 252 | } else { |
253 | attList->takeItem( attList->currentItem() ); | 253 | attList->takeItem( attList->currentItem() ); |
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | void ComposeMail::accept() | 257 | void ComposeMail::accept() |
258 | { | 258 | { |
259 | if (! checkBoxLater->isChecked() ) { | 259 | if (! checkBoxLater->isChecked() ) { |
260 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 260 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), |
261 | tr("Send this message?"), | 261 | tr("Send this message?"), |
262 | tr("Yes"), | 262 | tr("Yes"), |
263 | tr("Cancel")); | 263 | tr("Cancel")); |
264 | 264 | ||
265 | if (yesno == 1) { | 265 | if (yesno == 1) { |
266 | return; | 266 | return; |
267 | } | 267 | } |
268 | } | 268 | } |
269 | #if 0 | 269 | #if 0 |
270 | odebug << "Sending Mail with " | 270 | odebug << "Sending Mail with " |
271 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; | 271 | << smtpAccounts.at( smtpAccountBox->currentItem() )->getAccountName() << oendl; |
272 | #endif | 272 | #endif |
273 | Opie::Core::OSmartPointer<Mail> mail=new Mail; | 273 | Opie::Core::OSmartPointer<Mail> mail=new Mail; |
274 | 274 | ||
275 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); | 275 | SMTPaccount *smtp = smtpAccounts.at( smtpAccountBox->currentItem() ); |
276 | mail->setMail(fromBox->currentText()); | 276 | mail->setMail(fromBox->currentText()); |
277 | 277 | ||
278 | if ( !toLine->text().isEmpty() ) { | 278 | if ( !toLine->text().isEmpty() ) { |
279 | mail->setTo( toLine->text() ); | 279 | mail->setTo( toLine->text() ); |
280 | } else { | 280 | } else { |
281 | QMessageBox::warning(0,tr("Sending mail"), | 281 | QMessageBox::warning(0,tr("Sending mail"), |
282 | tr("No Receiver spezified" ) ); | 282 | tr("No Receiver spezified" ) ); |
283 | return; | 283 | return; |
284 | } | 284 | } |
285 | 285 | ||
286 | mail->setName(senderNameEdit->text()); | 286 | mail->setName(senderNameEdit->text()); |
287 | mail->setCC( ccLine->text() ); | 287 | mail->setCC( ccLine->text() ); |
288 | mail->setBCC( bccLine->text() ); | 288 | mail->setBCC( bccLine->text() ); |
289 | mail->setReply( replyLine->text() ); | 289 | mail->setReply( replyLine->text() ); |
290 | mail->setSubject( subjectLine->text() ); | 290 | mail->setSubject( subjectLine->text() ); |
291 | if (!m_replyid.isEmpty()) { | 291 | if (!m_replyid.isEmpty()) { |
292 | QStringList ids; | 292 | QStringList ids; |
293 | ids.append(m_replyid); | 293 | ids.append(m_replyid); |
294 | mail->setInreply(ids); | 294 | mail->setInreply(ids); |
295 | } | 295 | } |
296 | QString txt = message->text(); | 296 | QString txt = message->text(); |
297 | if ( !sigMultiLine->text().isEmpty() ) { | 297 | if ( !sigMultiLine->text().isEmpty() ) { |
298 | txt.append( "\n--\n" ); | 298 | txt.append( "\n--\n" ); |
299 | txt.append( sigMultiLine->text() ); | 299 | txt.append( sigMultiLine->text() ); |
300 | } | 300 | } |
301 | mail->setMessage( txt ); | 301 | mail->setMessage( txt ); |
302 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); | 302 | AttachViewItem *it = (AttachViewItem *) attList->firstChild(); |
303 | while ( it != 0 ) { | 303 | while ( it != 0 ) { |
304 | mail->addAttachment( it->getAttachment() ); | 304 | mail->addAttachment( it->getAttachment() ); |
305 | it = (AttachViewItem *) it->nextSibling(); | 305 | it = (AttachViewItem *) it->nextSibling(); |
306 | } | 306 | } |
307 | 307 | ||
308 | SMTPwrapper wrapper( smtp ); | 308 | SMTPwrapper wrapper( smtp ); |
309 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) | 309 | if ( wrapper.sendMail( mail,checkBoxLater->isChecked() ) ) |
310 | setStatus( tr ("Mail sent")); | 310 | setStatus( tr ("Mail sent")); |
311 | else { | 311 | else { |
312 | setStatus( tr ("Error: Something went wrong. Nothing sent")); | 312 | setStatus( tr ("Error: Something went wrong. Nothing sent")); |
313 | return; | 313 | return; |
314 | } | 314 | } |
315 | 315 | ||
316 | 316 | ||
317 | QDialog::accept(); | 317 | QDialog::accept(); |
318 | } | 318 | } |
319 | 319 | ||
320 | void ComposeMail::reject() | 320 | void ComposeMail::reject() |
321 | { | 321 | { |
322 | //qDebug("ComposeMail::reject() "); | 322 | //qDebug("ComposeMail::reject() "); |
323 | int yesno = QMessageBox::warning(0,tr("Stop editing message"), | 323 | int yesno = QMessageBox::warning(0,tr("Store message?"), |
324 | tr("Store message into drafts?"), | 324 | tr("Store message into drafts?\n"), |
325 | tr("Yes"), | 325 | tr("Yes"), |
326 | tr("No")); | 326 | tr("No")); |
327 | 327 | ||
328 | //qDebug("button %d ", yesno); | 328 | //qDebug("button %d ", yesno); |
329 | if (yesno == 0) { | 329 | if (yesno == 0) { |
330 | saveAsDraft(); | 330 | saveAsDraft(); |
331 | } | 331 | } |
332 | if (yesno == 2) { | 332 | if (yesno == 2) { |
333 | qDebug("return "); | 333 | qDebug("return "); |
334 | return; | 334 | return; |
335 | } | 335 | } |
336 | QDialog::reject(); | 336 | QDialog::reject(); |
337 | } | 337 | } |
338 | 338 | ||
339 | ComposeMail::~ComposeMail() | 339 | ComposeMail::~ComposeMail() |
340 | { | 340 | { |
341 | } | 341 | } |
342 | 342 | ||
343 | void ComposeMail::reEditMail(const RecMailP¤t) | 343 | void ComposeMail::reEditMail(const RecMailP¤t) |
344 | { | 344 | { |
345 | RecMailP data = current; | 345 | RecMailP data = current; |
346 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); | 346 | message->setText(data->Wrapper()->fetchBody(current)->Bodytext()); |
347 | subjectLine->setText( data->getSubject()); | 347 | subjectLine->setText( data->getSubject()); |
348 | toLine->setText(data->To().join(",")); | 348 | toLine->setText(data->To().join(",")); |
349 | ccLine->setText(data->CC().join(",")); | 349 | ccLine->setText(data->CC().join(",")); |
350 | bccLine->setText(data->Bcc().join(",")); | 350 | bccLine->setText(data->Bcc().join(",")); |
351 | replyLine->setText(data->Replyto()); | 351 | replyLine->setText(data->Replyto()); |
352 | } | 352 | } |
353 | 353 | ||
354 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) | 354 | AttachViewItem::AttachViewItem( QListView *parent, Attachment *att ) |
355 | : QListViewItem( parent ) | 355 | : QListViewItem( parent ) |
356 | { | 356 | { |
357 | attachment = att; | 357 | attachment = att; |
358 | if ( !attachment->getPixmap().isNull() ) | 358 | if ( !attachment->getPixmap().isNull() ) |
359 | setPixmap( 0,attachment->getPixmap() ); | 359 | setPixmap( 0,attachment->getPixmap() ); |
360 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); | 360 | setText( 0, att->getName().isEmpty() ? att->getFileName() : att->getName() ); |
361 | setText( 1, QString::number( att->getSize() ) ); | 361 | setText( 1, QString::number( att->getSize() ) ); |
362 | } | 362 | } |
363 | 363 | ||
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index b9b4cd9..1ca0ada 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -1,115 +1,142 @@ | |||
1 | #include "mailistviewitem.h" | 1 | #include "mailistviewitem.h" |
2 | #include <libmailwrapper/abstractmail.h> | 2 | #include <libmailwrapper/abstractmail.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <kiconloader.h> | 4 | #include <kiconloader.h> |
5 | //#include <qpe/resource.h> | 5 | //#include <qpe/resource.h> |
6 | 6 | ||
7 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 7 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
8 | :QListViewItem(parent,item),mail_data() | 8 | :QListViewItem(parent,item),mail_data() |
9 | { | 9 | { |
10 | } | 10 | } |
11 | 11 | ||
12 | void MailListViewItem::showEntry() | 12 | void MailListViewItem::showEntry() |
13 | { | 13 | { |
14 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { | 14 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { |
15 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); | 15 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); |
16 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { | 16 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { |
17 | /* I think it looks nicer if there are not such a log of icons but only on mails | 17 | /* I think it looks nicer if there are not such a log of icons but only on mails |
18 | replied or new - Alwin*/ | 18 | replied or new - Alwin*/ |
19 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); | 19 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); |
20 | } else { | 20 | } else { |
21 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); | 21 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); |
22 | } | 22 | } |
23 | double s = mail_data->Msgsize(); | 23 | double s = mail_data->Msgsize(); |
24 | int w; | 24 | int w = 0; |
25 | w=0; | 25 | s/=1024; |
26 | 26 | if (s>999.0) { | |
27 | while (s>1024) { | 27 | s/=1024.0; |
28 | s/=1024; | ||
29 | ++w; | 28 | ++w; |
30 | if (w>=2) break; | ||
31 | } | 29 | } |
32 | 30 | QString fsort; | |
33 | QString q=""; | 31 | fsort.sprintf( "%.2f", s ); |
34 | QString fsize=""; | 32 | QString fsize = QString::number( s, 'f', 2 ); |
35 | switch(w) { | 33 | // 1.23 |
36 | case 1: | 34 | // 11.23 |
37 | q="k"; | 35 | // 111.23 |
36 | // 999.23 maxlen | ||
37 | switch(fsize.length() ) { | ||
38 | case 4: | ||
39 | fsort = "00" + fsize ; | ||
38 | break; | 40 | break; |
39 | case 2: | 41 | case 5: |
40 | q="M"; | 42 | fsort = "0" + fsize ; |
41 | break; | 43 | break; |
42 | default: | 44 | default: |
43 | break; | 45 | fsort = fsize ; |
46 | break; | ||
47 | |||
44 | } | 48 | } |
45 | 49 | if ( w == 0 ) { | |
46 | { | 50 | setText(3, fsize + "kB" ); |
47 | QTextOStream o(&fsize); | 51 | mKeyMap.insert(3, "k" + fsort); |
48 | if (w>0) o.precision(2); else o.precision(0); | 52 | //setText(3, "kB" + fsort ); // test only |
49 | o.setf(QTextStream::fixed); | 53 | } else { |
50 | o << s << " " << q << "Byte"; | 54 | //setText(3, fsize + "MB"); |
55 | mKeyMap.insert(4, "M" +fsort ); | ||
51 | } | 56 | } |
52 | |||
53 | setText(1,mail_data->getSubject()); | 57 | setText(1,mail_data->getSubject()); |
54 | setText(2,mail_data->getFrom()); | 58 | setText(2,mail_data->getFrom()); |
55 | setText(3,fsize); | 59 | |
56 | QString date = mail_data->getDate(); | 60 | QString date = mail_data->getDate(); |
57 | 61 | ||
58 | int kom = date.find( ",")+2; | 62 | int kom = date.find( ",")+2; |
59 | if ( kom == 1 ) | 63 | if ( kom == 1 ) |
60 | kom = 0; | 64 | kom = 0; |
61 | if ( date.mid(kom,1) == " ") | 65 | if ( date.mid(kom,1) == " ") |
62 | ++kom; | 66 | ++kom; |
63 | if ( date.mid(kom+1,1) == " " ) | 67 | if ( date.mid(kom+1,1) == " " ) |
64 | date = "0" + date.mid( kom ); | 68 | date = "0" + date.mid( kom ); |
65 | else if ( kom ) | 69 | else if ( kom ) |
66 | date = date.mid( kom ); | 70 | date = date.mid( kom ); |
67 | if ( kom || date.mid(2,1 ) == " ") { | 71 | if ( kom || date.mid(2,1 ) == " ") { |
68 | QString mon = date.mid(3,3); | 72 | QString mon = date.mid(3,3); |
69 | QString so = 00; | 73 | QString so = 00; |
70 | if ( mon == "Jan" ) | 74 | if ( mon == "Jan" ) |
71 | so = "01"; | 75 | so = "01"; |
72 | else if ( mon == "Feb" ) | 76 | else if ( mon == "Feb" ) |
73 | so = "02"; | 77 | so = "02"; |
74 | else if ( mon == "Mar" ) | 78 | else if ( mon == "Mar" ) |
75 | so = "03"; | 79 | so = "03"; |
76 | else if ( mon == "Apr" ) | 80 | else if ( mon == "Apr" ) |
77 | so = "04"; | 81 | so = "04"; |
78 | else if ( mon == "May" ) | 82 | else if ( mon == "May" ) |
79 | so = "05"; | 83 | so = "05"; |
80 | else if ( mon == "Jun" ) | 84 | else if ( mon == "Jun" ) |
81 | so = "06"; | 85 | so = "06"; |
82 | else if ( mon == "Jul" ) | 86 | else if ( mon == "Jul" ) |
83 | so = "07"; | 87 | so = "07"; |
84 | else if ( mon == "Aug" ) | 88 | else if ( mon == "Aug" ) |
85 | so = "08"; | 89 | so = "08"; |
86 | else if ( mon == "Sep" ) | 90 | else if ( mon == "Sep" ) |
87 | so = "09"; | 91 | so = "09"; |
88 | else if ( mon == "Oct" ) | 92 | else if ( mon == "Oct" ) |
89 | so = "10"; | 93 | so = "10"; |
90 | else if ( mon == "Nov" ) | 94 | else if ( mon == "Nov" ) |
91 | so = "11"; | 95 | so = "11"; |
92 | else if ( mon == "Dec" ) | 96 | else if ( mon == "Dec" ) |
93 | so = "12"; | 97 | so = "12"; |
94 | date = date.mid(7,4)+"-"+so+"-"+date.left(2)+" "+date.mid(12,14); | 98 | date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); |
95 | } | 99 | } |
96 | // if ( date.left(1) != "1" || date.left(1) != "2" ) | 100 | // if ( date.left(1) != "1" || date.left(1) != "2" ) |
97 | // date = date.mid(5); | 101 | // date = date.mid(5); |
98 | setText(4,date); | 102 | mKeyMap.insert(4,date); |
103 | setText(4,mail_data->getDate()); | ||
99 | } | 104 | } |
100 | 105 | ||
101 | void MailListViewItem::storeData(const RecMailP&data) | 106 | void MailListViewItem::storeData(const RecMailP&data) |
102 | { | 107 | { |
103 | mail_data = data; | 108 | mail_data = data; |
104 | } | 109 | } |
110 | void MailListViewItem::setSortKey(int column,const QString &key) | ||
111 | { | ||
112 | mKeyMap.insert(column,key); | ||
113 | } | ||
114 | QString MailListViewItem::key(int column, bool) const | ||
115 | { | ||
116 | // to make is fast, we use here special cases | ||
117 | if ( column == 3 || column == 4 ) { | ||
118 | return *mKeyMap.find(column); | ||
119 | } | ||
120 | if ( column == 1 ) { | ||
121 | if ( text(1).left(4).lower() == "re: " ) | ||
122 | return text(1).mid(4); | ||
123 | |||
124 | } | ||
125 | return text(column); | ||
126 | /* | ||
127 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | ||
128 | if (it == mKeyMap.end()) return text(column); | ||
129 | else return *it; | ||
130 | */ | ||
131 | } | ||
105 | 132 | ||
106 | const RecMailP& MailListViewItem::data()const | 133 | const RecMailP& MailListViewItem::data()const |
107 | { | 134 | { |
108 | return mail_data; | 135 | return mail_data; |
109 | } | 136 | } |
110 | 137 | ||
111 | MAILLIB::ATYPE MailListViewItem::wrapperType() | 138 | MAILLIB::ATYPE MailListViewItem::wrapperType() |
112 | { | 139 | { |
113 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; | 140 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; |
114 | return mail_data->Wrapper()->getType(); | 141 | return mail_data->Wrapper()->getType(); |
115 | } | 142 | } |
diff --git a/kmicromail/mailistviewitem.h b/kmicromail/mailistviewitem.h index d953d83..cf8040b 100644 --- a/kmicromail/mailistviewitem.h +++ b/kmicromail/mailistviewitem.h | |||
@@ -1,23 +1,26 @@ | |||
1 | #ifndef __MAILLISTVIEWITEM_H | 1 | #ifndef __MAILLISTVIEWITEM_H |
2 | #define __MAILLISTVIEWITEM_H | 2 | #define __MAILLISTVIEWITEM_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
5 | #include <libmailwrapper/mailtypes.h> | 5 | #include <libmailwrapper/mailtypes.h> |
6 | #include <libmailwrapper/maildefines.h> | 6 | #include <libmailwrapper/maildefines.h> |
7 | 7 | ||
8 | class MailListViewItem:public QListViewItem | 8 | class MailListViewItem:public QListViewItem |
9 | { | 9 | { |
10 | public: | 10 | public: |
11 | MailListViewItem(QListView * parent, MailListViewItem * after ); | 11 | MailListViewItem(QListView * parent, MailListViewItem * after ); |
12 | virtual ~MailListViewItem(){} | 12 | virtual ~MailListViewItem(){} |
13 | 13 | ||
14 | void storeData(const RecMailP&data); | 14 | void storeData(const RecMailP&data); |
15 | const RecMailP&data()const; | 15 | const RecMailP&data()const; |
16 | void showEntry(); | 16 | void showEntry(); |
17 | MAILLIB::ATYPE wrapperType(); | 17 | MAILLIB::ATYPE wrapperType(); |
18 | 18 | QString key(int column, bool) const; | |
19 | void setSortKey(int column,const QString &key); | ||
19 | protected: | 20 | protected: |
20 | RecMailP mail_data; | 21 | RecMailP mail_data; |
22 | private: | ||
23 | QMap<int,QString> mKeyMap; | ||
21 | }; | 24 | }; |
22 | 25 | ||
23 | #endif | 26 | #endif |
diff --git a/kmicromail/mainwindow.cpp b/kmicromail/mainwindow.cpp index 78377ea..ddc7b3e 100644 --- a/kmicromail/mainwindow.cpp +++ b/kmicromail/mainwindow.cpp | |||
@@ -1,232 +1,232 @@ | |||
1 | #include <qlabel.h> | 1 | #include <qlabel.h> |
2 | #include <qvbox.h> | 2 | #include <qvbox.h> |
3 | #include <qheader.h> | 3 | #include <qheader.h> |
4 | #include <qtimer.h> | 4 | #include <qtimer.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | #include <kdialog.h> | 6 | #include <kdialog.h> |
7 | #include <kiconloader.h> | 7 | #include <kiconloader.h> |
8 | 8 | ||
9 | #ifndef DESKTOP_VERSION | 9 | #ifndef DESKTOP_VERSION |
10 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
11 | #endif | 11 | #endif |
12 | #include "defines.h" | 12 | #include "defines.h" |
13 | #include "mainwindow.h" | 13 | #include "mainwindow.h" |
14 | #include <KDGanttMinimizeSplitter.h> | 14 | #include <KDGanttMinimizeSplitter.h> |
15 | 15 | ||
16 | 16 | ||
17 | #include <kabc/stdaddressbook.h> | 17 | #include <kabc/stdaddressbook.h> |
18 | 18 | ||
19 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | 19 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) |
20 | : QMainWindow( parent, name, flags ) | 20 | : QMainWindow( parent, name, flags ) |
21 | { | 21 | { |
22 | setCaption( tr( "KMicroMail" ) ); | 22 | setCaption( tr( "KMicroMail" ) ); |
23 | setToolBarsMovable( false ); | 23 | setToolBarsMovable( false ); |
24 | KABC::StdAddressBook::self(); | 24 | KABC::StdAddressBook::self(); |
25 | toolBar = new QToolBar( this ); | 25 | toolBar = new QToolBar( this ); |
26 | menuBar = new QMenuBar( toolBar ); | 26 | menuBar = new QMenuBar( toolBar ); |
27 | mailMenu = new QPopupMenu( menuBar ); | 27 | mailMenu = new QPopupMenu( menuBar ); |
28 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 28 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
29 | settingsMenu = new QPopupMenu( menuBar ); | 29 | settingsMenu = new QPopupMenu( menuBar ); |
30 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 30 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
31 | 31 | ||
32 | addToolBar( toolBar ); | 32 | addToolBar( toolBar ); |
33 | toolBar->setHorizontalStretchable( true ); | 33 | toolBar->setHorizontalStretchable( true ); |
34 | 34 | ||
35 | QLabel *spacer = new QLabel( toolBar ); | 35 | QLabel *spacer = new QLabel( toolBar ); |
36 | spacer->setBackgroundMode( QWidget::PaletteButton ); | 36 | spacer->setBackgroundMode( QWidget::PaletteButton ); |
37 | toolBar->setStretchableWidget( spacer ); | 37 | toolBar->setStretchableWidget( spacer ); |
38 | 38 | ||
39 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), | 39 | composeMail = new QAction( tr( "Compose new mail" ), SmallIcon("composemail"), |
40 | 0, 0, this ); | 40 | 0, 0, this ); |
41 | composeMail->addTo( toolBar ); | 41 | composeMail->addTo( toolBar ); |
42 | composeMail->addTo( mailMenu ); | 42 | composeMail->addTo( mailMenu ); |
43 | 43 | ||
44 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , | 44 | sendQueued = new QAction( tr( "Send queued mails" ), SmallIcon("sendqueued") , |
45 | 0, 0, this ); | 45 | 0, 0, this ); |
46 | sendQueued->addTo( toolBar ); | 46 | sendQueued->addTo( toolBar ); |
47 | sendQueued->addTo( mailMenu ); | 47 | sendQueued->addTo( mailMenu ); |
48 | 48 | ||
49 | /* | 49 | /* |
50 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, | 50 | syncFolders = new QAction( tr( "Sync mailfolders" ), ICON_SYNC, |
51 | 0, 0, this ); | 51 | 0, 0, this ); |
52 | syncFolders->addTo( toolBar ); | 52 | syncFolders->addTo( toolBar ); |
53 | syncFolders->addTo( mailMenu ); | 53 | syncFolders->addTo( mailMenu ); |
54 | */ | 54 | */ |
55 | 55 | ||
56 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , | 56 | showFolders = new QAction( tr( "Show/Hide folders" ), SmallIcon("showfolders") , |
57 | 0, 0, this, 0, true ); | 57 | 0, 0, this, 0, true ); |
58 | showFolders->addTo( toolBar ); | 58 | showFolders->addTo( toolBar ); |
59 | showFolders->addTo( mailMenu ); | 59 | showFolders->addTo( mailMenu ); |
60 | showFolders->setOn( true ); | 60 | showFolders->setOn( true ); |
61 | connect(showFolders, SIGNAL( toggled(bool) ), | 61 | connect(showFolders, SIGNAL( toggled(bool) ), |
62 | SLOT( slotShowFolders(bool) ) ); | 62 | SLOT( slotShowFolders(bool) ) ); |
63 | 63 | ||
64 | /* | 64 | /* |
65 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), | 65 | searchMails = new QAction( tr( "Search mails" ), SmallIcon("find") ), |
66 | 0, 0, this ); | 66 | 0, 0, this ); |
67 | searchMails->addTo( toolBar ); | 67 | searchMails->addTo( toolBar ); |
68 | searchMails->addTo( mailMenu ); | 68 | searchMails->addTo( mailMenu ); |
69 | */ | 69 | */ |
70 | 70 | ||
71 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); | 71 | deleteMails = new QAction(tr("Delete Mail"), SmallIcon("trash"), 0, 0, this); |
72 | deleteMails->addTo( toolBar ); | 72 | deleteMails->addTo( toolBar ); |
73 | deleteMails->addTo( mailMenu ); | 73 | deleteMails->addTo( mailMenu ); |
74 | connect( deleteMails, SIGNAL( activated() ), | 74 | connect( deleteMails, SIGNAL( activated() ), |
75 | SLOT( slotDeleteMail() ) ); | 75 | SLOT( slotDeleteMail() ) ); |
76 | 76 | ||
77 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , | 77 | editSettings = new QAction( tr( "Edit settings" ), SmallIcon("SettingsIcon") , |
78 | 0, 0, this ); | 78 | 0, 0, this ); |
79 | editSettings->addTo( settingsMenu ); | 79 | editSettings->addTo( settingsMenu ); |
80 | connect( editSettings, SIGNAL( activated() ), | 80 | connect( editSettings, SIGNAL( activated() ), |
81 | SLOT( slotEditSettings() ) ); | 81 | SLOT( slotEditSettings() ) ); |
82 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , | 82 | editAccounts = new QAction( tr( "Configure accounts" ), SmallIcon("editaccounts") , |
83 | 0, 0, this ); | 83 | 0, 0, this ); |
84 | editAccounts->addTo( settingsMenu ); | 84 | editAccounts->addTo( settingsMenu ); |
85 | 85 | ||
86 | //setCentralWidget( view ); | 86 | //setCentralWidget( view ); |
87 | 87 | ||
88 | QVBox* wrapperBox = new QVBox( this ); | 88 | QVBox* wrapperBox = new QVBox( this ); |
89 | setCentralWidget( wrapperBox ); | 89 | setCentralWidget( wrapperBox ); |
90 | 90 | ||
91 | // QWidget *view = new QWidget( wrapperBox ); | 91 | // QWidget *view = new QWidget( wrapperBox ); |
92 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); | 92 | KDGanttMinimizeSplitter* split = new KDGanttMinimizeSplitter( Qt::Horizontal, wrapperBox); |
93 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); | 93 | split->setMinimizeDirection( KDGanttMinimizeSplitter::Left); |
94 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); | 94 | //layout = new QBoxLayout ( split, QBoxLayout::LeftToRight ); |
95 | 95 | ||
96 | folderView = new AccountView( split ); | 96 | folderView = new AccountView( split ); |
97 | folderView->header()->hide(); | 97 | folderView->header()->hide(); |
98 | folderView->setRootIsDecorated( true ); | 98 | folderView->setRootIsDecorated( false ); |
99 | folderView->addColumn( tr( "Mailbox" ) ); | 99 | folderView->addColumn( tr( "Mailbox" ) ); |
100 | 100 | ||
101 | //layout->addWidget( folderView ); | 101 | //layout->addWidget( folderView ); |
102 | 102 | ||
103 | mailView = new QListView( split ); | 103 | mailView = new QListView( split ); |
104 | mailView->addColumn( tr( "" ) ); | 104 | mailView->addColumn( tr( " " ) ); |
105 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 105 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
106 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 106 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
107 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 107 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
108 | mailView->addColumn( tr( "Date" )); | 108 | mailView->addColumn( tr( "Date" ),QListView::Manual); |
109 | mailView->setAllColumnsShowFocus(true); | 109 | mailView->setAllColumnsShowFocus(true); |
110 | //mailView->setSorting(-1); | 110 | //mailView->setSorting(-1); |
111 | 111 | mailView->setRootIsDecorated( false ); | |
112 | statusWidget = new StatusWidget( wrapperBox ); | 112 | statusWidget = new StatusWidget( wrapperBox ); |
113 | statusWidget->hide(); | 113 | statusWidget->hide(); |
114 | 114 | ||
115 | //layout->addWidget( mailView ); | 115 | //layout->addWidget( mailView ); |
116 | //layout->setStretchFactor( folderView, 1 ); | 116 | //layout->setStretchFactor( folderView, 1 ); |
117 | //layout->setStretchFactor( mailView, 2 ); | 117 | //layout->setStretchFactor( mailView, 2 ); |
118 | 118 | ||
119 | slotAdjustLayout(); | 119 | slotAdjustLayout(); |
120 | #ifndef DESKTOP_VERSION | 120 | #ifndef DESKTOP_VERSION |
121 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); | 121 | QPEApplication::setStylusOperation( mailView->viewport(),QPEApplication::RightOnHold); |
122 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); | 122 | QPEApplication::setStylusOperation( folderView->viewport(),QPEApplication::RightOnHold); |
123 | #endif | 123 | #endif |
124 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, | 124 | connect( mailView, SIGNAL( doubleClicked (QListViewItem* )),this, |
125 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 125 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
126 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, | 126 | connect( mailView, SIGNAL( returnPressed (QListViewItem* )),this, |
127 | SLOT( mailLeftClicked(QListViewItem*) ) ); | 127 | SLOT( mailLeftClicked(QListViewItem*) ) ); |
128 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 128 | connect( mailView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
129 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); | 129 | SLOT( mailHold(int,QListViewItem*,const QPoint&,int) ) ); |
130 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), | 130 | connect(folderView, SIGNAL(refreshMailview(const QValueList<RecMailP>&)), |
131 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); | 131 | this,SLOT(refreshMailView(const QValueList<RecMailP>&))); |
132 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); | 132 | connect( composeMail, SIGNAL( activated() ), SLOT( slotComposeMail() ) ); |
133 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); | 133 | connect( sendQueued, SIGNAL( activated() ), SLOT( slotSendQueued() ) ); |
134 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); | 134 | // connect( searchMails, SIGNAL( activated() ), SLOT( slotSearchMails() ) ); |
135 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); | 135 | connect( editAccounts, SIGNAL( activated() ), SLOT( slotEditAccounts() ) ); |
136 | mailView->setMultiSelection ( true ); | 136 | mailView->setMultiSelection ( true ); |
137 | //mailView->setSelectionMode( QListView::Extended ); | 137 | //mailView->setSelectionMode( QListView::Extended ); |
138 | QValueList<int> list; | 138 | QValueList<int> list; |
139 | int fw = 100; | 139 | int fw = 100; |
140 | if ( QApplication::desktop()->width() > 320 ) | 140 | if ( QApplication::desktop()->width() > 320 ) |
141 | fw = 50; | 141 | fw = 50; |
142 | list.append( fw ); | 142 | list.append( fw ); |
143 | list.append( 100 ); | 143 | list.append( 100 ); |
144 | split->setSizes( list ); | 144 | split->setSizes( list ); |
145 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); | 145 | QTimer::singleShot( 1000, this, SLOT( slotAdjustColumns() ) ); |
146 | mailView->setShowSortIndicator ( true ); | 146 | mailView->setShowSortIndicator ( true ); |
147 | } | 147 | } |
148 | 148 | ||
149 | MainWindow::~MainWindow() | 149 | MainWindow::~MainWindow() |
150 | { | 150 | { |
151 | } | 151 | } |
152 | 152 | ||
153 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 153 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
154 | { | 154 | { |
155 | qDebug("appMessage implemented by subclass"); | 155 | qDebug("appMessage implemented by subclass"); |
156 | } | 156 | } |
157 | 157 | ||
158 | void MainWindow::slotAdjustLayout() { | 158 | void MainWindow::slotAdjustLayout() { |
159 | 159 | ||
160 | /* | 160 | /* |
161 | QWidget *d = QApplication::desktop(); | 161 | QWidget *d = QApplication::desktop(); |
162 | 162 | ||
163 | if ( d->width() < d->height() ) { | 163 | if ( d->width() < d->height() ) { |
164 | layout->setDirection( QBoxLayout::TopToBottom ); | 164 | layout->setDirection( QBoxLayout::TopToBottom ); |
165 | } else { | 165 | } else { |
166 | layout->setDirection( QBoxLayout::LeftToRight ); | 166 | layout->setDirection( QBoxLayout::LeftToRight ); |
167 | } | 167 | } |
168 | */ | 168 | */ |
169 | } | 169 | } |
170 | 170 | ||
171 | void MainWindow::slotAdjustColumns() | 171 | void MainWindow::slotAdjustColumns() |
172 | { | 172 | { |
173 | bool hidden = folderView->isHidden(); | 173 | bool hidden = folderView->isHidden(); |
174 | if ( hidden ) folderView->show(); | 174 | if ( hidden ) folderView->show(); |
175 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); | 175 | folderView->setColumnWidth( 0, folderView->visibleWidth() ); |
176 | if ( hidden ) folderView->hide(); | 176 | if ( hidden ) folderView->hide(); |
177 | 177 | ||
178 | mailView->setColumnWidth( 0, 10 ); | 178 | mailView->setColumnWidth( 0, 10 ); |
179 | mailView->setColumnWidth( 1, mailView->visibleWidth() - 130 ); | 179 | mailView->setColumnWidth( 1, 80 ); |
180 | mailView->setColumnWidth( 2, 80 ); | 180 | mailView->setColumnWidth( 2, 80 ); |
181 | mailView->setColumnWidth( 3, 50 ); | 181 | mailView->setColumnWidth( 3, 50 ); |
182 | mailView->setColumnWidth( 4, 50 ); | 182 | mailView->setColumnWidth( 4, 50 ); |
183 | } | 183 | } |
184 | 184 | ||
185 | void MainWindow::slotEditSettings() | 185 | void MainWindow::slotEditSettings() |
186 | { | 186 | { |
187 | } | 187 | } |
188 | 188 | ||
189 | void MainWindow::slotShowFolders( bool ) | 189 | void MainWindow::slotShowFolders( bool ) |
190 | { | 190 | { |
191 | qDebug("not implemented: "); | 191 | qDebug("not implemented: "); |
192 | } | 192 | } |
193 | 193 | ||
194 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 194 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
195 | { | 195 | { |
196 | qDebug("not implemented: "); | 196 | qDebug("not implemented: "); |
197 | } | 197 | } |
198 | 198 | ||
199 | void MainWindow::mailLeftClicked(QListViewItem * ) | 199 | void MainWindow::mailLeftClicked(QListViewItem * ) |
200 | { | 200 | { |
201 | qDebug("not implemented: "); | 201 | qDebug("not implemented: "); |
202 | } | 202 | } |
203 | 203 | ||
204 | void MainWindow::displayMail() | 204 | void MainWindow::displayMail() |
205 | { | 205 | { |
206 | qDebug("not implemented: "); | 206 | qDebug("not implemented: "); |
207 | } | 207 | } |
208 | 208 | ||
209 | void MainWindow::slotDeleteMail() | 209 | void MainWindow::slotDeleteMail() |
210 | { | 210 | { |
211 | qDebug("not implemented: "); | 211 | qDebug("not implemented: "); |
212 | } | 212 | } |
213 | 213 | ||
214 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 214 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
215 | { | 215 | { |
216 | qDebug("not implemented: "); | 216 | qDebug("not implemented: "); |
217 | } | 217 | } |
218 | 218 | ||
219 | void MainWindow::slotSendQueued() | 219 | void MainWindow::slotSendQueued() |
220 | { | 220 | { |
221 | qDebug("not implemented: "); | 221 | qDebug("not implemented: "); |
222 | } | 222 | } |
223 | 223 | ||
224 | void MainWindow::slotEditAccounts() | 224 | void MainWindow::slotEditAccounts() |
225 | { | 225 | { |
226 | qDebug("not implemented: "); | 226 | qDebug("not implemented: "); |
227 | } | 227 | } |
228 | 228 | ||
229 | void MainWindow::slotComposeMail() | 229 | void MainWindow::slotComposeMail() |
230 | { | 230 | { |
231 | qDebug("not implemented: "); | 231 | qDebug("not implemented: "); |
232 | } | 232 | } |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index b1992ec..bdbd93a 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -1,343 +1,343 @@ | |||
1 | 1 | ||
2 | #include "settingsdialog.h" | 2 | #include "settingsdialog.h" |
3 | #include "opiemail.h" | 3 | #include "opiemail.h" |
4 | #include "editaccounts.h" | 4 | #include "editaccounts.h" |
5 | #include "composemail.h" | 5 | #include "composemail.h" |
6 | #include "mailistviewitem.h" | 6 | #include "mailistviewitem.h" |
7 | #include "viewmail.h" | 7 | #include "viewmail.h" |
8 | #include "selectstore.h" | 8 | #include "selectstore.h" |
9 | #include "selectsmtp.h" | 9 | #include "selectsmtp.h" |
10 | 10 | ||
11 | #include <qmessagebox.h> | 11 | #include <qmessagebox.h> |
12 | 12 | ||
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #include <libmailwrapper/smtpwrapper.h> | 14 | #include <libmailwrapper/smtpwrapper.h> |
15 | #include <libmailwrapper/mailtypes.h> | 15 | #include <libmailwrapper/mailtypes.h> |
16 | #include <libmailwrapper/abstractmail.h> | 16 | #include <libmailwrapper/abstractmail.h> |
17 | /* OPIE */ | 17 | /* OPIE */ |
18 | //#include <qpe/resource.h> | 18 | //#include <qpe/resource.h> |
19 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
20 | 20 | ||
21 | /* QT */ | 21 | /* QT */ |
22 | 22 | ||
23 | using namespace Opie::Core; | 23 | using namespace Opie::Core; |
24 | 24 | ||
25 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) | 25 | OpieMail::OpieMail( QWidget *parent, const char *name, WFlags flags ) |
26 | : MainWindow( parent, name, WStyle_ContextHelp ) | 26 | : MainWindow( parent, name, WStyle_ContextHelp ) |
27 | { | 27 | { |
28 | settings = new Settings(); | 28 | settings = new Settings(); |
29 | 29 | ||
30 | folderView->populate( settings->getAccounts() ); | 30 | folderView->populate( settings->getAccounts() ); |
31 | 31 | ||
32 | } | 32 | } |
33 | 33 | ||
34 | OpieMail::~OpieMail() | 34 | OpieMail::~OpieMail() |
35 | { | 35 | { |
36 | if (settings) delete settings; | 36 | if (settings) delete settings; |
37 | } | 37 | } |
38 | 38 | ||
39 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) | 39 | void OpieMail::appMessage(const QCString &msg, const QByteArray &data) |
40 | { | 40 | { |
41 | 41 | ||
42 | } | 42 | } |
43 | #include <stdlib.h> | 43 | #include <stdlib.h> |
44 | void OpieMail::message(const QCString &msg, const QByteArray &data) | 44 | void OpieMail::message(const QCString &msg, const QByteArray &data) |
45 | { | 45 | { |
46 | // copied from old mail2 | 46 | // copied from old mail2 |
47 | static int ii = 0; | 47 | static int ii = 0; |
48 | 48 | ||
49 | // block second call | 49 | // block second call |
50 | if ( ii < 2 ) { | 50 | if ( ii < 2 ) { |
51 | ++ii; | 51 | ++ii; |
52 | if ( ii > 1 ) { | 52 | if ( ii > 1 ) { |
53 | qDebug("qcop call blocked "); | 53 | qDebug("qcop call blocked "); |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | } | 56 | } |
57 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); | 57 | //qDebug("KM:appMessage %d *%s* %x", ii, msg.data(), this); |
58 | if (msg == "writeMail(QString,QString)") | 58 | if (msg == "writeMail(QString,QString)") |
59 | { | 59 | { |
60 | QDataStream stream(data,IO_ReadOnly); | 60 | QDataStream stream(data,IO_ReadOnly); |
61 | QString name, email; | 61 | QString name, email; |
62 | stream >> name >> email; | 62 | stream >> name >> email; |
63 | // removing the whitespaces at beginning and end is needed! | 63 | // removing the whitespaces at beginning and end is needed! |
64 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); | 64 | slotwriteMail(name.stripWhiteSpace(),email.stripWhiteSpace()); |
65 | } | 65 | } |
66 | else if (msg == "newMail()") | 66 | else if (msg == "newMail()") |
67 | { | 67 | { |
68 | slotComposeMail(); | 68 | slotComposeMail(); |
69 | } | 69 | } |
70 | else if (msg == "newMail(QString)") | 70 | else if (msg == "newMail(QString)") |
71 | { | 71 | { |
72 | QDataStream stream(data,IO_ReadOnly); | 72 | QDataStream stream(data,IO_ReadOnly); |
73 | QString nameemail; | 73 | QString nameemail; |
74 | stream >> nameemail; | 74 | stream >> nameemail; |
75 | // the format is | 75 | // the format is |
76 | // NAME <EMAIL>:SUBJECT | 76 | // NAME <EMAIL>:SUBJECT |
77 | //qDebug("message %s ", nameemail.latin1()); | 77 | //qDebug("message %s ", nameemail.latin1()); |
78 | 78 | ||
79 | slotwriteMail2( nameemail ); | 79 | slotwriteMail2( nameemail ); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | void OpieMail::slotwriteMail2(const QString& namemail ) | 82 | void OpieMail::slotwriteMail2(const QString& namemail ) |
83 | { | 83 | { |
84 | // qDebug("OpieMail::slotwriteMail2 "); | 84 | // qDebug("OpieMail::slotwriteMail2 "); |
85 | qApp->processEvents(); | 85 | qApp->processEvents(); |
86 | ComposeMail compose( settings, this, 0, true ); | 86 | ComposeMail compose( settings, this, 0, true ); |
87 | if ( !namemail.isEmpty() ) { | 87 | if ( !namemail.isEmpty() ) { |
88 | QString to = namemail; | 88 | QString to = namemail; |
89 | if ( namemail.find( " <") > 1 ) { | 89 | if ( namemail.find( " <") > 1 ) { |
90 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 90 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
91 | } else | 91 | } else |
92 | if ( namemail.find( "<") > 1 ) { | 92 | if ( namemail.find( "<") > 1 ) { |
93 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 93 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
94 | } | 94 | } |
95 | int sub = to.find( ">:"); | 95 | int sub = to.find( ">:"); |
96 | if ( sub > 0 ) { | 96 | if ( sub > 0 ) { |
97 | compose.setTo( to.left(sub+1) ); | 97 | compose.setTo( to.left(sub+1) ); |
98 | compose.setSubject( to.mid(sub+2) ); | 98 | compose.setSubject( to.mid(sub+2) ); |
99 | } else | 99 | } else |
100 | compose.setTo( to ); | 100 | compose.setTo( to ); |
101 | } | 101 | } |
102 | compose.slotAdjustColumns(); | 102 | compose.slotAdjustColumns(); |
103 | compose.showMaximized(); | 103 | compose.showMaximized(); |
104 | compose.exec(); | 104 | compose.exec(); |
105 | //qDebug("retttich "); | 105 | //qDebug("retttich "); |
106 | } | 106 | } |
107 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 107 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
108 | { | 108 | { |
109 | // qDebug("OpieMail::slotwriteMail "); | 109 | // qDebug("OpieMail::slotwriteMail "); |
110 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); | 110 | ComposeMail compose( settings, this, 0, true , WStyle_ContextHelp ); |
111 | if (!email.isEmpty()) | 111 | if (!email.isEmpty()) |
112 | { | 112 | { |
113 | if (!name.isEmpty()) | 113 | if (!name.isEmpty()) |
114 | { | 114 | { |
115 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 115 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
116 | } | 116 | } |
117 | else | 117 | else |
118 | { | 118 | { |
119 | compose.setTo(email); | 119 | compose.setTo(email); |
120 | } | 120 | } |
121 | } | 121 | } |
122 | compose.slotAdjustColumns(); | 122 | compose.slotAdjustColumns(); |
123 | compose.showMaximized(); | 123 | compose.showMaximized(); |
124 | compose.exec(); | 124 | compose.exec(); |
125 | } | 125 | } |
126 | 126 | ||
127 | void OpieMail::slotComposeMail() | 127 | void OpieMail::slotComposeMail() |
128 | { | 128 | { |
129 | slotwriteMail2( QString () ); | 129 | slotwriteMail2( QString () ); |
130 | //slotwriteMail(0l,0l); | 130 | //slotwriteMail(0l,0l); |
131 | } | 131 | } |
132 | 132 | ||
133 | void OpieMail::slotSendQueued() | 133 | void OpieMail::slotSendQueued() |
134 | { | 134 | { |
135 | SMTPaccount *smtp = 0; | 135 | SMTPaccount *smtp = 0; |
136 | 136 | ||
137 | QList<Account> list = settings->getAccounts(); | 137 | QList<Account> list = settings->getAccounts(); |
138 | QList<SMTPaccount> smtpList; | 138 | QList<SMTPaccount> smtpList; |
139 | smtpList.setAutoDelete(false); | 139 | smtpList.setAutoDelete(false); |
140 | Account *it; | 140 | Account *it; |
141 | for ( it = list.first(); it; it = list.next() ) | 141 | for ( it = list.first(); it; it = list.next() ) |
142 | { | 142 | { |
143 | if ( it->getType() == MAILLIB::A_SMTP ) | 143 | if ( it->getType() == MAILLIB::A_SMTP ) |
144 | { | 144 | { |
145 | smtp = static_cast<SMTPaccount *>(it); | 145 | smtp = static_cast<SMTPaccount *>(it); |
146 | smtpList.append(smtp); | 146 | smtpList.append(smtp); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | if (smtpList.count()==0) | 149 | if (smtpList.count()==0) |
150 | { | 150 | { |
151 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first")); | 151 | QMessageBox::information(0,tr("Info"),tr("Define a smtp account first!\n")); |
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | if (smtpList.count()==1) | 154 | if (smtpList.count()==1) |
155 | { | 155 | { |
156 | smtp = smtpList.at(0); | 156 | smtp = smtpList.at(0); |
157 | } | 157 | } |
158 | else | 158 | else |
159 | { | 159 | { |
160 | smtp = 0; | 160 | smtp = 0; |
161 | selectsmtp selsmtp; | 161 | selectsmtp selsmtp; |
162 | selsmtp.setSelectionlist(&smtpList); | 162 | selsmtp.setSelectionlist(&smtpList); |
163 | selsmtp.showMaximized(); | 163 | selsmtp.showMaximized(); |
164 | if ( selsmtp.exec() == QDialog::Accepted ) | 164 | if ( selsmtp.exec() == QDialog::Accepted ) |
165 | { | 165 | { |
166 | smtp = selsmtp.selected_smtp(); | 166 | smtp = selsmtp.selected_smtp(); |
167 | } | 167 | } |
168 | } | 168 | } |
169 | if (smtp) | 169 | if (smtp) |
170 | { | 170 | { |
171 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 171 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
172 | if ( wrap->flushOutbox() ) | 172 | if ( wrap->flushOutbox() ) |
173 | { | 173 | { |
174 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); | 174 | QMessageBox::information(0,tr("Info"),tr("Mail queue flushed")); |
175 | } | 175 | } |
176 | delete wrap; | 176 | delete wrap; |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
180 | void OpieMail::slotSearchMails() | 180 | void OpieMail::slotSearchMails() |
181 | { | 181 | { |
182 | qDebug("OpieMail::slotSearchMails():not implemented "); | 182 | qDebug("OpieMail::slotSearchMails():not implemented "); |
183 | } | 183 | } |
184 | 184 | ||
185 | void OpieMail::slotEditSettings() | 185 | void OpieMail::slotEditSettings() |
186 | { | 186 | { |
187 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); | 187 | SettingsDialog settingsDialog( this, 0, true, WStyle_ContextHelp ); |
188 | settingsDialog.showMaximized(); | 188 | settingsDialog.showMaximized(); |
189 | settingsDialog.exec(); | 189 | settingsDialog.exec(); |
190 | } | 190 | } |
191 | 191 | ||
192 | void OpieMail::slotEditAccounts() | 192 | void OpieMail::slotEditAccounts() |
193 | { | 193 | { |
194 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); | 194 | EditAccounts eaDialog( settings, this, 0, true, WStyle_ContextHelp ); |
195 | eaDialog.slotAdjustColumns(); | 195 | eaDialog.slotAdjustColumns(); |
196 | eaDialog.showMaximized(); | 196 | eaDialog.showMaximized(); |
197 | eaDialog.exec(); | 197 | eaDialog.exec(); |
198 | if ( settings ) delete settings; | 198 | if ( settings ) delete settings; |
199 | settings = new Settings(); | 199 | settings = new Settings(); |
200 | 200 | ||
201 | folderView->populate( settings->getAccounts() ); | 201 | folderView->populate( settings->getAccounts() ); |
202 | } | 202 | } |
203 | 203 | ||
204 | void OpieMail::displayMail() | 204 | void OpieMail::displayMail() |
205 | { | 205 | { |
206 | QListViewItem*item = mailView->currentItem(); | 206 | QListViewItem*item = mailView->currentItem(); |
207 | if (!item) return; | 207 | if (!item) return; |
208 | RecMailP mail = ((MailListViewItem*)item)->data(); | 208 | RecMailP mail = ((MailListViewItem*)item)->data(); |
209 | RecBodyP body = folderView->fetchBody(mail); | 209 | RecBodyP body = folderView->fetchBody(mail); |
210 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); | 210 | ViewMail readMail( this,"", Qt::WType_Modal | WStyle_ContextHelp ); |
211 | readMail.setBody( body ); | 211 | readMail.setBody( body ); |
212 | readMail.setMail( mail ); | 212 | readMail.setMail( mail ); |
213 | readMail.showMaximized(); | 213 | readMail.showMaximized(); |
214 | readMail.exec(); | 214 | readMail.exec(); |
215 | 215 | ||
216 | if ( readMail.deleted ) | 216 | if ( readMail.deleted ) |
217 | { | 217 | { |
218 | folderView->refreshCurrent(); | 218 | folderView->refreshCurrent(); |
219 | } | 219 | } |
220 | else | 220 | else |
221 | { | 221 | { |
222 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); | 222 | ( (MailListViewItem*)item )->setPixmap( 0, QPixmap() ); |
223 | } | 223 | } |
224 | } | 224 | } |
225 | 225 | ||
226 | void OpieMail::slotDeleteMail() | 226 | void OpieMail::slotDeleteMail() |
227 | { | 227 | { |
228 | if (!mailView->currentItem()) return; | 228 | if (!mailView->currentItem()) return; |
229 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 229 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
230 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 230 | if ( QMessageBox::warning(this, tr("Delete Mail"), QString( tr("<p>Do you really want to delete this mail? <br><br>" ) + mail->getFrom() + " - " + mail->getSubject() ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
231 | { | 231 | { |
232 | mail->Wrapper()->deleteMail( mail ); | 232 | mail->Wrapper()->deleteMail( mail ); |
233 | folderView->refreshCurrent(); | 233 | folderView->refreshCurrent(); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | void OpieMail::slotDeleteAllMail() | 236 | void OpieMail::slotDeleteAllMail() |
237 | { | 237 | { |
238 | if (!mailView->currentItem()) return; | 238 | if (!mailView->currentItem()) return; |
239 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 239 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
240 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) | 240 | if ( QMessageBox::warning(this, tr("Delete All Mails"), tr("Do you really want to delete\nall selected mails?" ) , QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes ) |
241 | { | 241 | { |
242 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); | 242 | MailListViewItem* item = (MailListViewItem*)mailView->firstChild (); |
243 | while ( item ) { | 243 | while ( item ) { |
244 | if ( item->isSelected() ) { | 244 | if ( item->isSelected() ) { |
245 | RecMailP mail = item->data(); | 245 | RecMailP mail = item->data(); |
246 | mail->Wrapper()->deleteMail( mail ); | 246 | mail->Wrapper()->deleteMail( mail ); |
247 | } | 247 | } |
248 | item = (MailListViewItem*)item->nextSibling(); | 248 | item = (MailListViewItem*)item->nextSibling(); |
249 | } | 249 | } |
250 | folderView->refreshCurrent(); | 250 | folderView->refreshCurrent(); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | void OpieMail::clearSelection() | 253 | void OpieMail::clearSelection() |
254 | { | 254 | { |
255 | mailView->clearSelection(); | 255 | mailView->clearSelection(); |
256 | 256 | ||
257 | } | 257 | } |
258 | 258 | ||
259 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) | 259 | void OpieMail::mailHold(int button, QListViewItem *item,const QPoint&,int ) |
260 | { | 260 | { |
261 | if (!mailView->currentItem()) return; | 261 | if (!mailView->currentItem()) return; |
262 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); | 262 | MAILLIB::ATYPE mailtype = ((MailListViewItem*)mailView->currentItem() )->wrapperType(); |
263 | /* just the RIGHT button - or hold on pda */ | 263 | /* just the RIGHT button - or hold on pda */ |
264 | if (button!=2) {return;} | 264 | if (button!=2) {return;} |
265 | if (!item) return; | 265 | if (!item) return; |
266 | QPopupMenu *m = new QPopupMenu(0); | 266 | QPopupMenu *m = new QPopupMenu(0); |
267 | if (m) | 267 | if (m) |
268 | { | 268 | { |
269 | if (mailtype==MAILLIB::A_NNTP) { | 269 | if (mailtype==MAILLIB::A_NNTP) { |
270 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); | 270 | m->insertItem(tr("Read this posting"),this,SLOT(displayMail())); |
271 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); | 271 | // m->insertItem(tr("Copy this posting"),this,SLOT(slotMoveCopyMail())); |
272 | } else { | 272 | } else { |
273 | if (folderView->currentisDraft()) { | 273 | if (folderView->currentisDraft()) { |
274 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); | 274 | m->insertItem(tr("Edit this mail"),this,SLOT(reEditMail())); |
275 | } | 275 | } |
276 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); | 276 | m->insertItem(tr("Read this mail"),this,SLOT(displayMail())); |
277 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); | 277 | m->insertItem(tr("Copy/Move this mail"),this,SLOT(slotMoveCopyMail())); |
278 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); | 278 | m->insertItem(tr("Delete this mail"),this,SLOT(slotDeleteMail())); |
279 | m->insertSeparator(); | 279 | m->insertSeparator(); |
280 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); | 280 | m->insertItem(tr("Delete all selected mails"),this,SLOT(slotDeleteAllMail())); |
281 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); | 281 | m->insertItem(tr("Clear selection"),this,SLOT(clearSelection())); |
282 | } | 282 | } |
283 | m->setFocus(); | 283 | m->setFocus(); |
284 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 284 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
285 | delete m; | 285 | delete m; |
286 | } | 286 | } |
287 | } | 287 | } |
288 | 288 | ||
289 | void OpieMail::slotShowFolders( bool show ) | 289 | void OpieMail::slotShowFolders( bool show ) |
290 | { | 290 | { |
291 | if ( show && folderView->isHidden() ) | 291 | if ( show && folderView->isHidden() ) |
292 | { | 292 | { |
293 | folderView->show(); | 293 | folderView->show(); |
294 | } | 294 | } |
295 | else if ( !show && !folderView->isHidden() ) | 295 | else if ( !show && !folderView->isHidden() ) |
296 | { | 296 | { |
297 | folderView->hide(); | 297 | folderView->hide(); |
298 | } | 298 | } |
299 | } | 299 | } |
300 | 300 | ||
301 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) | 301 | void OpieMail::refreshMailView(const QValueList<RecMailP>&list) |
302 | { | 302 | { |
303 | MailListViewItem*item = 0; | 303 | MailListViewItem*item = 0; |
304 | mailView->clear(); | 304 | mailView->clear(); |
305 | 305 | ||
306 | QValueList<RecMailP>::ConstIterator it; | 306 | QValueList<RecMailP>::ConstIterator it; |
307 | for (it = list.begin(); it != list.end();++it) | 307 | for (it = list.begin(); it != list.end();++it) |
308 | { | 308 | { |
309 | item = new MailListViewItem(mailView,item); | 309 | item = new MailListViewItem(mailView,item); |
310 | item->storeData((*it)); | 310 | item->storeData((*it)); |
311 | item->showEntry(); | 311 | item->showEntry(); |
312 | } | 312 | } |
313 | } | 313 | } |
314 | 314 | ||
315 | void OpieMail::mailLeftClicked( QListViewItem *item ) | 315 | void OpieMail::mailLeftClicked( QListViewItem *item ) |
316 | { | 316 | { |
317 | mailView->clearSelection(); | 317 | mailView->clearSelection(); |
318 | /* just LEFT button - or tap with stylus on pda */ | 318 | /* just LEFT button - or tap with stylus on pda */ |
319 | //if (button!=1) return; | 319 | //if (button!=1) return; |
320 | if (!item) return; | 320 | if (!item) return; |
321 | if (folderView->currentisDraft()) { | 321 | if (folderView->currentisDraft()) { |
322 | reEditMail(); | 322 | reEditMail(); |
323 | } else { | 323 | } else { |
324 | displayMail(); | 324 | displayMail(); |
325 | } | 325 | } |
326 | } | 326 | } |
327 | 327 | ||
328 | void OpieMail::slotMoveCopyMail() | 328 | void OpieMail::slotMoveCopyMail() |
329 | { | 329 | { |
330 | if (!mailView->currentItem()) return; | 330 | if (!mailView->currentItem()) return; |
331 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); | 331 | RecMailP mail = ((MailListViewItem*)mailView->currentItem() )->data(); |
332 | AbstractMail*targetMail = 0; | 332 | AbstractMail*targetMail = 0; |
333 | QString targetFolder = ""; | 333 | QString targetFolder = ""; |
334 | Selectstore sels; | 334 | Selectstore sels; |
335 | folderView->setupFolderselect(&sels); | 335 | folderView->setupFolderselect(&sels); |
336 | if (!sels.exec()) return; | 336 | if (!sels.exec()) return; |
337 | targetMail = sels.currentMail(); | 337 | targetMail = sels.currentMail(); |
338 | targetFolder = sels.currentFolder(); | 338 | targetFolder = sels.currentFolder(); |
339 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || | 339 | if ( (mail->Wrapper()==targetMail && mail->getMbox()==targetFolder) || |
340 | targetFolder.isEmpty()) | 340 | targetFolder.isEmpty()) |
341 | { | 341 | { |
342 | return; | 342 | return; |
343 | } | 343 | } |