diff -Nru kdepim-4.0.83/akonadi/agents/mailthreader/mailthreaderagent.desktop kdepim-4.0.98/akonadi/agents/mailthreader/mailthreaderagent.desktop --- kdepim-4.0.83/akonadi/agents/mailthreader/mailthreaderagent.desktop 2008-05-15 19:37:22.000000000 +0100 +++ kdepim-4.0.98/akonadi/agents/mailthreader/mailthreaderagent.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi Mail Threader Agent Name[ca]=Agent de fils de correu de l'Akonadi +Name[da]=Akonadi posttrådningsagent Name[de]=E-Mail-Gruppierungs-Agent für Akonadi Name[el]=Πράκτορας νηματοποίησης αλληλογραφίας του Akonadi Name[es]=Agente de hilos de correo de Anokadi @@ -27,6 +28,7 @@ Name[zh_TW]=Akonadi 信件串列代理程式 Comment=An agent to thread mails from a collection Comment[ca]=Un agent per a seguir el fil dels correus des d'una col·lecció +Comment[da]=En agent til at tråde e-mail fra en samling Comment[de]=Agent zur Gruppierung von E-Mails aus einer Sammlung Comment[el]=Ένας πράκτορας νηματοποίησης αλληλογραφίας από μια συλλογή Comment[es]=Un agente para ordenar por hilos una colección de mensajes diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/agents/nepomuk_contact_feeder/nepomukcontactfeeder.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/agents/nepomuk_contact_feeder/nepomukcontactfeeder.desktop --- kdepim-4.0.83/akonadi/agents/nepomuk_contact_feeder/nepomukcontactfeeder.desktop 2008-06-11 09:33:42.000000000 +0100 +++ kdepim-4.0.98/akonadi/agents/nepomuk_contact_feeder/nepomukcontactfeeder.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi Nepomuk Contact Feeder Name[ca]=Alimentador de contactes del Nepomuk per a l'Akonadi +Name[da]=Akonadi Nepomuk kontakt-feeder Name[de]=Akonadi-Modul für Nepomuk Name[el]=Τροφοδότης επαφών Nepomuk του Akonadi Name[et]=Akonadi Nepomuki kontaktide söötur @@ -19,6 +20,7 @@ Name[zh_CN]=Akonadi Nepomuk 联系人采集器 Comment=Extension for Akonadi to push contacts into Nepomuk Comment[ca]=Extensió per a l'Akonadi per introduir contactes en el Nepomuk +Comment[da]=Akonadi-udvidelse til at skubbe kontakter ind i Nepomuk Comment[de]=Nepomuk-Erweiterung zur Übergabe von Kontakten an Nepomuk Comment[el]=Επέκταση του Akonadi για την τροφοδοσία επαφών στο Nepomuk Comment[et]=Akonadi laiendus kontaktide edastamiseks Nepomukile diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/agents/nepomuk_email_feeder/nepomukemailfeeder.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/agents/nepomuk_email_feeder/nepomukemailfeeder.desktop --- kdepim-4.0.83/akonadi/agents/nepomuk_email_feeder/nepomukemailfeeder.desktop 2008-06-11 09:33:42.000000000 +0100 +++ kdepim-4.0.98/akonadi/agents/nepomuk_email_feeder/nepomukemailfeeder.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi Nepomuk EMail Feeder Name[ca]=Alimentador de correus del Nepomuk per a l'Akonadi +Name[da]=Akonadi Nepomuk e-mail-feeder Name[de]=Akonadi-Modul für Nepomuk-E-Mail-Übergabe Name[el]=Τροφοδότης Nepomuk EMail του Akonadi Name[et]=Akonadi Nepomuki e-kirjade söötur @@ -20,6 +21,7 @@ Name[zh_CN]=Akonadi Nepomuk 邮件采集器 Comment=Extension for Akonadi to push emails into Nepomuk Comment[ca]=Extensió per a l'Akonadi per introduir correus en el Nepomuk +Comment[da]=Akonadi-udvidelse til at skubbe e-mail ind i Nepomuk Comment[de]=Nepomuk-Erweiterung zur Übergabe von E-Mails an Nepomuk Comment[el]=Επέκταση του Akonadi για την τροφοδοσία email στο Nepomuk Comment[et]=Akonadi laiendus e-kirjade edastamiseks Nepomukile diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/agents/strigifeeder/strigifeeder.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/agents/strigifeeder/strigifeeder.desktop --- kdepim-4.0.83/akonadi/agents/strigifeeder/strigifeeder.desktop 2008-05-15 19:37:22.000000000 +0100 +++ kdepim-4.0.98/akonadi/agents/strigifeeder/strigifeeder.desktop 2008-07-03 06:06:12.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi Strigi Feeder Name[ca]=Alimentador del Strigi per a l'Akonadi +Name[da]=Akonadi Strigi-feeder Name[de]=Akonadi-Modul für Strigi Name[el]=Τροφοδότης Strigi του Akonadi Name[es]=Proveedor de datos de Strigi para Akonadi @@ -24,7 +25,8 @@ Name[zh_CN]=Akonadi Strigi 采集器 Comment=Strigi-based fulltext search Comment[ca]=Motor de cerca per text sencer basat en el Strigi -Comment[de]=Strigi-Basierte Volltextsuche +Comment[da]=Strigi-baseret fuldtekst-søgning +Comment[de]=Strigi-basierte Volltextsuche Comment[el]=Αναζήτηση κειμένου βασισμένη στο Strigi Comment[es]=Búsqueda de texto completo basada en Strigi Comment[et]=Strigi-põhine täistekstiotsing diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonadiconsole/akonadiconsole.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonadiconsole/akonadiconsole.desktop --- kdepim-4.0.83/akonadi/clients/akonadiconsole/akonadiconsole.desktop 2008-06-11 09:33:42.000000000 +0100 +++ kdepim-4.0.98/akonadi/clients/akonadiconsole/akonadiconsole.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi Console Name[ca]=Consola de l'Akonadi +Name[da]=Akonadi-konsol Name[de]=Akonadi-Konsole Name[el]=Κονσόλα Akonadi Name[et]=Akonadi konsool @@ -24,6 +25,7 @@ Type=Application Comment=Akonadi Management and Debugging Console Comment[ca]=Consola de gestió i depuració per a l'Akonadi +Comment[da]=Akonadi håndterings- og fejlretningskonsol Comment[de]=Akonadi-Konsole zur Verwaltung und Fehlersuche Comment[el]=Κονσόλα διαχείρισης και αποσφαλμάτωσης του Akonadi Comment[et]=Akonadi haldamise ja silumise konsool diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonadiconsole/browserwidget.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonadiconsole/browserwidget.cpp --- kdepim-4.0.83/akonadi/clients/akonadiconsole/browserwidget.cpp 2008-04-30 15:00:07.000000000 +0100 +++ kdepim-4.0.98/akonadi/clients/akonadiconsole/browserwidget.cpp 2008-06-25 08:58:28.000000000 +0100 @@ -50,6 +50,7 @@ #include #include #include +#include using namespace Akonadi; @@ -64,6 +65,7 @@ QVBoxLayout *layout = new QVBoxLayout( this ); QSplitter *splitter = new QSplitter( Qt::Horizontal, this ); + splitter->setObjectName( "collectionSplitter" ); layout->addWidget( splitter ); mCollectionView = new Akonadi::CollectionView( xmlGuiWindow ); @@ -78,6 +80,7 @@ mCollectionView->setModel( sortModel ); QSplitter *splitter2 = new QSplitter( Qt::Vertical, this ); + splitter2->setObjectName( "itemSplitter" ); splitter->addWidget( splitter2 ); QWidget *itemViewParent = new QWidget( this ); @@ -88,7 +91,7 @@ itemUi.modelBox->addItem( "Contacts" ); itemUi.modelBox->addItem( "Calendar" ); connect( itemUi.modelBox, SIGNAL(activated(int)), SLOT(modelChanged()) ); - modelChanged(); + QTimer::singleShot( 0, this, SLOT(modelChanged()) ); itemUi.itemView->setXmlGuiWindow( xmlGuiWindow ); itemUi.itemView->setModel( mItemModel ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonadiconsole/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonadiconsole/CMakeLists.txt --- kdepim-4.0.83/akonadi/clients/akonadiconsole/CMakeLists.txt 2008-05-29 12:19:48.000000000 +0100 +++ kdepim-4.0.98/akonadi/clients/akonadiconsole/CMakeLists.txt 2008-06-25 08:58:28.000000000 +0100 @@ -12,6 +12,7 @@ mainwidget.cpp mainwindow.cpp searchdialog.cpp + uistatesaver.cpp ) qt4_add_dbus_interfaces( akonadiconsole_bin_SRCS diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonadiconsole/mainwidget.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonadiconsole/mainwidget.cpp --- kdepim-4.0.83/akonadi/clients/akonadiconsole/mainwidget.cpp 2008-03-25 17:23:32.000000000 +0000 +++ kdepim-4.0.98/akonadi/clients/akonadiconsole/mainwidget.cpp 2008-06-25 08:58:28.000000000 +0100 @@ -44,6 +44,7 @@ QVBoxLayout *layout = new QVBoxLayout( this ); QTabWidget *tabWidget = new QTabWidget( this ); + tabWidget->setObjectName( "mainTab" ); layout->addWidget( tabWidget ); tabWidget->addTab( new AgentWidget( tabWidget ), "Agents" ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonadiconsole/mainwindow.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonadiconsole/mainwindow.cpp --- kdepim-4.0.83/akonadi/clients/akonadiconsole/mainwindow.cpp 2008-03-25 17:23:32.000000000 +0000 +++ kdepim-4.0.98/akonadi/clients/akonadiconsole/mainwindow.cpp 2008-06-25 08:58:28.000000000 +0100 @@ -22,11 +22,13 @@ #include "mainwindow.h" #include "mainwidget.h" +#include "uistatesaver.h" #include #include #include +#include #include #include #include @@ -40,4 +42,13 @@ KStandardAction::quit( qApp, SLOT(quit()), actionCollection() ); setupGUI( Keys /*| ToolBar | StatusBar*/ | Save | Create, "akonadiconsoleui.rc" ); + + UiStateSaver::restoreState( this, KConfigGroup( KGlobal::config(), "UiState" ) ); +} + +bool MainWindow::queryExit() +{ + KConfigGroup config( KGlobal::config(), "UiState" ); + UiStateSaver::saveState( this, config ); + return KXmlGuiWindow::queryExit(); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonadiconsole/mainwindow.h /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonadiconsole/mainwindow.h --- kdepim-4.0.83/akonadi/clients/akonadiconsole/mainwindow.h 2008-02-28 17:54:58.000000000 +0000 +++ kdepim-4.0.98/akonadi/clients/akonadiconsole/mainwindow.h 2008-06-25 08:58:28.000000000 +0100 @@ -30,6 +30,9 @@ public: explicit MainWindow( QWidget *parent = 0 ); + + protected: + bool queryExit(); }; #endif diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonadiconsole/uistatesaver.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonadiconsole/uistatesaver.cpp --- kdepim-4.0.83/akonadi/clients/akonadiconsole/uistatesaver.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/akonadi/clients/akonadiconsole/uistatesaver.cpp 2008-06-25 08:58:28.000000000 +0100 @@ -0,0 +1,116 @@ +/* + Copyright (c) 2008 Volker Krause + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#include "uistatesaver.h" + +#include +#include + +#include +#include +#include +#include +#include + +struct Saver { + static void process( QSplitter *splitter, KConfigGroup &config ) + { + config.writeEntry( splitter->objectName(), splitter->sizes() ); + } + + static void process( QTabWidget *tab, KConfigGroup &config ) + { + config.writeEntry( tab->objectName(), tab->currentIndex() ); + } + + static void process( QTreeView *tv, KConfigGroup &config ) + { + config.writeEntry( tv->objectName(), tv->header()->saveState() ); + } + + static void process( QComboBox *cb, KConfigGroup &config ) + { + config.writeEntry( cb->objectName(), cb->currentIndex() ); + } +}; + +struct Restorer { + static void process( QSplitter *splitter, const KConfigGroup &config ) + { + const QList sizes = config.readEntry( splitter->objectName(), QList() ); + if ( !sizes.isEmpty() && splitter->count() == sizes.count() ) + splitter->setSizes( sizes ); + } + + static void process( QTabWidget *tab, const KConfigGroup &config ) + { + const int index = config.readEntry( tab->objectName(), -1 ); + if ( index >= 0 && index < tab->count() ) + tab->setCurrentIndex( index ); + } + + static void process( QTreeView *tv, const KConfigGroup &config ) + { + const QByteArray state = config.readEntry( tv->objectName(), QByteArray() ); + if ( !state.isEmpty() ) + tv->header()->restoreState( state ); + } + + static void process( QComboBox *cb, const KConfigGroup &config ) + { + const int index = config.readEntry( cb->objectName(), -1 ); + if ( index >= 0 && index < cb->count() ) + cb->setCurrentIndex( index ); + } +}; + +#define PROCESS_TYPE( T ) \ +{ \ + T *obj = qobject_cast( w ); \ + if ( obj ) { \ + Op::process( obj, config ); \ + continue; \ + } \ +} + +template static void processWidgets( QWidget *widget, Config config ) +{ + QList widgets = widget->findChildren(); + widgets << widget; + foreach ( QWidget* w, widgets ) { + if ( w->objectName().isEmpty() ) + continue; + PROCESS_TYPE( QSplitter ); + PROCESS_TYPE( QTabWidget ); + PROCESS_TYPE( QTreeView ); + PROCESS_TYPE( QComboBox ); + } +} + +#undef PROCESS_TYPE + +void UiStateSaver::saveState(QWidget * widget, KConfigGroup & config) +{ + processWidgets( widget, config ); +} + +void UiStateSaver::restoreState(QWidget * widget, const KConfigGroup & config) +{ + processWidgets( widget, config ); +} diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonadiconsole/uistatesaver.h /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonadiconsole/uistatesaver.h --- kdepim-4.0.83/akonadi/clients/akonadiconsole/uistatesaver.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/akonadi/clients/akonadiconsole/uistatesaver.h 2008-06-25 08:58:28.000000000 +0100 @@ -0,0 +1,57 @@ +/* + Copyright (c) 2008 Volker Krause + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#ifndef UISTATESAVER_H +#define UISTATESAVER_H + +class QWidget; +class KConfigGroup; + +/** + * Methods to save and restore the UI state of an application. + * The following widgets are supported so far: + * - QSplitter + * - QTabWidget + * - QTreeView + * - QComboBox + */ +namespace UiStateSaver { + + /** + * Save the state of @p widget and all its sub-widgets + * to @p config. + * @param widget The top-level widget which state should + * be saved. + * @param config The config group the settings should be + * written to. + */ + void saveState( QWidget* widget, KConfigGroup &config ); + + /** + * Restore UI state of @p widget and all its sub-widgets + * from @p config. + * @param widget The top-level widget which state should + * be restored. + * @param config The config gorup the settings should be + * read from. + */ + void restoreState( QWidget *widget, const KConfigGroup &config ); +} + +#endif diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonalendar/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonalendar/CMakeLists.txt --- kdepim-4.0.83/akonadi/clients/akonalendar/CMakeLists.txt 2008-05-29 12:19:48.000000000 +0100 +++ kdepim-4.0.98/akonadi/clients/akonalendar/CMakeLists.txt 2008-06-25 08:58:27.000000000 +0100 @@ -14,4 +14,4 @@ target_link_libraries(akonalendar_bin ${KDE4_AKONADI_LIBS} kdepim akonadi-kcal ${KDE4_KDEUI_LIBRARY} ${KDE4_KUTILS_LIBS}) -install(TARGETS akonalendar_bin ${INSTALL_TARGETS_DEFAULT_ARGS}) +#install(TARGETS akonalendar_bin ${INSTALL_TARGETS_DEFAULT_ARGS}) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/akonamail/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/akonamail/CMakeLists.txt --- kdepim-4.0.83/akonadi/clients/akonamail/CMakeLists.txt 2008-05-29 12:19:48.000000000 +0100 +++ kdepim-4.0.98/akonadi/clients/akonamail/CMakeLists.txt 2008-06-25 08:58:28.000000000 +0100 @@ -14,4 +14,4 @@ target_link_libraries( akonamail_bin ${KDE4_AKONADI_LIBS} ${KDE4_AKONADI_KMIME_LIBS} kdepim ${KDE4_KDEUI_LIBRARY} ) -install(TARGETS akonamail_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) +#install(TARGETS akonamail_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/clients/kabc/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/clients/kabc/CMakeLists.txt --- kdepim-4.0.83/akonadi/clients/kabc/CMakeLists.txt 2008-05-29 12:19:48.000000000 +0100 +++ kdepim-4.0.98/akonadi/clients/kabc/CMakeLists.txt 2008-06-25 08:58:28.000000000 +0100 @@ -14,7 +14,7 @@ target_link_libraries( kabcviewer_bin ${KDE4_AKONADI_LIBS} akonadi-kabc kdepim ${KDE4_KDEUI_LIBRARY} ) -install(TARGETS kabcviewer_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) +#install(TARGETS kabcviewer_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) ########## next target ####################### @@ -30,4 +30,4 @@ target_link_libraries( kabceditor_bin ${KDE4_AKONADI_LIBS} akonadi-kabc kdepim ${KDE4_KDEUI_LIBRARY} ) -install(TARGETS kabceditor_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) +#install(TARGETS kabceditor_bin ${INSTALL_TARGETS_DEFAULT_ARGS} ) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/kabc/kcontactmanager/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/kabc/kcontactmanager/CMakeLists.txt --- kdepim-4.0.83/akonadi/kabc/kcontactmanager/CMakeLists.txt 2008-05-29 12:19:47.000000000 +0100 +++ kdepim-4.0.98/akonadi/kabc/kcontactmanager/CMakeLists.txt 2008-06-25 08:58:26.000000000 +0100 @@ -25,6 +25,6 @@ target_link_libraries(kcontactmanager ${KDE4_AKONADI_LIBS} akonadi-kabc ${KDE4_KDEUI_LIBRARY} ) -install(TARGETS kcontactmanager ${INSTALL_TARGETS_DEFAULT_ARGS}) -install( FILES kcontactmanager.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) -install( FILES kcontactmanagerui.rc DESTINATION ${DATA_INSTALL_DIR}/kcontactmanager) +#install(TARGETS kcontactmanager ${INSTALL_TARGETS_DEFAULT_ARGS}) +#install( FILES kcontactmanager.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) +#install( FILES kcontactmanagerui.rc DESTINATION ${DATA_INSTALL_DIR}/kcontactmanager) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/kabc/kcontactmanager/kcontactmanager.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/kabc/kcontactmanager/kcontactmanager.desktop --- kdepim-4.0.83/akonadi/kabc/kcontactmanager/kcontactmanager.desktop 2008-03-13 08:16:30.000000000 +0000 +++ kdepim-4.0.98/akonadi/kabc/kcontactmanager/kcontactmanager.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -8,6 +8,7 @@ GenericName=Contact Manager GenericName[br]=Merour an darempredoù GenericName[ca]=Gestor de contactes +GenericName[da]=Kontakthåndtering GenericName[de]=Kontaktverwaltung GenericName[el]=Διαχειριστής επαφών GenericName[es]=Gestor de contactos diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/kcm/kcm_akonadi_resources.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/kcm/kcm_akonadi_resources.desktop --- kdepim-4.0.83/akonadi/kcm/kcm_akonadi_resources.desktop 2008-06-11 09:33:43.000000000 +0100 +++ kdepim-4.0.98/akonadi/kcm/kcm_akonadi_resources.desktop 2008-07-03 06:06:13.000000000 +0100 @@ -1,5 +1,4 @@ [Desktop Entry] -Encoding=UTF-8 Icon=network Type=Service ServiceTypes=KCModule @@ -14,6 +13,7 @@ Name=Akonadi Resources Configuration Name[ca]=Configuració de recursos de l'Akonadi +Name[da]=Akonadi ressourcekonfiguration Name[de]=Einrichtung der Akonadi-Ressourcen Name[el]=Ρυθμίσεις πόρων του Akonadi Name[et]=Akonadi ressursside seadistused diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/kcm/Messages.sh /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/kcm/Messages.sh --- kdepim-4.0.83/akonadi/kcm/Messages.sh 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/akonadi/kcm/Messages.sh 2008-06-25 08:58:28.000000000 +0100 @@ -0,0 +1,2 @@ +#!/bin/sh +$XGETTEXT *.cpp -o $podir/kcm_akonadi_resources.pot diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/plugins/akonadi_serializer_addressee.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/plugins/akonadi_serializer_addressee.desktop --- kdepim-4.0.83/akonadi/plugins/akonadi_serializer_addressee.desktop 2008-06-11 09:33:43.000000000 +0100 +++ kdepim-4.0.98/akonadi/plugins/akonadi_serializer_addressee.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -1,6 +1,7 @@ [Misc] Name=Addressee Serializer Name[ca]=Serialitzador de destinataris +Name[da]=Serieordning af adressater Name[de]=Empfänger-Serialisierung Name[el]=Διαχειριστής διευθύνσεων Name[es]=Serializador de destinatarios @@ -27,6 +28,7 @@ Name[zh_TW]=地址序列器 Comment=An Akonadi serializer plugin for addressee objects Comment[ca]=Un connector de serialització de l'Akonadi pels objectes destinataris +Comment[da]=Et Akonadi-plugin til serieordning af adressatobjekter Comment[de]=Akonadi-Modul zur Serialisierung von Adressobjekten Comment[el]=Ένα πρόσθετο διαχείρισης διευθύνσεων του Akonadi Comment[es]=Un complemento serializador de Akonadi para objetos destinatario diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/plugins/akonadi_serializer_bookmark.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/plugins/akonadi_serializer_bookmark.desktop --- kdepim-4.0.83/akonadi/plugins/akonadi_serializer_bookmark.desktop 2008-06-11 09:33:43.000000000 +0100 +++ kdepim-4.0.98/akonadi/plugins/akonadi_serializer_bookmark.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -1,6 +1,7 @@ [Misc] Name=Bookmark serializer Name[ca]=Serialitzador de punts +Name[da]=Serieordning af bogmærker Name[de]=Lesezeichen-Serialisierung Name[el]=Διαχειριστής αλληλουχίας σελιδοδεικτών Name[es]=Serializador de marcadores @@ -26,6 +27,7 @@ Name[zh_TW]=書籤序列器 Comment=An Akonadi serializer plugin for bookmark objects Comment[ca]=Un connector de serialització de l'Akonadi pels objectes punts +Comment[da]=Et Akonadi-plugin til serieordning af bogmærkeobjekter Comment[de]=Akonadi-Modul zur Serialisierung von Lesezeichen Comment[el]=Ένα πρόσθετο διαχείρισης αλληλουχίας αντικειμένων αλληλογραφίας για το Akonadi Comment[es]=Un complemento serializador de Akonadi para objetos marcador diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/plugins/akonadi_serializer_kcal.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/plugins/akonadi_serializer_kcal.desktop --- kdepim-4.0.83/akonadi/plugins/akonadi_serializer_kcal.desktop 2008-06-11 09:33:43.000000000 +0100 +++ kdepim-4.0.98/akonadi/plugins/akonadi_serializer_kcal.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -1,6 +1,7 @@ [Misc] Name=Incidence Serializer Name[ca]=Serialitzador d'incidències +Name[da]=Serieordning af hændelser Name[de]=Ereignis-Serialisierung Name[el]=Διαχειριστής περιστατικών Name[es]=Serializador de incidencias @@ -26,6 +27,7 @@ Name[zh_TW]=頻率序列器 Comment=An Akonadi serializer plugin for events, tasks and journal entries Comment[ca]=Un connector de serialització de l'Akonadi pels objectes incidències +Comment[da]=Et Akonadi-plugin til serieordning af hændelser, opgaver og journalindgange Comment[de]=Akonadi-Modul zur Serialisierung von Ereignissen Comment[el]=Ένα πρόσθετο διαχείρισης γεγονότων, εργασιών και καταχωρήσεων χρονικού για το Akonadi Comment[es]=Un complemento serializador de Akonadi para eventos, tareas y entradas del diario diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/plugins/akonadi_serializer_mail.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/plugins/akonadi_serializer_mail.desktop --- kdepim-4.0.83/akonadi/plugins/akonadi_serializer_mail.desktop 2008-06-11 09:33:43.000000000 +0100 +++ kdepim-4.0.98/akonadi/plugins/akonadi_serializer_mail.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -1,6 +1,7 @@ [Misc] Name=Mail Serializer Name[ca]=Serialitzador de correu +Name[da]=Serieordning af post Name[de]=E-Mail-Serialisierung Name[el]=Διαχειριστής αλληλογραφίας Name[es]=Serializador de correo @@ -27,6 +28,7 @@ Name[zh_TW]=信件序列器 Comment=An Akonadi serializer plugin for mail objects Comment[ca]=Un connector de serialització de l'Akonadi pels objectes correu +Comment[da]=Et Akonadi-plugin til serieordning af postobjekter Comment[de]=Akonadi-Modul zur Serialisierung von E-Mail-Objekten Comment[el]=Ένα πρόσθετο διαχείρισης αντικειμένων αλληλογραφίας για το Akonadi Comment[es]=Un complemento serializador de Akonadi para objetos correo diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/ical/icalresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/ical/icalresource.desktop --- kdepim-4.0.83/akonadi/resources/ical/icalresource.desktop 2008-03-25 17:23:35.000000000 +0000 +++ kdepim-4.0.98/akonadi/resources/ical/icalresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi ICal Resource Name[ca]=Recurs ICal de l'Akonadi +Name[da]=Akonadi ICal-ressource Name[de]=Akonadi-Ressource für ICal-Kalender Name[el]=Πόρος ICal του Akonadi Name[es]=Recurso Ical de Akonadi @@ -27,6 +28,7 @@ Name[zh_TW]=Akonadi ICal 資源 Comment=An agent to load data from a local iCal file Comment[ca]=Un agent per carregar dades des d'un fitxer iCal local +Comment[da]=En agent til indlæsning af data fra en lokal iCal-fil Comment[de]=Agent zum Laden von Daten aus einer lokalen iCal-Datei Comment[el]=Ένας πελάτης φόρτωσης δεδομένων από τοπικά αρχεία iCal Comment[es]=Un agente para cargar datos de un archivo iCal local diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/imap/imaplibresource.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/imap/imaplibresource.cpp --- kdepim-4.0.83/akonadi/resources/imap/imaplibresource.cpp 2008-06-18 13:42:10.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/imap/imaplibresource.cpp 2008-06-24 08:10:20.000000000 +0100 @@ -281,7 +281,7 @@ m_collection = col; // If there is new mail, we get it without giubg through integrity, so the default is true! - m_incrementalFetch = true; + m_incrementalFetch = true; // Prevent fetching items from noselect folders. if ( m_collection.hasAttribute( "noselect" ) ) { @@ -326,11 +326,10 @@ fetchlist.append( uid ); } - + // if we are not fetching the whole folder, we can not do it in batches, so don't set - // the totalItems, as that would put it in batch mode. - if ( !m_incrementalFetch ) - setTotalItems( fetchlist.count() ); + // the totalItems, as that would put it in batch mode. + setTotalItems( fetchlist.count() ); m_imap->getHeaders( mb, fetchlist ); } @@ -369,7 +368,7 @@ kDebug() << "calling partlyretrieved with amount: " << messages.count() << "Incremental?" << m_incrementalFetch; - m_incrementalFetch ? itemsRetrievedIncremental( messages, Item::List() ) : itemsPartlyRetrieved( messages ); + m_incrementalFetch ? itemsRetrievedIncremental( messages, Item::List() ) : itemsRetrieved( messages ); } // ---------------------------------------------------------------------------------- @@ -516,9 +515,9 @@ return; } - // See how many messages are in the folder currently + // See how many messages are in the folder currently qint64 mailsReal = m_collection.statistics().count(); - if ( mailsReal == -1 ) { + if ( mailsReal == -1 ) { Akonadi::CollectionStatisticsJob *job = new Akonadi::CollectionStatisticsJob( m_collection ); if ( job->exec() ) { Akonadi::CollectionStatistics statistics = job->statistics(); @@ -539,7 +538,7 @@ // The amount on the server does not match the amount in the cache. // that means we need reget the catch completely. kDebug() << "O OH: " << totalShouldBe << " But: " << mailsReal; - m_incrementalFetch = false; + m_incrementalFetch = false; m_imap->getHeaderList( mb, 1, totalShouldBe ); return; } else if ( totalShouldBe == mailsReal && oldUidNext != uidnext.toInt() diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/imap/imaplibresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/imap/imaplibresource.desktop --- kdepim-4.0.83/akonadi/resources/imap/imaplibresource.desktop 2008-06-11 09:33:43.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/imap/imaplibresource.desktop 2008-07-03 06:06:13.000000000 +0100 @@ -1,7 +1,7 @@ [Desktop Entry] -Encoding=UTF-8 Name=Akonadi Mailody Imaplib Resource Name[ca]=Recurs Imaplib Mailody de l'Akonadi +Name[da]=Akonadi Mailody Imaplib-ressource Name[de]=Akonadi-Ressource für Mailody-Imaplib Name[el]=Πόρος Mailody Imaplib του Akonadi Name[et]=Akonadi Mailody Imaplibi ressurss diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/kabc/kabcresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/kabc/kabcresource.desktop --- kdepim-4.0.83/akonadi/resources/kabc/kabcresource.desktop 2008-06-11 09:33:43.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/kabc/kabcresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=KDE Addressbook Compatibility Resource Name[ca]=Recurs de compatibilitat de la llibreta d'adreces de l'Akonadi +Name[da]=KDE adressebogskompatibilitetsressource Name[de]=Kompatibilitäts-Ressource für das KDE-Adressbuch Name[el]=Πόρος συμβατότητας βιβλίου διευθύνσεων του KDE Name[et]=KDE aadressiraamatu ühilduvusressurss @@ -20,6 +21,7 @@ Name[zh_TW]=KDE 通訊錄相容性資源 Comment=An agent to load data from a traditional KDE addressbook resource Comment[ca]=Un agent per a carregar dades des d'un recurs de la llibreta d'adreces tradicional del KDE +Comment[da]=En agent til indlæsning af data fra en traditionel KDE adressebogsressource Comment[de]=Agent zum Laden von Daten aus einer herkömmlichen Adressbuch-Ressource Comment[el]=Ένας πελάτης φόρτωσης δεδομένων από έναν παραδοσιακό πόρο βιβλίου διευθύνσεων του KDE Comment[et]=Agent andmete laadimiseks traditsioonilisest KDE aadressiraamatu ressursist diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/kcal/kcalresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/kcal/kcalresource.desktop --- kdepim-4.0.83/akonadi/resources/kcal/kcalresource.desktop 2008-06-11 09:33:43.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/kcal/kcalresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=KDE Calendar Compatibility Resource Name[ca]=Recurs de compatibilitat de calendari del KDE +Name[da]=KDE kalenderkompatibilitetsressource Name[de]=Kompatibilitäts-Ressource für KDE-Kalender Name[el]=Πόρος συμβατότητας ημερολογίου του KDE Name[et]=KDE kalendri ühilduvusressurss @@ -20,6 +21,7 @@ Name[zh_TW]=KDE 行事曆相容性資源 Comment=An agent to load data from a traditional KDE calendar resource Comment[ca]=Un agent per a carregar dades des d'un recurs de calendari tradicional del KDE +Comment[da]=En agent til indlæsning af data fra en traditionel KDE kalenderressource Comment[de]=Agent zum Laden von Daten aus einer herkömmlichen KDE-Kalender-Ressource Comment[el]=Ένας πελάτης φόρτωσης δεδομένων από έναν παραδοσιακό πόρο ημερολογίου του KDE Comment[et]=Agent andmete laadimiseks traditsioonilisest KDE kalendri ressursist diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/knut/knutresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/knut/knutresource.desktop --- kdepim-4.0.83/akonadi/resources/knut/knutresource.desktop 2008-03-13 08:16:30.000000000 +0000 +++ kdepim-4.0.98/akonadi/resources/knut/knutresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi Knut Resource Name[ca]=Recurs Knut de l'Akonadi +Name[da]=Akonadi Knut-ressource Name[de]=Akonadi-Ressource für Knut Name[el]=Πόρος Knut του Akonadi Name[es]=Recurso Knut de Akonadi @@ -27,6 +28,7 @@ Name[zh_TW]=Akonadi Knut 資源 Comment=An agent for debugging purpose Comment[ca]=Un agent amb la finalitat de depuració +Comment[da]=En agent til fejlretningsformål Comment[de]=Agent für Zwecke der Fehlersuche Comment[el]=Ένας πελάτης με σκοπό την αποσφαλμάτωση Comment[es]=Un agente para depurar diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/localbookmarks/localbookmarksresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/localbookmarks/localbookmarksresource.desktop --- kdepim-4.0.83/akonadi/resources/localbookmarks/localbookmarksresource.desktop 2008-03-13 08:16:30.000000000 +0000 +++ kdepim-4.0.98/akonadi/resources/localbookmarks/localbookmarksresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi Localbookmark Resource Name[ca]=Recurs de punts locals de l'Akonadi +Name[da]=Akonadi lokalbogmærkeressource Name[de]=Akonadi-Ressource für lokale Lesezeichen Name[el]=Πόρος τοπικού σελιδοδείκτη του Akonadi Name[es]=Recurso de marcadores locales de Akonadi @@ -26,6 +27,7 @@ Name[zh_TW]=Akonadi 本地書籤資源 Comment=An agent to load data from a local bookmarks file Comment[ca]=Un agents per carregra dades des d'un fitxer de punts local +Comment[da]=En agent til indlæsning af data fra en lokal bogmærkefil Comment[de]=Agent zum Laden von Daten aus einer lokalen Lesezeichen-Datei Comment[el]=Ένας πράκτορας φόρτωσης δεδομένων από ένα τοπικό αρχείο σελιδοδεικτών Comment[es]=Un agente para cargar datos de un archivo de marcadores local diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/maildir/maildirresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/maildir/maildirresource.desktop --- kdepim-4.0.83/akonadi/resources/maildir/maildirresource.desktop 2008-03-13 08:16:30.000000000 +0000 +++ kdepim-4.0.98/akonadi/resources/maildir/maildirresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi Maildir Resource Name[ca]=Recurs maildir de l'Akonadi +Name[da]=Akonadi Maildir-ressource Name[de]=Akonadi-Ressource für Maildir Name[el]=Πόρος Maildir του Akonadi Name[es]=Recurso Maildir de Akonadi diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/nntp/nntpresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/nntp/nntpresource.desktop --- kdepim-4.0.83/akonadi/resources/nntp/nntpresource.desktop 2008-03-13 08:16:30.000000000 +0000 +++ kdepim-4.0.98/akonadi/resources/nntp/nntpresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi NNTP Resource Name[ca]=Recurs NNTP de l'Akonadi +Name[da]=Akonadi NNTP-ressource Name[de]=Akonadi-Ressource für NNTP Name[el]=Πόρος NNTP του Akonadi Name[es]=Recurso NNTP de Akonadi @@ -27,6 +28,7 @@ Name[zh_TW]=Akonadi NNTP 資源 Comment=An agent to load data from a news server Comment[ca]=Un agent per a carregar dades des d'un servidor de notícies +Comment[da]=En agent til indlæsning af data fra en nyhedsserver Comment[de]=Agent zum Laden von Daten von einem News-Server Comment[el]=Ένας πελάτης φόρτωσης δεδομένων από διακομιστές νέων Comment[es]=Un agente para cargar datos de un servidor de noticias diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/openchange/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/openchange/CMakeLists.txt --- kdepim-4.0.83/akonadi/resources/openchange/CMakeLists.txt 2008-05-29 12:19:49.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/openchange/CMakeLists.txt 2008-07-03 06:06:13.000000000 +0100 @@ -5,8 +5,7 @@ ${QT_QTDBUS_INCLUDE_DIR} ) -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBMAPI_DEFINITIONS}" ) - +set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBMAPI_DEFINITIONS} ${KDE4_ENABLE_EXCEPTIONS}" ) ########### next target ############### diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/openchange/howto.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/openchange/howto.txt --- kdepim-4.0.83/akonadi/resources/openchange/howto.txt 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/openchange/howto.txt 2008-07-03 06:06:13.000000000 +0100 @@ -0,0 +1,4 @@ +- Get and install OpenChange's libmapi (http://www.openchange.org) +- Get and install libmapi++ (svn co https://svn.openchange.org/openchange/branches/libmapi++ and sudo make install) + + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/openchange/ocresource.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/openchange/ocresource.cpp --- kdepim-4.0.83/akonadi/resources/openchange/ocresource.cpp 2008-05-15 19:37:23.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/openchange/ocresource.cpp 2008-07-03 06:06:13.000000000 +0100 @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -59,62 +60,19 @@ typedef boost::shared_ptr MessagePtr; using namespace Akonadi; +using namespace libmapipp; -OCResource::OCResource( const QString &id ) - :ResourceBase( id ) +OCResource::OCResource( const QString &id ) + : ResourceBase( id ) { // setName( "OC Resource" ); - - m_mapiMemoryContext = talloc_init("openchangeclient"); - - // Make this a setting somehow - m_profileDatabase = QDir::homePath() + QString( "/.openchange/profiles.ldb" ); - - int retval = MAPIInitialize( m_profileDatabase.toUtf8().data() ); - qDebug() << "initialize result: " << retval; - if (retval != MAPI_E_SUCCESS) { - if (GetLastError() != MAPI_E_NOT_FOUND ) { - // It wasn't just a missing database.... - qDebug() << "unhandled initialisation problem"; - mapi_errstr("MAPIInitialize", GetLastError()); - exit (1); - } - - // we need to create the database - qDebug() << "trying to create database"; - QFileInfo profileFileInfo( m_profileDatabase ); - QDir parentDir = profileFileInfo.dir(); - if (! parentDir.exists() ) { - // we have to create the parent - qDebug() << "trying to create parent for database"; - bool success = parentDir.mkpath( profileFileInfo.path() ); - if (! success) { - qDebug() << "Could not create parent path for profile file"; - exit(1); - } - } - // we now have the parent directory - retval = CreateProfileStore( m_profileDatabase.toUtf8().data(), "/usr/local/share/setup" ); - if (retval != MAPI_E_SUCCESS) { - mapi_errstr( "CreateProfileStore", GetLastError()); - exit(1); - } - int retval = MAPIInitialize( m_profileDatabase.toUtf8().data() ); - if (retval != MAPI_E_SUCCESS) { - // We've already tried to create the database, just bail here - mapi_errstr("MAPIInitialize", GetLastError()); - exit (1); - } - } + // Initialize C mapi library so Profile functions work correctly. + MAPIInitialize(session::get_default_profile_path().c_str()); } OCResource::~ OCResource() { - mapi_object_release(&m_mapiStore); - - MAPIUninitialize(); - - talloc_free(m_mapiMemoryContext); + if (m_session) delete m_session; } bool OCResource::retrieveItem( const Akonadi::Item &item, const QSet &parts ) @@ -153,80 +111,37 @@ qDebug() << "currently ignoring itemRemoved()"; } -void OCResource::getChildFolders( mapi_object_t *parentFolder, mapi_id_t id, +void OCResource::getChildFolders( folder& mapi_folder, const Akonadi::Collection &parentCollection, Akonadi::Collection::List &collections) { - mapi_object_t objFolder; - mapi_object_init( &objFolder ); - enum MAPISTATUS retval = OpenFolder( parentFolder, id, &objFolder ); - if ( retval != MAPI_E_SUCCESS ) { - qDebug() << "Failed to open folder in quest for child folders: " << retval; - return; - } - - mapi_object_t objHierarchyTable; - mapi_object_init( &objHierarchyTable ); - retval = GetHierarchyTable( &objFolder, &objHierarchyTable ); - if ( retval != MAPI_E_SUCCESS ) { - qDebug() << "Failed to get hierachy table in quest for child folders: " << retval; - return; - } + folder::hierarchy_container_type hierarchy = mapi_folder.fetch_hierarchy(); - struct SPropTagArray* sPropTagArray; - sPropTagArray = set_SPropTagArray(m_mapiMemoryContext, 0x4, - PR_DISPLAY_NAME, - PR_FID, - PR_COMMENT, - PR_FOLDER_CHILD_COUNT); - - retval = SetColumns( &objHierarchyTable, sPropTagArray ); - MAPIFreeBuffer( sPropTagArray ); - if ( retval != MAPI_E_SUCCESS ) { - qDebug() << "Failed to set columns in quest for child folders: " << retval; - return; - } - - struct SRowSet rowset; - while ( ( QueryRows(&objHierarchyTable, 0x32, TBL_ADVANCE, &rowset ) != MAPI_E_NOT_FOUND) && rowset.cRows ) { - // qDebug() << "num rows: " << rowset.cRows; - for (unsigned int index = 0; index < rowset.cRows; index++) { - Collection thisFolder; - thisFolder.setParent( parentCollection ); - uint64_t *fid = (uint64_t *)find_SPropValue_data(&rowset.aRow[index], PR_FID); - thisFolder.setRemoteId( QString::number( *fid ) ); - thisFolder.setName( ( const char * ) find_SPropValue_data(&rowset.aRow[index], PR_DISPLAY_NAME) ); - QStringList folderMimeType; - if (*( (uint32_t *)find_SPropValue_data(&rowset.aRow[index], PR_FOLDER_CHILD_COUNT) ) > 0 ) { - // if it has children, needs this mimetype: - folderMimeType << "inode/directory"; - uint64_t *fid = (uint64_t *)find_SPropValue_data(&rowset.aRow[index], PR_FID); - getChildFolders(&objFolder, *fid, thisFolder, collections); + for (unsigned int i = 0; i < hierarchy.size(); ++i) { + property_container folderProperty = hierarchy[i]->get_property_container(); + folderProperty << PR_DISPLAY_NAME << PR_FOLDER_CHILD_COUNT << PR_CONTAINER_CLASS; + folderProperty.fetch(); + + Collection thisFolder; + thisFolder.setParent(parentCollection); + thisFolder.setRemoteId(QString::number( hierarchy[i]->get_id() )); + thisFolder.setName( (const char* ) folderProperty[PR_DISPLAY_NAME] ); + QStringList folderMimeType; + if (*((uint32_t*) folderProperty[PR_FOLDER_CHILD_COUNT]) > 0) { + // if t has children, needs this mimetype: + folderMimeType << "inode/directory"; + getChildFolders(*hierarchy[i], thisFolder, collections); + } else { + if (folderProperty[PR_CONTAINER_CLASS] == NULL) { + qDebug() << "failed query for container class for " << thisFolder.name() << ", assuming rfc822 mailbox" << endl; + folderMimeType << "message/rfc822"; } else { - // no children - must have real contents - mapi_object_t obj_folder; - mapi_object_init(&obj_folder); - retval = OpenFolder(parentFolder, *fid, &obj_folder); - if ( retval != MAPI_E_SUCCESS ) { - qDebug() << "Failed to open folder in quest for child folders container class: " << retval; - return; - } - struct SPropTagArray* propertiesTagArray = set_SPropTagArray(m_mapiMemoryContext, 0x1, PR_CONTAINER_CLASS); - uint32_t count; - struct SPropValue *containerProperties; - retval = GetProps(&obj_folder, propertiesTagArray, &containerProperties, &count); - MAPIFreeBuffer(propertiesTagArray); - if ( (retval != MAPI_E_SUCCESS) || (containerProperties[0].ulPropTag != PR_CONTAINER_CLASS) ) { - qDebug() << "failed query for container class for " << thisFolder.name() << ", assuming rfc822 mailbox" << endl; - folderMimeType << "message/rfc822"; - } else { - folderMimeType << mimeTypeForFolderType( containerProperties[0].value.lpszA ); - qDebug() << "Folder " << thisFolder.name() << ", as mimetype " << folderMimeType << endl; - } + folderMimeType << mimeTypeForFolderType( (const char*) folderProperty[PR_CONTAINER_CLASS]); + qDebug() << "Folder " << thisFolder.name() << ", as mimetype " << folderMimeType << endl; } - thisFolder.setContentMimeTypes( folderMimeType ); - collections.append( thisFolder ); } + thisFolder.setContentMimeTypes(folderMimeType); + collections.append(thisFolder); } } @@ -263,22 +178,18 @@ mapi_errstr("GetDefaultProfile", GetLastError()); exit (1); } + MAPIUninitialize(); + m_profileName = profName; + try { // TODO: handle password (third argument) - retval = MapiLogonEx(&m_session, profName, 0 ); - if (retval != MAPI_E_SUCCESS) { - mapi_errstr("MapiLogonEx", GetLastError()); - exit (1); + m_session = new session(profName); } - - mapi_object_init(&m_mapiStore); - retval = OpenMsgStore(&m_mapiStore); - if (retval != MAPI_E_SUCCESS) { - mapi_errstr("OpenMsgStore", GetLastError()); - exit (1); + catch(mapi_exception e) + { + qDebug() << "MAPI EXception: " << e.what(); + emit error(e.what()); } - - m_profileName = QString( profName ); } void OCResource::retrieveCollections() @@ -287,53 +198,41 @@ login(); - struct SPropTagArray *sPropTagArray; - struct SPropValue *lpProps; - uint32_t cValues; - Collection::List collections; /* Retrieve the mailbox folder name */ - sPropTagArray = set_SPropTagArray( m_mapiMemoryContext, 0x1, PR_DISPLAY_NAME ); - enum MAPISTATUS retval = GetProps(&m_mapiStore, sPropTagArray, &lpProps, &cValues); - MAPIFreeBuffer(sPropTagArray); - if (retval != MAPI_E_SUCCESS) { - qDebug() << "failed to get properties:" << retval; - exit( 1 ); - } + property_container storeProperties = m_session->get_message_store().get_property_container(); + storeProperties << PR_DISPLAY_NAME; + storeProperties.fetch(); - if ( ! lpProps[0].value.lpszA ) { + if ( *(storeProperties.begin()) == NULL ) { qDebug() << "null mailbox name"; exit( 1 ); } else { - // qDebug() << "mailbox name: " << QString( lpProps[0].value.lpszA ); + // qDebug() << "mailbox name: " << QString( (const char*) *(storeProperties.begin()) ); } Collection account; account.setParent( Collection::root() ); account.setRemoteId( m_profileName ); - account.setName( QString( lpProps[0].value.lpszA ) + QString( " (OpenChange)" ) ); + account.setName( QString( (const char*) *(storeProperties.begin()) ) + QString( " (OpenChange)" ) ); QStringList mimeTypes; mimeTypes << "inode/directory"; account.setContentMimeTypes( mimeTypes ); collections.append( account ); - mapi_id_t id_mailbox; /* Prepare the directory listing */ - retval = GetDefaultFolder(&m_mapiStore, &id_mailbox, olFolderTopInformationStore); - if (retval != MAPI_E_SUCCESS) { - qDebug() << "failed to get default folder:" << retval; - exit( 1 ); - } + message_store& store = m_session->get_message_store(); + mapi_id_t topFolderId = store.get_default_folder(olFolderTopInformationStore); + folder top_folder(store, topFolderId); - getChildFolders( &m_mapiStore, id_mailbox, account, collections ); + getChildFolders( top_folder, account, collections ); collectionsRetrieved( collections ); } -static KDateTime convertSysTime(const struct mapi_SPropValue &lpProp) +static KDateTime convertSysTime(const FILETIME& filetime) { - struct FILETIME filetime = lpProp.value.ft; NTTIME nt_time = filetime.dwHighDateTime; nt_time = nt_time << 32; nt_time |= filetime.dwLowDateTime; @@ -343,81 +242,15 @@ return kdeTime; } -enum MAPISTATUS OCResource::fetchFolder(const Akonadi::Collection & collection) +void OCResource::appendMessageToCollection( libmapipp::message& mapi_message, const Akonadi::Collection & collection) { - enum MAPISTATUS retval; - mapi_object_t objFolder; - mapi_object_t obj_message; - mapi_object_t obj_table; - struct SPropTagArray *sPropTagArray; - struct SRowSet rowset; - struct mapi_SPropValue_array properties_array; - - mapi_object_init(&objFolder); - mapi_object_init(&obj_table); - - if ( ( retval = OpenFolder(&m_mapiStore, collection.remoteId().toULongLong(), &objFolder) ) != MAPI_E_SUCCESS ) - { - mapi_errstr( "OpenFolder", GetLastError() ); - return retval; - } - - if ( ( retval = GetContentsTable(&objFolder, &obj_table) ) != MAPI_E_SUCCESS ) - { - mapi_errstr( "GetContentsTable", GetLastError() ); - return retval; - } - - sPropTagArray = set_SPropTagArray(m_mapiMemoryContext, 0x5, - PR_FID, - PR_MID, - PR_INST_ID, - PR_INSTANCE_NUM, - PR_SUBJECT); - - if ( ( retval = SetColumns(&obj_table, sPropTagArray ) ) != MAPI_E_SUCCESS ) - { - mapi_errstr( "SetColumns", GetLastError() ); - return retval; - } - MAPIFreeBuffer(sPropTagArray); - - while ( ( QueryRows(&obj_table, 0xa, TBL_ADVANCE, &rowset) == MAPI_E_SUCCESS ) && rowset.cRows ) { - qDebug() << "Message count, this round:" << rowset.cRows; - for (unsigned int i = 0; i < rowset.cRows; i++) { - mapi_object_init(&obj_message); - mapi_id_t *fid = (mapi_id_t *)find_SPropValue_data(&(rowset.aRow[i]), PR_FID); - mapi_id_t *mid = (mapi_id_t *)find_SPropValue_data(&(rowset.aRow[i]), PR_MID); - retval = OpenMessage(&m_mapiStore, *fid, *mid, &obj_message, 0); - if (retval == MAPI_E_SUCCESS) { - qDebug() << "building message"; - retval = GetPropsAll(&obj_message, &properties_array); - if (retval != MAPI_E_SUCCESS) return retval; - - if ( collection.contentMimeTypes().contains( "text/vcard" ) ) { - qDebug() << "Ooh, a contact!"; - appendContactToCollection( properties_array, collection, &obj_message ); - } else { - appendMessageToCollection( properties_array, collection ); - } - } - mapi_object_release(&obj_message); - } - } - - mapi_object_release(&obj_table); - mapi_object_release(&objFolder); - - return MAPI_E_SUCCESS; + property_container message_properties = mapi_message.get_property_container(); -} + message_properties.fetch_all(); -void OCResource::appendMessageToCollection( struct mapi_SPropValue_array &properties_array, const Akonadi::Collection & collection) -{ - // mapidump_message(&properties_array); MessagePtr msg_ptr ( new KMime::Message ); - for ( uint32_t i = 0; i < properties_array.cValues; ++i ) { - switch( properties_array.lpProps[i].ulPropTag ) { + for ( property_container::iterator Iter = message_properties.begin(); Iter != message_properties.end(); ++Iter ) { + switch( Iter.get_tag() ) { case PR_ALTERNATE_RECIPIENT_ALLOWED: // PT_BOOLEAN break; @@ -441,7 +274,7 @@ break; case PR_CLIENT_SUBMIT_TIME: // PT_SYSTIME - msg_ptr->date()->setDateTime( convertSysTime( properties_array.lpProps[i] ) ); + msg_ptr->date()->setDateTime( convertSysTime( *((const FILETIME*) *Iter) ) ); break; case PR_SENT_REPRESENTING_SEARCH_KEY: // PT_BINARY @@ -451,21 +284,21 @@ break; case PR_RECEIVED_BY_NAME: // PT_STRING8 - qDebug() << "Received by:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "Received by:" << (const char*) *Iter; break; case PR_SENT_REPRESENTING_ENTRYID: // PT_BINARY break; case PR_SENT_REPRESENTING_NAME: // PT_STRING8 - msg_ptr->from()->from7BitString( properties_array.lpProps[i].value.lpszA ); + msg_ptr->from()->from7BitString( (const char*) *Iter ); break; case PR_RCVD_REPRESENTING_ENTRYID: // PT_BINARY break; case PR_RCVD_REPRESENTING_NAME: // PT_STRING8 - qDebug() << "Representing name:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "Representing name:" << (const char*) *Iter; break; case PR_MESSAGE_SUBMISSION_ID: // PR_BINARY @@ -490,7 +323,7 @@ break; case PR_SENT_REPRESENTING_EMAIL_ADDRESS: // PT_STRING8 - qDebug() << "Sent representing email addr:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "Sent representing email addr:" << (const char*) *Iter; break; case PR_CONVERSATION_INDEX: // PT_BINARY @@ -515,7 +348,7 @@ break; case PR_SENDER_NAME: // PT_STRING8 - msg_ptr->from()->from7BitString( properties_array.lpProps[i].value.lpszA ); + msg_ptr->from()->from7BitString( (const char*) *Iter ); break; case PR_SENDER_SEARCH_KEY: // PT_BINARY @@ -525,24 +358,24 @@ break; case PR_SENDER_EMAIL_ADDRESS: // PT_STRING8 - qDebug() << "Sender email addr:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "Sender email addr:" << (const char*) *Iter; break; case PR_DELETE_AFTER_SUBMIT: // PT_BOOLEAN break; case PR_DISPLAY_BCC: // PT_STRING8 - msg_ptr->bcc()->from7BitString( properties_array.lpProps[i].value.lpszA ); + msg_ptr->bcc()->from7BitString( (const char*) *Iter ); break; case PR_DISPLAY_CC: // PT_STRING8 - msg_ptr->cc()->from7BitString( properties_array.lpProps[i].value.lpszA ); + msg_ptr->cc()->from7BitString( (const char*) *Iter ); break; case PR_DISPLAY_TO: // PT_STRING8 // This (and BCC+CC) need to be split on semicolons, and combined with // the email address - msg_ptr->to()->from7BitString( properties_array.lpProps[i].value.lpszA ); + msg_ptr->to()->from7BitString( (const char*) *Iter ); break; case PR_MESSAGE_DELIVERY_TIME: // PT_SYSTIME @@ -585,7 +418,7 @@ // PT_STRING8 // This probably needs to construct some kind of multipart MIME body if ( msg_ptr->body().isEmpty() ) { - msg_ptr->setBody( properties_array.lpProps[i].value.lpszA ); + msg_ptr->setBody( (const char*) *Iter ); } break; case PR_BODY_UNICODE: @@ -601,7 +434,7 @@ // PT_BINARY // This probably needs to construct some kind of multipart MIME body if ( msg_ptr->body().isEmpty() ) { - struct SBinary_short *html = (struct SBinary_short *) find_mapi_SPropValue_data(&properties_array, PR_HTML ); + struct SBinary_short *html = (struct SBinary_short *) *Iter; QByteArray body = QByteArray( ( char* ) html->lpb, html->cb ); body.append( "\n" ); msg_ptr->setBody( body ); @@ -629,7 +462,7 @@ // PT_SYSTIME if ( msg_ptr->date()->isEmpty() ) { // we want to use PR_CLIENT_SUBMIT_TIME, but this will do instead - msg_ptr->date()->setDateTime( convertSysTime( properties_array.lpProps[i] ) ); + msg_ptr->date()->setDateTime( convertSysTime( *((const FILETIME*) *Iter) ) ); } break; case PR_LAST_MODIFICATION_TIME: @@ -723,29 +556,29 @@ // PT_BINARY break; case PR_CONVERSATION_TOPIC: - msg_ptr->subject()->from7BitString( properties_array.lpProps[i].value.lpszA ); + msg_ptr->subject()->from7BitString( (const char*) *Iter ); break; case 0x82f1001e: - qDebug() << "82f1001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "82f1001e:" << (const char*) *Iter; break; case 0x82f2001e: - qDebug() << "82f2001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "82f2001e:" << (const char*) *Iter; break; case 0xe28001e: - qDebug() << "0xe28001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0xe28001e:" << (const char*) *Iter; break; case 0xe29001e: - qDebug() << "0xe29001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0xe29001e:" << (const char*) *Iter; break; case 0x8001001e: - qDebug() << "0x8001001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8001001e:" << (const char*) *Iter; break; default: - qDebug() << "Unhandled: " << QString::number( properties_array.lpProps[i].ulPropTag, 16 ); + qDebug() << "Unhandled: " << QString::number( Iter.get_tag(), 16 ); } } - uint8_t *has_attach = (uint8_t *) find_mapi_SPropValue_data(&properties_array, PR_HASATTACH); + uint8_t *has_attach = (uint8_t *) message_properties[PR_HASATTACH]; /* If we have attachments, retrieve them */ if (has_attach && *has_attach) { @@ -764,12 +597,12 @@ } } -void OCResource::appendContactToCollection( struct mapi_SPropValue_array &properties_array, const Akonadi::Collection & collection, mapi_object_t *collection_object) +void OCResource::appendContactToCollection( libmapipp::message& mapi_message, const Akonadi::Collection & collection) { - enum MAPISTATUS retval; - struct SPropTagArray *attachmentPropertiesTagArray; + property_container message_properties = mapi_message.get_property_container(); + message_properties.fetch_all(); + KABC::Addressee *contact = new KABC::Addressee; - struct mapi_SPropValue_array attachPropertiesArray; Item item; item.setRemoteId( "itemnumber" ); @@ -779,11 +612,11 @@ workAddress.setType( KABC::Address::Work ); KABC::Address homeAddress; homeAddress.setType( KABC::Address::Home ); - for ( uint32_t i = 0; i < properties_array.cValues; ++i ) { - switch( properties_array.lpProps[i].ulPropTag ) { + for (property_container::iterator Iter = message_properties.begin(); Iter != message_properties.end(); ++Iter ) { + switch( Iter.get_tag() ) { case PR_ALTERNATE_RECIPIENT_ALLOWED: // PT_BOOLEAN - if ( properties_array.lpProps[i].value.b ) { + if ( *((const uint8_t*) *Iter) ) { contact->setSecrecy( KABC::Secrecy( KABC::Secrecy::Public) ); } else { contact->setSecrecy( KABC::Secrecy( KABC::Secrecy::Private) ); @@ -791,625 +624,608 @@ break; case PR_IMPORTANCE: // PT_LONG - qDebug() << "PR_IMPORTANCE:" << properties_array.lpProps[i].value.l << QString("(0x%1)").arg((uint)properties_array.lpProps[i].value.l, (int)4, (int)16, QChar('0') ); + qDebug() << "PR_IMPORTANCE:" << *((const uint32_t*) *Iter) << QString("(0x%1)").arg(*((const uint32_t*)*Iter), (int)4, (int)16, QChar('0') ); break; case PR_MESSAGE_CLASS: // PT_STRING8 - qDebug() << "PR_MESSAGE_CLASS:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_MESSAGE_CLASS:" << (const char*) *Iter; break; case PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED: // PT_BOOLEAN - qDebug() << "PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case PR_READ_RECEIPT_REQUESTED: // PT_BOOLEAN - qDebug() << "PR_READ_RECEIPT_REQUESTED:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_READ_RECEIPT_REQUESTED:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case PR_SENT_REPRESENTING_NAME: // PT_STRING8 - qDebug() << "PR_SENT_REPRESENTING_NAME:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_SENT_REPRESENTING_NAME:" << (const char*) *Iter; break; case PR_SENT_REPRESENTING_ADDRTYPE: // PT_STRING8 - qDebug() << "PR_SENT_REPRESENTING_ADDRTYPE:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_SENT_REPRESENTING_ADDRTYPE:" << (const char*) *Iter; break; case PR_SENT_REPRESENTING_EMAIL_ADDRESS: // PT_STRING8 - qDebug() << "PR_SENT_REPRESENTING_EMAIL_ADDRESS:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_SENT_REPRESENTING_EMAIL_ADDRESS:" << (const char*) *Iter; break; case PR_CONVERSATION_TOPIC: // PT_STRING8 - qDebug() << "PR_CONVERSATION_TOPIC:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_CONVERSATION_TOPIC:" << (const char*) *Iter; break; case PR_SENDER_NAME: // PT_STRING8 - qDebug() << "PR_SENDER_NAME:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_SENDER_NAME:" << (const char*) *Iter; break; case PR_SENDER_ADDRTYPE: // PT_STRING8 - qDebug() << "PR_SENDER_ADDRTYPE:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_SENDER_ADDRTYPE:" << (const char*) *Iter; break; case PR_SENDER_EMAIL_ADDRESS: // PT_STRING8 - qDebug() << "PR_SENDER_EMAIL_ADDRESS:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_SENDER_EMAIL_ADDRESS:" << (const char*) *Iter; break; case PR_DELETE_AFTER_SUBMIT: // PT_BOOLEAN - qDebug() << "PR_DELETE_AFTER_SUBMIT:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_DELETE_AFTER_SUBMIT:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case PR_DISPLAY_BCC: // PT_STRING8 - qDebug() << "PR_DISPLAY_BCC:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_DISPLAY_BCC:" << (const char*) *Iter; break; case PR_DISPLAY_CC: // PT_STRING8 - qDebug() << "PR_DISPLAY_CC:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_DISPLAY_CC:" << (const char*) *Iter; break; case PR_DISPLAY_TO: // PT_STRING8 - qDebug() << "PR_DISPLAY_TO:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_DISPLAY_TO:" << (const char*) *Iter; break; case PR_HASATTACH: + { // PT_BOOLEAN - qDebug() << "PR_HASATTACH:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); - mapi_object_t obj_tb_attach; - mapi_object_init( &obj_tb_attach ); - retval = GetAttachmentTable( collection_object, &obj_tb_attach ); - - if (retval != MAPI_E_SUCCESS) { - qDebug() << "GetAttachmentTable failed"; - break; - } + qDebug() << "PR_HASATTACH:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); - attachmentPropertiesTagArray = set_SPropTagArray( m_mapiMemoryContext, 0x1, PR_ATTACH_NUM ); - retval = SetColumns( &obj_tb_attach, attachmentPropertiesTagArray ); - if (retval != MAPI_E_SUCCESS) { - qDebug() << "SetColumns failed"; - break; + message::attachment_container_type attachments = mapi_message.fetch_attachments(); + + qDebug() << "Num attachments:" << attachments.size(); + + if (!attachments.size()) { + continue; } - MAPIFreeBuffer( attachmentPropertiesTagArray); - struct SRowSet rowset_attach; - retval = QueryRows( &obj_tb_attach, 0xa, TBL_ADVANCE, &rowset_attach ); - if (retval != MAPI_E_SUCCESS) { - qDebug() << "QueryRows failed"; - break; + // TODO: We always use the first attachment. Do we need to check for other attachments? + property_container attachment_properties = attachments[0]->get_property_container(); + attachment_properties.fetch_all(); + + QString attachFilename = QString( (const char*) attachment_properties[PR_ATTACH_FILENAME] ); + + if ( attachFilename.isEmpty() ) { + attachFilename = QString( (const char*) attachment_properties[PR_ATTACH_LONG_FILENAME] ); } - qDebug() << "Num attachments:" << rowset_attach.cRows; + qDebug() << "attachment Filename:" << attachFilename; - for ( uint32_t j = 0; j < rowset_attach.cRows; ++j ) { - const uint32_t *attach_num = (const uint32_t *)find_SPropValue_data( &(rowset_attach.aRow[j]), PR_ATTACH_NUM ); - mapi_object_t obj_attach; - mapi_object_init(&obj_attach); - retval = OpenAttach( collection_object, *attach_num, &obj_attach ); - if (retval != MAPI_E_SUCCESS) { - qDebug() << "OpenAttach failed"; - break; - } - - retval = GetPropsAll(&obj_attach, &attachPropertiesArray); - - QString attachFilename = QString( (const char*)find_mapi_SPropValue_data( &attachPropertiesArray, PR_ATTACH_FILENAME ) ); - - if ( attachFilename.isEmpty() ) { - attachFilename = QString( (const char*)find_mapi_SPropValue_data( &attachPropertiesArray, PR_ATTACH_LONG_FILENAME ) ); - } - - qDebug() << "attachment Filename:" << attachFilename; - - const uint32_t *attachSize = (const uint32_t *)find_mapi_SPropValue_data( &attachPropertiesArray, PR_ATTACH_SIZE ); - qDebug() << "file size: " << *attachSize; - - if ( attachFilename == "ContactPicture.jpg" ) { - struct SBinary *attachData = (struct SBinary*)find_mapi_SPropValue_data( &attachPropertiesArray, PR_ATTACH_DATA_BIN ); - QImage photoData = QImage::fromData( (const uchar*)attachData->lpb, attachData->cb ); - if ( !photoData.isNull() ) { - qDebug() << "Photo: " << photoData.size(); - contact->setPhoto( KABC::Picture( photoData) ); - } - } - mapi_object_release(&obj_attach); + const uint32_t *attachSize = (const uint32_t *) attachment_properties[PR_ATTACH_SIZE]; + qDebug() << "file size: " << *attachSize; + if ( attachFilename == "ContactPicture.jpg" ) { + struct SBinary *attachData = (struct SBinary*) attachment_properties[PR_ATTACH_DATA_BIN]; + QImage photoData = QImage::fromData( (const uchar*)attachData->lpb, attachData->cb ); + if ( !photoData.isNull() ) { + qDebug() << "Photo: " << photoData.size(); + contact->setPhoto( KABC::Picture( photoData) ); + } } + break; + } case PR_RTF_IN_SYNC: // PT_BOOLEAN - qDebug() << "PR_RTF_IN_SYNC:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_RTF_IN_SYNC:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case PR_URL_COMP_NAME_SET: // PT_BOOLEAN - qDebug() << "PR_URL_COMP_NAME_SET:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_URL_COMP_NAME_SET:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case PR_RTF_COMPRESSED: // PT_BINARY - qDebug() << "PR_RTF_COMPRESSED size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "PR_RTF_COMPRESSED data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "PR_RTF_COMPRESSED size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "PR_RTF_COMPRESSED data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); break; case PR_URL_COMP_NAME: // PT_STRING8 - qDebug() << "PR_URL_COMP_NAME:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_URL_COMP_NAME:" << (const char*) *Iter; break; case PR_ATTR_HIDDEN: // PT_BOOLEAN - qDebug() << "PR_ATTR_HIDDEN:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_ATTR_HIDDEN:" << ( *((uint8_t*) *Iter) ? "true":"false" ); break; case PR_ATTR_SYSTEM: // PT_BOOLEAN - qDebug() << "PR_ATTR_SYSTEM:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_ATTR_SYSTEM:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case PR_ATTR_READONLY: // PT_BOOLEAN - qDebug() << "PR_ATTR_READONLY:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_ATTR_READONLY:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case PR_DISPLAY_NAME: // PT_STRING8 - contact->setNameFromString( properties_array.lpProps[i].value.lpszA ); + contact->setNameFromString( (const char*) *Iter ); break; case PR_ACCOUNT: // PT_STRING8 - qDebug() << "PR_ACCOUNT:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_ACCOUNT:" << (const char*) *Iter; break; case PR_OFFICE_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Work ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Work ) ); break; case PR_CALLBACK_TELEPHONE_NUMBER: // PT_STRING8 - qDebug() << "PR_CALLBACK_TELEPHONE_NUMBER:" << properties_array.lpProps[i].value.lpszA; - // contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Work ) ); + qDebug() << "PR_CALLBACK_TELEPHONE_NUMBER:" << (const char*) *Iter; + // contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Work ) ); break; case PR_HOME_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Home ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Home ) ); break; case PR_INITIALS: // PT_STRING8 - qDebug() << "PR_INITIALS:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_INITIALS:" << (const char*) *Iter; break; case PR_KEYWORD: // PT_STRING8 - qDebug() << "PR_KEYWORD:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_KEYWORD:" << (const char*) *Iter; break; case PR_LANGUAGE: // PT_STRING8 - qDebug() << "PR_LANGUAGE:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_LANGUAGE:" << (const char*) *Iter; break; case PR_LOCATION: // PT_STRING8 - qDebug() << "PR_LOCATION:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_LOCATION:" << (const char*) *Iter; break; case PR_SURNAME: // PT_STRING8 - contact->setFamilyName( properties_array.lpProps[i].value.lpszA ); + contact->setFamilyName( (const char*) *Iter ); break; case PR_GENERATION: // PT_STRING8 // This is a bit of a stretch. - contact->setSuffix( properties_array.lpProps[i].value.lpszA ); + contact->setSuffix( (const char*) *Iter ); break; case PR_GIVEN_NAME: // PT_STRING8 - contact->setGivenName( properties_array.lpProps[i].value.lpszA ); + contact->setGivenName( (const char*) *Iter ); break; case PR_POSTAL_ADDRESS: // PT_STRING8 - qDebug() << "PR_POSTAL_ADDRESS:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_POSTAL_ADDRESS:" << (const char*) *Iter; break; case PR_COMPANY_NAME: // PT_STRING8 - contact->setOrganization( properties_array.lpProps[i].value.lpszA ); + contact->setOrganization( (const char*) *Iter ); break; case PR_TITLE: // PT_STRING8 - contact->setRole( properties_array.lpProps[i].value.lpszA ); + contact->setRole( (const char*) *Iter ); break; case PR_OFFICE_LOCATION: // PT_STRING8 - contact->insertCustom( "KADDRESSBOOK", "Office", properties_array.lpProps[i].value.lpszA ); + contact->insertCustom( "KADDRESSBOOK", "Office", (const char*) *Iter ); break; case PR_PRIMARY_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Pref ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Pref ) ); break; case PR_OFFICE2_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Work ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Work ) ); break; case PR_RADIO_TELEPHONE_NUMBER: // ignored break; case PR_PAGER_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Pager ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Pager ) ); break; case PR_TELEX_NUMBER: // ignored break; case PR_HOME2_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Home ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Home ) ); break; case PR_DEPARTMENT_NAME: // PT_STRING8 // FIXME: this probably shouldn't be required. kdepimlibs needs to be cleaned up for KDE5. - contact->setDepartment( properties_array.lpProps[i].value.lpszA ); - contact->insertCustom( "KADDRESSBOOK", "Department", properties_array.lpProps[i].value.lpszA ); + contact->setDepartment( (const char*) *Iter ); + contact->insertCustom( "KADDRESSBOOK", "Department", (const char*) *Iter ); break; case PR_MOBILE_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Cell ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Cell ) ); break; case PR_BUSINESS_FAX_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ) ); break; case PR_COUNTRY: // PT_STRING8 - workAddress.setCountry( properties_array.lpProps[i].value.lpszA ); + workAddress.setCountry( (const char*) *Iter ); break; case PR_LOCALITY: // PT_STRING8 - workAddress.setLocality( properties_array.lpProps[i].value.lpszA ); + workAddress.setLocality( (const char*) *Iter ); break; case PR_STREET_ADDRESS : // PT_STRING8 - workAddress.setStreet( properties_array.lpProps[i].value.lpszA ); + workAddress.setStreet( (const char*) *Iter ); break; case PR_STATE_OR_PROVINCE: // PT_STRING8 - workAddress.setRegion( properties_array.lpProps[i].value.lpszA ); + workAddress.setRegion( (const char*) *Iter ); break; case PR_POSTAL_CODE: // PT_STRING8 - workAddress.setPostalCode( properties_array.lpProps[i].value.lpszA ); + workAddress.setPostalCode( (const char*) *Iter ); break; case PR_POST_OFFICE_BOX: // PT_STRING8 - workAddress.setPostOfficeBox( properties_array.lpProps[i].value.lpszA ); + workAddress.setPostOfficeBox( (const char*) *Iter ); break; case PR_ISDN_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Isdn ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Isdn ) ); break; case PR_CAR_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Car ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Car ) ); break; case PR_OTHER_TELEPHONE_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Voice ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Voice ) ); break; case PR_HOME_FAX_NUMBER: // PT_STRING8 - contact->insertPhoneNumber( KABC::PhoneNumber( properties_array.lpProps[i].value.lpszA, KABC::PhoneNumber::Fax | KABC::PhoneNumber::Home ) ); + contact->insertPhoneNumber( KABC::PhoneNumber( (const char*) *Iter, KABC::PhoneNumber::Fax | KABC::PhoneNumber::Home ) ); break; case PR_PRIMARY_FAX_NUMBER: // PT_STRING8 - qDebug() << "PR_PRIMARY_FAX_NUMBER:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_PRIMARY_FAX_NUMBER:" << (const char*) *Iter; break; case PR_ASSISTANT: // PT_STRING8 - contact->insertCustom( "KADDRESSBOOK", "AssistantName", properties_array.lpProps[i].value.lpszA ); + contact->insertCustom( "KADDRESSBOOK", "AssistantName", (const char*) *Iter ); break; case PR_WEDDING_ANNIVERSARY: // PT_SYSTIME - contact->insertCustom( "KADDRESSBOOK", "Anniversary", convertSysTime( properties_array.lpProps[i] ).toString("%Y-%m-%d") ); + contact->insertCustom( "KADDRESSBOOK", "Anniversary", convertSysTime( *((const FILETIME*) *Iter) ).toString("%Y-%m-%d") ); break; case PR_BIRTHDAY: // PT_SYSTIME - contact->setBirthday( convertSysTime( properties_array.lpProps[i] ).toUtc().dateTime() ); + contact->setBirthday( convertSysTime( *((const FILETIME*) *Iter) ).toUtc().dateTime() ); break; case PR_MIDDLE_NAME: // PT_STRING8 - contact->setAdditionalName( properties_array.lpProps[i].value.lpszA ); + contact->setAdditionalName( (const char*) *Iter ); break; case PR_DISPLAY_NAME_PREFIX: // PT_STRING8 - contact->setPrefix( properties_array.lpProps[i].value.lpszA ); + contact->setPrefix( (const char*) *Iter ); break; case PR_PROFESSION: // PT_STRING8 - contact->insertCustom( "KADDRESSBOOK", "Profession", properties_array.lpProps[i].value.lpszA ); + contact->insertCustom( "KADDRESSBOOK", "Profession", (const char*) *Iter ); break; case PR_SPOUSE_NAME: // PT_STRING8 - contact->insertCustom( "KADDRESSBOOK", "SpouseName", properties_array.lpProps[i].value.lpszA ); + contact->insertCustom( "KADDRESSBOOK", "SpouseName", (const char*) *Iter ); break; case PR_TTYTDD_PHONE_NUMBER: // ignored break; case PR_MANAGER_NAME: // PT_STRING8 - contact->insertCustom( "KADDRESSBOOK", "Manager", properties_array.lpProps[i].value.lpszA ); + contact->insertCustom( "KADDRESSBOOK", "Manager", (const char*) *Iter ); break; case PR_NICKNAME: // PT_STRING8 - contact->setNickName( properties_array.lpProps[i].value.lpszA ); + contact->setNickName( (const char*) *Iter ); break; case PR_BUSINESS_HOME_PAGE: // PT_STRING8 - contact->setUrl( KUrl( properties_array.lpProps[i].value.lpszA ) ); + contact->setUrl( KUrl( (const char*) *Iter ) ); break; case PR_COMPANY_MAIN_PHONE_NUMBER: // PT_STRING8 - qDebug() << "PR_COMPANY_MAIN_PHONE_NUMBER:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_COMPANY_MAIN_PHONE_NUMBER:" << (const char*) *Iter; break; case PR_HOME_ADDRESS_CITY: // PT_STRING8 - homeAddress.setLocality( properties_array.lpProps[i].value.lpszA ); + homeAddress.setLocality( (const char*) *Iter ); break; case PR_HOME_ADDRESS_COUNTRY: // PT_STRING8 - homeAddress.setCountry( properties_array.lpProps[i].value.lpszA ); + homeAddress.setCountry( (const char*) *Iter ); break; case PR_HOME_ADDRESS_POSTAL_CODE: // PT_STRING8 - homeAddress.setPostalCode( properties_array.lpProps[i].value.lpszA ); + homeAddress.setPostalCode( (const char*) *Iter ); break; case PR_HOME_ADDRESS_STATE_OR_PROVINCE: // PT_STRING8 - homeAddress.setRegion( properties_array.lpProps[i].value.lpszA ); + homeAddress.setRegion( (const char*) *Iter ); break; case PR_HOME_ADDRESS_STREET: // PT_STRING8 - homeAddress.setStreet( properties_array.lpProps[i].value.lpszA ); + homeAddress.setStreet( (const char*) *Iter ); break; case PR_CREATOR_NAME: // PT_STRING8 - qDebug() << "PR_CREATOR_NAME:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_CREATOR_NAME:" << (const char*) *Iter; break; case PR_LAST_MODIFIER_NAME: // PT_STRING8 - qDebug() << "PR_LAST_MODIFIER_NAME:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_LAST_MODIFIER_NAME:" << (const char*) *Iter; break; case PR_CREATOR_ENTRYID: // PT_BINARY - qDebug() << "PR_CREATOR_ENTRYID size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "PR_CREATOR_ENTRYID data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "PR_CREATOR_ENTRYID size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "PR_CREATOR_ENTRYID data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); break; case PR_HAS_NAMED_PROPERTIES: // PT_BOOLEAN - qDebug() << "PR_HAS_NAMED_PROPERTIES:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "PR_HAS_NAMED_PROPERTIES:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case PR_URL_NAME: // PT_STRING8 - qDebug() << "PR_URL_NAME:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_URL_NAME:" << (const char*) *Iter; break; case PR_INTERNET_MESSAGE_ID: // PT_STRING8 - qDebug() << "PR_INTERNET_MESSAGE_ID:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "PR_INTERNET_MESSAGE_ID:" << (const char*) *Iter; break; case 0x8001001e: // PT_STRING8 - qDebug() << "0x8001001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8001001e:" << (const char*) *Iter; break; case 0x8004000b: // PT_BOOLEAN - qDebug() << "0x8004000b:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "0x8004000b:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case 0x8008101e: - for (unsigned int j=0; j < properties_array.lpProps[i].value.MVszA.cValues; ++j) { - qDebug() << "0x8008101e:" << properties_array.lpProps[i].value.MVszA.strings[j].lppszA; + { + struct SLPSTRArray value = *((const SLPSTRArray*) *Iter); + for (unsigned int j=0; j < value.cValues; ++j) { + qDebug() << "0x8008101e:" << value.strings[j]->lppszA; } break; + } case 0x800d001e: // PT_STRING8 - qDebug() << "0x800d001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x800d001e:" << (const char*) *Iter; break; case 0x800e001e: // PT_STRING8 - qDebug() << "0x800e001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x800e001e:" << (const char*) *Iter; break; case 0x800f001e: // PT_STRING8 - qDebug() << "0x800f001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x800f001e:" << (const char*) *Iter; break; case 0x8010001e: // PT_STRING8 - contact->insertEmail( properties_array.lpProps[i].value.lpszA, true ); // preferred + contact->insertEmail( (const char*) *Iter, true ); // preferred break; case 0x8011001e: // PT_STRING8 - contact->insertEmail( properties_array.lpProps[i].value.lpszA ); + contact->insertEmail( (const char*) *Iter ); break; case 0x8012001e: // PT_STRING8 - contact->insertEmail( properties_array.lpProps[i].value.lpszA ); + contact->insertEmail( (const char*) *Iter ); break; case 0x8013001e: // PT_STRING8 - qDebug() << "Display as (email):" << properties_array.lpProps[i].value.lpszA; + qDebug() << "Display as (email):" << (const char*) *Iter; break; case 0x8014001e: // PT_STRING8 - qDebug() << "Display as (email2):" << properties_array.lpProps[i].value.lpszA; + qDebug() << "Display as (email2):" << (const char*) *Iter; break; case 0x8015001e: // PT_STRING8 - qDebug() << "Display as (email3):" << properties_array.lpProps[i].value.lpszA; + qDebug() << "Display as (email3):" << (const char*) *Iter; break; case 0x8016001e: // PT_STRING8 - qDebug() << "0x8016001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8016001e:" << (const char*) *Iter; break; case 0x8019101e: - for (unsigned int j=0; j < properties_array.lpProps[i].value.MVszA.cValues; ++j) { - qDebug() << "0x8019101e:" << properties_array.lpProps[i].value.MVszA.strings[j].lppszA; + { + struct SLPSTRArray value = *((const SLPSTRArray*) *Iter); + for (unsigned int j=0; j < value.cValues; ++j) { + qDebug() << "0x8019101e:" << value.strings[j]->lppszA; } break; + } case 0x801f001e: // PT_STRING8 - qDebug() << "0x801f001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x801f001e:" << (const char*) *Iter; break; case 0x8020001e: // PT_STRING8 - qDebug() << "0x8020001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8020001e:" << (const char*) *Iter; break; case 0x8021001e: // PT_STRING8 - qDebug() << "0x8021001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8021001e:" << (const char*) *Iter; break; case 0x8022001e: // PT_STRING8 - contact->insertCustom( "KADDRESSBOOK", "IMAddress", properties_array.lpProps[i].value.lpszA ); + contact->insertCustom( "KADDRESSBOOK", "IMAddress", (const char*) *Iter ); break; case 0x8023001e: // PT_STRING8 - qDebug() << "Web page address:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "Web page address:" << (const char*) *Iter; break; case 0x80b7001e: // PT_STRING8 - qDebug() << "0x80b7001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x80b7001e:" << (const char*) *Iter; break; case 0x80bf001e: // PT_STRING8 - qDebug() << "0x80b7001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x80b7001e:" << (const char*) *Iter; break; case 0x80c5001e: // PT_STRING8 - qDebug() << "0x80c5001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x80c5001e:" << (const char*) *Iter; break; case 0x80c9001e: // PT_STRING8 - qDebug() << "0x80c9001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x80c9001e:" << (const char*) *Iter; break; case 0x80cc001e: // PT_STRING8 - qDebug() << "0x80cc001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x80cc001e:" << (const char*) *Iter; break; case 0x80cd001e: // PT_STRING8 - qDebug() << "0x80cd001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x80cd001e:" << (const char*) *Iter; break; case 0x81a7000b: // PT_BOOLEAN - qDebug() << "0x81a7000b:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "0x81a7000b:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case 0x81cd001e: // PT_STRING8 - qDebug() << "0x81cd001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x81cd001e:" << (const char*) *Iter; break; case 0x81ce0102: // PT_BINARY - qDebug() << "0x81ce0102 size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "0x81ce0102 data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "0x81ce0102 size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "0x81ce0102 data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); + break; case 0x81cf001e: // PT_STRING8 - qDebug() << "0x81cf001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x81cf001e:" << (const char*) *Iter; break; case 0x81d00102: // PT_BINARY - qDebug() << "0x81d00102 size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "0x81d00102 data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "0x81d00102 size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "0x81d00102 data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); + break; case 0x81d1001e: // PT_STRING8 - qDebug() << "0x81d1001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x81d1001e:" << (const char*) *Iter; break; case 0x81d20102: // PT_BINARY - qDebug() << "0x81d20102 size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "0x81d20102 data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "0x81d20102 size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "0x81d20102 data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); break; case 0x827c001e: // PT_STRING8 - qDebug() << "0x827c001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x827c001e:" << (const char*) *Iter; break; case 0x827f000b: // PT_BOOLEAN - qDebug() << "0x827f000b:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "0x827f000b:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case 0x8281001e: // PT_STRING8 - qDebug() << "0x8281001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8281001e:" << (const char*) *Iter; break; case 0x8282001e: // PT_STRING8 - qDebug() << "0x8282001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8282001e:" << (const char*) *Iter; break; case 0x8284001e: // PT_STRING8 - qDebug() << "0x8284001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8284001e:" << (const char*) *Iter; break; case 0x82b9000b: // PT_BOOLEAN - qDebug() << "0x82b9000b:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "0x82b9000b:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case 0x82ef000b: // PT_BOOLEAN - qDebug() << "0x82ef000b:" << ( properties_array.lpProps[i].value.b ? "true":"false" ); + qDebug() << "0x82ef000b:" << ( *((const uint8_t*) *Iter) ? "true":"false" ); break; case 0x82f5001e: // PT_STRING8 - qDebug() << "0x82f5001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x82f5001e:" << (const char*) *Iter; break; case 0x82f60102: // PT_BINARY - qDebug() << "0x82f60102 size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "0x82f60102 data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "0x82f60102 size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "0x82f60102 data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); break; case 0x82f70102: // PT_BINARY - qDebug() << "0x82f70102 size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "0x82f70102 data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "0x82f70102 size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "0x82f70102 data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); break; case 0x8386001e: // PT_STRING8 - qDebug() << "0x8386001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8386001e:" << (const char*) *Iter; break; case 0x8387001e: // PT_STRING8 - qDebug() << "0x8387001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8387001e:" << (const char*) *Iter; break; case 0x8388001e: // PT_STRING8 - qDebug() << "0x8388001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8388001e:" << (const char*) *Iter; break; case 0x83890102: // PT_BINARY - qDebug() << "0x83890102 size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "0x83890102 data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "0x83890102 size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "0x83890102 data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); break; case 0x838e001e: // PT_STRING8 - qDebug() << "0x838e001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x838e001e:" << (const char*) *Iter; break; case 0x838f001e: // PT_STRING8 - qDebug() << "0x838f001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x838f001e:" << (const char*) *Iter; break; case 0x8390001e: // PT_STRING8 - qDebug() << "0x8390001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8390001e:" << (const char*) *Iter; break; case 0x83910102: // PT_BINARY - qDebug() << "0x83910102 size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "0x83910102 data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "0x83910102 size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "0x83910102 data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); break; case 0x8396001e: // PT_STRING8 - qDebug() << "0x8396001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8396001e:" << (const char*) *Iter; break; case 0x8397001e: // PT_STRING8 - qDebug() << "0x8397001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8397001e:" << (const char*) *Iter; break; case 0x8398001e: // PT_STRING8 - qDebug() << "0x8398001e:" << properties_array.lpProps[i].value.lpszA; + qDebug() << "0x8398001e:" << (const char*) *Iter; break; case 0x83990102: // PT_BINARY - qDebug() << "0x83990102 size:" << properties_array.lpProps[i].value.bin.cb; - qDebug() << "0x83990102 data:" << QByteArray( (char*)properties_array.lpProps[i].value.bin.lpb, properties_array.lpProps[i].value.bin.cb ).toHex(); + qDebug() << "0x83990102 size:" << ((const SBinary*) *Iter)->cb; + qDebug() << "0x83990102 data:" << QByteArray( (char*)((const SBinary*) *Iter)->lpb, ((const SBinary*) *Iter)->cb ).toHex(); break; default: - qDebug() << "Unhandled in collection: " << QString::number( properties_array.lpProps[i].ulPropTag, 16 ); + qDebug() << "Unhandled in collection: " << QString::number( Iter.get_tag(), 16 ); } } contact->insertAddress( workAddress ); @@ -1437,7 +1253,19 @@ Item::List items = fetch->items(); - fetchFolder( collection ); + folder aFolder(m_session->get_message_store(), collection.remoteId().toULongLong()); + folder::message_container_type messages = aFolder.fetch_messages(); + + for (unsigned int i = 0; i < messages.size(); ++i) { + + if ( collection.contentMimeTypes().contains( "text/vcard" ) ) { + appendContactToCollection( *messages[i], collection ); + } else { + appendMessageToCollection( *messages[i], collection ); + } + } + + // fetchFolder( collection ); emit percent( 100 ); itemsRetrievalDone(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/openchange/ocresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/openchange/ocresource.desktop --- kdepim-4.0.83/akonadi/resources/openchange/ocresource.desktop 2008-05-07 10:06:01.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/openchange/ocresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi OpenChange Resource Name[ca]=Recurs OpenChange de l'Akonadi +Name[da]=Akonadi OpenChange-ressource Name[de]=Akonadi-Ressource für OpenChange Name[el]=Πόρος OpenChange του Akonadi Name[es]=Recurso OpenChange de Akonadi @@ -27,6 +28,7 @@ Name[zh_TW]=Akonadi OpenChange 資源 Comment=An agent to work with an OpenChange / Exchange server Comment[ca]=Un agent per a treballar amb un servidor OpenChange / Exchange +Comment[da]=En agent til arbejde med en OpenChange-/Exchange-server Comment[de]=Agent zur Verwendung mit Openchange- und Exchange-Servern Comment[el]=Ένας πελάτης για εργασία με διακομιστές OpenChange / Exchange Comment[es]=Un agente para trabajar con un servidor OpenChange / Exchange diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/openchange/ocresource.h /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/openchange/ocresource.h --- kdepim-4.0.83/akonadi/resources/openchange/ocresource.h 2008-04-18 08:22:40.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/openchange/ocresource.h 2008-07-03 06:06:13.000000000 +0100 @@ -25,10 +25,7 @@ #include -extern "C" { -#include -#include -} +#include class OCResource : public Akonadi::ResourceBase, public Akonadi::AgentBase::Observer { @@ -55,21 +52,18 @@ private: void login(); - void appendMessageToCollection( struct mapi_SPropValue_array &properties_array, const Akonadi::Collection & collection ); - void appendContactToCollection( struct mapi_SPropValue_array &properties_array, const Akonadi::Collection & collection, - mapi_object_t *collection_object); + void appendMessageToCollection( libmapipp::message & mapi_message, const Akonadi::Collection & collection ); + void appendContactToCollection( libmapipp::message & mapi_message, const Akonadi::Collection & collection); enum MAPISTATUS fetchFolder( const Akonadi::Collection &collection ); QString mimeTypeForFolderType( const char *folderTypeValue ) const; // this method may recurse into itself. - void getChildFolders( mapi_object_t *parentFolder, mapi_id_t id, + void getChildFolders( libmapipp::folder& parentFolder, const Akonadi::Collection &parentCollection, Akonadi::Collection::List &collections); QString m_profileName; - mapi_object_t m_mapiStore; - struct mapi_session *m_session; - TALLOC_CTX *m_mapiMemoryContext; + libmapipp::session *m_session; QString m_profileDatabase; // TODO: maybe this should be a constructor arg? friend class ProfileDialog; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/openchange/profiledialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/openchange/profiledialog.cpp --- kdepim-4.0.83/akonadi/resources/openchange/profiledialog.cpp 2008-03-06 09:53:09.000000000 +0000 +++ kdepim-4.0.98/akonadi/resources/openchange/profiledialog.cpp 2008-06-25 08:58:26.000000000 +0100 @@ -36,11 +36,11 @@ ProfileDialog::ProfileDialog( OCResource *resource, QWidget *parent ) : QDialog( parent ), m_resource( resource ) { - setWindowTitle( "Profile Configuration" ); + setWindowTitle( i18n( "Profile Configuration" ) ); QVBoxLayout *mainLayout = new QVBoxLayout; - QLabel *label = new QLabel( "OpenChange Profiles" ); + QLabel *label = new QLabel( i18n( "OpenChange Profiles" ) ); mainLayout->addWidget( label ); @@ -55,27 +55,27 @@ QVBoxLayout *rightLayout = new QVBoxLayout; - QPushButton *addButton = new QPushButton( "Add Profile" ); + QPushButton *addButton = new QPushButton( i18n( "Add Profile" ) ); connect( addButton, SIGNAL( clicked() ), this, SLOT( addNewProfile() ) ); rightLayout->addWidget( addButton ); - m_editButton = new QPushButton( "Edit Profile" ); + m_editButton = new QPushButton( i18n( "Edit Profile" ) ); connect( m_editButton, SIGNAL( clicked() ), this, SLOT( editExistingProfile() ) ); rightLayout->addWidget( m_editButton ); - m_setAsDefaultButton = new QPushButton( "Make default" ); + m_setAsDefaultButton = new QPushButton( i18n( "Make default" ) ); connect( m_setAsDefaultButton, SIGNAL( clicked() ), this, SLOT( setAsDefaultProfile() ) ); rightLayout->addWidget( m_setAsDefaultButton ); - m_removeButton = new QPushButton( "Remove Profile" ); + m_removeButton = new QPushButton( i18n( "Remove Profile" ) ); connect( m_removeButton, SIGNAL( clicked() ), this, SLOT( deleteSelectedProfile() ) ); rightLayout->addWidget( m_removeButton ); - QPushButton *closeButton = new QPushButton( "Close" ); + QPushButton *closeButton = new QPushButton( i18n( "Close" ) ); connect( closeButton, SIGNAL( clicked() ), this, SLOT( close() ) ); rightLayout->addWidget( closeButton ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/openchange/profileeditdialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/openchange/profileeditdialog.cpp --- kdepim-4.0.83/akonadi/resources/openchange/profileeditdialog.cpp 2008-05-15 19:37:23.000000000 +0100 +++ kdepim-4.0.98/akonadi/resources/openchange/profileeditdialog.cpp 2008-06-25 08:58:26.000000000 +0100 @@ -40,11 +40,11 @@ const QString &domain ) : QDialog( parent ) { - setWindowTitle( "Add / Edit Profile" ); + setWindowTitle( i18n( "Add / Edit Profile" ) ); QVBoxLayout *mainLayout = new QVBoxLayout; - QLabel *nameLabel = new QLabel( "Profile name" ); + QLabel *nameLabel = new QLabel( i18n( "Profile name" ) ); mainLayout->addWidget( nameLabel ); m_profileNameEdit = new QLineEdit(); m_profileNameEdit->setText( profileName ); @@ -52,7 +52,7 @@ this, SLOT( checkIfComplete() ) ); mainLayout->addWidget( m_profileNameEdit ); - QLabel *usernameLabel = new QLabel( "User name" ); + QLabel *usernameLabel = new QLabel( i18n( "User name" ) ); mainLayout->addWidget( usernameLabel ); m_usernameEdit = new QLineEdit(); m_usernameEdit->setText( userName ); @@ -60,7 +60,7 @@ this, SLOT( checkIfComplete() ) ); mainLayout->addWidget( m_usernameEdit ); - QLabel *passwordLabel = new QLabel( "Password" ); + QLabel *passwordLabel = new QLabel( i18n( "Password" ) ); mainLayout->addWidget( passwordLabel ); m_passwordEdit = new QLineEdit(); m_passwordEdit->setEchoMode( QLineEdit::Password ); @@ -69,7 +69,7 @@ this, SLOT( checkIfComplete() ) ); mainLayout->addWidget( m_passwordEdit ); - QLabel *addressLabel = new QLabel( "Server name or address" ); + QLabel *addressLabel = new QLabel( i18n( "Server name or address" ) ); mainLayout->addWidget( addressLabel ); m_addressEdit = new QLineEdit(); m_addressEdit->setText( serverAddress ); @@ -77,7 +77,7 @@ this, SLOT( checkIfComplete() ) ); mainLayout->addWidget( m_addressEdit ); - QLabel *workstationLabel = new QLabel( "Local machine name or address" ); + QLabel *workstationLabel = new QLabel( i18n( "Local machine name or address" ) ); mainLayout->addWidget( workstationLabel ); m_workstationEdit = new QLineEdit(); if ( workstation.isEmpty() ) @@ -88,25 +88,25 @@ this, SLOT( checkIfComplete() ) ); mainLayout->addWidget( m_workstationEdit ); - QLabel *domainLabel = new QLabel( "Authentication domain" ); + QLabel *domainLabel = new QLabel( i18n( "Authentication domain" ) ); mainLayout->addWidget( domainLabel ); m_domainEdit = new QLineEdit(); m_domainEdit->setText( domain ); connect( m_domainEdit, SIGNAL( textEdited(QString) ), this, SLOT( checkIfComplete() ) ); - m_domainEdit->setToolTip( "The authentication domain (also known as realm) to use for this account. Ask your exchange server administrator if you are do not know about this." ); + m_domainEdit->setToolTip( i18n( "The authentication domain (also known as realm) to use for this account. Ask your exchange server administrator if you are do not know about this." ) ); mainLayout->addWidget( m_domainEdit ); mainLayout->addStretch(); QHBoxLayout *buttonLayout = new QHBoxLayout; - m_okButton = new QPushButton( "OK" ); + m_okButton = new QPushButton( i18n( "OK" ) ); connect( m_okButton, SIGNAL( clicked() ), this, SLOT( commitProfile() ) ); buttonLayout->addWidget( m_okButton ); - QPushButton *cancelButton = new QPushButton( "Cancel" ); + QPushButton *cancelButton = new QPushButton( i18n( "Cancel" ) ); connect( cancelButton, SIGNAL( clicked() ), this, SLOT( close() ) ); buttonLayout->addWidget( cancelButton ); @@ -199,7 +199,7 @@ } - retval = ProcessNetworkProfile(session, m_usernameEdit->text().toUtf8().constData(), (mapi_profile_callback_t) ProfileEditDialog::callback, + retval = ProcessNetworkProfile(session, m_usernameEdit->text().toUtf8().constData(), (mapi_profile_callback_t) ProfileEditDialog::callback, "Select a user id"); if (retval != MAPI_E_SUCCESS && retval != 0x1) { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/resources/vcard/vcardresource.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/resources/vcard/vcardresource.desktop --- kdepim-4.0.83/akonadi/resources/vcard/vcardresource.desktop 2008-03-13 08:16:30.000000000 +0000 +++ kdepim-4.0.98/akonadi/resources/vcard/vcardresource.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Akonadi VCard Resource Name[ca]=Recurs VCard de l'Akonadi +Name[da]=Akonadi VCard-ressource Name[de]=Akonadi-Ressource für VCard Name[el]=Πόρος VCard του Akonadi Name[es]=Recurso VCard de Akonadi @@ -27,6 +28,7 @@ Name[zh_TW]=Akonadi VCard 資源 Comment=An agent to load data from a VCard file Comment[ca]=Un agent per carregar dades des d'un fitxer VCard +Comment[da]=En agent til indlæsning af data fra en VCard-fil Comment[de]=Agent zum Laden von Daten aus einer Visitenkarten-Datei Comment[el]=Ένας πελάτης φόρτωσης δεδομένων από αρχεία VCard Comment[es]=Un agente para cargar datos de un archivo VCard diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akonadi/tray/akonaditray.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akonadi/tray/akonaditray.desktop --- kdepim-4.0.83/akonadi/tray/akonaditray.desktop 2008-06-11 09:33:42.000000000 +0100 +++ kdepim-4.0.98/akonadi/tray/akonaditray.desktop 2008-06-25 08:58:26.000000000 +0100 @@ -11,6 +11,7 @@ Name[zh_CN]=Akonadi 托盘 GenericName=Akonadi Tray Utility GenericName[ca]=Utilitat de la safata per a l'Akonadi +GenericName[da]=Akonadi-værktøj til statusområdet GenericName[de]=Akonadi für die Kontrollleiste GenericName[el]=Εργαλείο πλαισίου συστήματος του Akonadi GenericName[et]=Akonadi süsteemse salve tööriist diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/configuration/akregator_config_advanced.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/configuration/akregator_config_advanced.desktop --- kdepim-4.0.83/akregator/configuration/akregator_config_advanced.desktop 2008-06-11 09:33:38.000000000 +0100 +++ kdepim-4.0.98/akregator/configuration/akregator_config_advanced.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -12,6 +12,7 @@ Name=Advanced Name[ca]=Avançat +Name[da]=Avanceret Name[de]=Erweitert Name[el]=Προχωρημένα Name[et]=Muu @@ -33,6 +34,7 @@ Name[zh_TW]=進階 Comment=Advanced Feed Reader Settings Comment[ca]=Arranjaments avançats del lector de fonts +Comment[da]=Avanceret opsætning af feed-læser Comment[de]=Erweiterte Einstellungen für den Nachrichtenbetrachter Comment[el]=Προχωρημένες ρυθμίσεις αναγνώστη ροών ειδήσεων Comment[et]=Uudistevoogude lugeja muud seadistused diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/configuration/akregator_config_appearance.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/configuration/akregator_config_appearance.desktop --- kdepim-4.0.83/akregator/configuration/akregator_config_appearance.desktop 2008-06-11 09:33:38.000000000 +0100 +++ kdepim-4.0.98/akregator/configuration/akregator_config_appearance.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -70,11 +70,12 @@ Name[zh_TW]=外觀 Comment=Configure the Feed Reader Appearance Comment[ca]=Configura l'aparença del lector de fonts +Comment[da]=Indstil udseendet af feed-læser Comment[de]=Erscheinungsbild des Nachrichtenbetrachters einrichten Comment[el]=Ρύθμιση της εμφάνισης του αναγνώστη ροών ειδήσεων Comment[et]=Uudistevoogude lugeja välimuse seadistamine Comment[fr]=Configurer l'apparence du lecteur de flux -Comment[ja]=フィードリーダーの外観を設定 +Comment[ja]=フィードリーダーの外観設定 Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​រូបរាង​របស់​កម្មវិធី​អាន​​មតិព័ត៌មាន Comment[lv]=Konfigurēt barotņu lasītāja izskatu Comment[nds]=Dat Utsehn vun den Stroomkieker instellen diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/configuration/akregator_config_archive.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/configuration/akregator_config_archive.desktop --- kdepim-4.0.83/akregator/configuration/akregator_config_archive.desktop 2008-06-11 09:33:38.000000000 +0100 +++ kdepim-4.0.98/akregator/configuration/akregator_config_archive.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -12,6 +12,7 @@ Name=Archive Name[ca]=Arxiu +Name[da]=Arkiv Name[de]=Archiv Name[el]=Αρχειοθήκη Name[et]=Arhiveerimine @@ -31,12 +32,13 @@ Name[zh_TW]=歸檔 Comment=Configure Feed Archive Comment[ca]=Configura l'arxiu de fonts +Comment[da]=Indstil feed-arkiv Comment[de]=Einrichtung des Nachrichten-Archivs Comment[el]=Ρύθμιση αρχειοθήκης ροών ειδήσεων Comment[et]=Uudistevoogude arhiveerimise seadistamine Comment[fr]=Configurer les archives des flux Comment[ga]=Cumraigh Cartlann na bhFothaí -Comment[ja]=フィードのアーカイブを設定 +Comment[ja]=フィードのアーカイブ設定 Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​ប័ណ្ណសារ​មតិព័ត៌មាន Comment[lv]=Konfigurēt barotņu arhīvu Comment[nds]=Stroomarchiev instellen diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/configuration/akregator_config_browser.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/configuration/akregator_config_browser.desktop --- kdepim-4.0.83/akregator/configuration/akregator_config_browser.desktop 2008-06-11 09:33:38.000000000 +0100 +++ kdepim-4.0.98/akregator/configuration/akregator_config_browser.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -31,11 +31,12 @@ Name[zh_TW]=瀏覽器 Comment=Configure Internal Browser Component Comment[ca]=Configura el component navegador intern +Comment[da]=Indstil intern browserkomponent Comment[de]=Einrichtung der internen Browser-Komponente Comment[el]=Ρύθμιση εσωτερικού συστατικού περιηγητή Comment[et]=Sisemise sirvimiskomponendi seadistamine Comment[fr]=Configurer la navigateur web interne -Comment[ja]=内部ブラウザコンポーネントを設定 +Comment[ja]=内部ブラウザコンポーネントの設定 Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​សមាសភាគ​កម្មវិធី​រុករក​ខាង​ក្នុង Comment[lv]=Konfigurēt iebūvēto pārlūku Comment[nds]=Intern Kiekerkomponent instellen diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/configuration/akregator_config_general.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/configuration/akregator_config_general.desktop --- kdepim-4.0.83/akregator/configuration/akregator_config_general.desktop 2008-06-11 09:33:38.000000000 +0100 +++ kdepim-4.0.98/akregator/configuration/akregator_config_general.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -64,12 +64,13 @@ Name[zh_CN]=常规 Comment=Configure Feeds Comment[ca]=Configura les fonts +Comment[da]=Indstil feeds Comment[de]=Einrichtung der Nachrichtenquellen Comment[el]=Ρύθμιση ροών ειδήσεων Comment[et]=Uudistevoogude seadistamine Comment[fr]=Configurer les flux Comment[ga]=Cumraigh Fothaí -Comment[ja]=フィードを設定 +Comment[ja]=フィードの全般設定 Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​មតិព័ត៌មាន Comment[lv]=Konfigurēt barotnes Comment[nds]=Strööm instellen diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/.krazy /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/.krazy --- kdepim-4.0.83/akregator/.krazy 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/akregator/.krazy 2008-06-25 08:58:28.000000000 +0100 @@ -0,0 +1,2 @@ +#metakit is 3rd party code +SKIP /plugins/mk4storage/metakit/ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/Messages.sh /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/Messages.sh --- kdepim-4.0.83/akregator/Messages.sh 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/akregator/Messages.sh 2008-06-25 08:58:28.000000000 +0100 @@ -0,0 +1,3 @@ +#! /bin/sh +$EXTRACTRC `find . -name "*.rc" -o -name "*.ui" -o -name "*.kcfg"` >> rc.cpp || exit 11 +$XGETTEXT $(find -name "*.cpp" ) -o $podir/akregator.pot diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/plugins/mk4storage/akregator_mk4storage_plugin.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/plugins/mk4storage/akregator_mk4storage_plugin.desktop --- kdepim-4.0.83/akregator/plugins/mk4storage/akregator_mk4storage_plugin.desktop 2008-06-03 10:34:38.000000000 +0100 +++ kdepim-4.0.98/akregator/plugins/mk4storage/akregator_mk4storage_plugin.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -21,7 +21,7 @@ Name[hu]=Metakit tároló Name[is]=Metakit geymslu bakendi Name[it]=Backend archiviazione metakit -Name[ja]=メタキットストレージバックエンド +Name[ja]=Metakit ストレージバックエンド Name[ka]=Metakit მეხსიერების ბუფერი Name[kk]=Metakit архивтеу бағдарламасы Name[km]=កម្មវិធី​ខាង​ក្រោយ​សម្រាប់​រក្សាទុក (Metakit) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/plugins/onlinesync/akregator_config_onlinesync.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/plugins/onlinesync/akregator_config_onlinesync.desktop --- kdepim-4.0.83/akregator/plugins/onlinesync/akregator_config_onlinesync.desktop 2008-06-18 13:42:07.000000000 +0100 +++ kdepim-4.0.98/akregator/plugins/onlinesync/akregator_config_onlinesync.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -12,12 +12,15 @@ Name=Online Readers Name[ca]=Lectors en línia +Name[da]=Onlinelæsere Name[de]=Online-Leser Name[el]=Αναγνώστης διαδικτύου Name[et]=Võrgulugejad Name[fr]=Lecteurs en ligne Name[ga]=Léitheoirí Ar Líne +Name[ja]=オンラインリーダー Name[km]=កម្មវិធី​អាន​លើ​បណ្ដាញ +Name[lv]=Tiešsasites lasītāji Name[nds]=Internetkiekers Name[pl]=Czytniki RSS online Name[pt]=Leitores 'Online' @@ -30,12 +33,15 @@ Name[zh_TW]=線上閱讀器 Comment=Configure Online Readers Comment[ca]=Configura els lectors en línia +Comment[da]=Indstil onlinelæsere Comment[de]=Online-Leser einrichten Comment[el]=Ρύθμιση αναγνωστών διαδικτύου Comment[et]=Võrgulugejate seadistamine Comment[fr]=Configurer les lecteurs en ligne Comment[ga]=Cumraigh Léitheoirí Ar Líne +Comment[ja]=オンラインリーダーの設定 Comment[km]=កំណត់​រចនាសម្ព័ន្ធ​កម្មវិធី​អាន​លើ​បណ្ដាញ +Comment[lv]=Konfigurēt tiešsasites lasītājus Comment[nds]=Internetkiekers instellen Comment[pl]=Konfiguracja czytników RSS online Comment[pt]=Configurar os Leitores 'Online' diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/plugins/onlinesync/akregator_onlinesync_plugin.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/plugins/onlinesync/akregator_onlinesync_plugin.desktop --- kdepim-4.0.83/akregator/plugins/onlinesync/akregator_onlinesync_plugin.desktop 2008-06-18 13:42:07.000000000 +0100 +++ kdepim-4.0.98/akregator/plugins/onlinesync/akregator_onlinesync_plugin.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -2,12 +2,15 @@ Type=Service Name=Akregator Online Feed Reader Support Name[ca]=Implementació de lectors de fonts en línia per a l'Akregator +Name[da]=Akregator-understøttelse af online feed-læser Name[de]=Akregator-Unterstützung für Online-Leser Name[el]=Υποστήριξη αναγνώστη ροών Akregator Name[et]=Akregatori uudistevoogude võrgulugejate toetus Name[fr]=Prise en charge des lecteurs en ligne pour Akregator Name[ga]=Tacaíocht Akregator do Léitheoirí Fothaí Ar Líne +Name[ja]=Akregator のオンラインフィードリーダーのサポート Name[km]=គាំទ្រ​កម្មវិធី​អាន​មតិព័ត៌មាន​លើ​បណ្ដាញ​របស់ Akregator +Name[lv]=Akregator tiešsastes barotņu lasītāju atbalsts Name[nds]=Internetkieker-Ünnerstütten för Akregator Name[pl]=Wsparcie dla czytnika kanałów RSS Akregator Name[pt]=Suporte de Leitura de Fontes de Notícias do Akregator diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/src/actionmanagerimpl.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/src/actionmanagerimpl.cpp --- kdepim-4.0.83/akregator/src/actionmanagerimpl.cpp 2008-02-13 15:45:36.000000000 +0000 +++ kdepim-4.0.98/akregator/src/actionmanagerimpl.cpp 2008-06-25 08:58:28.000000000 +0100 @@ -525,14 +525,14 @@ d->frameManager = frameManager; - KToolBarPopupAction* forward = new KToolBarPopupAction(KIcon("go-next"), i18n( "Forward"), this); + KToolBarPopupAction* forward = new KToolBarPopupAction(KIcon("go-next"), i18nc("Go forward in browser history", "Forward"), this); d->actionCollection->addAction("browser_forward", forward); forward->setShortcuts(KShortcut("Alt+Right")); connect(forward, SIGNAL(triggered()), frameManager, SLOT(slotBrowserForward())); connect(forward->menu(), SIGNAL(aboutToShow()), frameManager, SLOT(slotBrowserForwardAboutToShow())); - KToolBarPopupAction* back = new KToolBarPopupAction(KIcon("go-previous"), i18n( "Back"), this); + KToolBarPopupAction* back = new KToolBarPopupAction(KIcon("go-previous"), i18nc("Go back in browser history", "Back"), this); d->actionCollection->addAction("browser_back", back); back->setShortcuts(KShortcut("Alt+Left")); connect(back, SIGNAL(triggered()), frameManager, SLOT(slotBrowserBack())); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/src/akregator.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/src/akregator.desktop --- kdepim-4.0.83/akregator/src/akregator.desktop 2008-06-11 09:33:38.000000000 +0100 +++ kdepim-4.0.98/akregator/src/akregator.desktop 2008-06-25 08:58:28.000000000 +0100 @@ -8,6 +8,7 @@ X-DocPath=akregator/index.html GenericName=Feed Reader GenericName[ca]=Lector de fonts +GenericName[da]=Feed-læser GenericName[de]=Nachrichtenbetrachter GenericName[el]=Αναγνώστης ροών GenericName[et]=Uudistevoogude lugemisvahend @@ -27,6 +28,7 @@ GenericName[zh_TW]=RSS Feed 閱讀器 Comment=A Feed Reader for KDE Comment[ca]=Un lector de fonts per al KDE +Comment[da]=En feed-læser for KDE Comment[de]=Ein RSS-Nachrichtensammler für KDE Comment[el]=Μία εφαρμογή ανάγνωσης ροών για το KDE Comment[et]=KDE uudistevoogude lugemisvahend diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/src/akregator.notifyrc /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/src/akregator.notifyrc --- kdepim-4.0.83/akregator/src/akregator.notifyrc 2008-06-03 10:34:38.000000000 +0100 +++ kdepim-4.0.98/akregator/src/akregator.notifyrc 2008-06-25 08:58:28.000000000 +0100 @@ -1,7 +1,6 @@ [Global] IconName=akregator Comment=Akregator -Comment[da]=Akregator Plugin Comment[nds]=Tosamensteller Comment[x-test]=xxAkregatorxx @@ -10,7 +9,7 @@ Name[af]=Stroom bygevoeg Name[ca]=Font afegida Name[cs]=Přidán kanál -Name[da]=Kilde tilføjet +Name[da]=Feed tilføjet Name[de]=Nachrichtenquelle hinzugefügt Name[el]=Προστέθηκε ροή Name[eo]=Fluo aldonita @@ -55,7 +54,7 @@ Comment[af]='n Nuwe stroom was vanaf 'n afgeleë ligging by Akregator bygevoeg. Comment[ca]=S'ha afegir remotament un font nova a l'Akregator Comment[cs]=Byl přidán nový kanál do Akregatoru -Comment[da]=En ny kilde blev tilføjet eksternt til Akregator +Comment[da]=En ny feed blev tilføjet eksternt til Akregator Comment[de]=Eine neue Nachrichtenquelle wurde von außerhalb zu Akregator hinzugefügt Comment[el]=Μια νέα ροή προστέθηκε εξωτερικά στον Akregator Comment[es]=Se ha añadido remotamente una nueva fuente a Akregator diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/src/akregator_part.rc /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/src/akregator_part.rc --- kdepim-4.0.83/akregator/src/akregator_part.rc 2008-01-15 01:57:29.000000000 +0000 +++ kdepim-4.0.98/akregator/src/akregator_part.rc 2008-06-25 08:58:28.000000000 +0100 @@ -1,5 +1,5 @@ - + @@ -79,7 +79,7 @@ - + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/src/feedlist.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/src/feedlist.cpp --- kdepim-4.0.83/akregator/src/feedlist.cpp 2008-05-21 09:33:37.000000000 +0100 +++ kdepim-4.0.98/akregator/src/feedlist.cpp 2008-07-08 10:56:16.000000000 +0100 @@ -45,7 +45,7 @@ namespace Akregator { -class FeedList::FeedListPrivate +class FeedList::Private { public: Akregator::Backend::Storage* storage; @@ -79,8 +79,8 @@ m_list, SIGNAL( fetchError( Akregator::Feed* ) ) ); connect( node, SIGNAL( fetchDiscovery( Akregator::Feed* ) ), m_list, SIGNAL( fetchDiscovery( Akregator::Feed* ) ) ); - - + + visitTreeNode(node); return true; } @@ -97,7 +97,7 @@ node->setId(m_list->generateID()); m_list->d->idMap[node->id()] = node; m_list->d->flatList.append(node); - + connect(node, SIGNAL(signalDestroyed(Akregator::TreeNode*)), m_list, SLOT(slotNodeDestroyed(Akregator::TreeNode*) )); connect( node, SIGNAL( signalChanged( Akregator::TreeNode* ) ), m_list, SIGNAL( signalNodeChanged(Akregator::TreeNode* ) ) ); emit m_list->signalNodeAdded(node); @@ -147,7 +147,7 @@ bool visitFolder(Folder* node) { visitTreeNode(node); - + return true; } @@ -156,7 +156,7 @@ }; FeedList::FeedList(Akregator::Backend::Storage* storage, QObject *parent) - : QObject(parent), d(new FeedListPrivate) + : QObject(parent), d(new Private) { Q_ASSERT( storage ); d->storage = storage; @@ -305,23 +305,22 @@ delete d->addNodeVisitor; delete d->removeNodeVisitor; delete d; - d = 0; } const Feed* FeedList::findByURL(const QString& feedURL) const { - if (d->urlMap[feedURL].isEmpty()) + if ( !d->urlMap.contains( feedURL ) ) return 0; - else - return *(d->urlMap[feedURL].begin()); + const QList& v = d->urlMap[feedURL]; + return !v.isEmpty() ? v.front() : 0; } Feed* FeedList::findByURL(const QString& feedURL) { - if (d->urlMap[feedURL].isEmpty()) + if ( !d->urlMap.contains( feedURL ) ) return 0; - else - return *(d->urlMap[feedURL].begin()); + const QList& v = d->urlMap[feedURL]; + return !v.isEmpty() ? v.front() : 0; } const Article FeedList::findArticle(const QString& feedURL, const QString& guid) const @@ -474,7 +473,7 @@ FeedListManagementImpl::FeedListManagementImpl( FeedList* list ) : m_feedList( list ) { - + } void FeedListManagementImpl::setFeedList( FeedList* list ) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/src/feedlist.h /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/src/feedlist.h --- kdepim-4.0.83/akregator/src/feedlist.h 2008-05-21 09:33:37.000000000 +0100 +++ kdepim-4.0.98/akregator/src/feedlist.h 2008-07-08 10:56:16.000000000 +0100 @@ -55,7 +55,7 @@ public: explicit FeedListManagementImpl( FeedList* list=0 ); void setFeedList( FeedList* list ); - + /* reimp */ QStringList categories() const; /* reimp */ QStringList feeds( const QString& catId ) const; /* reimp */ void addFeed( const QString& url, const QString& catId ); @@ -96,21 +96,21 @@ void setTitle(const QString& name); /** - * returns all feeds in this list + * returns all feeds in this list */ QVector feeds() const; QVector feeds(); - + QVector feedIds() const; /** - * returns all folders in this list + * returns all folders in this list */ QVector folders() const; QVector folders(); /** appends another feed list as sub tree. The root node of @c list is ignored. NOTE: nodes are _moved_ from @c list to this feed list, not copied */ - + void append(FeedList* list, Folder* parent=0, TreeNode* after=0); /** reads an OPML document and appends the items to this list @@ -146,7 +146,7 @@ void signalNodeRemoved(Akregator::TreeNode*); void signalAboutToRemoveNode( Akregator::TreeNode* ); - + void signalNodeChanged( Akregator::TreeNode* ); /** emitted when fetching started */ @@ -159,7 +159,7 @@ void fetchError(Akregator::Feed *); /** emitted when a feed URL was found by auto discovery */ void fetchDiscovery(Akregator::Feed *); - + /** emitted when a fetch is aborted */ void fetchAborted(Akregator::Feed *); @@ -178,16 +178,16 @@ void slotNodeDestroyed(Akregator::TreeNode* node); void slotNodeAdded(Akregator::TreeNode* node); void slotNodeRemoved(Akregator::Folder* parent, Akregator::TreeNode* node); - + private: friend class AddNodeVisitor; class AddNodeVisitor; friend class RemoveNodeVisitor; class RemoveNodeVisitor; - - class FeedListPrivate; - FeedListPrivate* d; + + class Private; + Private* const d; }; } // namespace Akregator diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/src/Messages.sh /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/src/Messages.sh --- kdepim-4.0.83/akregator/src/Messages.sh 2008-01-15 01:57:29.000000000 +0000 +++ kdepim-4.0.98/akregator/src/Messages.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -#! /bin/sh -$EXTRACTRC `find . -name "*.rc" -o -name "*.ui" -o -name "*.kcfg"` >> rc.cpp || exit 11 -$XGETTEXT *.cpp -o $podir/akregator.pot diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/akregator/src/pageviewer.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/akregator/src/pageviewer.cpp --- kdepim-4.0.83/akregator/src/pageviewer.cpp 2008-02-13 15:45:36.000000000 +0000 +++ kdepim-4.0.98/akregator/src/pageviewer.cpp 2008-06-25 08:58:28.000000000 +0100 @@ -98,7 +98,7 @@ setXMLFile(KStandardDirs::locate("data", "akregator/pageviewer.rc"), true); - d->backAction = new KToolBarPopupAction(i18n("Back"), "go-previous", "Alt+Left", this, SLOT(slotBack()), actionCollection(), "pageviewer_back"); + d->backAction = new KToolBarPopupAction(i18nc("Go back in browser history", "Back"), "go-previous", "Alt+Left", this, SLOT(slotBack()), actionCollection(), "pageviewer_back"); connect(d->backAction->popupMenu(), SIGNAL(aboutToShow()), this, SLOT(slotBackAboutToShow())); @@ -106,7 +106,7 @@ this, SLOT(slotPopupActivated(int))); - d->forwardAction = new KToolBarPopupAction(i18n("Forward"), "go-next", "Alt+Right", this, SLOT(slotForward()), actionCollection(), "pageviewer_forward"); + d->forwardAction = new KToolBarPopupAction(i18nc("Go forward in browser history", "Forward"), "go-next", "Alt+Right", this, SLOT(slotForward()), actionCollection(), "pageviewer_forward"); connect(d->forwardAction->popupMenu(), SIGNAL(aboutToShow()), this, SLOT(slotForwardAboutToShow())); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/CMakeLists.txt --- kdepim-4.0.83/CMakeLists.txt 2008-06-10 12:41:25.000000000 +0100 +++ kdepim-4.0.98/CMakeLists.txt 2008-06-25 08:58:35.000000000 +0100 @@ -101,7 +101,7 @@ add_definitions (-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES) # for off_t add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) - include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libkdepim/) + include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDEPIMLIBS_INCLUDE_DIR} ${KDE4_INCLUDES} ${QT_QTDBUS_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/libkdepim/) include (kleopatra/ConfigureChecks.cmake) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/console/kabcclient/doc/examples/letters/home_address.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/console/kabcclient/doc/examples/letters/home_address.desktop --- kdepim-4.0.83/console/kabcclient/doc/examples/letters/home_address.desktop 2008-05-07 10:05:58.000000000 +0100 +++ kdepim-4.0.98/console/kabcclient/doc/examples/letters/home_address.desktop 2008-06-25 08:58:33.000000000 +0100 @@ -4,6 +4,7 @@ [Misc] Name=Letter home/private address Name[ca]=Adreça postal particular/privada +Name[da]=Postadresse hjemme/privat Name[de]=Postanschrift (privat) Name[el]=Διευθύνσεις οικιακής/προσωπικής αλληλογραφίας Name[es]=Dirección postal personal/privada diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/console/kabcclient/doc/examples/letters/work_address.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/console/kabcclient/doc/examples/letters/work_address.desktop --- kdepim-4.0.83/console/kabcclient/doc/examples/letters/work_address.desktop 2008-05-07 10:05:58.000000000 +0100 +++ kdepim-4.0.98/console/kabcclient/doc/examples/letters/work_address.desktop 2008-06-25 08:58:33.000000000 +0100 @@ -4,6 +4,7 @@ [Misc] Name=Letter business/work address Name[ca]=Adreça postal negoci/treball +Name[da]=Postadresse erhverv/arbejde Name[de]=Postanschrift (geschäftlich) Name[el]=Διευθύνσεις επιχείρησης/εργασίας αλληλογραφίας Name[es]=Dirección postal de negocios/del trabajo diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/console/kabcclient/Messages.sh /tmp/rIRHhfyqQE/kdepim-4.0.98/console/kabcclient/Messages.sh --- kdepim-4.0.83/console/kabcclient/Messages.sh 2008-01-15 01:58:42.000000000 +0000 +++ kdepim-4.0.98/console/kabcclient/Messages.sh 2008-07-08 10:56:31.000000000 +0100 @@ -1,3 +1,2 @@ #! /bin/sh -$XGETTEXT *.cpp -o $podir/kabcclient.pot -$XGETTEXT *.cpp -o $podir/kabc2mutt.pot +$XGETTEXT $(find -name "*.cpp") -o $podir/kabcclient.pot diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/console/kabcclient/src/main.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/console/kabcclient/src/main.cpp --- kdepim-4.0.83/console/kabcclient/src/main.cpp 2008-01-15 01:58:42.000000000 +0000 +++ kdepim-4.0.98/console/kabcclient/src/main.cpp 2008-07-08 10:56:31.000000000 +0100 @@ -55,18 +55,17 @@ int main(int argc, char** argv) { - KAboutData aboutData("kabcclient", 0, ki18n("KABC client"), version, - ki18n("KDE addressbook commandline client"), - KAboutData::License_GPL_V2); - - aboutData.addAuthor(ki18n("Kevin Krammer"), ki18n("Primary Author"), "kevin.krammer@gmx.at"); - QString commandName = QFileInfo(QFile::decodeName(argv[0])).fileName(); if (commandName == "kabc2mutt") { return handleKABC2Mutt(argc, argv); } + KAboutData aboutData("kabcclient", "kabcclient", ki18n("KABC client"), version, + ki18n("KDE addressbook commandline client"), + KAboutData::License_GPL_V2); + + aboutData.addAuthor(ki18n("Kevin Krammer"), ki18n("Primary Author"), "kevin.krammer@gmx.at"); KCmdLineOptions cmdLineOptions; @@ -420,7 +419,7 @@ int handleKABC2Mutt(int argc, char** argv) { - KAboutData aboutData("kabc2mutt", 0, ki18n("kabc2mutt"), version, + KAboutData aboutData("kabc2mutt", "kabcclient", ki18n("kabc2mutt"), version, ki18n("kabc - mutt converter"), KAboutData::License_GPL_V2); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/console/konsolekalendar/main.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/console/konsolekalendar/main.cpp --- kdepim-4.0.83/console/konsolekalendar/main.cpp 2008-02-07 13:20:29.000000000 +0000 +++ kdepim-4.0.98/console/konsolekalendar/main.cpp 2008-07-08 10:56:31.000000000 +0100 @@ -74,7 +74,7 @@ progName, 0, // internal program name ki18n( progDisplay ), // displayable program name. progVersion, // version string - ki18n( progDesc ), // short porgram description + ki18n( progDesc ), // short program description KAboutData::License_GPL, // license type ki18n( "(c) 2002-2007, Tuukka Pasanen and Allen Winter" ), ki18n( 0 ), // any free form text diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/akonadi-kde.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/akonadi-kde.install --- kdepim-4.0.83/debian/akonadi-kde.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/akonadi-kde.install 2008-07-15 11:00:36.000000000 +0100 @@ -13,11 +13,6 @@ usr/bin/akonadi_vcard_resource usr/bin/akonadiconsole usr/bin/akonaditray -usr/bin/akonalendar -usr/bin/akonamail -usr/bin/kabceditor -usr/bin/kabcviewer -usr/bin/kcontactmanager usr/lib/kde4/akonadi_serializer_addressee.so usr/lib/kde4/akonadi_serializer_bookmark.so usr/lib/kde4/akonadi_serializer_kcal.so @@ -46,13 +41,11 @@ usr/share/akonadi/agents/vcardresource.desktop usr/share/applications/kde4/akonadiconsole.desktop usr/share/applications/kde4/akonaditray.desktop -usr/share/applications/kde4/kcontactmanager.desktop usr/share/kde4/apps/akonadi/plugins/serializer/akonadi_serializer_addressee.desktop usr/share/kde4/apps/akonadi/plugins/serializer/akonadi_serializer_bookmark.desktop usr/share/kde4/apps/akonadi/plugins/serializer/akonadi_serializer_kcal.desktop usr/share/kde4/apps/akonadi/plugins/serializer/akonadi_serializer_mail.desktop usr/share/kde4/apps/akonadiconsole/akonadiconsoleui.rc -usr/share/kde4/apps/kcontactmanager/kcontactmanagerui.rc usr/share/kde4/apps/nepomuk/ontologies/nco.desktop usr/share/kde4/apps/nepomuk/ontologies/nco.trig usr/share/kde4/apps/nepomuk/ontologies/nmo.desktop diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/changelog /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/changelog --- kdepim-4.0.83/debian/changelog 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/changelog 2008-07-15 11:00:36.000000000 +0100 @@ -1,3 +1,15 @@ +kdepim (4:4.0.98-0ubuntu1) intrepid; urgency=low + + * New upstream release candidate + * Bump Standards-Version to 3.8.0 + * Remove kubuntu_01_akonadi_fix.diff + * kdepim-dev depends libkdepim4 + + Add DEB_DH_SHLIBDEPS_ARGS_kdepim-dev := -Xkdepimwidgets.so + * kdepim-kresources conflicts kdepim-wizards (<< 4:4.0.83) - unbreaks upgrade + * In kalarm, alarms can be scheduled via DBus, not DCOP + + -- Harald Sitter Sat, 12 Jul 2008 19:36:30 +0200 + kdepim (4:4.0.83-0ubuntu3) intrepid; urgency=low * Don't install groupwise files in kdepim-dev, broke compile diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/control /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/control --- kdepim-4.0.83/debian/control 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/control 2008-07-15 11:00:36.000000000 +0100 @@ -3,26 +3,34 @@ Priority: optional Maintainer: Kubuntu Developers XSBC-Original-Maintainer: Debian Qt/KDE Maintainers -Uploaders: Ana Beatriz Guerrero Lopez , Sune Vuorela , Fathi Boudra , Armin Berres , Matthew Rosewarne +Uploaders: Ana Beatriz Guerrero Lopez , + Sune Vuorela , Fathi Boudra , + Armin Berres , + Matthew Rosewarne Build-Depends: cdbs, debhelper (>= 6), cmake (>= 2.4.5), quilt, - kdepimlibs5-dev (>= 4:4.0.80), libphonon-dev (>= 4:4.2~svn820171+4.1.83-0ubuntu1), libplasma-dev (>= 4:4.0.83), + kdepimlibs5-dev (>= 4:4.0.98), libplasma-dev (>= 4:4.0.98), + libphonon-dev (>= 4:4.2~svn820171+4.1.83-0ubuntu1), libgpgme11-dev, libboost-dev, libboost-graph-dev, libsasl2-dev, xsltproc, libxss-dev, libqca2-dev (>= 2.0.0), libpisock-dev, libassuan-dev, libstreams-dev, libstreamanalyzer-dev, libsearchclient-dev, libstrigihtmlgui-dev, libstrigiqtdbusclient-dev, zlib1g-dev, libakonadi-dev (>= 0.82.0) -Standards-Version: 3.7.3 +Standards-Version: 3.8.0 Homepage: http://pim.kde.org/ Package: kdepim Architecture: all -Depends: akonadi-kde (>= ${source:Version}), akregator (>= ${source:Version}), kaddressbook (>= ${source:Version}), kalarm (>= ${source:Version}), - kdepim-kresources (>= ${source:Version}), kdepim-wizards (>= ${source:Version}), - kmail (>= ${source:Version}), knode (>= ${source:Version}), knotes (>= ${source:Version}), kode (>= ${source:Version}), - konsolekalendar (>= ${source:Version}), kontact (>= ${source:Version}), korganizer (>= ${source:Version}), korn (>= ${source:Version}), - ktimetracker (>= ${source:Version}), ktnef (>= ${source:Version}), kdepim-strigi-plugins (>= ${source:Version}), - kjots (>= ${source:Version}) +Depends: akonadi-kde (>= ${source:Version}), akregator (>= ${source:Version}), + kaddressbook (>= ${source:Version}), kalarm (>= ${source:Version}), + kdepim-kresources (>= ${source:Version}), + kdepim-wizards (>= ${source:Version}), + kmail (>= ${source:Version}), knode (>= ${source:Version}), + knotes (>= ${source:Version}), kode (>= ${source:Version}), + konsolekalendar (>= ${source:Version}), kontact (>= ${source:Version}), + korganizer (>= ${source:Version}), korn (>= ${source:Version}), + ktimetracker (>= ${source:Version}), ktnef (>= ${source:Version}), + kdepim-strigi-plugins (>= ${source:Version}), kjots (>= ${source:Version}) Suggests: kdepim-doc Description: Personal Information Management apps from the official KDE release KDE (the K Desktop Environment) is a powerful Open Source graphical @@ -45,15 +53,19 @@ Package: kdepim-dev Architecture: all -Depends:akonadi-kde (>= ${binary:Version}), akregator (>= ${binary:Version}), kaddressbook (>= ${binary:Version}), kalarm (>= ${binary:Version}), - kdepim-kresources (>= ${binary:Version}), kdepim-wizards (>= ${binary:Version}), - kmail (>= ${binary:Version}), knode (>= ${binary:Version}), knotes (>= ${binary:Version}), kode (>= ${binary:Version}), - konsolekalendar (>= ${binary:Version}), kontact (>= ${binary:Version}), korganizer (>= ${binary:Version}), korn (>= ${binary:Version}), - ktimetracker (>= ${binary:Version}), ktnef (>= ${binary:Version}), kdepim-strigi-plugins (>= ${binary:Version}), - kjots (>= ${binary:Version}) -Description: This package contains development files needed to compile kdepim applications. - This package is part of KDE, and a component of the KDE PIM module. See the 'kde' and 'kdepim' packages for more information. -Homepage: http://pim.kde.org/ +Depends:akonadi-kde (>= ${binary:Version}), akregator (>= ${binary:Version}), + kaddressbook (>= ${binary:Version}), kalarm (>= ${binary:Version}), + kdepim-kresources (>= ${binary:Version}), kjots (>= ${binary:Version}), + kdepim-wizards (>= ${binary:Version}), kmail (>= ${binary:Version}), + knode (>= ${binary:Version}), knotes (>= ${binary:Version}), + kode (>= ${binary:Version}), konsolekalendar (>= ${binary:Version}), + kontact (>= ${binary:Version}), korganizer (>= ${binary:Version}), + korn (>= ${binary:Version}), ktimetracker (>= ${binary:Version}), + ktnef (>= ${binary:Version}), kdepim-strigi-plugins (>= ${binary:Version}), + libkdepim4 (>= ${binary:Version}) +Description: Contains development files needed to compile kdepim applications. + This package is part of KDE, and a component of the KDE PIM module. + See the 'kde' and 'kdepim' packages for more information. Package: kdepim-doc Section: doc @@ -124,7 +136,7 @@ timer'. . As an alternative to using the graphical interface, alarms can be scheduled - from the command line or via DCOP calls from other programs. KAlarm is + from the command line or via DBus calls from other programs. KAlarm is KDE-based, but will also run on other desktops. . This package is part of KDE, and a component of the KDE PIM module. @@ -136,6 +148,7 @@ Depends: ${shlibs:Depends} Recommends: korganizer Suggests: knotes +Conflicts: kdepim-wizards (<< 4:4.0.83) Description: KDE pim resource plugins This package includes several plugins needed to interface with groupware servers. It also includes plugins for features such as blogging and @@ -173,7 +186,8 @@ Package: kleopatra Section: net Architecture: any -Depends: ${shlibs:Depends}, gnupg-agent, gnupg2, gpgsm, dirmngr, pinentry-qt | pinentry-x11 +Depends: ${shlibs:Depends}, gnupg-agent, gnupg2, gpgsm, dirmngr, + pinentry-qt | pinentry-x11 Description: KDE Certificate Manager Kleopatra is the KDE tool for managing X.509 certificates in the gpgsm keybox and for retrieving certificates from LDAP servers. @@ -186,7 +200,8 @@ Architecture: any Depends: ${shlibs:Depends}, ${perl:Depends} Recommends: procmail -Suggests: gnupg, gnupg-agent, pinentry-qt | pinentry-x11, kaddressbook, kleopatra, spamassassin | bogofilter | annoyance-filter | spambayes | bsfilter | crm114, clamav | f-prot-installer +Suggests: gnupg, gnupg-agent, pinentry-qt | pinentry-x11, kaddressbook, + kleopatra, spamassassin | bogofilter | annoyance-filter | spambayes | bsfilter | crm114, clamav | f-prot-installer Replaces: kmailcvt (<< 4:3.90.0) Provides: imap-client, mail-reader Homepage: http://kontact.kde.org/kmail/ @@ -340,8 +355,8 @@ Conflicts: karm Replaces: karm Description: KDE time tracker tool - KTimetracker is a time tracker for busy people who need to keep track of the amount of - time they spend on various tasks. + KTimetracker is a time tracker for busy people who need to keep track of + the amount of time they spend on various tasks. . This package is part of KDE, and a component of the KDE PIM module. See the 'kde' and 'kdepim' packages for more information. @@ -358,7 +373,6 @@ This package is part of KDE, and a component of the KDE PIM module. See the 'kde' and 'kdepim' packages for more information. - Package: libkdepim4 Section: libs Architecture: any diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/kaddressbook.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/kaddressbook.install --- kdepim-4.0.83/debian/kaddressbook.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/kaddressbook.install 2008-07-15 11:00:36.000000000 +0100 @@ -53,6 +53,7 @@ usr/share/icons/hicolor/22x22/apps/kaddressbook.png usr/share/icons/hicolor/16x16/apps/kaddressbook.png usr/share/icons/hicolor/128x128/apps/kaddressbook.png +usr/share/icons/hicolor/scalable/apps/kaddressbook.svgz usr/share/kde4/apps/kaddressbook/bookmark_xxportui.rc usr/share/kde4/apps/kaddressbook/csv-templates/kaddressbook.desktop usr/share/kde4/apps/kaddressbook/csv-templates/outlook2000.desktop diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/kdepim-dev.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/kdepim-dev.install --- kdepim-4.0.83/debian/kdepim-dev.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/kdepim-dev.install 2008-07-15 11:00:36.000000000 +0100 @@ -13,6 +13,7 @@ ./usr/include/akregator/types.h ./usr/include/kaddressbook/kaddressbook_export.h ./usr/include/kdepimprotocols.h +./usr/include/kleo/adduseridjob.h ./usr/include/kleo/changeexpiryjob.h ./usr/include/kleo/changeownertrustjob.h ./usr/include/kleo/cryptobackend.h @@ -79,6 +80,8 @@ ./usr/include/ksieve/scriptbuilder.h ./usr/include/libkleopatraclient/core/command.h ./usr/include/libkleopatraclient/core/initialization.h +./usr/include/libkleopatraclient/core/selectcertificatecommand.h +./usr/include/libkleopatraclient/core/signencryptfilescommand.h ./usr/include/libkleopatraclient/gui/certificaterequester.h ./usr/include/libkleopatraclient/kleopatraclient_export.h ./usr/lib/kde4/plugins/designer/kdepimwidgets.so diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/kjots.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/kjots.install --- kdepim-4.0.83/debian/kjots.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/kjots.install 2008-07-15 11:00:36.000000000 +0100 @@ -12,7 +12,6 @@ usr/share/icons/hicolor/64x64/apps/kjots.png usr/share/kde4/apps/kjots/kjotspartui.rc usr/share/kde4/apps/kjots/kjotsui.rc -usr/share/kde4/apps/kjots/pics/filedel.png usr/share/kde4/config.kcfg/kjots.kcfg usr/share/kde4/services/kontact/kjots_plugin.desktop usr/share/kde4/apps/kontact/ksettingsdialog/kjots.setdlg diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/kleopatra.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/kleopatra.install --- kdepim-4.0.83/debian/kleopatra.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/kleopatra.install 2008-07-15 11:00:36.000000000 +0100 @@ -30,6 +30,10 @@ usr/share/kde4/services/kleopatra_config_appear.desktop usr/share/kde4/services/kleopatra_config_dirserv.desktop usr/share/kde4/services/kleopatra_config_dnorder.desktop +usr/share/kde4/services/kleopatra_decryptverifyfiles.desktop +usr/share/kde4/services/kleopatra_decryptverifyfolders.desktop +usr/share/kde4/services/kleopatra_signencryptfiles.desktop +usr/share/kde4/services/kleopatra_signencryptfolders.desktop #usr/share/kde4/services/kleopatra_config_smimevalidation.desktop -usr/lib/libkleopatraclientcore.so.0.1.0 -usr/lib/libkleopatraclientgui.so.0.1.0 +usr/lib/libkleopatraclientcore.so.0.2.0 +usr/lib/libkleopatraclientgui.so.0.2.0 diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/kmail.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/kmail.install --- kdepim-4.0.83/debian/kmail.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/kmail.install 2008-07-15 11:00:36.000000000 +0100 @@ -100,3 +100,16 @@ usr/share/icons/oxygen/16x16/actions/mail-signed-part.png usr/share/icons/oxygen/16x16/actions/mail-signed.png usr/share/kde4/apps/kontact/ksettingsdialog/kmail.setdlg + +usr/share/icons/oxygen/16x16/actions/edit-delete-page.png +usr/share/icons/oxygen/22x22/actions/edit-delete-page.png +usr/share/icons/oxygen/32x32/actions/edit-delete-page.png +usr/share/icons/oxygen/48x48/actions/edit-delete-page.png +usr/share/icons/oxygen/scalable/actions/edit-delete-page.svgz +usr/share/icons/oxygen/scalable/actions/mail-forwarded-replied.svgz +usr/share/icons/oxygen/scalable/actions/mail-forwarded.svgz +usr/share/icons/oxygen/scalable/actions/mail-signed-part.svgz +usr/share/icons/oxygen/scalable/actions/mail-signed.svgz +usr/share/icons/oxygen/scalable/actions/mail-signed-verified.svgz +usr/share/icons/oxygen/scalable/mimetypes/x-mail-distribution-list.svgz +usr/share/icons/oxygen/scalable/status/mail-task.svgz diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/korganizer.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/korganizer.install --- kdepim-4.0.83/debian/korganizer.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/korganizer.install 2008-07-15 11:00:36.000000000 +0100 @@ -59,6 +59,7 @@ usr/share/icons/hicolor/32x32/apps/korganizer.png usr/share/icons/hicolor/48x48/apps/korganizer.png usr/share/icons/hicolor/64x64/apps/korganizer.png +usr/share/icons/hicolor/scalable/apps/korganizer.svgz usr/share/kde4/apps/kconf_update/korganizer.upd usr/share/kde4/apps/korgac/icons/oxygen/22x22/actions/korgac.png usr/share/icons/oxygen/16x16/actions/smallclock.png diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/ktimetracker.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/ktimetracker.install --- kdepim-4.0.83/debian/ktimetracker.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/ktimetracker.install 2008-07-15 11:00:36.000000000 +0100 @@ -1,5 +1,6 @@ usr/bin/ktimetracker usr/lib/kde4/karmpart.so +usr/lib/kde4/kcm_ktimetrackerconfig.so usr/share/applications/kde4/karm.desktop usr/share/dbus-1/interfaces/org.kde.ktimetracker.ktimetracker.xml usr/share/doc/kde4/HTML/en/ktimetracker/common diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/libkdepim4.install /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/libkdepim4.install --- kdepim-4.0.83/debian/libkdepim4.install 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/libkdepim4.install 2008-07-15 11:00:36.000000000 +0100 @@ -25,7 +25,7 @@ usr/share/icons/oxygen/22x22/status/task-complete.png usr/share/icons/oxygen/22x22/status/task-recurring.png usr/share/icons/oxygen/22x22/status/task-reminder.png -usr/share/icons/oxygen/32x32/actions/appointment-new.png +# 4.0.98 also in oxygen usr/share/icons/oxygen/32x32/actions/appointment-new.png usr/share/icons/oxygen/32x32/actions/journal-new.png usr/share/icons/oxygen/32x32/actions/meeting-attending-tentative.png usr/share/icons/oxygen/32x32/actions/meeting-attending.png diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/patches/kubuntu_01_akonadi_fix.diff /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/patches/kubuntu_01_akonadi_fix.diff --- kdepim-4.0.83/debian/patches/kubuntu_01_akonadi_fix.diff 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/patches/kubuntu_01_akonadi_fix.diff 1970-01-01 01:00:00.000000000 +0100 @@ -1,58 +0,0 @@ -Index: resources/imap/imaplibresource.cpp -=================================================================== ---- kdepim/akonadi/resources/imap/imaplibresource.cpp (revision 822774) -+++ kdepim/akonadi/resources/imap/imaplibresource.cpp (revision 822775) -@@ -281,7 +281,7 @@ - m_collection = col; - - // If there is new mail, we get it without giubg through integrity, so the default is true! -- m_incrementalFetch = true; -+ m_incrementalFetch = true; - - // Prevent fetching items from noselect folders. - if ( m_collection.hasAttribute( "noselect" ) ) { -@@ -326,11 +326,10 @@ - - fetchlist.append( uid ); - } -- -+ - // if we are not fetching the whole folder, we can not do it in batches, so don't set -- // the totalItems, as that would put it in batch mode. -- if ( !m_incrementalFetch ) -- setTotalItems( fetchlist.count() ); -+ // the totalItems, as that would put it in batch mode. -+ setTotalItems( fetchlist.count() ); - - m_imap->getHeaders( mb, fetchlist ); - } -@@ -369,7 +368,7 @@ - - kDebug() << "calling partlyretrieved with amount: " << messages.count() << "Incremental?" << m_incrementalFetch; - -- m_incrementalFetch ? itemsRetrievedIncremental( messages, Item::List() ) : itemsPartlyRetrieved( messages ); -+ m_incrementalFetch ? itemsRetrievedIncremental( messages, Item::List() ) : itemsRetrieved( messages ); - } - - // ---------------------------------------------------------------------------------- -@@ -516,9 +515,9 @@ - return; - } - -- // See how many messages are in the folder currently -+ // See how many messages are in the folder currently - qint64 mailsReal = m_collection.statistics().count(); -- if ( mailsReal == -1 ) { -+ if ( mailsReal == -1 ) { - Akonadi::CollectionStatisticsJob *job = new Akonadi::CollectionStatisticsJob( m_collection ); - if ( job->exec() ) { - Akonadi::CollectionStatistics statistics = job->statistics(); -@@ -539,7 +538,7 @@ - // The amount on the server does not match the amount in the cache. - // that means we need reget the catch completely. - kDebug() << "O OH: " << totalShouldBe << " But: " << mailsReal; -- m_incrementalFetch = false; -+ m_incrementalFetch = false; - m_imap->getHeaderList( mb, 1, totalShouldBe ); - return; - } else if ( totalShouldBe == mailsReal && oldUidNext != uidnext.toInt() diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/patches/series /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/patches/series --- kdepim-4.0.83/debian/patches/series 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/patches/series 2008-07-15 11:00:36.000000000 +0100 @@ -1,2 +1 @@ -01_cmake_fixups.diff -kubuntu_01_akonadi_fix.diff +#01_cmake_fixups.diff diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/debian/rules /tmp/rIRHhfyqQE/kdepim-4.0.98/debian/rules --- kdepim-4.0.83/debian/rules 2008-07-15 11:00:35.000000000 +0100 +++ kdepim-4.0.98/debian/rules 2008-07-15 11:00:36.000000000 +0100 @@ -1,6 +1,9 @@ #!/usr/bin/make -f +export DH_VERBOSE=1 + THIS_SHOULD_GO_TO_UNSTABLE = 1 include debian/cdbs/kde.mk +DEB_DH_SHLIBDEPS_ARGS_kdepim-dev := -Xkdepimwidgets.so Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/akregator/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/akregator/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kaddressbook/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kaddressbook/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kalarm/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kalarm/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kjots/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kjots/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kleopatra/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kleopatra/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kmail/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kmail/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kmobiletools/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kmobiletools/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/knode/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/knode/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/knotes/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/knotes/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/konsolekalendar/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/konsolekalendar/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kontact/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kontact/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/korganizer/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/korganizer/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/korn/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/korn/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kpilot/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kpilot/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/ktimetracker/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/ktimetracker/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/ktnef/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/ktnef/index.cache.bz2 differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/doc/kwatchgnupg/index.cache.bz2 and /tmp/rIRHhfyqQE/kdepim-4.0.98/doc/kwatchgnupg/index.cache.bz2 differ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kaddressbook/dbusaddressbook.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kaddressbook/dbusaddressbook.desktop --- kdepim-4.0.83/kaddressbook/dbusaddressbook.desktop 2008-03-06 09:52:51.000000000 +0000 +++ kdepim-4.0.98/kaddressbook/dbusaddressbook.desktop 2008-06-25 08:58:31.000000000 +0100 @@ -5,6 +5,7 @@ Comment[be]=Адрасная кніга з D-Bus інтэрфейсам Comment[bg]=Адресник с интерфейс DCOP Comment[ca]=Llibreta d'adreces amb una interfície D-Bus +Comment[da]=Adressebog med en D-Bus-grænseflade Comment[de]=Adressbuch mit D-Bus-Schnittstelle Comment[el]=Βιβλίο διευθύνσεων με ένα περιβάλλον χρήσης D-Bus Comment[es]=Libreta de direcciones con una interfaz D-Bus diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kaddressbook/editors/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/kaddressbook/editors/CMakeLists.txt --- kdepim-4.0.83/kaddressbook/editors/CMakeLists.txt 2008-03-13 08:16:27.000000000 +0000 +++ kdepim-4.0.98/kaddressbook/editors/CMakeLists.txt 2008-06-25 08:58:31.000000000 +0100 @@ -2,7 +2,7 @@ add_subdirectory( protocols ) add_subdirectory( icons ) -include_directories( ${CMAKE_SOURCE_DIR}/kaddressbook/interfaces ${CMAKE_SOURCE_DIR}/kaddressbook ${KDE4_INCLUDE_DIR} ${GPGME_INCLUDES} ${CMAKE_SOURCE_DIR}/libkleo ${QT_INCLUDES} ) +include_directories( ${CMAKE_SOURCE_DIR}/kaddressbook/interfaces ${CMAKE_SOURCE_DIR}/kaddressbook ${KDE4_INCLUDE_DIR} ${GPGME_INCLUDES} ${CMAKE_SOURCE_DIR}/libkleo ${QT_INCLUDES} ${Boost_INCLUDE_DIR} ) ########### next target ############### diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kaddressbook/features/distributionlistng.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kaddressbook/features/distributionlistng.desktop --- kdepim-4.0.83/kaddressbook/features/distributionlistng.desktop 2008-06-11 09:33:40.000000000 +0100 +++ kdepim-4.0.98/kaddressbook/features/distributionlistng.desktop 2008-07-03 06:06:11.000000000 +0100 @@ -1,8 +1,8 @@ [Desktop Entry] -Encoding=UTF-8 X-KDE-Library=kaddrbk_distributionlistng Name=KAB Distribution List Next Generation Plugin Name[ca]=Connector de nova generació de llistes de distribució del KAB +Name[da]=KAB Next Generation distributionsliste-plugin Name[de]=Verteilerlisten-Modul für Adressbuch (nächste Generation) Name[el]=Πρόσθετο λίστας διανομής επόμενης γενιάς του KAB Name[et]=KAB postiloendi uue põlvkonna plugin diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kaddressbook/features/resourceselection.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kaddressbook/features/resourceselection.cpp --- kdepim-4.0.83/kaddressbook/features/resourceselection.cpp 2008-05-29 12:19:36.000000000 +0100 +++ kdepim-4.0.98/kaddressbook/features/resourceselection.cpp 2008-06-25 08:58:31.000000000 +0100 @@ -53,10 +53,10 @@ } }; -class ResourceItem : public QTreeWidgetItem +class KABCResourceItem : public QTreeWidgetItem { public: - ResourceItem( QTreeWidget *parent, KABC::Resource *resource ) + KABCResourceItem( QTreeWidget *parent, KABC::Resource *resource ) : QTreeWidgetItem( parent, QStringList( resource->resourceName() ) ), mResource( resource ), mIsSubresource( false ), mSubItemsCreated( false ), @@ -67,7 +67,7 @@ setIcon( 0, KIcon( "x-office-address-book" ) ); } - ResourceItem( KABC::ResourceABC *resourceABC, ResourceItem* parent, + KABCResourceItem( KABC::ResourceABC *resourceABC, KABCResourceItem* parent, const QString& resourceIdent ) : QTreeWidgetItem( parent, QStringList( resourceABC->subresourceLabel( resourceIdent ) ) ), mResource( resourceABC ), @@ -82,6 +82,11 @@ treeWidget()->setRootIsDecorated( true ); } + ~KABCResourceItem() + { + qDebug( ) << "Deleting Item"; + } + void createSubresourceItems(); KABC::Resource *resource() const { return mResource; } QString resourceIdentifier() const { return mResourceIdentifier; } @@ -95,7 +100,7 @@ }; // Comes from korganizer/resourceview.cpp -void ResourceItem::createSubresourceItems() +void KABCResourceItem::createSubresourceItems() { if ( !mIsSubresource && !mSubItemsCreated ) { KABC::ResourceABC* res = dynamic_cast( mResource ); @@ -108,7 +113,7 @@ // This resource has subresources QStringList::ConstIterator it; for ( it = subresources.begin(); it != subresources.end(); ++it ) { - (void)new ResourceItem( res, this, *it ); + (void)new KABCResourceItem( res, this, *it ); } } mSubItemsCreated = true; @@ -118,7 +123,7 @@ } // TODO: connect this to some signalResourceModified -// void ResourceItem::setGuiState() +// void KABCResourceItem::setGuiState() // { // if ( mIsSubresource ) // setOn( mResource->subresourceActive( mResourceIdentifier ) ); @@ -201,7 +206,7 @@ void ResourceSelection::edit() { - ResourceItem *item = selectedItem(); + KABCResourceItem *item = selectedItem(); if ( !item ) return; @@ -218,7 +223,7 @@ void ResourceSelection::remove() { - ResourceItem *item = selectedItem(); + KABCResourceItem *item = selectedItem(); if ( !item ) return; @@ -239,7 +244,7 @@ void ResourceSelection::currentChanged( QTreeWidgetItem *item ) { - ResourceItem *resItem = static_cast( item ); + KABCResourceItem *resItem = static_cast( item ); bool state = (resItem && !resItem->isSubResource() ); mEditButton->setEnabled( state ); @@ -288,7 +293,7 @@ KRES::Manager::Iterator it; for ( it = mManager->begin(); it != mManager->end(); ++it ) { - new ResourceItem( mListView, *it ); + new KABCResourceItem( mListView, *it ); KABC::ResourceABC* resource = dynamic_cast( *it ); if ( resource ) { disconnect( resource, 0, this, 0 ); @@ -308,7 +313,7 @@ QTreeWidgetItemIterator iterator( mListView ); while ( *iterator ) { - ResourceItem *item = static_cast< ResourceItem * >( *iterator ); + KABCResourceItem *item = static_cast< KABCResourceItem * >( *iterator ); if ( item->resource()->identifier() == mLastResource ) { item->setSelected( true ); break; @@ -334,8 +339,8 @@ // Not found return; - ResourceItem *item = static_cast( foundItems[0] ); - (void)new ResourceItem( resource, item, subResource ); + KABCResourceItem *item = static_cast( foundItems[0] ); + (void)new KABCResourceItem( resource, item, subResource ); } // Remove an entry @@ -349,9 +354,9 @@ //emitResourcesChanged(); } -ResourceItem* ResourceSelection::selectedItem() const +KABCResourceItem* ResourceSelection::selectedItem() const { - return static_cast( mListView->currentItem() ); + return static_cast( mListView->currentItem() ); } void ResourceSelection::initGUI() diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kaddressbook/features/resourceselection.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kaddressbook/features/resourceselection.h --- kdepim-4.0.83/kaddressbook/features/resourceselection.h 2008-02-13 15:45:45.000000000 +0000 +++ kdepim-4.0.98/kaddressbook/features/resourceselection.h 2008-06-25 08:58:31.000000000 +0100 @@ -32,7 +32,7 @@ namespace KABC { class ResourceABC; } -class ResourceItem; +class KABCResourceItem; class ResourceSelection : public KAB::ExtensionWidget { @@ -65,7 +65,7 @@ private: void initGUI(); - ResourceItem* selectedItem() const; + KABCResourceItem* selectedItem() const; QTreeWidget *mListView; QAbstractButton *mAddButton; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kaddressbook/kaddressbook.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kaddressbook/kaddressbook.desktop --- kdepim-4.0.83/kaddressbook/kaddressbook.desktop 2008-06-03 10:34:41.000000000 +0100 +++ kdepim-4.0.98/kaddressbook/kaddressbook.desktop 2008-06-25 08:58:31.000000000 +0100 @@ -44,7 +44,7 @@ GenericName[hu]=Címjegyzékkezelő GenericName[is]=Vistfangastjóri GenericName[it]=Gestore degli indirizzi -GenericName[ja]=アドレスマネージャ +GenericName[ja]=アドレス帳 GenericName[ka]=წიგნაკის მმართველი GenericName[kk]=Адрес менеджері GenericName[km]=កម្មវិធី​គ្រប់គ្រង​អាសយដ្ឋាន diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kaddressbook/kaddressbook_part.rc /tmp/rIRHhfyqQE/kdepim-4.0.98/kaddressbook/kaddressbook_part.rc --- kdepim-4.0.83/kaddressbook/kaddressbook_part.rc 2008-02-21 09:28:27.000000000 +0000 +++ kdepim-4.0.98/kaddressbook/kaddressbook_part.rc 2008-06-25 08:58:31.000000000 +0100 @@ -1,5 +1,5 @@ - + &File New @@ -86,7 +86,8 @@ - Main Toolbar + + Main Toolbar diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kaddressbook/xxport/gmx_xxport.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kaddressbook/xxport/gmx_xxport.desktop --- kdepim-4.0.83/kaddressbook/xxport/gmx_xxport.desktop 2008-06-11 09:33:40.000000000 +0100 +++ kdepim-4.0.98/kaddressbook/xxport/gmx_xxport.desktop 2008-06-25 08:58:31.000000000 +0100 @@ -3,6 +3,7 @@ Name=KAB GMX XXPort Plugin Name[bg]=KAB CSV XXPort Plugin Name[ca]=Connector d'importació/exportació GMX per al KAB +Name[da]=KAB GMX XXPort-plugin Name[de]=GMX-Modul für das Adressbuch Name[el]=Πρόσθετο GMX XXPort του KAB Name[es]=Complemento de KAB de exportación e importación de GMX @@ -33,6 +34,7 @@ Comment=Plugin to import and export contacts in GMX's addressbook format Comment[bg]=Приставка за експортиране/импортиране на контактите във формат на vCard Comment[ca]=Connector per a importar i exportar contactes en el format vCard +Comment[da]=Plugin til at importere og eksportere kontakter i GMX's adressebogsformat Comment[de]=Modul für Import/Export von Kontakten im GMX-Adressbuchformat Comment[el]=Πρόσθετο για εισαγωγή και εξαγωγή επαφών μορφής GMX Comment[es]=Complemento para importar y exportar contactos en el formato de libreta de direcciones de GMX diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/alarmcalendar.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/alarmcalendar.cpp --- kdepim-4.0.83/kalarm/alarmcalendar.cpp 2008-06-03 10:34:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/alarmcalendar.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -1078,7 +1078,7 @@ KAEvent::List AlarmCalendar::events(AlarmResource* resource, KCalEvent::Status type) { KAEvent::List list; - if (!mCalendar || resource && mCalType != RESOURCES) + if (!mCalendar || (resource && mCalType != RESOURCES)) return list; if (resource) { @@ -1117,14 +1117,14 @@ Event::List AlarmCalendar::kcalEvents(AlarmResource* resource, KCalEvent::Status type) { Event::List list; - if (!mCalendar || resource && mCalType != RESOURCES) + if (!mCalendar || (resource && mCalType != RESOURCES)) return list; list = resource ? AlarmResources::instance()->rawEvents(resource) : mCalendar->rawEvents(); for (int i = 0; i < list.count(); ) { Event* event = list[i]; if (event->alarms().isEmpty() - || type != KCalEvent::EMPTY && !(type & KCalEvent::status(event))) + || (type != KCalEvent::EMPTY && !(type & KCalEvent::status(event)))) list.removeAt(i); else ++i; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/alarmevent.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/alarmevent.cpp --- kdepim-4.0.83/kalarm/alarmevent.cpp 2008-06-18 13:42:07.000000000 +0100 +++ kdepim-4.0.98/kalarm/alarmevent.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -1058,7 +1058,7 @@ // If only-during-working-time is set and it recurs, it won't actually trigger // unless it falls during working hours. if (!mWorkTimeOnly - || (!mRepeatCount || !mRepeatInterval) && checkRecur() == KARecurrence::NO_RECUR + || (!mRepeatCount || (!mRepeatInterval && checkRecur() == KARecurrence::NO_RECUR)) || KAlarm::isWorkingTime(mMainTrigger.kDateTime())) { mMainWorkTrigger = mMainTrigger; @@ -1130,7 +1130,7 @@ int repeatFreq = mRepeatInterval.asDays(); bool weeklyRepeat = mRepeatCount && !(repeatFreq % 7); Duration interval = mRecurrence->regularInterval(); - if (interval && !(interval.asDays() % 7) + if ((interval && !(interval.asDays() % 7)) || nDayPos == 1) { // It recurs on the same day each week @@ -1602,7 +1602,7 @@ if (interval && interval.isDaily() && !(interval.asDays() % 7)) { // It recurs weekly - if (!mRepeatCount || mRepeatInterval.isDaily() && !(mRepeatInterval.asDays() % 7)) + if (!mRepeatCount || (mRepeatInterval.isDaily() && !(mRepeatInterval.asDays() % 7))) return false; // any repetitions are also weekly // Repetitions are daily. Check if any occur on working days // by checking the first recurrence and up to 6 repetitions. @@ -1643,8 +1643,8 @@ bool KAEvent::updateKCalEvent(Event* ev, bool checkUid, bool original, bool cancelCancelledDefer) const { if (!ev - || checkUid && !mEventID.isEmpty() && mEventID != ev->uid() - || !mAlarmCount && (!original || !mMainExpired)) + || (checkUid && !mEventID.isEmpty() && mEventID != ev->uid()) + || (!mAlarmCount && (!original || !mMainExpired))) return false; ev->startUpdates(); // prevent multiple update notifications @@ -1779,7 +1779,7 @@ } // Add subsidiary alarms - if (mRepeatAtLogin || mArchiveRepeatAtLogin && original) + if (mRepeatAtLogin || (mArchiveRepeatAtLogin && original)) { DateTime dtl; if (mArchiveRepeatAtLogin) @@ -1797,7 +1797,7 @@ ancillaryType = 1; } } - if (mReminderMinutes || mArchiveReminderMinutes && original) + if (mReminderMinutes || (mArchiveReminderMinutes && original)) { int minutes = mReminderMinutes ? mReminderMinutes : mArchiveReminderMinutes; initKCalAlarm(ev, -minutes * 60, QStringList(mReminderOnceOnly ? REMINDER_ONCE_TYPE : REMINDER_TYPE)); @@ -1807,7 +1807,7 @@ ancillaryType = 2; } } - if (mDeferral > 0 || mDeferral == CANCEL_DEFERRAL && !cancelCancelledDefer) + if (mDeferral > 0 || (mDeferral == CANCEL_DEFERRAL && !cancelCancelledDefer)) { DateTime nextDateTime = mNextMainDateTime; if (mMainExpired) @@ -3785,7 +3785,7 @@ event->setCategories(cats); - if ((pre_1_4_14 || pre_1_9_7 && !pre_1_9_0) + if ((pre_1_4_14 || (pre_1_9_7 && !pre_1_9_0)) && event->recurrence() && event->recurrence()->recurs()) { /* @@ -3877,7 +3877,7 @@ } } - if (pre_1_5_0 || pre_1_9_9 && !pre_1_9_0) + if (pre_1_5_0 || (pre_1_9_9 && !pre_1_9_0)) { /* * It's a KAlarm pre-1.5.0 or KAlarm 1.9 series pre-1.9.9 calendar file. @@ -3963,7 +3963,7 @@ event->startUpdates(); // prevent multiple update notifications if (readOnly) event->setReadOnly(false); - if (alarm->snoozeTime().asSeconds() % (24*3600)) + if ((alarm->snoozeTime().asSeconds() % (24*3600)) != 0) recur->setMinutely(alarm->snoozeTime()); else recur->setDaily(alarm->snoozeTime() / (24*3600)); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/alarmevent.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/alarmevent.h --- kdepim-4.0.83/kalarm/alarmevent.h 2008-06-18 13:42:07.000000000 +0100 +++ kdepim-4.0.98/kalarm/alarmevent.h 2008-07-03 06:06:11.000000000 +0100 @@ -362,7 +362,7 @@ KAAlarm convertDisplayingAlarm() const; bool updateKCalEvent(KCal::Event*, bool checkUid = true, bool original = false, bool cancelCancelledDefer = false) const; Action action() const { return (Action)mActionType; } - bool displayAction() const { return mActionType == T_MESSAGE || mActionType == T_FILE || mActionType == T_COMMAND && mCommandDisplay; } + bool displayAction() const { return mActionType == T_MESSAGE || mActionType == T_FILE || (mActionType == T_COMMAND && mCommandDisplay); } const QString& id() const { return mEventID; } bool valid() const { return mAlarmCount && (mAlarmCount != 1 || !mRepeatAtLogin); } int alarmCount() const { return mAlarmCount; } @@ -389,7 +389,7 @@ unsigned long kmailSerialNumber() const { return mKMailSerialNumber; } bool copyToKOrganizer() const { return mCopyToKOrganizer; } bool workTimeOnly() const { return mWorkTimeOnly; } - bool speak() const { return (mActionType == T_MESSAGE || mActionType == T_COMMAND && mCommandDisplay) && mSpeak; } + bool speak() const { return (mActionType == T_MESSAGE || (mActionType == T_COMMAND && mCommandDisplay)) && mSpeak; } const QString& audioFile() const { return mAudioFile; } float soundVolume() const { return !mAudioFile.isEmpty() ? mSoundVolume : -1; } float fadeVolume() const { return !mAudioFile.isEmpty() && mSoundVolume >= 0 && mFadeSeconds ? mFadeVolume : -1; } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/alarmtimewidget.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/alarmtimewidget.cpp --- kdepim-4.0.83/kalarm/alarmtimewidget.cpp 2008-06-10 12:41:22.000000000 +0100 +++ kdepim-4.0.98/kalarm/alarmtimewidget.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -1,7 +1,7 @@ /* * alarmtimewidget.cpp - alarm date/time entry widget * Program: kalarm - * Copyright © 2001-2008 by David Jarvie + * Copyright © 2001-2008 by David Jarvie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -529,7 +529,7 @@ { // The current date has reached or has passed the maximum date if (now.date() > mMaxDateTime.date() - || !mAnyTime && now.time() > mTimeEdit->maxTime()) + || (!mAnyTime && now.time() > mTimeEdit->maxTime())) { mPastMax = true; emit pastMax(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/autostart/autostart.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/autostart/autostart.cpp --- kdepim-4.0.83/kalarm/autostart/autostart.cpp 2008-04-30 14:59:57.000000000 +0100 +++ kdepim-4.0.98/kalarm/autostart/autostart.cpp 2008-06-25 08:58:31.000000000 +0100 @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) { - KAboutData aboutData(PROGRAM_NAME, 0, ki18n("KAlarm Autostart"), + KAboutData aboutData(PROGRAM_NAME, "kalarm", ki18n("KAlarm Autostart"), PROGRAM_VERSION, ki18n("KAlarm autostart at login"), KAboutData::License_GPL, ki18n("Copyright 2001,2008 David Jarvie"), KLocalizedString(), "http://www.astrojar.org.uk/kalarm"); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/Changelog /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/Changelog --- kdepim-4.0.83/kalarm/Changelog 2008-06-03 10:34:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/Changelog 2008-07-08 10:56:29.000000000 +0100 @@ -1,6 +1,6 @@ KAlarm Change Log -=== Version 2.0.0 beta4 === +=== Version 2.0.0 --- 7 July 2008 === - New facility to use multiple alarm calendar resources. - Add facility to select time zone for alarm times. - Handle summer/winter time changes correctly. @@ -8,6 +8,7 @@ - Add option for display alarm text to be generated by a command. - Provide "Don't show again for this alarm" option for command error messages. - Alarm edit dialogue layout improvements. +- Make alarm edit and preferences dialogues scrollable if too high for screen. - Choose new alarm/template type from menu instead of in alarm edit dialogue. - Add option to show alarm windows in centre of screen, with buttons initially disabled to prevent accidental acknowledgement. @@ -19,6 +20,24 @@ - Use kconf_update to convert old config file settings. - Change numeric codes in config file to strings for long-term maintainability. - Rename Defaults section options in config file. +- Fix detection of yearly February 29th recurrences on Feb 28th or Mar 1st. + +=== Version 1.5.3 --- 16 June 2008 === +- In New From Template menu, show list of template names in sorted order. +- Fix recurrence count being lost when using alarm templates. +- Prevent invalid negative values appearing in 'Time from now' edit field. +- Fix time shown in alarm edit dialogue for recurring alarms. +- Fix recurrence count shown in alarm edit dialogue once alarm has triggered. +- Fix Find not working with a new search text after a failed search. +- Display correct error message when a search fails. +- Prevent user changing font/colour dialogue when editing read-only alarms. + +=== Version 1.5.2 --- 13 February 2008 === +- Prevent repetition duration error message when saving alarm which never +recurs. + +=== Version 1.5.1 (KDE 3.5.9) --- 13 February 2008 === +- Fix inability to set up sub-repetitions for simple yearly recurrences. === Version 1.5.0 --- 23 January 2008 === - Replace simple repetitions with recurrence sub-repetitions, to save confusion. diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/dialogscroll.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/dialogscroll.h --- kdepim-4.0.83/kalarm/dialogscroll.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kalarm/dialogscroll.h 2008-07-08 10:56:29.000000000 +0100 @@ -0,0 +1,162 @@ +/* + * dialogscroll.h - dialog scrolling when too high for screen + * Program: kalarm + * Copyright © 2008 by David Jarvie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef DIALOGSCROLL_H +#define DIALOGSCROLL_H + +#include "kalarm.h" + +#include +#include + + +/*============================================================================= += Class DialogScroll += A widget to contain the tab contents, allowing the contents to scroll if += the dialog is too high to fit the screen. +=============================================================================*/ +template +class DialogScroll : public QScrollArea +{ + public: + explicit DialogScroll(QWidget* parent = 0); + ~DialogScroll(); + virtual QSize sizeHint() const { return minimumSizeHint(); } + virtual QSize minimumSizeHint() const; + static int heightReduction() { return mHeightReduction; } + static QSize initMinimumHeight(T*); + static void setSized() { mSized = true; } + static bool sized() { return mSized; } + private: + static QList*> mTabs; + static int mMinHeight; + static int mHeightReduction; + static bool mSized; +}; + + +#include "dialogscroll.h" +#include "functions.h" +#include +#include + +namespace KAlarm { QRect desktopWorkArea(); } + +template QList*> DialogScroll::mTabs; +template int DialogScroll::mHeightReduction = 0; +template int DialogScroll::mMinHeight = -1; +template bool DialogScroll::mSized = false; + +template +DialogScroll::DialogScroll(QWidget* parent) + : QScrollArea(parent) +{ + setFrameStyle(QFrame::NoFrame); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + setWidgetResizable(true); + setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); + mTabs += this; +} + +template +DialogScroll::~DialogScroll() +{ + mTabs.removeAll(this); +} + +template +QSize DialogScroll::minimumSizeHint() const +{ + if (!widget()) + return QSize(); + QSize s = widget()->minimumSizeHint(); + if (mMinHeight > 0) + return QSize(s.width() + style()->pixelMetric(QStyle::PM_ScrollBarExtent), mMinHeight); + return s; +} + +/****************************************************************************** +* Return the minimum size for the dialog. +* If the minimum size would be too high to fit the desktop, the tab contents +* are made scrollable. +*/ +template +QSize DialogScroll::initMinimumHeight(T* dlg) +{ + if (mSized) + return QSize(); + int maxHeight = 0; + for (int i = 0, end = mTabs.count(); i < end; ++i) + { + if (!mTabs[i]->widget()) + return QSize(); + QSize s = mTabs[i]->widget()->minimumSizeHint(); + if (!s.isValid()) + return QSize(); + if (s.height() > maxHeight) + maxHeight = s.height(); + } + int decoration = dlg->frameGeometry().height() - dlg->geometry().height(); + if (!decoration) + { + // On X11 at least, the window decoration height may not be + // available, so use a guess of 25 pixels. + decoration = 25; + } + int desk = KAlarm::desktopWorkArea().height(); + // There is no stored size, or the deferral group is visible. + // Allow the tab contents to be scrolled vertically if that is necessary + // to avoid the dialog exceeding the screen height. + QSize s = dlg->KDialog::minimumSizeHint(); + int y = s.height() + decoration - desk; + if (y > 0) + { + mHeightReduction = y; + mMinHeight = maxHeight - y; + if (mMinHeight > 0) + { + for (int i = 0, end = mTabs.count(); i < end; ++i) + { + mTabs[i]->setMinimumHeight(mMinHeight); + mTabs[i]->resize(QSize(mTabs[i]->width(), mMinHeight)); + } + } + mSized = true; + mTabs[0]->parentWidget()->resize(mTabs[0]->parentWidget()->sizeHint()); + for (QWidget* w = mTabs[0]->parentWidget(); w && w != dlg; w = w->parentWidget()) + { + w->setMinimumHeight(qMin(w->minimumSizeHint().height(), w->sizeHint().height())); + w->resize(w->minimumSize()); + } + s = dlg->KDialog::minimumSizeHint(); + dlg->setMinimumHeight(s.height()); + } + else + { + for (int i = 0, end = mTabs.count(); i < end; ++i) + mTabs[i]->setMinimumHeight(maxHeight); + mSized = true; + } + dlg->resize(s); + return s; +} + +#endif // DIALOGSCROLL_H diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/editdlg.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/editdlg.cpp --- kdepim-4.0.83/kalarm/editdlg.cpp 2008-06-18 13:42:07.000000000 +0100 +++ kdepim-4.0.98/kalarm/editdlg.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -1,22 +1,22 @@ /* -* editdlg.cpp - dialog to create or modify an alarm or alarm template -* Program: kalarm -* Copyright © 2001-2008 by David Jarvie -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write to the Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ + * editdlg.cpp - dialog to create or modify an alarm or alarm template + * Program: kalarm + * Copyright © 2001-2008 by David Jarvie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ #include "kalarm.h" @@ -54,6 +54,7 @@ #include "checkbox.h" #include "colourcombo.h" #include "deferdlg.h" +#include "dialogscroll.h" #include "functions.h" #include "kalarmapp.h" #include "latecancel.h" @@ -224,23 +225,24 @@ box->setFixedHeight(box->sizeHint().height()); } mTabs = new KTabWidget(mainWidget); -// mTabs->setMargin(marginHint()); - KVBox* mainPageBox = new KVBox; - mainPageBox->setMargin(marginHint()); - mTabs->addTab(mainPageBox, i18nc("@title:tab", "Alarm")); + DialogScroll* mainScroll = new DialogScroll(); + mTabs->addTab(mainScroll, i18nc("@title:tab", "Alarm")); mMainPageIndex = 0; - PageFrame* mainPage = new PageFrame(mainPageBox); + PageFrame* mainPage = new PageFrame(mainScroll); + mainScroll->setWidget(mainPage); // mainPage becomes the child of mainScroll connect(mainPage, SIGNAL(shown()), SLOT(slotShowMainPage())); QVBoxLayout* topLayout = new QVBoxLayout(mainPage); - topLayout->setMargin(0); + topLayout->setMargin(marginHint()); topLayout->setSpacing(spacingHint()); // Recurrence tab - KVBox* recurTab = new KVBox; - recurTab->setMargin(marginHint()); - mTabs->addTab(recurTab, QString()); + DialogScroll* recurScroll = new DialogScroll(); + mTabs->addTab(recurScroll, QString()); mRecurPageIndex = 1; + KVBox* recurTab = new KVBox(); + recurTab->setMargin(marginHint()); + recurScroll->setWidget(recurTab); // recurTab becomes the child of recurScroll mRecurrenceEdit = new RecurrenceEdit(mReadOnly, recurTab); connect(mRecurrenceEdit, SIGNAL(shown()), SLOT(slotShowRecurrenceEdit())); connect(mRecurrenceEdit, SIGNAL(typeChanged(int)), SLOT(slotRecurTypeChange(int))); @@ -583,8 +585,8 @@ { if (mSavedTemplateName != mTemplateName->text() || mSavedTemplateTimeType != mTemplateTimeGroup->checkedButton() - || mTemplateUseTime->isChecked() && mSavedTemplateTime != mTemplateTime->time() - || mTemplateUseTimeAfter->isChecked() && mSavedTemplateAfterTime != mTemplateTimeAfter->value()) + || (mTemplateUseTime->isChecked() && mSavedTemplateTime != mTemplateTime->time()) + || (mTemplateUseTimeAfter->isChecked() && mSavedTemplateAfterTime != mTemplateTimeAfter->value())) return true; } else @@ -594,7 +596,7 @@ return true; } if (mSavedLateCancel != mLateCancel->minutes() - || mShowInKorganizer && mSavedShowInKorganizer != mShowInKorganizer->isChecked() + || (mShowInKorganizer && mSavedShowInKorganizer != mShowInKorganizer->isChecked()) || textFileCommandMessage != mSavedTextFileCommandMessage || mSavedRecurrenceType != mRecurrenceEdit->repeatType()) return true; @@ -662,8 +664,8 @@ mRecurrenceEdit->updateEvent(event, !mTemplate); KDateTime now = KDateTime::currentDateTime(mAlarmDateTime.timeSpec()); bool dateOnly = mAlarmDateTime.isDateOnly(); - if (dateOnly && mAlarmDateTime.date() < now.date() - || !dateOnly && mAlarmDateTime.kDateTime() < now) + if ((dateOnly && mAlarmDateTime.date() < now.date()) + || (!dateOnly && mAlarmDateTime.kDateTime() < now)) { // A timed recurrence has an entered start date which has // already expired, so we must adjust the next repetition. @@ -716,18 +718,34 @@ */ void EditAlarmDlg::showEvent(QShowEvent* se) { + KDialog::showEvent(se); if (!mDeferGroupHeight) { mDeferGroupHeight = mDeferGroup->height() + spacingHint(); QSize s; if (KAlarm::readConfigWindowSize(EDIT_DIALOG_NAME, s)) - s.setHeight(s.height() + (mDeferGroup->isHidden() ? 0 : mDeferGroupHeight)); - else - s = minimumSize(); - resize(s); + { + bool defer = !mDeferGroup->isHidden(); + s.setHeight(s.height() + (defer ? mDeferGroupHeight : 0)); + if (!defer) + DialogScroll::setSized(); + resize(s); + } } KWindowSystem::setOnDesktop(winId(), mDesktop); // ensure it displays on the desktop expected by the user - KDialog::showEvent(se); +} + +/****************************************************************************** +* Return the minimum size for the dialog. +* If the minimum size would be too high to fit the desktop, the tab contents +* are made scrollable. +*/ +QSize EditAlarmDlg::minimumSizeHint() const +{ + QSize s = DialogScroll::initMinimumHeight(const_cast(this)); + if (s.isValid()) + return s; + return KDialog::minimumSizeHint(); } /****************************************************************************** @@ -821,8 +839,8 @@ getEvent(event, r); // this may adjust mAlarmDateTime KDateTime now = KDateTime::currentDateTime(mAlarmDateTime.timeSpec()); bool dateOnly = mAlarmDateTime.isDateOnly(); - if (dateOnly && mAlarmDateTime.date() < now.date() - || !dateOnly && mAlarmDateTime.kDateTime() < now) + if ((dateOnly && mAlarmDateTime.date() < now.date()) + || (!dateOnly && mAlarmDateTime.kDateTime() < now)) { // A timed recurrence has an entered start date which // has already expired, so we must adjust it. @@ -882,7 +900,7 @@ return false; } if (!recurEvent.repeatInterval().isDaily() - && (mTemplate && mTemplateAnyTime->isChecked() || !mTemplate && mAlarmDateTime.isDateOnly())) + && ((mTemplate && mTemplateAnyTime->isChecked()) || (!mTemplate && mAlarmDateTime.isDateOnly()))) { KMessageBox::sorry(this, i18nc("@info", "For a repetition within the recurrence, its period must be in units of days or weeks for a date-only alarm")); mRecurrenceEdit->activateSubRepetition(); // display the alarm repetition dialog again diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/editdlg.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/editdlg.h --- kdepim-4.0.83/kalarm/editdlg.h 2008-04-10 10:30:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/editdlg.h 2008-07-08 10:56:29.000000000 +0100 @@ -32,8 +32,8 @@ class QResizeEvent; class QAbstractButton; class QGroupBox; -class QTabWidget; class QVBoxLayout; +class KTabWidget; class KLineEdit; class AlarmResource; class ButtonGroup; @@ -66,6 +66,7 @@ virtual ~EditAlarmDlg(); bool getEvent(KAEvent&, AlarmResource*&); virtual void setAction(KAEvent::Action, const AlarmText& = AlarmText()) = 0; + virtual QSize minimumSizeHint() const; static QString i18n_chk_ShowInKOrganizer(); // text of 'Show in KOrganizer' checkbox @@ -124,7 +125,7 @@ protected: KAEvent::Action mAlarmType; // actual alarm type private: - QTabWidget* mTabs; // the tabs in the dialog + KTabWidget* mTabs; // the tabs in the dialog int mMainPageIndex; int mRecurPageIndex; bool mMainPageShown; // true once the main tab has been displayed diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/editdlgtypes.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/editdlgtypes.cpp --- kdepim-4.0.83/kalarm/editdlgtypes.cpp 2008-05-29 12:19:36.000000000 +0100 +++ kdepim-4.0.98/kalarm/editdlgtypes.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -1164,7 +1164,7 @@ QStringList emailAttach; for (int i = 0, end = mEmailAttachList->count(); i < end; ++i) emailAttach += mEmailAttachList->itemText(i); - if (mEmailFromList && mSavedEmailFrom != mEmailFromList->currentIdentityName() + if ((mEmailFromList && mSavedEmailFrom != mEmailFromList->currentIdentityName()) || mSavedEmailTo != mEmailToEdit->text() || mSavedEmailSubject != mEmailSubjectEdit->text() || mSavedEmailAttach != emailAttach diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/eventlistmodel.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/eventlistmodel.cpp --- kdepim-4.0.83/kalarm/eventlistmodel.cpp 2008-06-03 10:34:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/eventlistmodel.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -213,7 +213,7 @@ case Qt::BackgroundRole: if (event->action() == KAEvent::MESSAGE || event->action() == KAEvent::FILE - || event->action() == KAEvent::COMMAND && event->commandDisplay()) + || (event->action() == KAEvent::COMMAND && event->commandDisplay())) return event->bgColour(); case SortRole: { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/find.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/find.cpp --- kdepim-4.0.83/kalarm/find.cpp 2008-05-07 10:05:56.000000000 +0100 +++ kdepim-4.0.98/kalarm/find.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -316,8 +316,8 @@ last = true; // we've wrapped round and reached the starting alarm again fromCurrent = false; bool live = !event->expired(); - if (live && !(mOptions & FIND_LIVE) - || !live && !(mOptions & FIND_ARCHIVED)) + if ((live && !(mOptions & FIND_LIVE)) + || (!live && !(mOptions & FIND_ARCHIVED))) continue; // we're not searching this type of alarm switch (event->action()) { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/functions.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/functions.cpp --- kdepim-4.0.83/kalarm/functions.cpp 2008-06-03 10:34:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/functions.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -52,8 +52,9 @@ #include #include #include -#include +#include #include +#include #include #include @@ -1295,6 +1296,18 @@ } /****************************************************************************** +* Return the size of the usable area of the desktop. +*/ +QRect desktopWorkArea() +{ +#ifdef Q_WS_X11 + return KWindowSystem::workArea(); +#else + return qApp->desktop()->availableGeometry(); +#endif +} + +/****************************************************************************** * Return the current KAlarm version number. */ int Version() @@ -1417,7 +1430,7 @@ if (!Preferences::workDays().testBit(dt.date().dayOfWeek() - 1)) return false; return dt.isDateOnly() - || dt.time() >= Preferences::workDayStart() && dt.time() < Preferences::workDayEnd(); + || (dt.time() >= Preferences::workDayStart() && dt.time() < Preferences::workDayEnd()); } /****************************************************************************** @@ -1451,6 +1464,131 @@ } /****************************************************************************** +* Convert a date/time specification string into a local date/time or date value. +* Parameters: +* tzString = in the form [[[yyyy-]mm-]dd-]hh:mm [TZ] or yyyy-mm-dd [TZ]. +* dateTime = receives converted date/time value. +* defaultDt = default date/time used for missing parts of tzString, or null +* to use current date/time. +* allowTZ = whether to allow a time zone specifier in tzString. +* Reply = true if successful. +*/ +bool convTimeString(const QByteArray& tzString, KDateTime& dateTime, const KDateTime& defaultDt, bool allowTZ) +{ +#define MAX_DT_LEN 19 + int i = tzString.indexOf(' '); + if (i > MAX_DT_LEN || (i >= 0 && !allowTZ)) + return false; + QString zone = (i >= 0) ? QString::fromLatin1(tzString.mid(i)) : QString(); + char timeStr[MAX_DT_LEN+1]; + strcpy(timeStr, tzString.left(i >= 0 ? i : MAX_DT_LEN)); + int dt[5] = { -1, -1, -1, -1, -1 }; + char* s; + char* end; + bool noTime; + // Get the minute value + if ((s = strchr(timeStr, ':')) == 0) + noTime = true; + else + { + noTime = false; + *s++ = 0; + dt[4] = strtoul(s, &end, 10); + if (end == s || *end || dt[4] >= 60) + return false; + // Get the hour value + if ((s = strrchr(timeStr, '-')) == 0) + s = timeStr; + else + *s++ = 0; + dt[3] = strtoul(s, &end, 10); + if (end == s || *end || dt[3] >= 24) + return false; + } + bool noDate = true; + if (s != timeStr) + { + noDate = false; + // Get the day value + if ((s = strrchr(timeStr, '-')) == 0) + s = timeStr; + else + *s++ = 0; + dt[2] = strtoul(s, &end, 10); + if (end == s || *end || dt[2] == 0 || dt[2] > 31) + return false; + if (s != timeStr) + { + // Get the month value + if ((s = strrchr(timeStr, '-')) == 0) + s = timeStr; + else + *s++ = 0; + dt[1] = strtoul(s, &end, 10); + if (end == s || *end || dt[1] == 0 || dt[1] > 12) + return false; + if (s != timeStr) + { + // Get the year value + dt[0] = strtoul(timeStr, &end, 10); + if (end == timeStr || *end) + return false; + } + } + } + + QDate date; + if (dt[0] >= 0) + date = QDate(dt[0], dt[1], dt[2]); + QTime time(0, 0, 0); + if (noTime) + { + // No time was specified, so the full date must have been specified + if (dt[0] < 0 || !date.isValid()) + return false; + dateTime = KAlarm::applyTimeZone(zone, date, time, false, defaultDt); + } + else + { + // Compile the values into a date/time structure + time.setHMS(dt[3], dt[4], 0); + if (dt[0] < 0) + { + // Some or all of the date was omitted. + // Use the default date/time if provided. + if (defaultDt.isValid()) + { + dt[0] = defaultDt.date().year(); + date.setYMD(dt[0], + (dt[1] < 0 ? defaultDt.date().month() : dt[1]), + (dt[2] < 0 ? defaultDt.date().day() : dt[2])); + } + else + date.setYMD(2000, 1, 1); // temporary substitute for date + } + dateTime = KAlarm::applyTimeZone(zone, date, time, true, defaultDt); + if (!dateTime.isValid()) + return false; + if (dt[0] < 0) + { + // Some or all of the date was omitted. + // Use the current date in the specified time zone as default. + KDateTime now = KDateTime::currentDateTime(dateTime.timeSpec()); + date = dateTime.date(); + date.setYMD(now.date().year(), + (dt[1] < 0 ? now.date().month() : dt[1]), + (dt[2] < 0 ? now.date().day() : dt[2])); + if (!date.isValid()) + return false; + if (noDate && time < now.time()) + date = date.addDays(1); + dateTime.setDate(date); + } + } + return dateTime.isValid(); +} + +/****************************************************************************** * Convert a time zone specifier string and apply it to a given date and/or time. * The time zone specifier is a system time zone name, e.g. "Europe/London", * "UTC" or "Clock". If no time zone is specified, it defaults to the local time diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/functions.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/functions.h --- kdepim-4.0.83/kalarm/functions.h 2008-06-03 10:34:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/functions.h 2008-07-08 10:56:29.000000000 +0100 @@ -65,6 +65,7 @@ MainWindow* displayMainWindowSelected(const QString& eventID = QString()); bool readConfigWindowSize(const char* window, QSize&, int* splitterWidth = 0); void writeConfigWindowSize(const char* window, const QSize&, int splitterWidth = -1); +QRect desktopWorkArea(); /** Check from its mime type whether a file appears to be a text or image file. * If a text file, its type is distinguished. */ @@ -134,6 +135,7 @@ QString stripAccel(const QString&); +bool convTimeString(const QByteArray& tzString, KDateTime& dateTime, const KDateTime& defaultDt = KDateTime(), bool allowTZ = true); KDateTime applyTimeZone(const QString& tzstring, const QDate& date, const QTime& time, bool haveTime, const KDateTime& defaultDt = KDateTime()); bool isWorkingTime(const KDateTime&); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/kalarmapp.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/kalarmapp.cpp --- kdepim-4.0.83/kalarm/kalarmapp.cpp 2008-06-10 12:41:22.000000000 +0100 +++ kdepim-4.0.98/kalarm/kalarmapp.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -64,7 +64,6 @@ #include #include -static bool convWakeTime(const QByteArray& timeParam, KDateTime&, const KDateTime& defaultDt = KDateTime()); static bool convInterval(const QByteArray& timeParam, KARecurrence::Type&, int& timeInterval, bool allowMonthYear = false); /****************************************************************************** @@ -470,7 +469,7 @@ if (args->isSet("time")) { QByteArray dateTime = args->getOption("time").toLocal8Bit(); - if (!convWakeTime(dateTime, alarmTime)) + if (!KAlarm::convTimeString(dateTime, alarmTime)) USAGE(i18nc("@info:shell", "Invalid %1 parameter", QLatin1String("--time"))) } else @@ -507,9 +506,9 @@ QByteArray dateTime = args->getOption("until").toLocal8Bit(); bool ok; if (args->isSet("time")) - ok = convWakeTime(dateTime, endTime, alarmTime); + ok = KAlarm::convTimeString(dateTime, endTime, alarmTime); else - ok = convWakeTime(dateTime, endTime); + ok = KAlarm::convTimeString(dateTime, endTime); if (!ok) USAGE(i18nc("@info:shell", "Invalid %1 parameter", QLatin1String("--until"))) if (alarmTime.isDateOnly() && !endTime.isDateOnly()) @@ -760,7 +759,7 @@ return; int mwcount = MainWindow::count(); MainWindow* mw = mwcount ? MainWindow::firstWindow() : 0; - if (mwcount > 1 || mwcount && (!mw->isHidden() || !mw->isTrayParent())) + if (mwcount > 1 || (mwcount && (!mw->isHidden()) || !mw->isTrayParent())) return; // There are no windows left except perhaps a main window which is a hidden tray icon parent if (mTrayWindow) @@ -1355,7 +1354,7 @@ if (now >= limit) { if (type == KAEvent::LAST_RECURRENCE - || type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event->recurs()) + || (type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event->recurs())) cancel = true; // last occurrence (and there are no repetitions) else reschedule = true; @@ -1387,7 +1386,7 @@ if (next.effectiveKDateTime().secsTo(now) > maxlate) { if (type == KAEvent::LAST_RECURRENCE - || type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event->recurs()) + || (type == KAEvent::FIRST_OR_ONLY_OCCURRENCE && !event->recurs())) cancel = true; // last occurrence (and there are no repetitions) else reschedule = true; @@ -1636,7 +1635,7 @@ if (!event.enabled()) delete win; // event is disabled - close its window else if (!win - || !win->hasDefer() && !alarm.repeatAtLogin() + || (!win->hasDefer() && !alarm.repeatAtLogin()) || replaceReminder) { // Either there isn't already a message for this event, @@ -2010,124 +2009,6 @@ } /****************************************************************************** -* Convert the --time parameter string into a local date/time or date value. -* The parameter is in the form [[[yyyy-]mm-]dd-]hh:mm or yyyy-mm-dd. -* Reply = true if successful. -*/ -static bool convWakeTime(const QByteArray& timeParam, KDateTime& dateTime, const KDateTime& defaultDt) -{ -#define MAX_DT_LEN 19 - int i = timeParam.indexOf(' '); - if (i > MAX_DT_LEN) - return false; - QString zone = (i >= 0) ? QString::fromLatin1(timeParam.mid(i)) : QString(); - char timeStr[MAX_DT_LEN+1]; - strcpy(timeStr, timeParam.left(i >= 0 ? i : MAX_DT_LEN)); - int dt[5] = { -1, -1, -1, -1, -1 }; - char* s; - char* end; - bool noTime; - // Get the minute value - if ((s = strchr(timeStr, ':')) == 0) - noTime = true; - else - { - noTime = false; - *s++ = 0; - dt[4] = strtoul(s, &end, 10); - if (end == s || *end || dt[4] >= 60) - return false; - // Get the hour value - if ((s = strrchr(timeStr, '-')) == 0) - s = timeStr; - else - *s++ = 0; - dt[3] = strtoul(s, &end, 10); - if (end == s || *end || dt[3] >= 24) - return false; - } - bool noDate = true; - if (s != timeStr) - { - noDate = false; - // Get the day value - if ((s = strrchr(timeStr, '-')) == 0) - s = timeStr; - else - *s++ = 0; - dt[2] = strtoul(s, &end, 10); - if (end == s || *end || dt[2] == 0 || dt[2] > 31) - return false; - if (s != timeStr) - { - // Get the month value - if ((s = strrchr(timeStr, '-')) == 0) - s = timeStr; - else - *s++ = 0; - dt[1] = strtoul(s, &end, 10); - if (end == s || *end || dt[1] == 0 || dt[1] > 12) - return false; - if (s != timeStr) - { - // Get the year value - dt[0] = strtoul(timeStr, &end, 10); - if (end == timeStr || *end) - return false; - } - } - } - - QDate date(dt[0], dt[1], dt[2]); - QTime time(0, 0, 0); - if (noTime) - { - // No time was specified, so the full date must have been specified - if (dt[0] < 0 || !date.isValid()) - return false; - dateTime = KAlarm::applyTimeZone(zone, date, time, false, defaultDt); - } - else - { - // Compile the values into a date/time structure - time.setHMS(dt[3], dt[4], 0); - if (dt[0] < 0) - { - // Some or all of the date was omitted. - // Use the default date/time if provided. - if (defaultDt.isValid()) - { - dt[0] = defaultDt.date().year(); - date.setYMD(dt[0], - (dt[1] < 0 ? defaultDt.date().month() : dt[1]), - (dt[2] < 0 ? defaultDt.date().day() : dt[2])); - } - else - date.setYMD(2000, 1, 1); // temporary substitute for date - } - dateTime = KAlarm::applyTimeZone(zone, date, time, true, defaultDt); - if (!dateTime.isValid()) - return false; - if (dt[0] < 0) - { - // Some or all of the date was omitted. - // Use the current date in the specified time zone as default. - KDateTime now = KDateTime::currentDateTime(dateTime.timeSpec()); - date = dateTime.date(); - date.setYMD(now.date().year(), - (dt[1] < 0 ? now.date().month() : dt[1]), - (dt[2] < 0 ? now.date().day() : dt[2])); - if (!date.isValid()) - return false; - if (noDate && time < now.time()) - date = date.addDays(1); - dateTime.setDate(date); - } - } - return dateTime.isValid(); -} - -/****************************************************************************** * Convert a time interval command line parameter. * 'timeInterval' receives the count for the recurType. If 'allowMonthYear' is * false, weeks are converted to days in 'timeInterval'. diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/kalarm.autostart.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/kalarm.autostart.desktop --- kdepim-4.0.83/kalarm/kalarm.autostart.desktop 2008-06-11 09:33:39.000000000 +0100 +++ kdepim-4.0.98/kalarm/kalarm.autostart.desktop 2008-06-25 08:58:31.000000000 +0100 @@ -19,6 +19,7 @@ X-DocPath=kalarm/index.html Comment=KAlarm autostart at login Comment[ca]=Inici automàtic del KAlarm en connectar-se +Comment[da]=Autostart KAlarm ved login Comment[de]=Autostart von KAlarm bei der Anmeldung Comment[el]=Αυτόματη εκκίνηση KAlarm κατά τη σύνδεση Comment[et]=KAlarmi automaatne käivitamine sisselogimisel diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/kalarm.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/kalarm.h --- kdepim-4.0.83/kalarm/kalarm.h 2008-06-03 10:34:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/kalarm.h 2008-07-08 10:56:29.000000000 +0100 @@ -23,13 +23,11 @@ #undef QT3_SUPPORT -#define KALARM_VERSION "2.0.0beta4" +#define KALARM_VERSION "2.0.0" #define KALARM_NAME "KAlarm" #define KALARM_DBUS_SERVICE "org.kde.kalarm" // D-Bus service name of KAlarm application #include -#define AUTOSTART_BY_KALARMD // temporary fix for autostart before session restoration - #endif // KALARM_H diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/kalarm.upd /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/kalarm.upd --- kdepim-4.0.83/kalarm/kalarm.upd 2008-04-18 08:22:37.000000000 +0100 +++ kdepim-4.0.98/kalarm/kalarm.upd 2008-07-08 10:56:29.000000000 +0100 @@ -50,3 +50,8 @@ RemoveKey=DaemonTrayCheckInterval Key=AutostartTray,AutoStart Key=RunInSystemTray,ShowInSystemTray + +# KAlarm version 2.0.0 +Id=2.0.0 +File=kalarmrc +RemoveGroup=EditDialog diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/karecurrence.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/karecurrence.cpp --- kdepim-4.0.83/kalarm/karecurrence.cpp 2008-04-23 16:51:52.000000000 +0100 +++ kdepim-4.0.98/kalarm/karecurrence.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -111,8 +111,8 @@ if (count < -1) return false; bool dateOnly = start.isDateOnly(); - if (!count && (!dateOnly && !end.isValid() - || dateOnly && !end.date().isValid())) + if (!count && ((!dateOnly && !end.isValid()) + || (dateOnly && !end.date().isValid()))) return false; switch (recurType) { @@ -136,7 +136,7 @@ setEndDateTime(end); KDateTime startdt = start; if (recurType == RecurrenceRule::rYearly - && feb29Type == Preferences::Feb29_Feb28 || feb29Type == Preferences::Feb29_Mar1) + && (feb29Type == Preferences::Feb29_Feb28 || feb29Type == Preferences::Feb29_Mar1)) { int year = startdt.date().year(); if (!QDate::isLeapYear(year) @@ -255,7 +255,7 @@ { // This is the second rule. // Ensure that it can be combined with the first one. - if (day == days[0] || day == -1 && days[0] == 60 + if (day == days[0] || (day == -1 && days[0] == 60) || rrule->frequency() != rrules[0]->frequency() || rrule->startDt() != rrules[0]->startDt()) break; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/lib/lineedit.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/lib/lineedit.cpp --- kdepim-4.0.83/kalarm/lib/lineedit.cpp 2008-01-15 01:58:08.000000000 +0000 +++ kdepim-4.0.98/kalarm/lib/lineedit.cpp 2008-07-08 10:56:28.000000000 +0100 @@ -1,7 +1,7 @@ /* * lineedit.cpp - Line edit widget with extra drag and drop options * Program: kalarm - * Copyright © 2003-2005 by David Jarvie + * Copyright © 2003-2005 by David Jarvie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -100,8 +100,8 @@ else ok = (data->hasText() || KUrl::List::canDecode(data) - || mType != Url && KPIM::MailList::canDecode(data) - || mType == Emails && KPIM::KVCardDrag::canDecode(data)); + || (mType != Url && KPIM::MailList::canDecode(data)) + || (mType == Emails && KPIM::KVCardDrag::canDecode(data))); if (ok) e->accept(rect()); else diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/lib/shellprocess.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/lib/shellprocess.cpp --- kdepim-4.0.83/kalarm/lib/shellprocess.cpp 2008-05-21 09:33:40.000000000 +0100 +++ kdepim-4.0.98/kalarm/lib/shellprocess.cpp 2008-07-08 10:56:28.000000000 +0100 @@ -88,8 +88,8 @@ else { // Some shells report if the command couldn't be found, or is not executable - if (mShellName == "bash" && (exitCode == 126 || exitCode == 127) - || mShellName == "ksh" && exitCode == 127) + if ((mShellName == "bash" && (exitCode == 126 || exitCode == 127)) + || (mShellName == "ksh" && exitCode == 127)) { kWarning(5950) << mCommand << ":" << mShellName << ": not found or not executable"; mStatus = NOT_FOUND; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/lib/spinbox2.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/lib/spinbox2.cpp --- kdepim-4.0.83/kalarm/lib/spinbox2.cpp 2008-03-13 08:16:26.000000000 +0000 +++ kdepim-4.0.98/kalarm/lib/spinbox2.cpp 2008-07-08 10:56:28.000000000 +0100 @@ -464,8 +464,8 @@ } int adjust = mSpinbox->shiftStepAdjustment(oldValue, step); if (adjust == -step - && (step > 0 && oldValue + step >= mSpinbox->maximum() - || step < 0 && oldValue + step <= mSpinbox->minimum())) + && ((step > 0 && oldValue + step >= mSpinbox->maximum()) + || (step < 0 && oldValue + step <= mSpinbox->minimum()))) adjust = 0; // allow stepping to the minimum or maximum value mSpinbox->addValue(adjust + step); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/lib/spinbox.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/lib/spinbox.cpp --- kdepim-4.0.83/kalarm/lib/spinbox.cpp 2008-04-02 13:19:04.000000000 +0100 +++ kdepim-4.0.98/kalarm/lib/spinbox.cpp 2008-07-08 10:56:28.000000000 +0100 @@ -1,7 +1,7 @@ /* * spinbox.cpp - spin box with read-only option and shift-click step value * Program: kalarm - * Copyright © 2002,2004-2008 by David Jarvie + * Copyright © 2002,2004-2008 by David Jarvie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -319,7 +319,7 @@ if (mReadOnly) return true; // discard the event bool shift = (state & (Qt::ShiftModifier | Qt::AltModifier)) == Qt::ShiftModifier; - if (!shift && mShiftMouse || shift && !mShiftMouse) + if ((!shift && mShiftMouse) || (shift && !mShiftMouse)) { // The effective shift state has changed. // Set normal or shift stepping as appropriate. diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/lib/timeedit.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/lib/timeedit.cpp --- kdepim-4.0.83/kalarm/lib/timeedit.cpp 2008-01-15 01:58:08.000000000 +0000 +++ kdepim-4.0.98/kalarm/lib/timeedit.cpp 2008-07-08 10:56:28.000000000 +0100 @@ -1,7 +1,7 @@ /* * timeedit.cpp - time-of-day edit widget, with AM/PM shown depending on locale * Program: kalarm - * Copyright (c) 2004-2006 by David Jarvie + * Copyright © 2001-2006 by David Jarvie * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,8 +77,8 @@ void TimeEdit::setValid(bool valid) { bool oldValid = mSpinBox->isValid(); - if (valid && !oldValid - || !valid && oldValid) + if ((valid && !oldValid) + || (!valid && oldValid)) { mSpinBox->setValid(valid); if (mAmPm) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/lib/timeperiod.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/lib/timeperiod.cpp --- kdepim-4.0.83/kalarm/lib/timeperiod.cpp 2008-01-29 09:18:33.000000000 +0000 +++ kdepim-4.0.98/kalarm/lib/timeperiod.cpp 2008-07-08 10:56:28.000000000 +0100 @@ -211,7 +211,7 @@ else if (item > mMaxUnitShown) item = mMaxUnitShown; mUnitsCombo->setCurrentIndex(item - mDateOnlyOffset); - if (dateOnly && !mDateOnlyOffset || !dateOnly && mDateOnlyOffset) + if ((dateOnly && !mDateOnlyOffset) || (!dateOnly && mDateOnlyOffset)) item = setDateOnly(perod, dateOnly, false); } showHourMin(item == HoursMinutes && !mNoHourMinute); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/messagewin.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/messagewin.cpp --- kdepim-4.0.83/kalarm/messagewin.cpp 2008-05-21 09:33:40.000000000 +0100 +++ kdepim-4.0.98/kalarm/messagewin.cpp 2008-07-03 06:06:11.000000000 +0100 @@ -131,15 +131,6 @@ }; -static QRect desktopWorkArea() -{ -#ifdef Q_WS_X11 - return KWindowSystem::workArea(); -#else - return qApp->desktop()->availableGeometry(); -#endif -} - // Basic flags for the window static const Qt::WFlags WFLAGS = Qt::WindowStaysOnTopHint; static const Qt::WFlags WFLAGS2 = Qt::WindowContextHelpButtonHint; @@ -373,7 +364,7 @@ { bool showZone = false; if (mDateTime.timeType() == KDateTime::UTC - || mDateTime.timeType() == KDateTime::TimeZone && !mDateTime.isLocalZone()) + || (mDateTime.timeType() == KDateTime::TimeZone && !mDateTime.isLocalZone())) { // Display time zone abbreviation if it's different from the local // zone. Note that the iCalendar time zone might represent the local @@ -484,7 +475,7 @@ topLayout->addSpacing(vspace); topLayout->addStretch(); // Don't include any horizontal margins if message is 2/3 screen width - if (text->sizeHint().width() >= desktopWorkArea().width()*2/3) + if (text->sizeHint().width() >= KAlarm::desktopWorkArea().width()*2/3) topLayout->addWidget(text, 1, Qt::AlignHCenter); else { @@ -1268,7 +1259,7 @@ } // Limit the size to fit inside the working area of the desktop - QSize desktop = desktopWorkArea().size(); + QSize desktop = KAlarm::desktopWorkArea().size(); QSize frameThickness = frameGeometry().size() - geometry().size(); // title bar & window frame return desired.boundedTo(desktop - frameThickness); } @@ -1298,7 +1289,7 @@ KAlarm::readConfigWindowSize("FileMessage", s); resize(s); - QRect desk = desktopWorkArea(); + QRect desk = KAlarm::desktopWorkArea(); QRect frame = frameGeometry(); mButtonDelay = Preferences::messageButtonDelay() * 1000; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/prefdlg.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/prefdlg.cpp --- kdepim-4.0.83/kalarm/prefdlg.cpp 2008-06-18 13:42:07.000000000 +0100 +++ kdepim-4.0.98/kalarm/prefdlg.cpp 2008-07-03 06:06:11.000000000 +0100 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -77,8 +78,11 @@ #include "timespinbox.h" #include "timezonecombo.h" #include "traywindow.h" +#include "prefdlg_p.moc" #include "prefdlg.moc" +static const char PREF_DIALOG_NAME[] = "PrefDialog"; + // Command strings for executing commands in different types of terminal windows. // %t = window title parameter // %c = command to execute in terminal @@ -107,6 +111,18 @@ if (!mInstance) { mInstance = new KAlarmPrefDlg; + if (DialogScroll::heightReduction()) + { + // Evaluating the scroll size and then displaying the dialog + // doesn't adjust the dialog size to fit the minimum height of + // the pages. The only way to size the dialog correctly seems + // to be to delete the dialog and create it a second time!?! + delete mInstance; + mInstance = new KAlarmPrefDlg; + } + QSize s; + if (KAlarm::readConfigWindowSize(PREF_DIALOG_NAME, s)) + mInstance->resize(s); mInstance->show(); } else @@ -262,6 +278,41 @@ Preferences::self()->useDefaults(false); } +/****************************************************************************** +* Return the minimum size for the dialog. +* If the minimum size would be too high to fit the desktop, the tab contents +* are made scrollable. +*/ +QSize KAlarmPrefDlg::minimumSizeHint() const +{ + if (!DialogScroll::sized()) + { + KAlarmPrefDlg* thisvar = const_cast(this); + QSize s = DialogScroll::initMinimumHeight(thisvar); + if (s.isValid()) + { + if (DialogScroll::heightReduction()) + { + s = QSize(s.width(), s.height() - DialogScroll::heightReduction()); + thisvar->resize(s); + } + return s; + } + } + return KDialog::minimumSizeHint(); +} + +/****************************************************************************** +* Called when the dialog's size has changed. +* Records the new size in the config file. +*/ +void KAlarmPrefDlg::resizeEvent(QResizeEvent* re) +{ + if (isVisible()) + KAlarm::writeConfigWindowSize(PREF_DIALOG_NAME, re->size()); + KPageDialog::resizeEvent(re); +} + /*============================================================================= = Class PrefsTabBase @@ -269,10 +320,11 @@ int PrefsTabBase::mIndentWidth = 0; PrefsTabBase::PrefsTabBase() - : KVBox() { - setMargin(0); - setSpacing(KDialog::spacingHint()); + mTopWidget = new KVBox(this); + mTopWidget->setMargin(0); + mTopWidget->setSpacing(KDialog::spacingHint()); + setWidget(mTopWidget); if (!mIndentWidth) { QRadioButton radio(this); @@ -280,7 +332,7 @@ opt.initFrom(&radio); mIndentWidth = style()->subElementRect(QStyle::SE_RadioButtonIndicator, &opt).width(); } - mTopLayout = qobject_cast(layout()); + mTopLayout = qobject_cast(mTopWidget->layout()); Q_ASSERT(mTopLayout); } @@ -299,7 +351,7 @@ MiscPrefTab::MiscPrefTab() : PrefsTabBase() { - QGroupBox* group = new QGroupBox(i18nc("@title:group", "Run Mode"), this); + QGroupBox* group = new QGroupBox(i18nc("@title:group", "Run Mode"), topWidget()); QVBoxLayout* vlayout = new QVBoxLayout(group); vlayout->setMargin(KDialog::marginHint()); vlayout->setSpacing(KDialog::spacingHint()); @@ -319,7 +371,7 @@ group->setFixedHeight(group->sizeHint().height()); // Confirm alarm deletion? - KHBox* itemBox = new KHBox(this); // this is to allow left adjustment + KHBox* itemBox = new KHBox(topWidget()); // this is to allow left adjustment itemBox->setMargin(0); mConfirmAlarmDeletion = new QCheckBox(i18nc("@option:check", "Confirm alarm deletions"), itemBox); mConfirmAlarmDeletion->setMinimumSize(mConfirmAlarmDeletion->sizeHint()); @@ -328,7 +380,7 @@ itemBox->setFixedHeight(itemBox->sizeHint().height()); // Terminal window to use for command alarms - group = new QGroupBox(i18nc("@title:group", "Terminal for Command Alarms"), this); + group = new QGroupBox(i18nc("@title:group", "Terminal for Command Alarms"), topWidget()); group->setWhatsThis(i18nc("@info:whatsthis", "Choose which application to use when a command alarm is executed in a terminal window")); QGridLayout* grid = new QGridLayout(group); grid->setMargin(KDialog::marginHint()); @@ -420,7 +472,7 @@ if (KStandardDirs::findExe(cmd).isEmpty()) { mXtermCommand->setFocus(); - if (KMessageBox::warningContinueCancel(this, i18nc("@info", "Command to invoke terminal window not found: %1", cmd)) + if (KMessageBox::warningContinueCancel(topWidget(), i18nc("@info", "Command to invoke terminal window not found: %1", cmd)) != KMessageBox::Continue) return; } @@ -453,7 +505,7 @@ void MiscPrefTab::slotAutostartClicked() { if (!mAutoStart->isChecked() - && KMessageBox::warningYesNo(this, + && KMessageBox::warningYesNo(topWidget(), i18nc("@info", "You should not uncheck this option unless you intend to discontinue use of KAlarm"), QString(), KStandardGuiItem::cont(), KStandardGuiItem::cancel() ) != KMessageBox::Yes) @@ -474,7 +526,7 @@ : PrefsTabBase() { // Default time zone - KHBox* itemBox = new KHBox(this); + KHBox* itemBox = new KHBox(topWidget()); itemBox->setMargin(0); KHBox* box = new KHBox(itemBox); // this is to control the QWhatsThis text display area box->setMargin(0); @@ -498,7 +550,7 @@ itemBox->setFixedHeight(box->sizeHint().height()); // Start-of-day time - itemBox = new KHBox(this); + itemBox = new KHBox(topWidget()); itemBox->setMargin(0); box = new KHBox(itemBox); // this is to control the QWhatsThis text display area box->setMargin(0); @@ -514,7 +566,7 @@ // Working hours - QGroupBox* group = new QGroupBox(i18nc("@title:group", "Working Hours"), this); + QGroupBox* group = new QGroupBox(i18nc("@title:group", "Working Hours"), topWidget()); QBoxLayout* layout = new QVBoxLayout(group); layout->setMargin(KDialog::marginHint()); layout->setSpacing(KDialog::spacingHint()); @@ -634,7 +686,7 @@ mCheckKeepChanges(false) { // Which resource to save to - QGroupBox* group = new QGroupBox(i18nc("@title:group", "New Alarms && Templates"), this); + QGroupBox* group = new QGroupBox(i18nc("@title:group", "New Alarms && Templates"), topWidget()); QButtonGroup* bgroup = new QButtonGroup(group); QBoxLayout* layout = new QVBoxLayout(group); layout->setMargin(KDialog::marginHint()); @@ -652,7 +704,7 @@ layout->addWidget(mAskResource, 0, Qt::AlignLeft); // Archived alarms - group = new QGroupBox(i18nc("@title:group", "Archived Alarms"), this); + group = new QGroupBox(i18nc("@title:group", "Archived Alarms"), topWidget()); QGridLayout* grid = new QGridLayout(group); grid->setMargin(KDialog::marginHint()); grid->setSpacing(KDialog::spacingHint()); @@ -728,7 +780,7 @@ if (keep && !mOldKeepArchived && mCheckKeepChanges && !AlarmResources::instance()->getStandardResource(AlarmResource::ARCHIVED)) { - KMessageBox::sorry(this, + KMessageBox::sorry(topWidget(), i18nc("@info", "A default resource is required in order to archive alarms, but none is currently enabled." "If you wish to keep expired alarms, please first use the resources view to select a default " "archived alarms resource.")); @@ -745,7 +797,7 @@ void StorePrefTab::slotClearArchived() { bool single = AlarmResources::instance()->activeCount(AlarmResource::ARCHIVED, false) <= 1; - if (KMessageBox::warningContinueCancel(this, single ? i18nc("@info", "Do you really want to delete all archived alarms?") + if (KMessageBox::warningContinueCancel(topWidget(), single ? i18nc("@info", "Do you really want to delete all archived alarms?") : i18nc("@info", "Do you really want to delete all alarms in the default archived alarm resource?")) != KMessageBox::Continue) return; @@ -762,7 +814,7 @@ mAddressChanged(false), mBccAddressChanged(false) { - KHBox* box = new KHBox(this); + KHBox* box = new KHBox(topWidget()); box->setMargin(0); box->setSpacing(2*KDialog::spacingHint()); QLabel* label = new QLabel(i18nc("@label", "Email client:"), box); @@ -784,14 +836,14 @@ "your system is configured to use sendmail or a sendmail compatible mail transport agent.", kmailOption, sendmailOption)); - box = new KHBox(this); // this is to allow left adjustment + box = new KHBox(topWidget()); // this is to allow left adjustment box->setMargin(0); mEmailCopyToKMail = new QCheckBox(i18nc("@option:check", "Copy sent emails into KMail's %1 folder", KAMail::i18n_sent_mail()), box); mEmailCopyToKMail->setWhatsThis(i18nc("@info:whatsthis", "After sending an email, store a copy in KMail's %1 folder", KAMail::i18n_sent_mail())); box->setStretchFactor(new QWidget(box), 1); // left adjust the controls box->setFixedHeight(box->sizeHint().height()); - box = new KHBox(this); // this is to allow left adjustment + box = new KHBox(topWidget()); // this is to allow left adjustment box->setMargin(0); mEmailQueuedNotify = new QCheckBox(i18nc("@option:check", "Notify when remote emails are queued"), box); mEmailQueuedNotify->setWhatsThis( @@ -801,7 +853,7 @@ box->setFixedHeight(box->sizeHint().height()); // Your Email Address group box - QGroupBox* group = new QGroupBox(i18nc("@title:group", "Your Email Address"), this); + QGroupBox* group = new QGroupBox(i18nc("@title:group", "Your Email Address"), topWidget()); QGridLayout* grid = new QGridLayout(group); grid->setMargin(KDialog::marginHint()); grid->setSpacing(KDialog::spacingHint()); @@ -895,7 +947,7 @@ Preferences::setEmailCopyToKMail(b); int from = mFromAddressGroup->selectedId(); QString text = mEmailAddress->text().trimmed(); - if (from >= 0 && static_cast(from) != Preferences::emailFrom() + if ((from >= 0 && static_cast(from) != Preferences::emailFrom()) || text != Preferences::emailAddress()) Preferences::setEmailAddress(static_cast(from), text); b = (mBccAddressGroup->checkedButton() == mBccCCentreButton); @@ -986,7 +1038,7 @@ FontColourPrefTab::FontColourPrefTab() : PrefsTabBase() { - mFontChooser = new FontColourChooser(this, QStringList(), i18nc("@title:group", "Message Font && Color"), true, false); + mFontChooser = new FontColourChooser(topWidget(), QStringList(), i18nc("@title:group", "Message Font && Color"), true, false); QHBoxLayout* hlayout = new QHBoxLayout(); hlayout->setMargin(0); @@ -995,7 +1047,7 @@ colourLayout->setMargin(0); hlayout->addLayout(colourLayout); - KHBox* box = new KHBox(this); // to group widgets for QWhatsThis text + KHBox* box = new KHBox(topWidget()); // to group widgets for QWhatsThis text box->setMargin(0); box->setSpacing(KDialog::spacingHint()/2); colourLayout->addWidget(box); @@ -1005,7 +1057,7 @@ label1->setBuddy(mDisabledColour); box->setWhatsThis(i18nc("@info:whatsthis", "Choose the text color in the alarm list for disabled alarms.")); - box = new KHBox(this); // to group widgets for QWhatsThis text + box = new KHBox(topWidget()); // to group widgets for QWhatsThis text box->setMargin(0); box->setSpacing(KDialog::spacingHint()/2); colourLayout->addWidget(box); @@ -1058,7 +1110,7 @@ #define DEFSETTING "The default setting for %1 in the alarm edit dialog." // DISPLAY ALARMS - QGroupBox* group = new QGroupBox(i18nc("@title:group", "Display Alarms"), this); + QGroupBox* group = new QGroupBox(i18nc("@title:group", "Display Alarms"), topWidget()); QVBoxLayout* vlayout = new QVBoxLayout(group); vlayout->setMargin(KDialog::marginHint()); vlayout->setSpacing(KDialog::spacingHint()); @@ -1092,7 +1144,7 @@ mSpecialActionsButton->setFixedSize(mSpecialActionsButton->sizeHint()); // SOUND - QGroupBox* bbox = new QGroupBox(i18nc("@title:group Audio options group", "Sound"), this); + QGroupBox* bbox = new QGroupBox(i18nc("@title:group Audio options group", "Sound"), topWidget()); vlayout = new QVBoxLayout(bbox); vlayout->setMargin(KDialog::marginHint()); vlayout->setSpacing(KDialog::spacingHint()); @@ -1134,7 +1186,7 @@ bbox->setFixedHeight(bbox->sizeHint().height()); // COMMAND ALARMS - group = new QGroupBox(i18nc("@title:group", "Command Alarms"), this); + group = new QGroupBox(i18nc("@title:group", "Command Alarms"), topWidget()); vlayout = new QVBoxLayout(group); vlayout->setMargin(KDialog::marginHint()); vlayout->setSpacing(KDialog::spacingHint()); @@ -1154,7 +1206,7 @@ hlayout->addWidget(mCmdXterm); // EMAIL ALARMS - group = new QGroupBox(i18nc("@title:group", "Email Alarms"), this); + group = new QGroupBox(i18nc("@title:group", "Email Alarms"), topWidget()); vlayout = new QVBoxLayout(group); vlayout->setMargin(KDialog::marginHint()); vlayout->setSpacing(KDialog::spacingHint()); @@ -1167,12 +1219,12 @@ // MISCELLANEOUS // Show in KOrganizer - mCopyToKOrganizer = new QCheckBox(EditAlarmDlg::i18n_chk_ShowInKOrganizer(), this); + mCopyToKOrganizer = new QCheckBox(EditAlarmDlg::i18n_chk_ShowInKOrganizer(), topWidget()); mCopyToKOrganizer->setMinimumSize(mCopyToKOrganizer->sizeHint()); mCopyToKOrganizer->setWhatsThis(i18nc("@info:whatsthis", DEFSETTING, EditAlarmDlg::i18n_chk_ShowInKOrganizer())); // Late cancellation - box = new KHBox(this); + box = new KHBox(topWidget()); box->setMargin(0); box->setSpacing(KDialog::spacingHint()); mLateCancel = new QCheckBox(LateCancelSelector::i18n_chk_CancelIfLate(), box); @@ -1199,7 +1251,7 @@ box->setFixedHeight(itemBox->sizeHint().height()); // How to handle February 29th in yearly recurrences - KVBox* vbox = new KVBox(this); // this is to control the QWhatsThis text display area + KVBox* vbox = new KVBox(topWidget()); // this is to control the QWhatsThis text display area vbox->setMargin(0); vbox->setSpacing(KDialog::spacingHint()); label = new QLabel(i18nc("@label", "In non-leap years, repeat yearly February 29th alarms on:"), vbox); @@ -1385,7 +1437,7 @@ : PrefsTabBase() { // Run-in-system-tray radio button - KHBox* box = new KHBox(this); // this is to allow left adjustment + KHBox* box = new KHBox(topWidget()); // this is to allow left adjustment box->setMargin(0); mShowInSystemTray = new QCheckBox(i18nc("@option:check", "Show in system tray"), box); mShowInSystemTray->setWhatsThis( @@ -1394,7 +1446,7 @@ box->setStretchFactor(new QWidget(box), 1); // left adjust the controls box->setFixedHeight(box->sizeHint().height()); - QGroupBox* group = new QGroupBox(i18nc("@title:group", "System Tray Tooltip"), this); + QGroupBox* group = new QGroupBox(i18nc("@title:group", "System Tray Tooltip"), topWidget()); QGridLayout* grid = new QGridLayout(group); grid->setMargin(KDialog::marginHint()); grid->setSpacing(KDialog::spacingHint()); @@ -1446,7 +1498,7 @@ grid->addWidget(box, 4, 2, Qt::AlignLeft); group->setMaximumHeight(group->sizeHint().height()); - group = new QGroupBox(i18nc("@title:group", "Alarm Message Windows"), this); + group = new QGroupBox(i18nc("@title:group", "Alarm Message Windows"), topWidget()); grid = new QGridLayout(group); grid->setMargin(KDialog::marginHint()); grid->setSpacing(KDialog::spacingHint()); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/prefdlg.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/prefdlg.h --- kdepim-4.0.83/kalarm/prefdlg.h 2008-06-18 13:42:07.000000000 +0100 +++ kdepim-4.0.98/kalarm/prefdlg.h 2008-07-03 06:06:11.000000000 +0100 @@ -22,27 +22,6 @@ #define PREFDLG_H #include -#include - -#include "preferences.h" - -class QCheckBox; -class QAbstractButton; -class QRadioButton; -class QPushButton; -class QLabel; -class QSpinBox; -class KTimeZone; -class KLineEdit; -class KComboBox; -class KColorCombo; -class FontColourChooser; -class ButtonGroup; -class RadioButton; -class TimeEdit; -class SpinBox; -class SpecialActionsButton; -class TimeZoneCombo; class FontColourPrefTab; class EditPrefTab; @@ -60,6 +39,7 @@ public: static void display(); ~KAlarmPrefDlg(); + virtual QSize minimumSizeHint() const; MiscPrefTab* mMiscPage; TimePrefTab* mTimePage; @@ -77,6 +57,9 @@ KPageWidgetItem* mViewPageItem; KPageWidgetItem* mFontColourPageItem; + protected: + virtual void resizeEvent(QResizeEvent*); + protected slots: virtual void slotOk(); virtual void slotApply(); @@ -92,228 +75,4 @@ bool mValid; }; -// Base class for each tab in the Preferences dialog -class PrefsTabBase : public KVBox -{ - Q_OBJECT - public: - PrefsTabBase(); - - void setPreferences(); - virtual void restore(bool defaults) = 0; - virtual void apply(bool syncToDisc) = 0; - QVBoxLayout* topLayout() const { return mTopLayout; } - static int indentWidth() { return mIndentWidth; } - - private: - static int mIndentWidth; // indent width for checkboxes etc. - QVBoxLayout* mTopLayout; -}; - - -// Miscellaneous tab of the Preferences dialog -class MiscPrefTab : public PrefsTabBase -{ - Q_OBJECT - public: - MiscPrefTab(); - - virtual void restore(bool defaults); - virtual void apply(bool syncToDisc); - - private slots: - void slotAutostartClicked(); - void slotOtherTerminalToggled(bool); - - private: - void setTimeZone(const KTimeZone&); - - QCheckBox* mAutoStart; - QCheckBox* mQuitWarn; - QCheckBox* mConfirmAlarmDeletion; - ButtonGroup* mXtermType; - KLineEdit* mXtermCommand; - int mXtermFirst; // id of first terminal window radio button - int mXtermCount; // number of terminal window types -}; - - -// Date/time tab of the Preferences dialog -class TimePrefTab : public PrefsTabBase -{ - Q_OBJECT - public: - TimePrefTab(); - - virtual void restore(bool defaults); - virtual void apply(bool syncToDisc); - - private: - void setWorkDays(const QBitArray& days); - - TimeZoneCombo* mTimeZone; - TimeEdit* mStartOfDay; - QCheckBox* mWorkDays[7]; - TimeEdit* mWorkStart; - TimeEdit* mWorkEnd; -}; - - -// Storage tab of the Preferences dialog -class StorePrefTab : public PrefsTabBase -{ - Q_OBJECT - public: - StorePrefTab(); - - virtual void restore(bool defaults); - virtual void apply(bool syncToDisc); - - private slots: - void slotArchivedToggled(bool); - void slotClearArchived(); - - private: - void setArchivedControls(int purgeDays); - - QRadioButton* mDefaultResource; - QRadioButton* mAskResource; - QCheckBox* mKeepArchived; - QCheckBox* mPurgeArchived; - SpinBox* mPurgeAfter; - QLabel* mPurgeAfterLabel; - QPushButton* mClearArchived; - bool mOldKeepArchived; // previous setting of keep-archived - bool mCheckKeepChanges; -}; - - -// Email tab of the Preferences dialog -class EmailPrefTab : public PrefsTabBase -{ - Q_OBJECT - public: - EmailPrefTab(); - - QString validate(); - virtual void restore(bool defaults); - virtual void apply(bool syncToDisc); - - private slots: - void slotEmailClientChanged(QAbstractButton*); - void slotFromAddrChanged(QAbstractButton*); - void slotBccAddrChanged(QAbstractButton*); - void slotAddressChanged() { mAddressChanged = true; } - - private: - void setEmailAddress(Preferences::MailFrom, const QString& address); - void setEmailBccAddress(bool useControlCentre, const QString& address); - QString validateAddr(ButtonGroup*, KLineEdit* addr, const QString& msg); - - ButtonGroup* mEmailClient; - RadioButton* mKMailButton; - RadioButton* mSendmailButton; - ButtonGroup* mFromAddressGroup; - RadioButton* mFromAddrButton; - RadioButton* mFromCCentreButton; - RadioButton* mFromKMailButton; - KLineEdit* mEmailAddress; - ButtonGroup* mBccAddressGroup; - RadioButton* mBccAddrButton; - RadioButton* mBccCCentreButton; - KLineEdit* mEmailBccAddress; - QCheckBox* mEmailQueuedNotify; - QCheckBox* mEmailCopyToKMail; - bool mAddressChanged; - bool mBccAddressChanged; -}; - - -// Edit defaults tab of the Preferences dialog -class EditPrefTab : public PrefsTabBase -{ - Q_OBJECT - public: - EditPrefTab(); - - QString validate(); - virtual void restore(bool defaults); - virtual void apply(bool syncToDisc); - - private slots: - void slotBrowseSoundFile(); - - private: - QCheckBox* mAutoClose; - QCheckBox* mConfirmAck; - KComboBox* mReminderUnits; - SpecialActionsButton* mSpecialActionsButton; - QCheckBox* mCmdScript; - QCheckBox* mCmdXterm; - QCheckBox* mEmailBcc; - KComboBox* mSound; - QLabel* mSoundFileLabel; - KLineEdit* mSoundFile; - QPushButton* mSoundFileBrowse; - QCheckBox* mSoundRepeat; - QCheckBox* mCopyToKOrganizer; - QCheckBox* mLateCancel; - KComboBox* mRecurPeriod; - ButtonGroup* mFeb29; - - static int soundIndex(Preferences::SoundType); -}; - - -// View tab of the Preferences dialog -class ViewPrefTab : public PrefsTabBase -{ - Q_OBJECT - public: - ViewPrefTab(); - - virtual void restore(bool defaults); - virtual void apply(bool syncToDisc); - - private slots: - void slotTooltipAlarmsToggled(bool); - void slotTooltipMaxToggled(bool); - void slotTooltipTimeToggled(bool); - void slotTooltipTimeToToggled(bool); - void slotWindowPosChanged(QAbstractButton*); - - private: - void setTooltip(int maxAlarms, bool time, bool timeTo, const QString& prefix); - - QCheckBox* mShowInSystemTray; - QCheckBox* mTooltipShowAlarms; - QCheckBox* mTooltipMaxAlarms; - SpinBox* mTooltipMaxAlarmCount; - QCheckBox* mTooltipShowTime; - QCheckBox* mTooltipShowTimeTo; - KLineEdit* mTooltipTimeToPrefix; - QLabel* mTooltipTimeToPrefixLabel; - ButtonGroup* mWindowPosition; - QSpinBox* mWindowButtonDelay; - QLabel* mWindowButtonDelayLabel; - QCheckBox* mModalMessages; -}; - - -// Font & Colour tab of the Preferences dialog -class FontColourPrefTab : public PrefsTabBase -{ - Q_OBJECT - public: - FontColourPrefTab(); - - virtual void restore(bool defaults); - virtual void apply(bool syncToDisc); - - private: - FontColourChooser* mFontChooser; - KColorCombo* mDisabledColour; - KColorCombo* mArchivedColour; -}; - #endif // PREFDLG_H diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/prefdlg_p.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/prefdlg_p.h --- kdepim-4.0.83/kalarm/prefdlg_p.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kalarm/prefdlg_p.h 2008-07-03 06:06:11.000000000 +0100 @@ -0,0 +1,273 @@ +/* + * prefdlg_p.h - private classes for program preferences dialog + * Program: kalarm + * Copyright © 2001-2008 by David Jarvie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef PREFDLG_P_H +#define PREFDLG_P_H + +#include "dialogscroll.h" +#include "preferences.h" +#include "prefdlg.h" + +class QCheckBox; +class QAbstractButton; +class QRadioButton; +class QPushButton; +class QLabel; +class QSpinBox; +class KTimeZone; +class KLineEdit; +class KVBox; +class KComboBox; +class KColorCombo; +class FontColourChooser; +class ButtonGroup; +class RadioButton; +class TimeEdit; +class SpinBox; +class SpecialActionsButton; +class TimeZoneCombo; + + +// Base class for each tab in the Preferences dialog +class PrefsTabBase : public DialogScroll +{ + public: + PrefsTabBase(); + + void setPreferences(); + virtual void restore(bool defaults) = 0; + virtual void apply(bool syncToDisc) = 0; + KVBox* topWidget() const { return mTopWidget; } + QVBoxLayout* topLayout() const { return mTopLayout; } + static int indentWidth() { return mIndentWidth; } + + private: + static int mIndentWidth; // indent width for checkboxes etc. + KVBox* mTopWidget; + QVBoxLayout* mTopLayout; +}; + + +// Miscellaneous tab of the Preferences dialog +class MiscPrefTab : public PrefsTabBase +{ + Q_OBJECT + public: + MiscPrefTab(); + + virtual void restore(bool defaults); + virtual void apply(bool syncToDisc); + + private slots: + void slotAutostartClicked(); + void slotOtherTerminalToggled(bool); + + private: + void setTimeZone(const KTimeZone&); + + QCheckBox* mAutoStart; + QCheckBox* mQuitWarn; + QCheckBox* mConfirmAlarmDeletion; + ButtonGroup* mXtermType; + KLineEdit* mXtermCommand; + int mXtermFirst; // id of first terminal window radio button + int mXtermCount; // number of terminal window types +}; + + +// Date/time tab of the Preferences dialog +class TimePrefTab : public PrefsTabBase +{ + Q_OBJECT + public: + TimePrefTab(); + + virtual void restore(bool defaults); + virtual void apply(bool syncToDisc); + + private: + void setWorkDays(const QBitArray& days); + + TimeZoneCombo* mTimeZone; + TimeEdit* mStartOfDay; + QCheckBox* mWorkDays[7]; + TimeEdit* mWorkStart; + TimeEdit* mWorkEnd; +}; + + +// Storage tab of the Preferences dialog +class StorePrefTab : public PrefsTabBase +{ + Q_OBJECT + public: + StorePrefTab(); + + virtual void restore(bool defaults); + virtual void apply(bool syncToDisc); + + private slots: + void slotArchivedToggled(bool); + void slotClearArchived(); + + private: + void setArchivedControls(int purgeDays); + + QRadioButton* mDefaultResource; + QRadioButton* mAskResource; + QCheckBox* mKeepArchived; + QCheckBox* mPurgeArchived; + SpinBox* mPurgeAfter; + QLabel* mPurgeAfterLabel; + QPushButton* mClearArchived; + bool mOldKeepArchived; // previous setting of keep-archived + bool mCheckKeepChanges; +}; + + +// Email tab of the Preferences dialog +class EmailPrefTab : public PrefsTabBase +{ + Q_OBJECT + public: + EmailPrefTab(); + + QString validate(); + virtual void restore(bool defaults); + virtual void apply(bool syncToDisc); + + private slots: + void slotEmailClientChanged(QAbstractButton*); + void slotFromAddrChanged(QAbstractButton*); + void slotBccAddrChanged(QAbstractButton*); + void slotAddressChanged() { mAddressChanged = true; } + + private: + void setEmailAddress(Preferences::MailFrom, const QString& address); + void setEmailBccAddress(bool useControlCentre, const QString& address); + QString validateAddr(ButtonGroup*, KLineEdit* addr, const QString& msg); + + ButtonGroup* mEmailClient; + RadioButton* mKMailButton; + RadioButton* mSendmailButton; + ButtonGroup* mFromAddressGroup; + RadioButton* mFromAddrButton; + RadioButton* mFromCCentreButton; + RadioButton* mFromKMailButton; + KLineEdit* mEmailAddress; + ButtonGroup* mBccAddressGroup; + RadioButton* mBccAddrButton; + RadioButton* mBccCCentreButton; + KLineEdit* mEmailBccAddress; + QCheckBox* mEmailQueuedNotify; + QCheckBox* mEmailCopyToKMail; + bool mAddressChanged; + bool mBccAddressChanged; +}; + + +// Edit defaults tab of the Preferences dialog +class EditPrefTab : public PrefsTabBase +{ + Q_OBJECT + public: + EditPrefTab(); + + QString validate(); + virtual void restore(bool defaults); + virtual void apply(bool syncToDisc); + + private slots: + void slotBrowseSoundFile(); + + private: + QCheckBox* mAutoClose; + QCheckBox* mConfirmAck; + KComboBox* mReminderUnits; + SpecialActionsButton* mSpecialActionsButton; + QCheckBox* mCmdScript; + QCheckBox* mCmdXterm; + QCheckBox* mEmailBcc; + KComboBox* mSound; + QLabel* mSoundFileLabel; + KLineEdit* mSoundFile; + QPushButton* mSoundFileBrowse; + QCheckBox* mSoundRepeat; + QCheckBox* mCopyToKOrganizer; + QCheckBox* mLateCancel; + KComboBox* mRecurPeriod; + ButtonGroup* mFeb29; + + static int soundIndex(Preferences::SoundType); +}; + + +// View tab of the Preferences dialog +class ViewPrefTab : public PrefsTabBase +{ + Q_OBJECT + public: + ViewPrefTab(); + + virtual void restore(bool defaults); + virtual void apply(bool syncToDisc); + + private slots: + void slotTooltipAlarmsToggled(bool); + void slotTooltipMaxToggled(bool); + void slotTooltipTimeToggled(bool); + void slotTooltipTimeToToggled(bool); + void slotWindowPosChanged(QAbstractButton*); + + private: + void setTooltip(int maxAlarms, bool time, bool timeTo, const QString& prefix); + + QCheckBox* mShowInSystemTray; + QCheckBox* mTooltipShowAlarms; + QCheckBox* mTooltipMaxAlarms; + SpinBox* mTooltipMaxAlarmCount; + QCheckBox* mTooltipShowTime; + QCheckBox* mTooltipShowTimeTo; + KLineEdit* mTooltipTimeToPrefix; + QLabel* mTooltipTimeToPrefixLabel; + ButtonGroup* mWindowPosition; + QSpinBox* mWindowButtonDelay; + QLabel* mWindowButtonDelayLabel; + QCheckBox* mModalMessages; +}; + + +// Font & Colour tab of the Preferences dialog +class FontColourPrefTab : public PrefsTabBase +{ + Q_OBJECT + public: + FontColourPrefTab(); + + virtual void restore(bool defaults); + virtual void apply(bool syncToDisc); + + private: + FontColourChooser* mFontChooser; + KColorCombo* mDisabledColour; + KColorCombo* mArchivedColour; +}; + +#endif // PREFDLG_P_H diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/recurrenceedit.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/recurrenceedit.cpp --- kdepim-4.0.83/kalarm/recurrenceedit.cpp 2008-06-03 10:34:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/recurrenceedit.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -471,8 +471,8 @@ void RecurrenceEdit::slotAnyTimeToggled(bool on) { QAbstractButton* button = mRuleButtonGroup->checkedButton(); - mEndTimeEdit->setEnabled(button == mAtLoginButton && !on - || button == mSubDailyButton && mEndDateButton->isChecked()); + mEndTimeEdit->setEnabled((button == mAtLoginButton && !on) + || (button == mSubDailyButton && mEndDateButton->isChecked())); } /****************************************************************************** @@ -483,7 +483,7 @@ bool endDate = mEndDateButton->isChecked(); mEndDateEdit->setEnabled(endDate); mEndTimeEdit->setEnabled(endDate - && (mAtLoginButton->isChecked() && !mEndAnyTimeCheckBox->isChecked() + && ((mAtLoginButton->isChecked() && !mEndAnyTimeCheckBox->isChecked()) || mSubDailyButton->isChecked())); bool repeatCount = mRepeatCountButton->isChecked(); mRepeatCountEntry->setEnabled(repeatCount); @@ -1030,7 +1030,7 @@ { if (mSavedRuleButton != mRuleButtonGroup->checkedButton() || mSavedRangeButton != mRangeButtonGroup->checkedButton() - || mRule && mRule->stateChanged()) + || (mRule && mRule->stateChanged())) return true; if (mSavedRangeButton == mRepeatCountButton && mSavedRecurCount != mRepeatCountEntry->value()) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/recurrenceedit.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/recurrenceedit.h --- kdepim-4.0.83/kalarm/recurrenceedit.h 2008-04-24 13:27:59.000000000 +0100 +++ kdepim-4.0.98/kalarm/recurrenceedit.h 2008-07-03 06:06:11.000000000 +0100 @@ -60,7 +60,7 @@ // Don't alter the order of these recurrence types enum RepeatType { INVALID_RECUR = -1, NO_RECUR, AT_LOGIN, SUBDAILY, DAILY, WEEKLY, MONTHLY, ANNUAL }; - RecurrenceEdit(bool readOnly, QWidget* parent); + explicit RecurrenceEdit(bool readOnly, QWidget* parent = 0); virtual ~RecurrenceEdit() { } /** Set widgets to default values */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/resources/alarmresource.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/resources/alarmresource.cpp --- kdepim-4.0.83/kalarm/resources/alarmresource.cpp 2008-04-10 10:30:41.000000000 +0100 +++ kdepim-4.0.98/kalarm/resources/alarmresource.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -276,7 +276,7 @@ } if (ronly != oldRCronly) ResourceCached::setReadOnly(ronly); - if ((ronly || mCompatibility != KCalendar::Current && mCompatibility != KCalendar::ByEvent) != oldronly) + if ((ronly || (mCompatibility != KCalendar::Current && mCompatibility != KCalendar::ByEvent)) != oldronly) emit readOnlyChanged(this); // the effective read-only status has changed } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/resources/kalarm_manager.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/resources/kalarm_manager.desktop --- kdepim-4.0.83/kalarm/resources/kalarm_manager.desktop 2008-02-21 09:28:26.000000000 +0000 +++ kdepim-4.0.98/kalarm/resources/kalarm_manager.desktop 2008-06-25 08:58:31.000000000 +0100 @@ -3,6 +3,7 @@ Name=Alarms Name[bg]=Аларми Name[ca]=Alarmes +Name[da]=Alarmer Name[de]=Erinnerungen Name[el]=Ειδοποιήσεις Name[es]=Alarmas diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/resources/local.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/resources/local.desktop --- kdepim-4.0.83/kalarm/resources/local.desktop 2008-03-06 09:52:50.000000000 +0000 +++ kdepim-4.0.98/kalarm/resources/local.desktop 2008-06-25 08:58:31.000000000 +0100 @@ -2,6 +2,7 @@ Name=Alarms in Local File Name[bg]=Аларми в локален файл Name[ca]=Alarmes en un fitxer local +Name[da]=Alarmer i lokal fil Name[de]=Lokale Datei Name[el]=Ειδοποιήσεις σε τοπικό αρχείο Name[es]=Alarmas en un archivo local diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/resources/localdir.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/resources/localdir.desktop --- kdepim-4.0.83/kalarm/resources/localdir.desktop 2008-03-06 09:52:50.000000000 +0000 +++ kdepim-4.0.98/kalarm/resources/localdir.desktop 2008-06-25 08:58:31.000000000 +0100 @@ -3,6 +3,7 @@ Name[be]=Каляндар у мясцовай тэчцы Name[bg]=Аларми в локална директория Name[ca]=Alarmes en un directori local +Name[da]=Alarmer i lokal mappe Name[de]=Lokaler Ordner Name[el]=Ειδοποιήσεις σε τοπικό κατάλογο Name[es]=Alarmas en un directorio local diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/resources/remote.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/resources/remote.desktop --- kdepim-4.0.83/kalarm/resources/remote.desktop 2008-03-06 09:52:50.000000000 +0000 +++ kdepim-4.0.98/kalarm/resources/remote.desktop 2008-06-25 08:58:31.000000000 +0100 @@ -3,6 +3,7 @@ Name[be]=Каляндар у аддаленым файле Name[bg]=Аларми в отдалечен файл Name[ca]=Alarmes en un fitxer remot +Name[da]=Alarmer i ekstern fil Name[de]=Datei auf Fremdrechner Name[el]=Ειδοποιήσεις σε απομακρυσμένο αρχείο Name[es]=Alarmas en un archivo remoto diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kalarm/templatemenuaction.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kalarm/templatemenuaction.cpp --- kdepim-4.0.83/kalarm/templatemenuaction.cpp 2008-04-30 15:00:04.000000000 +0100 +++ kdepim-4.0.98/kalarm/templatemenuaction.cpp 2008-07-08 10:56:29.000000000 +0100 @@ -60,7 +60,7 @@ int j = 0; for (int jend = sorted.count(); j < jend && QString::localeAwareCompare(name, sorted[j]) > 0; - ++j); + ++j) ; sorted.insert(j, name); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kitchensync/src/configguijescs.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kitchensync/src/configguijescs.cpp --- kdepim-4.0.83/kitchensync/src/configguijescs.cpp 2008-01-15 01:58:30.000000000 +0000 +++ kdepim-4.0.98/kitchensync/src/configguijescs.cpp 2008-06-25 08:58:33.000000000 +0100 @@ -94,6 +94,6 @@ layout->addWidget( mPassword, 2, 1, 1, 2 ); mDelNotify = new QCheckBox( this ); - mDelNotify->setText( "Notify attendees about event/task deletion" ); + mDelNotify->setText( i18n("Notify attendees about event/task deletion") ); layout->addWidget( mDelNotify, 3, 0, 1, 3 ); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kitchensync/src/configguisynce.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kitchensync/src/configguisynce.cpp --- kdepim-4.0.83/kitchensync/src/configguisynce.cpp 2008-01-15 01:58:30.000000000 +0000 +++ kdepim-4.0.98/kitchensync/src/configguisynce.cpp 2008-06-25 08:58:33.000000000 +0100 @@ -77,18 +77,19 @@ layout->setMargin( KDialog::marginHint() ); mContacts = new QCheckBox( this ); - mContacts->setText( "Sync Contacts" ); + mContacts->setText( i18n("Sync Contacts") ); layout->addWidget( mContacts, 0, 0, 1, 2 ); mTodos = new QCheckBox( this ); - mTodos->setText( "Sync \'Todo\' items" ); + mTodos->setText( i18n("Sync \'Todo\' items") ); layout->addWidget( mTodos, 1, 0, 1, 2 ); mCalendar = new QCheckBox( this ); - mCalendar->setText( "Sync Calendar" ); + mCalendar->setText( i18n("Sync Calendar") ); layout->addWidget( mCalendar, 2, 0, 1, 2 ); layout->addWidget( new QLabel( i18n( "File:" ), this ), 3, 0 ); mFile = new KLineEdit( this ); layout->addWidget( mFile, 3, 1 ); } + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kitchensync/src/groupitem.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kitchensync/src/groupitem.cpp --- kdepim-4.0.83/kitchensync/src/groupitem.cpp 2008-01-15 01:58:30.000000000 +0000 +++ kdepim-4.0.98/kitchensync/src/groupitem.cpp 2008-06-25 08:58:33.000000000 +0100 @@ -261,7 +261,7 @@ mStatus->setText( i18n( "Connected" ) ); mProgressBar->setValue( 0 ); mSynchronizing = true; - mSyncAction->setText( "Abort Synchronization" ); + mSyncAction->setText( i18n("Abort Synchronization") ); break; case QSync::SyncEngineUpdate::Read: mStatus->setText( i18n( "Data read" ) ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/bookshelf.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/bookshelf.cpp --- kdepim-4.0.83/kjots/bookshelf.cpp 2008-06-10 12:41:22.000000000 +0100 +++ kdepim-4.0.98/kjots/bookshelf.cpp 2008-07-03 06:06:11.000000000 +0100 @@ -30,6 +30,8 @@ #include #include #include +#include +#include #include #include @@ -61,7 +63,6 @@ setDragEnabled(true); setAcceptDrops(true); setDropIndicatorShown(true); - setContextMenuPolicy(Qt::ActionsContextMenu); connect(this, SIGNAL(itemChanged(QTreeWidgetItem*, int)), SLOT(entryRenamed(QTreeWidgetItem*, int))); @@ -70,35 +71,18 @@ void Bookshelf::DelayedInitialization ( KActionCollection *actionCollection ) { loadBooks(); - QAction *sep = new QAction(this); - sep->setSeparator(true); - - QAction *action; - action = actionCollection->addAction("copy_link_address"); - action->setText(i18n("Copy Link Address")); - connect(action, SIGNAL(triggered()), SLOT(copyLinkAddress())); - - // Set up the context menu on the bookshelf. - // TODO: Move this to the xml file. - addAction(actionCollection->action("new_book")); - addAction(actionCollection->action("new_page")); - addAction(actionCollection->action("rename_entry")); - addAction(actionCollection->action("save_to")); - addAction(actionCollection->action("copy_link_address")); - addAction(actionCollection->action("change_color")); - addAction(sep); - addAction(actionCollection->action("del_folder")); - addAction(actionCollection->action("del_page")); - addAction(actionCollection->action("del_mult")); - //These need to be connected after books are loaded. connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(itemWasExpanded(QTreeWidgetItem*))); connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(itemWasCollapsed(QTreeWidgetItem*))); + connect(actionCollection->action("copy_link_address"), SIGNAL(triggered()), + this, SLOT(copyLinkAddress())); connect(actionCollection->action("change_color"), SIGNAL(triggered()), this, SLOT(changeColor())); connect(header(), SIGNAL(sectionClicked(int)), this, SLOT(onHeaderClick(int))); + m_actionCollection = actionCollection; + return; } @@ -168,6 +152,41 @@ return; } +void Bookshelf::contextMenuEvent( QContextMenuEvent* event) +{ + QMenu *popup = new QMenu(this); + + // Set up the context menu on the bookshelf. + // TODO: Move this to the xml file. + popup->addAction(m_actionCollection->action("new_book")); + popup->addAction(m_actionCollection->action("new_page")); + popup->addAction(m_actionCollection->action("rename_entry")); + popup->addAction(m_actionCollection->action("save_to")); + popup->addAction(m_actionCollection->action("copy_link_address")); + popup->addAction(m_actionCollection->action("change_color")); + popup->addSeparator(); + + QList selection = selectedItems(); + if ( selection.size() == 1 ) { + KJotsEntry* entry = static_cast(selection.at(0)); + if ( entry->isBook() ) { + popup->addAction(m_actionCollection->action("del_folder")); + } else { + popup->addAction(m_actionCollection->action("del_folder")); + popup->addAction(m_actionCollection->action("del_page")); + } + } else if ( selection.size() < 1 ) { + // No meaningful selection. + } else { + // Multiple items selected. + popup->addAction(m_actionCollection->action("del_mult")); + } + + popup->exec( event->globalPos() ); + + delete popup; +} + /*! * Runs just before KJots is closed. Save your stuff! */ @@ -254,6 +273,13 @@ } if ( entry->isBook() ) { + // Fix for bug 164480. + // Not certain what the problem is here, but if a page is selected and + // its parent book is deleted, we get a crash. The workaround is to + // select the book before removing it. + // Stephen Kelly - 20th June 2008 + jumpToEntry( entry ); + dynamic_cast(entry)->deleteBook(); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/bookshelf.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/bookshelf.h --- kdepim-4.0.83/kjots/bookshelf.h 2008-06-10 12:41:22.000000000 +0100 +++ kdepim-4.0.98/kjots/bookshelf.h 2008-07-03 06:06:11.000000000 +0100 @@ -76,6 +76,7 @@ virtual void dragEnterEvent ( QDragEnterEvent * ); virtual void dragMoveEvent ( QDragMoveEvent * ); + virtual void contextMenuEvent( QContextMenuEvent* ); Qt::SortOrder sortOrder; @@ -85,6 +86,9 @@ void itemWasCollapsed(QTreeWidgetItem*); void copyLinkAddress(); void changeColor(); + +private: + KActionCollection* m_actionCollection; }; #endif //bookshelf_included diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/CMakeLists.txt --- kdepim-4.0.83/kjots/CMakeLists.txt 2008-06-10 12:41:22.000000000 +0100 +++ kdepim-4.0.98/kjots/CMakeLists.txt 2008-07-03 06:06:11.000000000 +0100 @@ -19,6 +19,8 @@ kjotsreplacenextdialog.cpp kjotsbrowser.cpp kjotslinkdialog.cpp + flatcollectionproxymodel.cpp + kjotsbookshelfentryvalidator.cpp ) @@ -62,8 +64,3 @@ install( FILES kjotspartui.rc DESTINATION ${DATA_INSTALL_DIR}/kjots) install(TARGETS kjotspart DESTINATION ${PLUGIN_INSTALL_DIR} ) - -kde4_install_icons( ${ICON_INSTALL_DIR} ) - - - diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/flatcollectionproxymodel.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/flatcollectionproxymodel.cpp --- kdepim-4.0.83/kjots/flatcollectionproxymodel.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kjots/flatcollectionproxymodel.cpp 2008-06-25 08:58:33.000000000 +0100 @@ -0,0 +1,183 @@ +/* + Copyright (c) 2008 Volker Krause + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#include "flatcollectionproxymodel.h" + +#include + +/** + * @internal + */ +class FlatCollectionProxyModel::Private +{ + public: + Private( FlatCollectionProxyModel* parent ) : q( parent ) {} + + // ### SLOW! + static int totalCount( QAbstractItemModel *model, const QModelIndex &index ) + { + Q_ASSERT( model ); + const int rows = model->rowCount( index ); + int count = rows; + for ( int i = 0; i < rows; ++i ) { + QModelIndex current = model->index( i, 0, index ); + if ( current.isValid() ) + count += totalCount( model, current ); + } + return count; + } + + // ### EVEN SLOWER, and even called multiple times in a row! + static QModelIndex findSourceIndex( QAbstractItemModel *model, int _row, int col, const QModelIndex &parent = QModelIndex() ) + { + int row = _row; + Q_ASSERT( model ); + for ( int i = 0; i <= row; ++i ) { + QModelIndex current = model->index( i, col, parent ); + if ( i == row ) + return current; + const int childCount = totalCount( model, current ); + if ( childCount >= ( row - i ) ) + return findSourceIndex( model, row - i - 1, col, current ); + else + row -= childCount; + } + Q_ASSERT( false ); + return QModelIndex(); + } + + void sourceDataChanged( const QModelIndex &sourceTopLeft, const QModelIndex &sourceBottomRight ) + { + if ( sourceTopLeft != sourceBottomRight ) { + emit q->dataChanged( q->mapFromSource( sourceTopLeft ), q->mapFromSource( sourceBottomRight ) ); + } else { + const QModelIndex proxyIndex = q->mapFromSource( sourceTopLeft ); + emit q->dataChanged( proxyIndex, proxyIndex ); + } + } + + QString ancestorSeparator; + QList< int > flattenRoles; + + FlatCollectionProxyModel *q; +}; + +FlatCollectionProxyModel::FlatCollectionProxyModel(QObject * parent) : + QAbstractProxyModel( parent ), + d( new Private( this ) ) +{ + d->ancestorSeparator = "/"; +} + +void FlatCollectionProxyModel::setAncestorSeparator( QString s) +{ + d->ancestorSeparator = s; +} + +FlatCollectionProxyModel::~FlatCollectionProxyModel() +{ + delete d; +} + +void FlatCollectionProxyModel::setSourceModel(QAbstractItemModel * sourceModel) +{ + QAbstractProxyModel::setSourceModel( sourceModel ); + connect( sourceModel, SIGNAL(modelReset()), SIGNAL(modelReset()) ); + connect( sourceModel, SIGNAL(layoutChanged()), SIGNAL(layoutChanged()) ); + connect( sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + SLOT(sourceDataChanged(QModelIndex,QModelIndex)) ); +} + +int FlatCollectionProxyModel::rowCount(const QModelIndex & parent) const +{ + if ( parent.isValid() ) + return 0; + return d->totalCount( sourceModel(), mapToSource( parent ) ); +} + +int FlatCollectionProxyModel::columnCount(const QModelIndex & parent) const +{ + return sourceModel()->columnCount( mapToSource( parent ) ); +} + +QModelIndex FlatCollectionProxyModel::index(int row, int column, const QModelIndex & parent) const +{ + Q_UNUSED( parent ); + if ( ( row > rowCount() ) || column > columnCount() ) + { + return QModelIndex(); + } + + return createIndex( row, column ); +} + +QModelIndex FlatCollectionProxyModel::parent(const QModelIndex & index) const +{ + Q_UNUSED( index ); + return QModelIndex(); +} + +QModelIndex FlatCollectionProxyModel::mapToSource(const QModelIndex & proxyIndex) const +{ + if ( !proxyIndex.isValid() ) + return QModelIndex(); + return d->findSourceIndex( sourceModel(), proxyIndex.row(), proxyIndex.column() ); +} + +QModelIndex FlatCollectionProxyModel::mapFromSource(const QModelIndex & sourceIndex) const +{ + if ( !sourceIndex.isValid() ) + return QModelIndex(); + int row = 0; + QModelIndex current = sourceIndex; + while ( current.parent() != QModelIndex() ) { + row += current.row() + 1; + for ( int i = current.row() - 1; i >= 0; --i ) + row += d->totalCount( sourceModel(), sourceModel()->index( i, 0, current.parent() ) ); + current = current.parent(); + } + row += current.row(); + for ( int i = current.row() - 1; i >= 0; --i ) + row += d->totalCount( sourceModel(), sourceModel()->index( i, 0 ) ); + return createIndex( row, sourceIndex.column() ); +} + +void FlatCollectionProxyModel::setRolesToFlatten( QList< int > roles ) +{ + d->flattenRoles = roles; +} + +QVariant FlatCollectionProxyModel::data(const QModelIndex & index, int role) const +{ + if ( d->flattenRoles.contains( role ) ) { + QModelIndex sourceIndex = mapToSource( index ); + QString name = sourceIndex.data( role ).toString(); + sourceIndex = sourceIndex.parent(); + while ( sourceIndex.isValid() ) { + if ( index.column() == 0 ) { + name.prepend( sourceIndex.data( role ).toString() + QString( d->ancestorSeparator ) ); + } + sourceIndex = sourceIndex.parent(); + } + return name; + } + return QAbstractProxyModel::data( index, role ); +} + +#include "flatcollectionproxymodel.moc" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/flatcollectionproxymodel.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/flatcollectionproxymodel.h --- kdepim-4.0.83/kjots/flatcollectionproxymodel.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kjots/flatcollectionproxymodel.h 2008-06-25 08:58:33.000000000 +0100 @@ -0,0 +1,67 @@ +/* + Copyright (c) 2008 Volker Krause + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + +#ifndef AKONADI_FLATCOLLECTIONPROXYMODEL_H +#define AKONADI_FLATCOLLECTIONPROXYMODEL_H + +#include + +/** + * @internal + * + * Converts the hierarchical collection model into a flat one. + * + * @todo Make this fast. And maybe even generic. + */ +class FlatCollectionProxyModel : public QAbstractProxyModel +{ + Q_OBJECT + public: + /** + Create a new flat collection proxy model. + @param parent The parent object. + */ + FlatCollectionProxyModel( QObject *parent = 0 ); + + /** + Destructor. + */ + ~FlatCollectionProxyModel(); + + void setSourceModel ( QAbstractItemModel * sourceModel ); + void setAncestorSeparator( QString s); + void setRolesToFlatten( QList< int > roles = QList< int >() << Qt::DisplayRole ); + + QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; + int rowCount( const QModelIndex & parent = QModelIndex() ) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; + QModelIndex index( int row, int column, const QModelIndex & parent = QModelIndex() ) const; + QModelIndex parent( const QModelIndex & index ) const; + + QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const; + QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const; + + private: + class Private; + Private* const d; + + Q_PRIVATE_SLOT( d, void sourceDataChanged( const QModelIndex &, const QModelIndex & ) ) +}; + +#endif diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/icons/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/icons/CMakeLists.txt --- kdepim-4.0.83/kjots/icons/CMakeLists.txt 2008-05-21 09:33:41.000000000 +0100 +++ kdepim-4.0.98/kjots/icons/CMakeLists.txt 2008-07-03 06:06:11.000000000 +0100 @@ -1,6 +1,2 @@ -install( FILES filedel.png DESTINATION ${DATA_INSTALL_DIR}/kjots/pics) - kde4_install_icons( ${ICON_INSTALL_DIR} ) - - Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/icons/filedel.png and /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/icons/filedel.png differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/icons/ox16-actions-edit-delete-page.png and /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/icons/ox16-actions-edit-delete-page.png differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/icons/ox22-actions-edit-delete-page.png and /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/icons/ox22-actions-edit-delete-page.png differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/icons/ox32-actions-edit-delete-page.png and /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/icons/ox32-actions-edit-delete-page.png differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/icons/ox48-actions-edit-delete-page.png and /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/icons/ox48-actions-edit-delete-page.png differ Binary files /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/icons/oxsc-actions-edit-delete-page.svgz and /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/icons/oxsc-actions-edit-delete-page.svgz differ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotsbookshelfentryvalidator.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotsbookshelfentryvalidator.cpp --- kdepim-4.0.83/kjots/kjotsbookshelfentryvalidator.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotsbookshelfentryvalidator.cpp 2008-07-08 10:56:30.000000000 +0100 @@ -0,0 +1,67 @@ +/* + This file is part of KJots. + + Copyright (c) 2008 Stephen Kelly + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + +#include "kjotsbookshelfentryvalidator.h" + +KJotsBookshelfEntryValidator::KJotsBookshelfEntryValidator( QAbstractItemModel* model, QObject* parent ) + : QValidator( parent ) +{ + m_model = model; +} + +KJotsBookshelfEntryValidator::~KJotsBookshelfEntryValidator() +{ + +} + +QValidator::State KJotsBookshelfEntryValidator::validate( QString& input, int& pos ) const +{ + Q_UNUSED(pos); + if (!m_model) + return Invalid; + if (input.isEmpty()) + return Intermediate; + + QModelIndexList list = m_model->match( + m_model->index(0,0), + Qt::DisplayRole, + input, + Qt::MatchStartsWith | Qt::MatchFixedString | Qt::MatchWrap ); + + if (list.empty()) + { + return Invalid; + } + else + { + foreach (const QModelIndex& index, list) + { + if ( 0 == QString::compare(m_model->data(index).toString(), input, Qt::CaseInsensitive ) ) + { + return Acceptable; + } + return Intermediate; + } + } + return Invalid; +} + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotsbookshelfentryvalidator.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotsbookshelfentryvalidator.h --- kdepim-4.0.83/kjots/kjotsbookshelfentryvalidator.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotsbookshelfentryvalidator.h 2008-07-08 10:56:30.000000000 +0100 @@ -0,0 +1,69 @@ +/* + This file is part of KJots. + + Copyright (c) 2008 Stephen Kelly + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ + + +#ifndef KJOTSBOOKSHELFENTRYVALIDATOR +#define KJOTSBOOKSHELFENTRYVALIDATOR + +#include +#include + +/** + This class is a validator intended to be used with an editable QComboBox. + + \a validate returns the state of whether the text in the lineedit matches one of the items in the + model. All matching is attempted on the first column of the model. + +*/ +class KJotsBookshelfEntryValidator : public QValidator +{ + Q_OBJECT + public: + /** + Create a new Validator for Entries in the KJots bookshelf. + @param parent The parent object. + @param model The model to use to validate the input. + */ + explicit KJotsBookshelfEntryValidator( QAbstractItemModel* model, QObject *parent = 0 ); + + /** + Destructor. + */ + ~KJotsBookshelfEntryValidator(); + + /** + Reimplemented. Returns the state of whether \p input matches one of the items in the model. + + If the text does not match any item in the model, the state is Invalid. + If the text is empty, the state is Intermediate. + If the text matches the start of one or more items in the model, the state is Intermediate. + If the text matches one of the items in the model exactly, the state is Acceptable. + + \return The validation state. + */ + virtual QValidator::State validate ( QString& input, int& pos ) const; + + private: + QAbstractItemModel* m_model; + +}; + +#endif diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotscomponent.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotscomponent.cpp --- kdepim-4.0.83/kjots/kjotscomponent.cpp 2008-06-10 12:41:22.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotscomponent.cpp 2008-07-08 10:56:30.000000000 +0100 @@ -119,14 +119,14 @@ QAction *action; action = actionCollection->addAction( "go_next_book"); action->setText( i18n("Next Book") ); - action->setIcon(KIcon("go-next")); + action->setIcon(KIcon("go-down")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); connect(action, SIGNAL(triggered()), bookshelf, SLOT(nextBook())); action = actionCollection->addAction( "go_prev_book"); action->setText( i18n("Previous Book") ); - action->setIcon(KIcon("go-previous")); + action->setIcon(KIcon("go-up")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D)); connect(action, SIGNAL(triggered()), bookshelf, SLOT(prevBook())); @@ -152,8 +152,7 @@ action = actionCollection->addAction("new_book"); action->setText(i18n("New &Book...")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_N)); - action->setIcon(KIcon("x-office-address-book")); - // should rather be "address-book-new", use that once it exists in Oxygen + action->setIcon(KIcon("address-book-new")); connect(action, SIGNAL(triggered()), SLOT(createNewBook())); exportMenu = actionCollection->add("save_to"); @@ -185,7 +184,7 @@ action = actionCollection->addAction("del_page"); action->setText(i18n("&Delete Page")); action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Delete)); - action->setIcon(KIcon("edit-delete-shred")); + action->setIcon(KIcon("edit-delete-page")); connect(action, SIGNAL(triggered()), SLOT(deletePage())); action = actionCollection->addAction("del_folder"); @@ -243,6 +242,7 @@ KStandardAction::find( this, SLOT( onShowSearch() ), actionCollection ); action = KStandardAction::findNext( this, SLOT( onRepeatSearch() ), actionCollection ); + action->setEnabled(false); KStandardAction::replace( this, SLOT( onShowReplace() ), actionCollection ); action = actionCollection->addAction("rename_entry"); @@ -260,6 +260,11 @@ action = actionCollection->addAction("change_color"); action->setIcon(KIcon("format-fill-color")); action->setText(i18n("Change Color...")); + // connected to protected slot in bookshelf.cpp + + action = actionCollection->addAction("copy_link_address"); + action->setText(i18n("Copy Link Address")); + // connected to protected slot in bookshelf.cpp KStandardAction::preferences(this, SLOT(configure()), actionCollection); @@ -318,13 +323,27 @@ connect(replaceDialog, SIGNAL(optionsChanged()), SLOT(onUpdateReplace()) ); connect(replaceAllPages, SIGNAL(stateChanged(int)), SLOT(onUpdateReplace()) ); + // Actions are enabled or disabled based on whether the selection is a single page, a single book + // multiple selections, or no selection. + // + // The entryActions are enabled for all single pages and single books, and the multiselectionActions + // are enabled when the user has made multiple selections. + // + // Some actions are in neither (eg, new book) and are available even when there is no selection. + // + // Some actions are in both, so that they are available for valid selections, but not available + // for invalid selections (eg, print/find are disabled when there is no selection) + // Actions for a single item selection. entryActions.insert( actionCollection->action(KStandardAction::name(KStandardAction::Find)) ); + entryActions.insert( actionCollection->action(KStandardAction::name(KStandardAction::Print)) ); entryActions.insert( actionCollection->action("go_next_book") ); entryActions.insert( actionCollection->action("go_prev_book") ); entryActions.insert( actionCollection->action("del_folder") ); entryActions.insert( actionCollection->action("rename_entry") ); entryActions.insert( actionCollection->action("change_color") ); + entryActions.insert( actionCollection->action("save_to") ); + entryActions.insert( actionCollection->action("copy_link_address") ); // Actions that are used only when a page is selected. pageActions.insert( actionCollection->action(KStandardAction::name(KStandardAction::Cut)) ); @@ -338,11 +357,15 @@ pageActions.insert( actionCollection->action("manage_link") ); pageActions.insert( actionCollection->action("insert_checkmark") ); - // Actions that are used only when a page is selected. + // Actions that are used only when a book is selected. bookActions.insert( actionCollection->action("save_to_book") ); - // Actions that are used only when multiple items are selected. + // Actions that are used when multiple items are selected. + multiselectionActions.insert( actionCollection->action(KStandardAction::name(KStandardAction::Find)) ); + multiselectionActions.insert( actionCollection->action(KStandardAction::name(KStandardAction::Print))); multiselectionActions.insert( actionCollection->action("del_mult") ); + multiselectionActions.insert( actionCollection->action("save_to") ); + multiselectionActions.insert( actionCollection->action("change_color") ); bookshelf->DelayedInitialization(actionCollection); editor->DelayedInitialization(actionCollection, bookshelf); @@ -356,6 +379,11 @@ quint64 currentSelection = KJotsSettings::currentSelection(); bookshelf->jumpToId(currentSelection); } + + connect(bookshelf->itemDelegate(), SIGNAL(closeEditor( QWidget *, QAbstractItemDelegate::EndEditHint )), + SLOT(bookshelfEditItemFinished( QWidget *, QAbstractItemDelegate::EndEditHint ))); + + updateMenu(); } inline QTextEdit* KJotsComponent::activeEditor() { @@ -366,6 +394,12 @@ } } +void KJotsComponent::bookshelfEditItemFinished( QWidget *, QAbstractItemDelegate::EndEditHint ) +{ + // Make sure the editor gets focus again after naming a new book/page. + activeEditor()->setFocus(); +} + void KJotsComponent::copy() { activeEditor()->copy(); } @@ -380,7 +414,17 @@ bookshelf->setItemExpanded(book, true); QTreeWidgetItem *item = static_cast(book); bookshelf->clearSelection(); - bookshelf->setItemSelected(item->child(0), true); + + // Scroll to newly created page. + QTreeWidgetItem* firstPage = item->child(0); + bookshelf->setItemSelected(firstPage, true); + bookshelf->scrollToItem(firstPage); + if ( !KJotsSettings::pageNamePrompt() ) { + // Select the title text of first page of the new book for editing + bookshelf->setCurrentItem(firstPage); + bookshelf->editItem(firstPage); + } + success = true; } @@ -462,6 +506,12 @@ KJotsPage *page = book->addPage(); bookshelf->clearSelection(); bookshelf->setItemSelected(page, true); + bookshelf->scrollToItem(page); + if ( !KJotsSettings::pageNamePrompt() ) { + // Select the title text of first page of the new page for editing + bookshelf->setCurrentItem(page); + bookshelf->editItem(page); + } } } @@ -576,6 +626,8 @@ } } + actionCollection->action(KStandardAction::name(KStandardAction::FindNext))->setEnabled(true); + onRepeatSearch(); } @@ -586,14 +638,16 @@ { if ( search(false) == 0 ) { KMessageBox::sorry(0, i18n("No matches found.")); + actionCollection->action(KStandardAction::name(KStandardAction::FindNext))->setEnabled(false); } } /*! - Called when user presses Cancel in find dialog. Just a placeholder for now. + Called when user presses Cancel in find dialog. */ void KJotsComponent::onEndSearch() { + actionCollection->action(KStandardAction::name(KStandardAction::FindNext))->setEnabled(false); } /*! @@ -944,18 +998,15 @@ void KJotsComponent::saveToFile(KJotsComponent::ExportType type) { - autoSave(); - + autoSave(); QString title; QList entries = bookshelf->selected(); Q_ASSERT(entries.size()); - if ( entries.size() == 1 ) { title = entries[0]->title(); } else { title = i18n("Multiple Selections"); } - KUrl saveUrl; QString encoding; if ( type == Native ) { @@ -965,15 +1016,18 @@ KEncodingFileDialog::Result res; res = KEncodingFileDialog::getSaveUrlAndEncoding( QString("UTF-8"), title + ".html", "*.html|" + i18n("HTML Files")); + if ( res.URLs.isEmpty() ) + return; saveUrl = res.URLs[0]; encoding = res.encoding; } else if ( type == Ascii ) { KEncodingFileDialog::Result res; res = KEncodingFileDialog::getSaveUrlAndEncoding(QString("UTF-8"), title); + if ( res.URLs.isEmpty() ) + return; saveUrl = res.URLs[0]; encoding = res.encoding; } - //Create an interim file for us to write to std::auto_ptr interimFile ( new KTemporaryFile ); interimFile->setAutoRemove(false); @@ -1054,8 +1108,6 @@ KJob *job = KIO::move(tempUrl, saveUrl); connect( job, SIGNAL( result(KJob*) ), this, SLOT( saveFinished(KJob*) ) ); } - - return; } void KJotsComponent::saveFinished(KJob *job) @@ -1238,7 +1290,7 @@ action->setEnabled(false); foreach ( QAction* action, multiselectionActions ) action->setEnabled(true); - + editor->setActionsEnabled( false ); } else { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotscomponent.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotscomponent.h --- kdepim-4.0.83/kjots/kjotscomponent.h 2008-06-10 12:41:22.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotscomponent.h 2008-07-08 10:56:30.000000000 +0100 @@ -36,7 +36,6 @@ class QTimer; class QTextEdit; -class QLabel; class QStackedWidget; class QCheckBox; @@ -93,6 +92,7 @@ void onRenameEntry(); void configure(); void updateConfiguration(); + void bookshelfEditItemFinished( QWidget *, QAbstractItemDelegate::EndEditHint ); void copy(); void copySelection(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/Kjots.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/Kjots.desktop --- kdepim-4.0.83/kjots/Kjots.desktop 2008-06-18 13:42:08.000000000 +0100 +++ kdepim-4.0.98/kjots/Kjots.desktop 2008-06-25 08:58:33.000000000 +0100 @@ -6,12 +6,14 @@ Name[x-test]=xxKJotsxx GenericName=Note Taker GenericName[ca]=Bloc de notes +GenericName[da]=Notetager GenericName[de]=Elektronischer Notizblock GenericName[el]=Σημειώσεις GenericName[et]=Märkmete rakendus GenericName[fr]=Prise de note GenericName[ja]=メモ帳 GenericName[km]=កម្មវិធី​ទទួល​ចំណាំ +GenericName[lv]=Piezīmju blociņš GenericName[nds]=Notizenprogramm GenericName[pl]=Notatki GenericName[pt]=Bloco de Notas diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotsedit.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotsedit.cpp --- kdepim-4.0.83/kjots/kjotsedit.cpp 2008-05-21 09:33:41.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotsedit.cpp 2008-07-03 06:06:11.000000000 +0100 @@ -45,6 +45,7 @@ setWordWrapMode(QTextOption::WordWrap); setRichTextSupport( FullTextFormattingSupport | FullListSupport + | SupportAlignment | SupportRuleLine | SupportFormatPainting ); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotsentry.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotsentry.cpp --- kdepim-4.0.83/kjots/kjotsentry.cpp 2008-05-21 09:33:41.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotsentry.cpp 2008-07-03 06:06:11.000000000 +0100 @@ -195,7 +195,7 @@ QString KJotsEntry::kjotsLinkUrl() { - return kjotsLinkStringPrefix() + id(); + return kjotsLinkStringPrefix() + QString::number(id()); } QString KJotsEntry::kjotsLinkUrlFromId(quint64 id) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotslinkdialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotslinkdialog.cpp --- kdepim-4.0.83/kjots/kjotslinkdialog.cpp 2008-05-29 12:19:37.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotslinkdialog.cpp 2008-06-25 08:58:33.000000000 +0100 @@ -21,6 +21,7 @@ #include "kjotslinkdialog.h" #include +#include #include #include @@ -29,9 +30,10 @@ #include #include #include -#include #include "KJotsSettings.h" +#include "flatcollectionproxymodel.h" +#include "kjotsbookshelfentryvalidator.h" #include "kjotsentry.h" #include "bookshelf.h" @@ -44,7 +46,11 @@ setModal(true); showButtonSeparator(true); mBookshelf = bookshelf; - QAbstractItemModel* model = mBookshelf->model(); + + FlatCollectionProxyModel* proxyModel = new FlatCollectionProxyModel( this ); + proxyModel->setSourceModel( mBookshelf->model() ); + proxyModel->setRolesToFlatten( QList< int >() << Qt::DisplayRole << Qt::EditRole ); + proxyModel->setAncestorSeparator( QLatin1String( " / " ) ); QWidget *entries = new QWidget(this); @@ -59,18 +65,27 @@ linkUrlLineEdit->setClearButtonShown(true); tree = new QTreeView(); - tree->setModel(model); + tree->setModel(proxyModel); tree->expandAll(); tree->setColumnHidden(1, true); - hrefCombo->setModel(mBookshelf->model()); + hrefCombo->setModel(proxyModel); hrefCombo->setView(tree); + hrefCombo->setEditable(true); + QCompleter *completer = new QCompleter(proxyModel, this); + completer->setCaseSensitivity(Qt::CaseInsensitive); + hrefCombo->setCompleter(completer); + KJotsBookshelfEntryValidator* validator = new KJotsBookshelfEntryValidator( proxyModel, this ); + hrefCombo->setValidator( validator ); + QGridLayout* linkLayout = new QGridLayout(); linkUrlLineEditRadioButton = new QRadioButton(entries); hrefComboRadioButton = new QRadioButton(entries); - connect(linkUrlLineEditRadioButton, SIGNAL(toggled(bool)), linkUrlLineEdit, SLOT(setEnabled(bool))); - connect(hrefComboRadioButton, SIGNAL(toggled(bool)), hrefCombo, SLOT(setEnabled(bool))); + connect(linkUrlLineEditRadioButton, SIGNAL(toggled(bool)), + linkUrlLineEdit, SLOT(setEnabled(bool))); + connect(hrefComboRadioButton, SIGNAL(toggled(bool)), + hrefCombo, SLOT(setEnabled(bool))); hrefCombo->setEnabled(false); linkUrlLineEditRadioButton->setChecked(true); @@ -87,6 +102,9 @@ setMainWidget(entries); textLineEdit->setFocus(); + + connect( hrefCombo, SIGNAL( editTextChanged ( const QString & ) ), + this, SLOT( trySetEntry(const QString & ) ) ); } void KJotsLinkDialog::setLinkText(const QString &linkText) @@ -99,17 +117,29 @@ void KJotsLinkDialog::setLinkUrl(const QString &linkUrl) { if (KJotsEntry::isKJotsLink(linkUrl)) { - kDebug() << KJotsEntry::idFromLinkUrl(linkUrl); - KJotsEntry* item = mBookshelf->entryFromId(KJotsEntry::idFromLinkUrl(linkUrl)); + quint64 id = KJotsEntry::idFromLinkUrl(linkUrl); + KJotsEntry* item = mBookshelf->entryFromId(id); if ( item ) { - QModelIndex index = hrefCombo->model()->index(0,1); - index = index.sibling(index.row(), 0); - index = index.sibling(index.row() + 1, 0); - index = index.sibling(index.row(), 1); - index = index.sibling(index.row(), 0); - hrefCombo->view()->setCurrentIndex(index); + QModelIndex index = hrefCombo->model()->index(0,1); + if ( hrefCombo->model()->data(index).toULongLong() == id ) + { + hrefCombo->view()->setCurrentIndex(index); + hrefCombo->setCurrentIndex( index.row() ); + } else { + while ( index.sibling(index.row() + 1, 1).isValid() ) + { + index = index.sibling(index.row() + 1, 1); + + if ( hrefCombo->model()->data(index).toULongLong() == id ) + { + hrefCombo->view()->setCurrentIndex(index); + hrefCombo->setCurrentIndex( index.row() ); + break; + } + } + } } hrefComboRadioButton->setChecked(true); } else { @@ -123,6 +153,19 @@ return textLineEdit->text().trimmed(); } +void KJotsLinkDialog::trySetEntry(const QString & text) +{ + QString t(text); + int pos = hrefCombo->lineEdit()->cursorPosition(); + if ( hrefCombo->validator()->validate(t, pos) == KJotsBookshelfEntryValidator::Acceptable ) + { + int row = hrefCombo->findText( t, Qt::MatchFixedString ); + QModelIndex index = hrefCombo->model()->index( row, 0 ); + hrefCombo->view()->setCurrentIndex( index ); + hrefCombo->setCurrentIndex( row ); + } +} + QString KJotsLinkDialog::linkUrl() const { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotslinkdialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotslinkdialog.h --- kdepim-4.0.83/kjots/kjotslinkdialog.h 2008-05-29 12:19:37.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotslinkdialog.h 2008-07-08 10:56:30.000000000 +0100 @@ -25,11 +25,9 @@ class QLabel; class QString; -class QAbstractItemModel; class QRadioButton; class QTreeView; -class KUrl; class KComboBox; class KLineEdit; @@ -66,6 +64,9 @@ */ QString linkUrl() const; + public slots: + void trySetEntry(const QString & text); + private: QLabel *textLabel; KLineEdit *textLineEdit; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotspart.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotspart.desktop --- kdepim-4.0.83/kjots/kjotspart.desktop 2008-06-18 13:42:08.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotspart.desktop 2008-07-03 06:06:11.000000000 +0100 @@ -1,5 +1,4 @@ [Desktop Entry] -Encoding=UTF-8 Name=KJotsPart Name[pl]=Moduł Notatek Name[sv]=Kjots-delprogram diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotspart.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotspart.h --- kdepim-4.0.83/kjots/kjotspart.h 2008-05-21 09:33:41.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotspart.h 2008-07-08 10:56:30.000000000 +0100 @@ -28,11 +28,8 @@ #include class QWidget; -class QPainter; -class KUrl; class QTextEdit; class KAboutData; -class KAction; class KJotsComponent; /** diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotspartui.rc /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotspartui.rc --- kdepim-4.0.83/kjots/kjotspartui.rc 2008-06-03 10:34:42.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotspartui.rc 2008-07-03 06:06:11.000000000 +0100 @@ -1,5 +1,5 @@ - + @@ -24,6 +24,11 @@ + + + + + @@ -38,8 +43,8 @@ - + @@ -56,7 +61,7 @@ - + Main Toobar @@ -84,6 +89,11 @@ Format Toolbar + + + + + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kjots/kjotsui.rc /tmp/rIRHhfyqQE/kdepim-4.0.98/kjots/kjotsui.rc --- kdepim-4.0.83/kjots/kjotsui.rc 2008-05-21 09:33:41.000000000 +0100 +++ kdepim-4.0.98/kjots/kjotsui.rc 2008-07-03 06:06:11.000000000 +0100 @@ -1,5 +1,5 @@ - + @@ -24,6 +24,11 @@ + + + + + @@ -37,8 +42,8 @@ - + @@ -53,7 +58,7 @@ - + Main Toobar @@ -84,6 +89,11 @@ Format Toolbar + + + + + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/aboutdata.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/aboutdata.cpp --- kdepim-4.0.83/kleopatra/aboutdata.cpp 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/aboutdata.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -37,7 +37,7 @@ #include static const char kleopatra_version[] = KLEOPATRA_VERSION_STRING; -static const char description[] = I18N_NOOP("KDE Certificate Manager"); +static const char description[] = I18N_NOOP("Certificate Manager and Unified Crypto GUI"); struct about_data { const char * name; @@ -49,33 +49,20 @@ static const about_data authors[] = { { "Marc Mutz", I18N_NOOP("Current Maintainer"), "mutz@kde.org", 0 }, { "Steffen Hansen", I18N_NOOP("Former Maintainer"), "hansen@kde.org", 0 }, - { "Kalle Dalheimer", I18N_NOOP("Original Author"), "kalle@kde.org", 0 }, - { "Jesper Petersen", I18N_NOOP("Original Author"), "blackie@kde.org", 0 }, + { "Matthias Kalle Dalheimer", I18N_NOOP("Original Author"), "kalle@kde.org", 0 }, }; static const about_data credits[] = { - { I18N_NOOP("Till Adam"), - I18N_NOOP("UI Server commands and dialogs"), - "adam@kde.org", 0 }, { I18N_NOOP("David Faure"), I18N_NOOP("Backend configuration framework, KIO integration"), "faure@kde.org", 0 }, { I18N_NOOP("Michel Boyer de la Giroday"), I18N_NOOP("Key-state dependant colors and fonts in the key list"), "michel@klaralvdalens-datakonsult.se", 0 }, - { I18N_NOOP("Volker Krause"), - I18N_NOOP("UI Server dialogs"), - "vkrause@kde.org", 0 }, { I18N_NOOP("Thomas Moenicke"), I18N_NOOP("Artwork"), "tm@php-qt.org", 0 }, - { I18N_NOOP("Daniel Molkentin"), - I18N_NOOP("Certificate Wizard KIOSK integration, infrastructure"), - "molkentin@kde.org", 0 }, - { I18N_NOOP("Ralf Nolden"), - I18N_NOOP("Support for obsolete EMAIL RDN in Certificate Wizard"), - "nolden@kde.org", 0 }, { I18N_NOOP("Frank Osterfeld"), I18N_NOOP("Resident gpgme/win wrangler, UI Server commands and dialogs"), "osterfeld@kde.org", 0 }, @@ -88,9 +75,8 @@ AboutData::AboutData() : KAboutData( "kleopatra", 0, ki18n("Kleopatra"), kleopatra_version, ki18n(description), License_GPL, - ki18n("(c) 2002 Steffen Hansen, Jesper Pedersen,\n" - "Kalle Dalheimer, Klar\xC3\xA4lvdalens Datakonsult AB\n\n" - "(c) 2004, 2007 Marc Mutz, Klar\xC3\xA4lvdalens Datakonsult AB") ) + ki18n("(c) 2002 Steffen Hansen, Matthias Kalle Dalheimer, Klar\xC3\xA4lvdalens Datakonsult AB\n" + "(c) 2004, 2007, 2008 Marc Mutz, Klar\xC3\xA4lvdalens Datakonsult AB") ) { using ::authors; using ::credits; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certificateinfowidgetimpl.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certificateinfowidgetimpl.cpp --- kdepim-4.0.83/kleopatra/certificateinfowidgetimpl.cpp 2008-04-10 10:30:39.000000000 +0100 +++ kdepim-4.0.98/kleopatra/certificateinfowidgetimpl.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,467 +0,0 @@ -/* - certificateinfowidgetimpl.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2001,2002,2004 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "certificateinfowidgetimpl.h" - -// libkleopatra -#include "libkleo/kleo/keylistjob.h" -#include "libkleo/kleo/dn.h" -#include "libkleo/kleo/cryptobackendfactory.h" -#include "libkleo/ui/progressdialog.h" - -// gpgme++ -#include - -// KDE -#include -#include -#include -#include -#include - -// Qt -#include -#include -#include -#include -#include -#include -#include - -// other -#include -#include - -CertificateInfoWidgetImpl::CertificateInfoWidgetImpl( const GpgME::Key & key, bool external, - QWidget * parent ) - : CertificateInfoWidget( parent ), - mExternal( external ), - mFoundIssuer( true ), - mHaveKeyLocally( false ), - mProc(0L) -{ - importButton->setEnabled( false ); - - listView->header()->setResizeMode( 0, QHeaderView::ResizeToContents ); - listView->header()->setResizeMode( 1, QHeaderView::Stretch ); - - QFontMetrics fm = fontMetrics(); - listView->setColumnWidth( 1, fm.width( i18n("Information") ) * 5 ); - - listView->header()->setClickable( false ); - listView->header()->setSortIndicatorShown( false ); - - connect( listView, SIGNAL(itemSelectionChanged()), - this, SLOT(slotShowInfo()) ); - pathView->header()->setResizeMode( 0, QHeaderView::Stretch ); - pathView->header()->hide(); - - connect( pathView, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), - this, SLOT(slotShowCertPathDetails(QTreeWidgetItem*)) ); - connect( importButton, SIGNAL( clicked() ), - this, SLOT( slotImportCertificate() ) ); - - dumpView->setFont( KGlobalSettings::fixedFont() ); - - if ( !key.isNull() ) - setKey( key ); -} - -static QString time_t2string( time_t t ) { - QDateTime dt; - dt.setTime_t( t ); - return dt.toString(); -} - -static QTreeWidgetItem * makeItem( QTreeWidget * p, const QString & text0, const QString & text1 ) { - return new QTreeWidgetItem( p, QStringList() << text0 << text1 ); -} - -static QTreeWidgetItem * makeItem( QTreeWidget * p, const QString & text ) { - return new QTreeWidgetItem( p, QStringList() << text ); -} - -static QTreeWidgetItem * makeItem( QTreeWidgetItem * p, const QString & text ) { - return new QTreeWidgetItem( p, QStringList() << text ); -} - -void CertificateInfoWidgetImpl::setKey( const GpgME::Key & key ) { - mChain.clear(); - mFoundIssuer = true; - mHaveKeyLocally = false; - - listView->clear(); - pathView->clear(); - importButton->setEnabled( false ); - - if ( key.isNull() ) - return; - - mChain.push_front( key ); - startKeyExistanceCheck(); // starts a local keylisting to enable the - // importButton if needed - - makeItem( listView, i18n("Valid"), i18n("From %1 to %2", - time_t2string( key.subkey(0).creationTime() ), - time_t2string( key.subkey(0).expirationTime() ) ) ); - makeItem( listView, i18n("Can be used for signing"), - key.canSign() ? i18n("Yes") : i18n("No") ); - makeItem( listView, i18n("Can be used for encryption"), - key.canEncrypt() ? i18n("Yes") : i18n("No") ); - makeItem( listView, i18n("Can be used for certification"), - key.canCertify() ? i18n("Yes") : i18n("No") ); - makeItem( listView, i18n("Can be used for authentication"), - key.canAuthenticate() ? i18n("Yes") : i18n("No" ) ); - makeItem( listView, i18n("Fingerprint"), key.primaryFingerprint() ); - makeItem( listView, i18n("Issuer"), Kleo::DN( key.issuerName() ).prettyDN() ); - makeItem( listView, i18n("Serial Number"), key.issuerSerial() ); - - const Kleo::DN dn( key.userID(0).id() ); - - // FIXME: use the attributeLabelMap from certificatewizardimpl.cpp: - static QMap dnComponentNames; - if ( dnComponentNames.isEmpty() ) { - dnComponentNames["C"] = i18n("Country"); - dnComponentNames["OU"] = i18n("Organizational Unit"); - dnComponentNames["O"] = i18n("Organization"); - dnComponentNames["L"] = i18n("Location"); - dnComponentNames["CN"] = i18n("Common Name"); - dnComponentNames["EMAIL"] = i18n("Email"); - } - - for ( Kleo::DN::const_iterator dnit = dn.begin() ; dnit != dn.end() ; ++dnit ) { - QString displayName = (*dnit).name(); - if( dnComponentNames.contains(displayName) ) displayName = dnComponentNames[displayName]; - makeItem( listView, displayName, (*dnit).value() ); - } - - const std::vector uids = key.userIDs(); - if ( !uids.empty() ) { - makeItem( listView, i18n("Subject"), - Kleo::DN( uids.front().id() ).prettyDN() ); - for ( std::vector::const_iterator it = uids.begin() + 1 ; it != uids.end() ; ++it ) { - if ( !(*it).id() ) - continue; - const QString email = QString::fromUtf8( (*it).id() ).trimmed(); - if ( email.isEmpty() ) - continue; - if ( email.startsWith( "<" ) ) - makeItem( listView, i18n("Email"), - email.mid( 1, email.length()-2 ) ); - else - makeItem( listView, i18n("A.k.a."), email ); - } - } - - updateChainView(); - startCertificateChainListing(); - startCertificateDump(); -} - -static void showChainListError( QWidget * parent, const GpgME::Error & err, const char * subject ) { - assert( err ); - const QString msg = i18n("

An error occurred while fetching " - "the certificate %1 from the backend:

" - "

%2

", - subject ? QString::fromUtf8( subject ) : QString(), - QString::fromLocal8Bit( err.asString() ) ); - KMessageBox::error( parent, msg, i18n("Certificate Listing Failed" ) ); -} - -void CertificateInfoWidgetImpl::startCertificateChainListing() { - kDebug() <<"CertificateInfoWidgetImpl::startCertificateChainListing()"; - - if ( mChain.empty() ) { - // we need a seed... - kWarning() <<"CertificateInfoWidgetImpl::startCertificateChainListing(): mChain is empty!"; - return; - } - const char * chainID = mChain.front().chainID(); - if ( !chainID || !*chainID ) { - // cert not found: - kDebug() <<"CertificateInfoWidgetImpl::startCertificateChainListing(): empty chain ID - root not found"; - return; - } - const char * fpr = mChain.front().primaryFingerprint(); - if ( qstricmp( fpr, chainID ) == 0 ) { - kDebug() <<"CertificateInfoWidgetImpl::startCertificateChainListing(): chain_id equals fingerprint -> found root"; - return; - } - if ( mChain.size() > 100 ) { - // safe guard against certificate loops (paranoia factor 8 out of 10)... - kWarning() <<"CertificateInfoWidgetImpl::startCertificateChainListing(): maximum chain length of 100 exceeded!"; - return; - } - if ( !mFoundIssuer ) { - // key listing failed. Don't end up in endless loop - kDebug() <<"CertificateInfoWidgetImpl::startCertificateChainListing(): issuer not found - giving up"; - return; - } - - mFoundIssuer = false; - - // gpgsm / dirmngr / LDAP / whoever doesn't support looking up - // external keys by fingerprint. Furthermore, since we actually got - // a chain-id set on the key, we know that we have the issuer's cert - // in the local keyring, so just use local keylisting. - Kleo::KeyListJob * job = - Kleo::CryptoBackendFactory::instance()->smime()->keyListJob( false ); - assert( job ); - - connect( job, SIGNAL(result(const GpgME::KeyListResult&)), - SLOT(slotCertificateChainListingResult(const GpgME::KeyListResult&)) ); - connect( job, SIGNAL(nextKey(const GpgME::Key&)), - SLOT(slotNextKey(const GpgME::Key&)) ); - - kDebug() <<"Going to fetch" << endl - << " issuer : \"" << mChain.front().issuerName() << "\"" << endl - << " chain id:" << mChain.front().chainID() << endl - << "for" << endl - << " subject : \"" << mChain.front().userID(0).id() << "\"" << endl - << " subj.fpr:" << mChain.front().primaryFingerprint(); - - const GpgME::Error err = job->start( QStringList( mChain.front().chainID() ) ); - - if ( err ) - showChainListError( this, err, mChain.front().issuerName() ); - else - (void)new Kleo::ProgressDialog( job, i18n("Fetching Certificate Chain"), this ); -} - -void CertificateInfoWidgetImpl::startCertificateDump() { - delete mProc; - mProc = new KProcess( this ); - (*mProc) << "gpgsm"; // must be in the PATH - (*mProc) << "--dump-keys"; - (*mProc) << mChain.front().primaryFingerprint(); - - connect( mProc, SIGNAL(readyReadStandardOutput ()), - this, SLOT( slotCollectStdout())); - connect( mProc, SIGNAL(readyReadStandardError()), - this, SLOT(slotCollectStderr())); - connect( mProc, SIGNAL(finished (int, QProcess::ExitStatus)), - this,SLOT(slotDumpProcessExited(int, QProcess::ExitStatus))); - - mProc->setOutputChannelMode(KProcess::SeparateChannels); - mProc->start(); - if ( !mProc->waitForStarted()) { - QString wmsg = i18n("Failed to execute gpgsm:\n%1", i18n( "program not found" ) ); - dumpView->setText( wmsg ); - delete mProc; - mProc = 0; - } -} - -void CertificateInfoWidgetImpl::slotCollectStdout() -{ - mDumpOutput += mProc->readAllStandardOutput (); -} - -void CertificateInfoWidgetImpl::slotCollectStderr() -{ - mDumpOutput += mProc->readAllStandardError (); -} - -void CertificateInfoWidgetImpl::slotDumpProcessExited(int, QProcess::ExitStatus) { - int rc = ( mProc->exitStatus() == QProcess::NormalExit ) ? mProc->exitStatus() : -1 ; - - if ( rc == 0 ) { - dumpView->setText( QString::fromUtf8( mDumpOutput ) ); - } else { - if ( !mDumpError.isEmpty() ) { - dumpView->setText( QString::fromUtf8( mDumpError ) ); - } else - { - QString reason; - if ( rc == -1 ) - reason = i18n( "program cannot be executed" ); - else - reason = strerror(rc); - dumpView->setText( i18n("Failed to execute gpgsm:\n%1", reason) ); - } - } -} - -void CertificateInfoWidgetImpl::slotNextKey( const GpgME::Key & key ) { - kDebug() <<"CertificateInfoWidgetImpl::slotNextKey( \"" - << key.userID(0).id() << "\" )"; - if ( key.isNull() ) - return; - - mFoundIssuer = true; - mChain.push_front( key ); - updateChainView(); - // FIXME: cancel the keylisting. We're only interested in _one_ key. -} - -void CertificateInfoWidgetImpl::updateChainView() { - pathView->clear(); - if ( mChain.empty() ) - return; - QTreeWidgetItem * item = 0; - - QList::const_iterator it = mChain.begin(); - // root item: - if ( (*it).chainID() && qstrcmp( (*it).chainID(), (*it).primaryFingerprint() ) == 0 ) - item = makeItem( pathView, Kleo::DN( (*it++).userID(0).id() ).prettyDN() ); - else { - item = makeItem( pathView, i18n("Issuer certificate not found (%1)", - Kleo::DN( (*it).issuerName() ).prettyDN() ) ); - item->setExpanded( true ); // Qt bug: doesn't open after setEnabled( false ) :/ - item->setDisabled( true ); - } - item->setExpanded( true ); - - // subsequent items: - while ( it != mChain.end() ) { - item = makeItem( item, Kleo::DN( (*it++).userID(0).id() ).prettyDN() ); - item->setExpanded( true ); - } -} - -void CertificateInfoWidgetImpl::slotCertificateChainListingResult( const GpgME::KeyListResult & res ) { - if ( res.error() ) - showChainListError( this, res.error(), mChain.front().issuerName() ); - else - startCertificateChainListing(); -} - -void CertificateInfoWidgetImpl::slotShowInfo() { - const QList items = listView->selectedItems(); - textView->setText( items.empty() ? QString() : items.front()->text(1) ); -} - -void CertificateInfoWidgetImpl::slotShowCertPathDetails( QTreeWidgetItem * item ) { - if ( !item ) - return; - - // find the key corresponding to "item". This hack would not be - // necessary if pathView was a Kleo::KeyListView, but it's - // Qt-Designer-generated and I don't feel like creating a custom - // widget spec for Kleo::KeyListView. - int totalCount = 0; - int itemIndex = -1; - for ( const QTreeWidgetItem * i = pathView->topLevelItem( 0 ) ; i ; i = i->child( 0 ) ) { - if ( i == item ) - itemIndex = totalCount; - ++totalCount; - } - - assert( totalCount == mChain.size() || totalCount == mChain.size() + 1 ); - - // skip pseudo root item with "not found message": - if ( totalCount == mChain.size() + 1 ) - { - if ( itemIndex == 0 ) // ignore pseudo - return; - --itemIndex; - } - - assert( itemIndex >= 0 ); - - CertificateInfoWidgetImpl * const top = new CertificateInfoWidgetImpl( mChain[itemIndex], mExternal ); - // proxy the signal to our receiver: - connect( top, SIGNAL(requestCertificateDownload(QString, QString)), - SIGNAL(requestCertificateDownload(QString, QString)) ); - KDialog * const dialog = createDialog( top, this ); - dialog->show(); -} - -KDialog * CertificateInfoWidgetImpl::createDialog( const GpgME::Key & key, QWidget * parent ) -{ - return createDialog( new CertificateInfoWidgetImpl( key, /*external=*/false ), parent ); -} - -KDialog * CertificateInfoWidgetImpl::createDialog( CertificateInfoWidgetImpl * widget, QWidget * parent ) -{ - KDialog * const dialog = new KDialog( parent ); - dialog->setObjectName( "dialog" ); - dialog->setButtons( KDialog::Close ); - dialog->setDefaultButton( KDialog::Close ); - dialog->setModal( false ); - dialog->setMainWidget( widget ); - dialog->setWindowTitle( i18n("Additional Information for Certificate") ); - dialog->setAttribute( Qt::WA_DeleteOnClose ); - return dialog; -} - -void CertificateInfoWidgetImpl::slotImportCertificate() -{ - if ( mChain.empty() || mChain.back().isNull() ) - return; - const Kleo::DN dn( mChain.back().userID( 0 ).id() ); - emit requestCertificateDownload( mChain.back().primaryFingerprint(), dn.prettyDN() ); - importButton->setEnabled( false ); -} - -void CertificateInfoWidgetImpl::startKeyExistanceCheck() { - if ( !mExternal ) - // we already have it if it's from a local keylisting :) - return; - if ( mChain.empty() || mChain.back().isNull() ) - // need a key to look for - return; - const QString fingerprint = mChain.back().primaryFingerprint(); - if ( fingerprint.isEmpty() ) - // empty pattern means list all keys. We don't want that - return; - - // start _local_ keylistjob (no progressdialog needed here): - Kleo::KeyListJob * job = - Kleo::CryptoBackendFactory::instance()->smime()->keyListJob( false ); - assert( job ); - - connect( job, SIGNAL(nextKey(const GpgME::Key&)), - SLOT(slotKeyExistanceCheckNextCandidate(const GpgME::Key&)) ); - connect( job, SIGNAL(result(const GpgME::KeyListResult&)), - SLOT(slotKeyExistanceCheckFinished()) ); - // nor to check for errors: - job->start( QStringList( fingerprint ) ); -} - -void CertificateInfoWidgetImpl::slotKeyExistanceCheckNextCandidate( const GpgME::Key & key ) { - if ( key.isNull() || mChain.empty() || !key.primaryFingerprint() ) - return; - - if ( qstrcmp( key.primaryFingerprint(), - mChain.back().primaryFingerprint() ) == 0 ) - mHaveKeyLocally = true; -} - -void CertificateInfoWidgetImpl::slotKeyExistanceCheckFinished() { - importButton->setEnabled( !mHaveKeyLocally ); -} - - -#include "certificateinfowidgetimpl.moc" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certificateinfowidgetimpl.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certificateinfowidgetimpl.h --- kdepim-4.0.83/kleopatra/certificateinfowidgetimpl.h 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/certificateinfowidgetimpl.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,103 +0,0 @@ -/* - certificateinfowidgetimpl.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2001,2004 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef CERTIFICATEINFOWIDGETIMPL_H -#define CERTIFICATEINFOWIDGETIMPL_H - -#include "ui_certificateinfowidget.h" - -#include - -#include -//Added by qt3to4: -#include -#include -#include - -class KProcess; -class QTreeWidgetItem; - -namespace GpgME { - class KeyListResult; -} - -class CertificateInfoWidget : public QWidget, public Ui::CertificateInfoWidget -{ -public: - CertificateInfoWidget( QWidget *parent ) : QWidget( parent ) { - setupUi( this ); - } -}; - -class CertificateInfoWidgetImpl : public CertificateInfoWidget { - Q_OBJECT -public: - CertificateInfoWidgetImpl( const GpgME::Key & key, bool external, - QWidget * parent=0); - - void setKey( const GpgME::Key & key ); - - static KDialog * createDialog( const GpgME::Key & key, QWidget * parent ); - -Q_SIGNALS: - void requestCertificateDownload( const QString & fingerprint, const QString& displayName ); - -private Q_SLOTS: - void slotShowInfo(); - void slotShowCertPathDetails( QTreeWidgetItem* ); - void slotImportCertificate(); - void slotCertificateChainListingResult( const GpgME::KeyListResult & res ); - void slotNextKey( const GpgME::Key & key ); - void slotKeyExistanceCheckNextCandidate( const GpgME::Key & key ); - void slotKeyExistanceCheckFinished(); - void slotCollectStdout(); - void slotCollectStderr(); - void slotDumpProcessExited(int, QProcess::ExitStatus); - -private: - void startCertificateChainListing(); - void startCertificateDump(); - void startKeyExistanceCheck(); - void updateChainView(); - static KDialog * createDialog( CertificateInfoWidgetImpl * widget, QWidget * parent ); - -private: - QByteArray mDumpOutput; - QByteArray mDumpError; - QList mChain; - bool mExternal; - bool mFoundIssuer; - bool mHaveKeyLocally; - KProcess* mProc; -}; - -#endif // CERTIFICATEINFOWIDGETIMPL_H diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certificateinfowidget.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certificateinfowidget.ui --- kdepim-4.0.83/kleopatra/certificateinfowidget.ui 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/certificateinfowidget.ui 1970-01-01 01:00:00.000000000 +0100 @@ -1,184 +0,0 @@ - - - - - CertificateInfoWidget - - - - 0 - 0 - 423 - 403 - - - - - 250 - 0 - - - - - - - HLine - - - Sunken - - - - - - - - &Details - - - - 6 - - - - - true - - - - Description - - - true - - - true - - - - - Information - - - true - - - true - - - - - - - - true - - - false - - - - - - - - &Chain - - - - 6 - - - - - true - - - - Path - - - true - - - true - - - - - - - - - Du&mp - - - - 6 - - - - - true - - - false - - - - - - - - - - - &Import to Local - - - - - - - - 291 - 16 - - - - Expanding - - - Horizontal - - - - - - - - 5 - 4 - 0 - 0 - - - - - 8 - true - - - - Certificate Information - - - true - - - - - - - qPixmapFromMimeSource - diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certificatewizardimpl.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certificatewizardimpl.cpp --- kdepim-4.0.83/kleopatra/certificatewizardimpl.cpp 2008-05-15 19:37:21.000000000 +0100 +++ kdepim-4.0.98/kleopatra/certificatewizardimpl.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,560 +0,0 @@ -/* - certificatewizardimpl.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2001,2002,2004 Klar�vdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "certificatewizardimpl.h" - -// libkleopatra -#include "libkleo/kleo/oidmap.h" -#include "libkleo/kleo/keygenerationjob.h" -#include "libkleo/kleo/dn.h" -#include "libkleo/kleo/cryptobackendfactory.h" -#include "libkleo/ui/progressdialog.h" -#include "libkleo/ui/filenamerequester.h" - -// gpgme++ -#include - -// KDE -#ifdef KLEO_HAVE_KDEPIMLIBS -# include -# include -#endif - -#include -#include -#include -#include -#include -#ifdef KLEO_TEMPORARILY_REMOVED //PENDING(frank) -#include -#include -#include -#include -#include -#endif -#include -#include - -// Qt -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -static const unsigned int keyLengths[] = { - 1024, 1532, 2048, 3072, 4096 -}; -static const unsigned int numKeyLengths = sizeof keyLengths / sizeof *keyLengths; - -static QString attributeLabel( const QString & attr, bool required ) { - if ( attr.isEmpty() ) - return QString(); - const QString label = Kleo::DNAttributeMapper::instance()->name2label( attr ); - if ( !label.isEmpty() ) - if ( required ) - return i18nc("Format string for the labels in the \"Your Personal Data\" page - required field", - "*%1 (%2):", label, attr ); - else - return i18nc("Format string for the labels in the \"Your Personal Data\" page", - "%1 (%2):", label, attr ); - - else if ( required ) - return '*' + attr + ':'; - else - return attr + ':'; -} - -static QString attributeFromKey( const QString &key ) { - QString t = key; - return t.remove( '!' ); -} - -static bool availForMod( const QLineEdit * le ) { - return le && le->isEnabled(); -} - -/* - * Constructs a CertificateWizardImpl which is a child of 'parent', with the - * name 'name' and widget flags set to 'f' - * - * The wizard will by default be modeless, unless you set 'modal' to - * TRUE to construct a modal wizard. - */ -CertificateWizardImpl::CertificateWizardImpl( QWidget* parent ) - : CertificateWizard( parent ) -{ - setModal(false); - // don't allow to go to last page until a key has been generated - setNextEnabled( generatePage, false ); - // setNextEnabled( personalDataPage, false ); // ## disable again once we have a criteria when to enable again - - createPersonalDataPage(); - QVBoxLayout* layout = new QVBoxLayout( storeCAWidget ); - layout->setMargin( 0 ); - _storeFR = new Kleo::FileNameRequester; - _storeFR->setExistingOnly( false ); - _storeFR->setFilter( QDir::Files ); - connect( storeInFileRB, SIGNAL( toggled( bool ) ), - _storeFR, SLOT( setEnabled( bool ) ) ); - layout->addWidget( _storeFR ); - // Allow to select remote URLs - -#ifdef KLEO_TEMPORARILY_REMOVED //PENDING(frank) - _storeFR->setMode( KFile::File ); - _storeFR->setFilter( "application/pkcs10" ); - connect( storeUR, SIGNAL( urlSelected( const KUrl& ) ), - this, SLOT( slotURLSelected( const KUrl& ) ) ); -#endif - const KConfigGroup config( KGlobal::config(), "CertificateCreationWizard" ); - caEmailED->setText( config.readEntry( "CAEmailAddress" ) ); - - connect( this, SIGNAL( helpClicked() ), - this, SLOT( slotHelpClicked() ) ); - connect( insertAddressButton, SIGNAL( clicked() ), - this, SLOT( slotSetValuesFromWhoAmI() ) ); - - connect(generatePB,SIGNAL(clicked()), this, SLOT(slotGenerateCertificate())); - - for ( unsigned int i = 0 ; i < numKeyLengths ; ++i ) - keyLengthCB->addItem( i18np("%1 bit", "%1 bits", keyLengths[i] ) ); - certTypeBG->setExclusive( true ); - ButtonGroup7->setExclusive( true ); -} - -static bool requirementsAreMet( const CertificateWizardImpl::AttrPairList & list ) { - for ( CertificateWizardImpl::AttrPairList::const_iterator it = list.begin() ; - it != list.end() ; ++it ) { - const QLineEdit * le = (*it).second; - if ( !le ) - continue; - const QString key = (*it).first; - kDebug() << "requirementsAreMet(): checking \"" << key << "\" against \"" << le->text() << "\":"; - if ( key.endsWith("!") && le->text().trimmed().isEmpty() ) { - kDebug() << "required field is empty!"; - return false; - } - kDebug() << "ok" << endl; - } - return true; -} - -/* - This slot is called when the user changes the text. - */ -void CertificateWizardImpl::slotEnablePersonalDataPageExit() { - setNextEnabled( personalDataPage, requirementsAreMet( _attrPairList ) ); -} - - -/* - * Destroys the object and frees any allocated resources - */ -CertificateWizardImpl::~CertificateWizardImpl() -{ - // no need to delete child widgets, Qt does it all for us -} - -static const char * oidForAttributeName( const QString & attr ) { - QByteArray attrUtf8 = attr.toUtf8(); - for ( unsigned int i = 0 ; i < numOidMaps ; ++i ) - if ( qstricmp( attrUtf8, oidmap[i].name ) == 0 ) - return oidmap[i].oid; - return 0; -} - -/* - * protected slot - */ -void CertificateWizardImpl::slotGenerateCertificate() -{ - if(keyLengthCB->currentIndex() < 0) return; - - // Ask gpgme to generate a key and return it - QString certParms; - certParms += "\n"; - certParms += "Key-Type: RSA\n"; - certParms += QString( "Key-Length: %1\n" ).arg( keyLengths[keyLengthCB->currentIndex()] ); - certParms += "Key-Usage: "; - if ( signOnlyCB->isChecked() ) - certParms += "Sign"; - else if ( encryptOnlyCB->isChecked() ) - certParms += "Encrypt"; - else - certParms += "Sign, Encrypt"; - certParms += '\n'; - certParms += "name-dn: "; - - QString email; - QStringList rdns; - for( AttrPairList::const_iterator it = _attrPairList.begin(); it != _attrPairList.end(); ++it ) { - const QString attr = attributeFromKey( (*it).first.toUpper() ); - const QLineEdit * le = (*it).second; - if ( !le ) - continue; - - const QString value = le->text().trimmed(); - if ( value.isEmpty() ) - continue; - - if ( attr == "EMAIL" ) { - // EMAIL is special, since it shouldn't be part of the DN, - // except for non-RFC-conformant CAs that require it to be - // there. - email = value; - if ( !brokenCA->isChecked() ) - continue; - } - - if ( const char * oid = oidForAttributeName( attr ) ) { - // we need to translate the attribute name for the backend: - rdns.push_back( QString::fromUtf8( oid ) + '=' + value ); - } else { - rdns.push_back( attr + '=' + value ); - } - } - certParms += rdns.join(","); - if( !email.isEmpty() ) - certParms += "\nname-email: " + email; - certParms += "\n\n"; - - kDebug() << certParms; - - Kleo::KeyGenerationJob * job = - Kleo::CryptoBackendFactory::instance()->smime()->keyGenerationJob(); - assert( job ); - - connect( job, SIGNAL(result(const GpgME::KeyGenerationResult&,const QByteArray&)), - SLOT(slotResult(const GpgME::KeyGenerationResult&,const QByteArray&)) ); - - certificateTE->setText( certParms ); - - const GpgME::Error err = job->start( certParms ); - if ( err ) - KMessageBox::error( this, - i18n( "Could not start certificate generation: %1" , - QString::fromLocal8Bit( err.asString() ) ), - i18n( "Certificate Manager Error" ) ); - else { - generatePB->setEnabled( false ); - setBackEnabled( generatePage, false ); - (void)new Kleo::ProgressDialog( job, i18n("Generating key"), this ); - } -} - - -void CertificateWizardImpl::slotResult( const GpgME::KeyGenerationResult & res, - const QByteArray & keyData ) { - //kDebug() <<"keyData.size():" << keyData.size(); - _keyData = keyData; - - if ( res.error().isCanceled() || res.error() ) { - setNextEnabled( generatePage, false ); - setBackEnabled( generatePage, true ); - setFinishEnabled( finishPage, false ); - generatePB->setEnabled( true ); - if ( !res.error().isCanceled() ) - KMessageBox::error( this, - i18n( "Could not generate certificate: %1" , - QString::fromLatin1( res.error().asString() ) ), - i18n( "Certificate Manager Error" ) ); - } else { - // next will stay enabled until the user clicks Generate - // Certificate again - setNextEnabled( generatePage, true ); - setFinishEnabled( finishPage, true ); - } -} - -void CertificateWizardImpl::slotHelpClicked() -{ - KToolInvocation::invokeHelp( "newcert" ); -} - -void CertificateWizardImpl::slotSetValuesFromWhoAmI() -{ -#ifdef KLEO_HAVE_KDEPIMLIBS - const KABC::Addressee a = KABC::StdAddressBook::self( true )->whoAmI(); - if ( a.isEmpty() ) - return; - const KABC::Address adr = a.address(KABC::Address::Work); - - for ( AttrPairList::const_iterator it = _attrPairList.begin() ; - it != _attrPairList.end() ; ++it ) { - QLineEdit * le = (*it).second; - if ( !availForMod( le ) ) - continue; - - const QString attr = attributeFromKey( (*it).first.toUpper() ); - if ( attr == "CN" ) - le->setText( a.formattedName() ); - else if ( attr == "EMAIL" ) - le->setText( a.preferredEmail() ); - else if ( attr == "O" ) - le->setText( a.organization() ); - else if ( attr == "OU" ) - le->setText( a.custom( "KADDRESSBOOK", "X-Department" ) ); - else if ( attr == "L" ) - le->setText( adr.locality() ); - else if ( attr == "SP" ) - le->setText( adr.region() ); - else if ( attr == "PC" ) - le->setText( adr.postalCode() ); - else if ( attr == "SN" ) - le->setText( a.familyName() ); - else if ( attr == "GN" ) - le->setText( a.givenName() ); - else if ( attr == "T" ) - le->setText( a.title() ); - else if ( attr == "BC" ) - le->setText( a.role() ); // correct mapping? - } -#endif -} - -void CertificateWizardImpl::createPersonalDataPage() -{ - QGridLayout* grid = new QGridLayout( edContainer ); - grid->setSpacing( KDialog::spacingHint() ); - grid->setMargin( KDialog::marginHint() ); - - KConfigGroup config( KGlobal::config(), "CertificateCreationWizard" ); - QStringList attrOrder = config.readEntry( "DNAttributeOrder" , QStringList() ); - if ( attrOrder.empty() ) - attrOrder << "CN!" << "L" << "OU" << "O!" << "C!" << "EMAIL!"; - int row = 0; - - for ( QStringList::const_iterator it = attrOrder.begin() ; it != attrOrder.end() ; ++it, ++row ) { - const QString key = (*it).trimmed().toUpper(); - const QString attr = attributeFromKey( key ); - if ( attr.isEmpty() ) { - --row; - continue; - } - const QString preset = config.readEntry( attr, QString() ); - const QString label = config.readEntry( attr + "_label", - attributeLabel( attr, key.endsWith("!") ) ); - - QLineEdit * le = new QLineEdit( edContainer ); - grid->addWidget( le, row, 1 ); - QLabel* lbl = new QLabel( label.isEmpty() ? attr : label, edContainer ); - lbl->setBuddy( le ); - grid->addWidget( lbl, row, 0 ); - - le->setText( preset ); - if ( config.isEntryImmutable( attr ) ) - le->setEnabled( false ); - - _attrPairList.append(qMakePair(key, le)); - - connect( le, SIGNAL(textChanged(const QString&)), - SLOT(slotEnablePersonalDataPageExit()) ); - } - -#ifdef KLEO_HAVE_KDEPIMLIBS - // enable button only if administrator wants to allow it - if (KABC::StdAddressBook::self( true )->whoAmI().isEmpty() || - !config.readEntry("ShowSetWhoAmI", true)) -#endif - insertAddressButton->setEnabled( false ); - - slotEnablePersonalDataPageExit(); -} - -bool CertificateWizardImpl::sendToCA() const { - return sendToCARB->isChecked(); -} - -QString CertificateWizardImpl::caEMailAddress() const { - return caEmailED->text().trimmed(); -} - -void CertificateWizardImpl::slotURLSelected( const KUrl& url ) -{ - _storeFR->setFileName( url.path() ); -} - -KUrl CertificateWizardImpl::saveFileUrl() const { - return KUrl::fromPath( _storeFR->fileName() ); -} - -void CertificateWizardImpl::showPage( QWidget * page ) -{ - CertificateWizard::showPage( page ); - if ( page == generatePage ) { - // Initial settings for the generation page: focus the correct lineedit - // and disable the other one - if ( storeInFileRB->isChecked() ) { - _storeFR->setEnabled( true ); - caEmailED->setEnabled( false ); - _storeFR->setFocus(); - } else { - _storeFR->setEnabled( false ); - caEmailED->setEnabled( true ); - caEmailED->setFocus(); - } - } -} - -/** - Send the new certificate by mail using KMail - */ -void CertificateWizardImpl::sendCertificate( const QString& email, const QByteArray& certificateData ) -{ - QString error; -#ifdef __GNUC__ -#warning Port me to DBus! -#endif -#ifdef KLEO_TEMPORARILY_REMOVED //PENDING(frank) - QString dbusService; - int result = KDBusServiceStarter::self()->findServiceFor( "DBUS/Mailer", QString(), &error, &dbusService ); - if ( result != 0 ) { - kDebug() <<"Couldn't connect to KMail"; - KMessageBox::error( this, - i18n( "DBUS Communication Error, unable to send certificate using KMail.\n%1", error ) ); - return; - } - - //TODO look at if we can find kmail when embedded into kontact - bool kmailFound = false; - QDBusConnection dbus = QDBusConnection::sessionBus(); - QDBusReply reply = dbus.interface()->registeredServiceNames(); - if ( !reply.isValid() ) - return; - - const QStringList allServices = reply; - for ( QStringList::const_iterator it = allServices.begin(), end = allServices.end() ; it != end ; ++it ) { - const QString service = *it; - if ( service.startsWith( "org.kde.kmail" ) ) { - kmailFound = true; - break; - } - } - - if(!kmailFound) - { - //TODO launch it into kontact - } - /* DCOPCString dcopService; - DCOPCString dummy; - // OK, so kmail (or kontact) is running. Now ensure the object we want is available. - // [that's not the case when kontact was already running, but kmail not loaded into it... in theory.] - if ( !kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) ) { - DCOPRef ref( dcopService, dcopService ); // talk to the KUniqueApplication or its kontact wrapper - DCOPReply reply = ref.call( "load()" ); - if ( reply.isValid() && (bool)reply ) { - Q_ASSERT( kapp->dcopClient()->findObject( dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) ); - } else - kWarning() <<"Error loading" << dcopService; - } - - DCOPClient* dcopClient = kapp->dcopClient(); - QByteArray data; - QDataStream arg( &data, QIODevice::WriteOnly ); - arg << email; - arg << certificateData; - if( !dcopClient->send( dcopService, dcopObjectId, - "sendCertificate(QString,QByteArray)", data ) ) { - KMessageBox::error( this, - i18n( "DCOP Communication Error, unable to send certificate using KMail." ) ); - return; - }*/ - // All good, close dialog - CertificateWizard::accept(); -#endif // KLEO_TEMPORARILY_REMOVED -} - -// Called when pressing Finish -// We want to do the emailing/uploading first, before closing the dialog, -// in case of errors during the upload. -void CertificateWizardImpl::accept() -{ -#ifdef KLEO_TEMPORARILY_REMOVED //PENDING(frank) - if( sendToCA() ) { - // Ask KMail to send this key to the CA. - sendCertificate( caEMailAddress(), _keyData ); - } else { - // Save in file/URL - KUrl url = saveFileUrl(); - bool overwrite = false; - if ( KIO::NetAccess::exists( url, KIO::NetAccess::DestinationSide /*dest*/, this ) ) { - if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel( - this, - i18n( "A file named \"%1\" already exists. " - "Are you sure you want to overwrite it?", url.prettyUrl() ), - i18n( "Overwrite File?" ), - KStandardGuiItem::overwrite() ) ) - return; - overwrite = true; - } - - KIO::Job* uploadJob = KIO::storedPut( _keyData, url, -1, overwrite ? KIO::Overwrite : KIO::DefaultFlags ); - uploadJob->ui()->setWindow( this ); - connect( uploadJob, SIGNAL( result( KJob* ) ), - this, SLOT( slotUploadResult( KJob* ) ) ); - // Can't press finish again during the upload - setFinishEnabled( finishPage, false ); - } -#endif // KLEO_TEMPORARILY_REMOVED - CertificateWizard::accept(); -} - -/** - This slot is invoked by the KIO job used in newCertificate - to save/upload the certificate, when finished (success or error). -*/ -void CertificateWizardImpl::slotUploadResult( KJob* job ) -{ -#ifdef KLEO_TEMPORARILY_REMOVED //PENDING(frank) - if ( job->error() ) { - static_cast(job)->ui()->showErrorMessage(); - setFinishEnabled( finishPage, true ); - } else { - // All good, close dialog - CertificateWizard::accept(); - } -#endif -} - -#include "certificatewizardimpl.moc" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certificatewizardimpl.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certificatewizardimpl.h --- kdepim-4.0.83/kleopatra/certificatewizardimpl.h 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/certificatewizardimpl.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,108 +0,0 @@ -/* - certificatewizardimpl.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2001,2002,2004 Klar�vdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef CERTIFICATEWIZARDIMPL_H -#define CERTIFICATEWIZARDIMPL_H -#include "ui_certificatewizard.h" - -#include -#include -#include -#include - -namespace GpgME { - class KeyGenerationResult; -} -namespace KIO { - class Job; -} - -namespace Kleo { - class FileNameRequester; -} - -class KJob; - -class CertificateWizard : public Q3Wizard, public Ui::CertificateWizard -{ - Q_OBJECT -public: - CertificateWizard( QWidget *parent ) : Q3Wizard( parent ) { - setupUi( this ); - } - // public Q_SLOTS: - // void accept() { return Q3Wizard::accept(); } -}; - -class CertificateWizardImpl : public CertificateWizard -{ - Q_OBJECT - -public: - CertificateWizardImpl( QWidget* parent = 0); - ~CertificateWizardImpl(); - - bool sendToCA() const; - QString caEMailAddress() const; - KUrl saveFileUrl() const; - - typedef QPair StringLEPair; - typedef QVector< StringLEPair > AttrPairList; - -public: - virtual void showPage( QWidget * page ); - -public slots: - virtual void accept(); - -private slots: - void slotGenerateCertificate(); - void slotResult( const GpgME::KeyGenerationResult & res, const QByteArray & keyData ); - void slotSetValuesFromWhoAmI(); - void slotEnablePersonalDataPageExit(); - void slotURLSelected( const KUrl& ); - - void slotHelpClicked(); - - void slotUploadResult( KJob* ); - -private: - void createPersonalDataPage(); - void sendCertificate( const QString& email, const QByteArray& certificateData ); - -private: - AttrPairList _attrPairList; - QByteArray _keyData; - Kleo::FileNameRequester* _storeFR; -}; - -#endif // CERTIFICATEWIZARDIMPL_H diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certificatewizard.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certificatewizard.ui --- kdepim-4.0.83/kleopatra/certificatewizard.ui 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/certificatewizard.ui 1970-01-01 01:00:00.000000000 +0100 @@ -1,530 +0,0 @@ - - CertificateWizard - - - - 0 - 0 - 827 - 502 - - - - Key Generation Wizard - - - - 16 - 50 - false - - - - - - 6 - 37 - 815 - 416 - - - - - - - <b>Welcome to the Key Generation Wizard.</b> -<br> -<br> -In a few easy steps, this wizard will help you to create a new key pair and request a certificate for it. You can then use your certificate in order to sign messages, to encrypt messages and to decrypt messages that other people send to you in encrypted form. -<p> -The key pair will be generated in a decentralized manner. Please contact your local help desk if you are unsure how to obtain a certificate for your new key in your organization. - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - - - 6 - 37 - 815 - 416 - - - - - - - On this page, you will configure the cryptographic key length and the type of certificate to create. - - - Qt::AlignVCenter - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 31 - - - - - - - - Cryptographic Key Length - - - - - - Choose &key length: - - - true - - - keyLengthCB - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 61 - 20 - - - - - - - - - - - Certificate Usage - - - - - - For &signing only - - - - - - - For &encrypting only - - - - - - - For signing &and encrypting - - - true - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 21 - 60 - - - - - - - - - - 6 - 37 - 815 - 416 - - - - - - - On this page, you will enter some personal data that will be stored in your certificate and that will help other people to determine that it is actually you who is sending a message. - - - Qt::AlignVCenter - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 440 - 20 - - - - - - - - This will insert your address if you have set the "Who am I" information in the address book - - - &Insert My Address - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - - - - - - <qt><p>On this page, you will create a key pair in a decentralized way. -</p><p>You can either store the certificate request in a file for later transmission or -send it to the Certificate Authority (CA) directly. Please check with -your local help desk if you are unsure what to select here.</p><p> -Once you are done with your settings, click -<em>Generate Key Pair and Certificate Request</em> in order to generate your key pair and a corresponding certificate request.</p> -<p><b>Note:</b> if you choose to send via email directly, -a kmail composer will be opened; you can add detailed information for the CA -there.</p><qt> - - - Qt::AlignVCenter - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - - - - Certificate Request Options - - - - - - &Store in a file: - - - - - - - QFrame::NoFrame - - - QFrame::Raised - - - - - - - Send to CA as an &email message: - - - true - - - - - - - - - - Add email to DN in request for broken CAs - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 119 - 16 - - - - - - - - - 0 - 30 - - - - &Generate Key Pair && Certificate Request - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 118 - 16 - - - - - - - - - - 6 - 37 - 820 - 503 - - - - - 11 - - - 11 - - - 11 - - - 11 - - - - - <qt> -Your key pair has now been created and stored locally. The corresponding certificate request is now ready to be sent to the CA (certification authority) which will generate a certificate for you and send it back via email (unless you have selected storage in a file). Please review the certificate details shown below. -<p> -If you want to change anything, press Back and make your changes; otherwise, press Finish to send the certificate request to the CA. -</qt> - - - Qt::AlignVCenter - - - true - - - - - - - true - - - - - - - - qPixmapFromMimeSource - - - Q3Frame - QFrame -
Qt3Support/Q3Frame
- 1 -
- - Q3Wizard - QDialog -
q3wizard.h
- 1 -
- - Q3ButtonGroup - Q3GroupBox -
Qt3Support/Q3ButtonGroup
- 1 -
-
- - sendToCARB - caEmailED - certificateTE - generatePB - - - klineedit.h - kpushbutton.h - - - - - sendToCARB - toggled(bool) - caEmailED - setEnabled(bool) - - - 20 - 20 - - - 20 - 20 - - - - - sendToCARB - clicked() - caEmailED - setFocus() - - - 20 - 20 - - - 20 - 20 - - - - -
diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certlistview.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certlistview.cpp --- kdepim-4.0.83/kleopatra/certlistview.cpp 2008-02-13 15:45:39.000000000 +0000 +++ kdepim-4.0.98/kleopatra/certlistview.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,81 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - certlistview.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2007 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "certlistview.h" -#include -#include -#include -#include -#include -#include - -CertKeyListView::CertKeyListView( const ColumnStrategy * strategy, - const DisplayStrategy * display, - QWidget * parent, Qt::WFlags f ) - : Kleo::KeyListView( strategy, display, parent, f ) -{ - viewport()->setAcceptDrops( true ); -} - -void CertKeyListView::contentsDragEnterEvent( QDragEnterEvent * event ) -{ - //const char* fmt; - //for (int i=0; (fmt = event->format(i)); i++) - // kDebug() << fmt; - - // We only accept URL drops. We'll check the mimetype later on. - event->setAccepted( KUrl::List::canDecode( event->mimeData() ) ); -} - -void CertKeyListView::contentsDragMoveEvent( QDragMoveEvent * event ) -{ - event->setAccepted( KUrl::List::canDecode( event->mimeData() ) ); -} - - -void CertKeyListView::contentsDragLeaveEvent( QDragLeaveEvent * ) -{ - // Don't let QListView do its stuff -} - -void CertKeyListView::contentsDropEvent( QDropEvent * event ) -{ - KUrl::List lst = KUrl::List::fromMimeData( event->mimeData() ); - if ( !lst.isEmpty() ) { - event->accept(); - emit dropped( lst ); - } -} - -#include "certlistview.moc" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certlistview.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certlistview.h --- kdepim-4.0.83/kleopatra/certlistview.h 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/certlistview.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,65 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - certlistview.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2007 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef CERTLISTVIEW_H -#define CERTLISTVIEW_H - -#include "libkleo/ui/keylistview.h" -#include -//Added by qt3to4: -#include -#include -#include -#include - -/// We need to derive from Kleo::KeyListView simply to add support for drop events -class CertKeyListView : public Kleo::KeyListView { - Q_OBJECT - -public: - CertKeyListView( const ColumnStrategy * strategy, - const DisplayStrategy * display=0, - QWidget * parent=0, Qt::WFlags f=0 ); - -signals: - void dropped( const KUrl::List& urls ); - -protected: - virtual void contentsDragEnterEvent ( QDragEnterEvent * ); - virtual void contentsDragMoveEvent( QDragMoveEvent * ); - virtual void contentsDragLeaveEvent( QDragLeaveEvent * ); - virtual void contentsDropEvent ( QDropEvent * ); - -}; - - -#endif /* CERTLISTVIEW_H */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certmanager.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certmanager.cpp --- kdepim-4.0.83/kleopatra/certmanager.cpp 2008-02-28 17:54:39.000000000 +0000 +++ kdepim-4.0.98/kleopatra/certmanager.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,1468 +0,0 @@ -/* - certmanager.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2001,2002,2004 Klar�vdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "certmanager.h" - -#include "certlistview.h" -#include "certificatewizardimpl.h" -#include "certificateinfowidgetimpl.h" -#include "crlview.h" -#include "customactions.h" -#include "hierarchyanalyser.h" -#include "conf/configuredialog.h" - -// libkleopatra -#include "libkleo/kleo/cryptobackendfactory.h" -#include "libkleo/kleo/downloadjob.h" -#include "libkleo/kleo/importjob.h" -#include "libkleo/kleo/exportjob.h" -#include "libkleo/kleo/multideletejob.h" -#include "libkleo/kleo/deletejob.h" -#include "libkleo/kleo/keylistjob.h" -#include "libkleo/kleo/dn.h" -#include "libkleo/kleo/keyfilter.h" -#include "libkleo/kleo/keyfiltermanager.h" -#include "libkleo/kleo/hierarchicalkeylistjob.h" -#include "libkleo/kleo/refreshkeysjob.h" -#include "libkleo/kleo/cryptoconfig.h" -#include "libkleo/ui/progressdialog.h" -#include "libkleo/ui/progressbar.h" -#include "libkleo/ui/keyselectiondialog.h" -#include "libkleo/ui/cryptoconfigdialog.h" - -// GPGME++ -#include -#include -#include - -// KDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Qt -#include -#include -#include -#include -#include -#include -#include -// other -#include -#include -namespace { - - class DisplayStrategy : public Kleo::KeyListView::DisplayStrategy{ - public: - ~DisplayStrategy() {} - - virtual QFont keyFont( const GpgME::Key& key, const QFont& font ) const { - const boost::shared_ptr filter = Kleo::KeyFilterManager::instance()->filterMatching( key, Kleo::KeyFilter::Appearance ); - return filter ? filter->font( font ) : font; - } - virtual QColor keyForeground( const GpgME::Key& key, const QColor& c ) const { - const boost::shared_ptr filter = Kleo::KeyFilterManager::instance()->filterMatching( key, Kleo::KeyFilter::Appearance ); - if ( filter && filter->fgColor().isValid() ) - return filter->fgColor(); - return c; - } - virtual QColor keyBackground( const GpgME::Key& key, const QColor& c ) const { - const boost::shared_ptr filter = Kleo::KeyFilterManager::instance()->filterMatching( key, Kleo::KeyFilter::Appearance ); - if ( filter && filter->bgColor().isValid() ) - return filter->bgColor(); - return c; - } - }; - - class ColumnStrategy : public Kleo::KeyListView::ColumnStrategy { - public: - ~ColumnStrategy() {} - - QString title( int col ) const; - QString text( const GpgME::Key & key, int col ) const; - int width( int col, const QFontMetrics & fm ) const; - }; - - QString ColumnStrategy::title( int col ) const { - switch ( col ) { - case 0: return i18n("Subject"); - case 1: return i18n("Issuer"); - case 2: return i18n("Serial"); - default: return QString(); - } - } - - QString ColumnStrategy::text( const GpgME::Key & key, int col ) const { - switch ( col ) { - case 0: return Kleo::DN( key.userID(0).id() ).prettyDN(); - case 1: return Kleo::DN( key.issuerName() ).prettyDN(); - case 2: return key.issuerSerial() ? QString::fromUtf8( key.issuerSerial() ) : QString() ; - default: return QString(); - } - } - - int ColumnStrategy::width( int col, const QFontMetrics & fm ) const { - int factor = -1; - switch ( col ) { - case 0: factor = 6; break; - case 1: factor = 4; break; - default: return -1; - } - return fm.width( title( col ) ) * factor; - } -} // anon namespace - -CertManager::CertManager( bool remote, const QString& query, const QString & import, - QWidget* parent, Qt::WFlags f ) - : KXmlGuiWindow( parent, f|Qt::WDestructiveClose ), - mCrlView( 0 ), - mDirmngrProc( 0 ), - mHierarchyAnalyser( 0 ), - mLineEditAction( 0 ), - mComboAction( 0 ), - mFindAction( 0 ), - mImportCertFromFileAction( 0 ), - mImportCRLFromFileAction( 0 ), - mNextFindRemote( remote ), - mRemote( remote ), - mDirMngrFound( false ) -{ - readConfig( query.isEmpty() ); - createStatusBar(); - createActions(); - - createGUI(); - setAutoSaveSettings(); - - // Main Window -------------------------------------------------- - mKeyListView = new CertKeyListView( new ColumnStrategy(), new DisplayStrategy(), this ); - mKeyListView->setObjectName( "mKeyListView" ); - mKeyListView->setSelectionMode( Q3ListView::Extended ); - setCentralWidget( mKeyListView ); - - connect( mKeyListView, SIGNAL(doubleClicked(Kleo::KeyListViewItem*,const QPoint&,int)), - SLOT(slotViewDetails(Kleo::KeyListViewItem*)) ); - connect( mKeyListView, SIGNAL(returnPressed(Kleo::KeyListViewItem*)), - SLOT(slotViewDetails(Kleo::KeyListViewItem*)) ); - connect( mKeyListView, SIGNAL(selectionChanged()), - SLOT(slotSelectionChanged()) ); - connect( mKeyListView, SIGNAL(contextMenu(Kleo::KeyListViewItem*, const QPoint&)), - SLOT(slotContextMenu(Kleo::KeyListViewItem*, const QPoint&)) ); - - connect( mKeyListView, SIGNAL(dropped(const KUrl::List&) ), - SLOT( slotDropped(const KUrl::List&) ) ); - - mLineEditAction->setText(query); - if ( !mRemote || !query.isEmpty() ) - slotSearch(); - - if ( !import.isEmpty() ) - slotImportCertFromFile( KUrl( import ) ); - - slotToggleHierarchicalView( mHierarchicalView ); - updateStatusBarLabels(); - slotSelectionChanged(); // initial state for selection-dependent actions -} - -CertManager::~CertManager() { - writeConfig(); - delete mDirmngrProc; mDirmngrProc = 0; - delete mHierarchyAnalyser; mHierarchyAnalyser = 0; -} - -void CertManager::readConfig( bool noQueryGiven ) { - KConfig _config( "kleopatrarc" ); - KConfigGroup config(&_config, "Display Options" ); - mHierarchicalView = config.readEntry( "hierarchicalView", false ); - if ( noQueryGiven ) { - mNextFindRemote = config.readEntry( "startInRemoteMode", false ); - } -} - -void CertManager::writeConfig() { - KConfig _config( "kleopatrarc" ); - KConfigGroup config(&_config, "Display Options" ); - config.writeEntry( "hierarchicalView", mKeyListView->hierarchical() ); - config.writeEntry( "startInRemoteMode", mNextFindRemote ); -} - -void CertManager::createStatusBar() { - KStatusBar * bar = statusBar(); - mProgressBar = new Kleo::ProgressBar( bar ); - mProgressBar->setObjectName( "mProgressBar" ); - mProgressBar->reset(); - mProgressBar->setFixedSize( QSize( 100, mProgressBar->height() * 3 / 5 ) ); - bar->addPermanentWidget( mProgressBar, 0 ); - mStatusLabel = new QLabel( bar ); - mStatusLabel->setObjectName( "mStatusLabel" ); - bar->addWidget( mStatusLabel, 1 ); -} - -static inline void connectEnableOperationSignal( QObject * s, QObject * d ) { - QObject::connect( s, SIGNAL(enableOperations(bool)), - d, SLOT(setEnabled(bool)) ); -} - - -void CertManager::createActions() { - QAction * action = 0; - KActionCollection *coll = actionCollection(); - - (void)KStandardAction::quit( this, SLOT(close()), actionCollection() ); - - action = KStandardAction::redisplay( this, SLOT(slotRedisplay()), actionCollection() ); - // work around the fact that the stdaction has no shortcut - KShortcut reloadShortcut = KStandardShortcut::shortcut(KStandardShortcut::Reload); - reloadShortcut.setAlternate(Qt::CTRL + Qt::Key_R); - action->setShortcuts( reloadShortcut ); - - connectEnableOperationSignal( this, action ); - - action = coll->addAction( "view_stop_operations" ); - action->setIcon( KIcon("process-stop") ); - action->setText( i18n("Stop Operation") ); - connect(action, SIGNAL(triggered(bool) ), SIGNAL(stopOperations())); - action->setShortcut(QKeySequence(Qt::Key_Escape)); - action->setEnabled( false ); - - action = coll->addAction( "file_new_certificate" ); - action->setIcon( KIcon("document-new") ); - action->setText( i18n("New Key Pair...") ); - connect(action, SIGNAL(triggered(bool) ), SLOT(newCertificate())); - - action = coll->add( "view_hierarchical" ); - action->setText( i18n("Hierarchical Key List") ); - connect( action, SIGNAL(toggled(bool)), SLOT(slotToggleHierarchicalView(bool)) ); - - action = coll->addAction( "view_expandall" ); - action->setText( i18n("Expand All") ); - connect(action, SIGNAL(triggered(bool) ), SLOT(slotExpandAll())); - action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_Period)); - - action = coll->addAction( "view_collapseall" ); - action->setText( i18n("Collapse All") ); - connect(action, SIGNAL(triggered(bool) ), SLOT(slotCollapseAll())); - action->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_Comma)); - - action = coll->addAction( "certificates_refresh_clr" ); - action->setText( i18n("Refresh CRLs" ) ); - connect(action, SIGNAL(triggered(bool) ), SLOT(slotRefreshKeys())); - -#ifdef NOT_IMPLEMENTED_ANYWAY - mRevokeCertificateAction = new KAction( i18n("Revoke"), 0, - this, SLOT(revokeCertificate()), - actionCollection(), "edit_revoke_certificate" ); - connectEnableOperationSignal( this, mRevokeCertificateAction ); - - mExtendCertificateAction = new KAction( i18n("Extend"), 0, - this, SLOT(extendCertificate()), - actionCollection(), "edit_extend_certificate" ); - connectEnableOperationSignal( this, mExtendCertificateAction ); -#endif - - mDeleteCertificateAction = coll->addAction( "edit_delete_certificate" ); - mDeleteCertificateAction->setIcon( KIcon("edit-delete") ); - mDeleteCertificateAction->setText( i18n("Delete") ); - connect(mDeleteCertificateAction, SIGNAL(triggered(bool) ), SLOT(slotDeleteCertificate())); - mDeleteCertificateAction->setShortcut(QKeySequence(Qt::Key_Delete)); - connectEnableOperationSignal( this, mDeleteCertificateAction ); - - mValidateCertificateAction = coll->addAction( "certificates_validate" ); - mValidateCertificateAction->setIcon( KIcon("view-refresh") ); - mValidateCertificateAction->setText( i18n("Validate") ); - connect(mValidateCertificateAction, SIGNAL(triggered(bool) ), SLOT(slotValidate())); - mValidateCertificateAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F5)); - connectEnableOperationSignal( this, mValidateCertificateAction ); - - mImportCertFromFileAction = coll->addAction( "file_import_certificates" ); - mImportCertFromFileAction->setText( i18n("Import Certificates...") ); - connect(mImportCertFromFileAction, SIGNAL(triggered(bool) ), SLOT(slotImportCertFromFile())); - connectEnableOperationSignal( this, mImportCertFromFileAction ); - - mImportCRLFromFileAction = coll->addAction( "file_import_crls" ); - mImportCRLFromFileAction->setText( i18n("Import CRLs...") ); - connect(mImportCRLFromFileAction, SIGNAL(triggered(bool) ), SLOT(importCRLFromFile())); - connectEnableOperationSignal( this, mImportCRLFromFileAction ); - - mExportCertificateAction = coll->addAction( "file_export_certificate" ); - mExportCertificateAction->setIcon( KIcon("export") ); - mExportCertificateAction->setText( i18n("Export Certificates...") ); - connect(mExportCertificateAction, SIGNAL(triggered(bool) ), SLOT(slotExportCertificate())); - - mExportSecretKeyAction = coll->addAction( "file_export_secret_keys" ); - mExportSecretKeyAction->setIcon( KIcon("export") ); - mExportSecretKeyAction->setText( i18n("Export Secret Key...") ); - connect(mExportSecretKeyAction, SIGNAL(triggered(bool) ), SLOT(slotExportSecretKey())); - connectEnableOperationSignal( this, mExportSecretKeyAction ); - - mViewCertDetailsAction = coll->addAction( "view_certificate_details" ); - mViewCertDetailsAction->setText( i18n("Certificate Details") ); - connect(mViewCertDetailsAction, SIGNAL(triggered(bool) ), SLOT(slotViewDetails())); - - mDownloadCertificateAction = coll->addAction( "download_certificate" ); - mDownloadCertificateAction->setText( i18n( "Download") ); - connect(mDownloadCertificateAction, SIGNAL(triggered(bool) ), SLOT(slotDownloadCertificate())); - - mDirMngrFound = !KStandardDirs::findExe( "dirmngr" ).isEmpty() && !KStandardDirs::findExe( "gpgsm" ).isEmpty(); - action = coll->addAction( "crl_dump_crl_cache" ); - action->setText( i18n("Dump CRL Cache") ); - connect(action, SIGNAL(triggered(bool) ), SLOT(slotViewCRLs())); - action->setEnabled( mDirMngrFound ); - - action = coll->addAction( "crl_clear_crl_cache" ); - action->setText( i18n("Clear CRL Cache" ) ); - connect(action, SIGNAL(triggered(bool) ), SLOT(slotClearCRLs())); - action->setEnabled( mDirMngrFound ); - - action = coll->addAction( "tools_start_kwatchgnupg"); - action->setIcon( KIcon("pgp-keys") ); - action->setText( i18n("GnuPG Log Viewer...") ); - connect(action, SIGNAL(triggered(bool)), SLOT(slotStartWatchGnuPG())); - // disable action if no kwatchgnupg binary is around - if (KStandardDirs::findExe("kwatchgnupg").isEmpty()) action->setEnabled(false); - - (void)new LabelAction( i18n("Search:"), actionCollection(), "label_action" ); - - mLineEditAction = new LineEditAction( QString(), actionCollection(), this, - SLOT(slotSearch()), - "query_lineedit_action"); - - QStringList lst; - lst << i18n("In Local Certificates") << i18n("In External Certificates"); - mComboAction = new ComboAction( lst, actionCollection(), this, SLOT( slotToggleRemote(int) ), - "location_combo_action", mNextFindRemote? 1 : 0 ); - - mFindAction = coll->addAction( "find" ); - mFindAction->setIcon( KIcon("edit-find") ); - mFindAction->setText( i18n("Find") ); - connect(mFindAction, SIGNAL(triggered(bool)), SLOT(slotSearch())); - - KStandardAction::keyBindings( this, SLOT(slotEditKeybindings()), actionCollection() ); - KStandardAction::preferences( this, SLOT(slotShowConfigurationDialog()), actionCollection() ); - - action = coll->addAction( "configure_gpgme" ); - action->setText( i18n( "Configure &GpgME Backend" ) ); - connect(action, SIGNAL(triggered(bool)), SLOT(slotConfigureGpgME())); - - createStandardStatusBarAction(); - updateImportActions( true ); -} - -void CertManager::updateImportActions( bool enable ) { - mImportCRLFromFileAction->setEnabled( mDirMngrFound && enable ); - mImportCertFromFileAction->setEnabled( enable ); -} - -void CertManager::slotEditKeybindings() { - KShortcutsDialog::configure( actionCollection(), KShortcutsEditor::LetterShortcutsAllowed ); -} - -void CertManager::slotShowConfigurationDialog() { - ConfigureDialog dlg( this ); - connect( &dlg, SIGNAL( configCommitted() ), SLOT( slotRepaint() ) ); - dlg.exec(); -} - -void CertManager::slotConfigureGpgME() { - Kleo::CryptoConfig* config = Kleo::CryptoBackendFactory::instance()->config(); - if ( config ) { - Kleo::CryptoConfigDialog dlg( config ); - - int result = dlg.exec(); - - // Forget all data parsed from gpgconf, so that we show updated information - // when reopening the configuration dialog. - config->clear(); - - if ( result == QDialog::Accepted ) - { - // Tell other apps (e.g. kmail) that the gpgconf data might have changed - QDBusMessage message = - QDBusMessage::createSignal(QString(), "org.kde.kleo.CryptoConfig", "changed"); - QDBusConnection::sessionBus().send(message); - } - } -} - -void CertManager::slotRepaint() -{ - mKeyListView->repaintContents(); -} - -void CertManager::slotToggleRemote( int idx ) { - mNextFindRemote = idx != 0; -} - -void CertManager::slotToggleHierarchicalView( bool hier ) { - mHierarchicalView = hier; - mKeyListView->setHierarchical( hier ); - mKeyListView->setRootIsDecorated( hier ); - if ( QAction * act = action("view_expandall") ) - act->setEnabled( hier ); - if ( QAction * act = action("view_collapseall" ) ) - act->setEnabled( hier ); - if ( KToggleAction * act = - static_cast( action("view_hierarchical") ) ) - act->setChecked( hier ); - - if ( hier && !mCurrentQuery.isEmpty() ) - startRedisplay( false ); -} - -void CertManager::slotExpandAll() { - for ( Q3ListViewItemIterator it( mKeyListView ) ; it.current() ; ++it ) - it.current()->setOpen( true ); -} - -void CertManager::slotCollapseAll() { - for ( Q3ListViewItemIterator it( mKeyListView ) ; it.current() ; ++it ) - it.current()->setOpen( false ); -} - -void CertManager::connectJobToStatusBarProgress( Kleo::Job * job, const QString & initialText ) { - assert( mProgressBar ); - if ( !job ) - return; - if ( !initialText.isEmpty() ) - statusBar()->showMessage( initialText ); - connect( job, SIGNAL(progress(const QString&,int,int)), - mProgressBar, SLOT(slotProgress(const QString&,int,int)) ); - connect( job, SIGNAL(done()), mProgressBar, SLOT(reset()) ); - connect( this, SIGNAL(stopOperations()), job, SLOT(slotCancel()) ); - - action("view_stop_operations")->setEnabled( true ); - emit enableOperations( false ); -} - -void CertManager::disconnectJobFromStatusBarProgress( const GpgME::Error & err ) { - updateStatusBarLabels(); - const QString msg = err.isCanceled() ? i18n("Canceled.") - : err ? i18n("Failed.") - : i18n("Done.") ; - statusBar()->showMessage( msg, 4000 ); - - action("view_stop_operations")->setEnabled( false ); - emit enableOperations( true ); - slotSelectionChanged(); -} - -void CertManager::updateStatusBarLabels() { - mKeyListView->flushKeys(); - int total = 0; - for ( Q3ListViewItemIterator it( mKeyListView ) ; it.current() ; ++it ) - ++total; - mStatusLabel->setText( i18np( "%1 Key.","%1 Keys.", total ) ); -} - -// -// -// Key Listing: -// -// - - -static std::set extractKeyFingerprints( const Q3PtrList & items ) { - std::set result; - for ( Q3PtrListIterator it( items ) ; it.current() ; ++it ) - if ( const char * fpr = it.current()->key().primaryFingerprint() ) - result.insert( fpr ); - return result; -} - -static QStringList stringlistFromSet( const std::set & set ) { - // ARGH. This is madness. Shitty Qt containers don't support QStringList( patterns.begin(), patterns.end() ) :/ - QStringList sl; - for ( std::set::const_iterator it = set.begin() ; it != set.end() ; ++it ) - // let's make extra sure, maybe someone tries to make Qt not support std::string->QString conversion - sl.push_back( QString::fromLatin1( it->c_str() ) ); - return sl; -} - -void CertManager::slotRefreshKeys() { - const QStringList keys = stringlistFromSet( extractKeyFingerprints( mKeyListView->selectedItems() ) ); - Kleo::RefreshKeysJob * job = Kleo::CryptoBackendFactory::instance()->smime()->refreshKeysJob(); - assert( job ); - - connect( job, SIGNAL(result(const GpgME::Error&)), - this, SLOT(slotRefreshKeysResult(const GpgME::Error&)) ); - - connectJobToStatusBarProgress( job, i18n("Refreshing keys...") ); - if ( const GpgME::Error err = job->start( keys ) ) - slotRefreshKeysResult( err ); -} - -void CertManager::slotRefreshKeysResult( const GpgME::Error & err ) { - disconnectJobFromStatusBarProgress( err ); - if ( err.isCanceled() ) - return; - if ( err ) - KMessageBox::error( this, i18n("An error occurred while trying to refresh " - "keys:\n%1", QString::fromLocal8Bit( err.asString() ) ), - i18n("Refreshing Keys Failed") ); -} - -static void showKeyListError( QWidget * parent, const GpgME::Error & err ) { - assert( err ); - const QString msg = i18n( "

An error occurred while fetching " - "the certificates from the backend:

" - "

%1

" , - QString::fromLocal8Bit( err.asString() ) ); - - KMessageBox::error( parent, msg, i18n( "Certificate Listing Failed" ) ); -} - -void CertManager::slotSearch() { - mPreviouslySelectedFingerprints.clear(); - // Clear display - mKeyListView->clear(); - mCurrentQuery = mLineEditAction->text(); - startKeyListing( false, false, QStringList( mCurrentQuery ) ); -} - -void CertManager::startRedisplay( bool validate ) { - mPreviouslySelectedFingerprints = extractKeyFingerprints( mKeyListView->selectedItems() ); - if ( mPreviouslySelectedFingerprints.empty() ) - startKeyListing( validate, true, QStringList( mCurrentQuery ) ); - else - startKeyListing( validate, true, mPreviouslySelectedFingerprints ); -} - -void CertManager::startKeyListing( bool validating, bool refresh, const std::set & patterns ) { - startKeyListing( validating, refresh, stringlistFromSet( patterns ) ); -} - -void CertManager::startKeyListing( bool validating, bool refresh, const QStringList & patterns ) { - mRemote = mNextFindRemote; - mLineEditAction->setEnabled( false ); - mComboAction->setEnabled( false ); - mFindAction->setEnabled( false ); - - Kleo::KeyListJob * job = 0; - if ( !validating && !refresh && mKeyListView->hierarchical() && !patterns.empty() ) - job = new Kleo::HierarchicalKeyListJob( Kleo::CryptoBackendFactory::instance()->smime(), - mRemote, false, validating ); - else - job = Kleo::CryptoBackendFactory::instance()->smime()->keyListJob( mRemote, false, validating ); - assert( job ); - - connect( job, SIGNAL(nextKey(const GpgME::Key&)), - mKeyListView, refresh ? SLOT(slotRefreshKey(const GpgME::Key&)) : SLOT(slotAddKey(const GpgME::Key&)) ); - connect( job, SIGNAL(result(const GpgME::KeyListResult&)), - this, SLOT(slotKeyListResult(const GpgME::KeyListResult&)) ); - - connectJobToStatusBarProgress( job, i18n("Fetching keys...") ); - - const GpgME::Error err = job->start( patterns ) ; - if ( err ) { - showKeyListError( this, err ); - return; - } - mProgressBar->setRange( 0, 0 ); // enable busy indicator -} - -static void selectKeys( Kleo::KeyListView * lv, const std::set & fprs ) { - if ( !lv || fprs.empty() ) - return; - for ( Q3ListViewItemIterator it( lv ) ; it.current() ; ++it ) - if ( Kleo::KeyListViewItem * item = Kleo::lvi_cast( it.current() ) ) { - const char * fpr = item->key().primaryFingerprint(); - item->setSelected( fpr && fprs.find( fpr ) != fprs.end() ); - } -} - -void CertManager::slotKeyListResult( const GpgME::KeyListResult & res ) { - if ( res.error() ) - showKeyListError( this, res.error() ); - else if ( res.isTruncated() ) - KMessageBox::information( this, - i18n("The query result has been truncated.\n" - "Either the local or a remote limit on " - "the maximum number of returned hits has " - "been exceeded.\n" - "You can try to increase the local limit " - "in the configuration dialog, but if one " - "of the configured servers is the limiting " - "factor, you have to refine your search.") ); - - mLineEditAction->setEnabled( true ); - mComboAction->setEnabled( true ); - mFindAction->setEnabled( true ); - - mLineEditAction->focusAll(); - disconnectJobFromStatusBarProgress( res.error() ); - selectKeys( mKeyListView, mPreviouslySelectedFingerprints ); -} - -void CertManager::slotContextMenu(Kleo::KeyListViewItem* item, const QPoint& point) { - if ( !item ) - return; - if ( QMenu * popup = static_cast(factory()->container("listview_popup",this)) ) - popup->exec( point ); -} - -/** - This slot is invoked when the user selects "New certificate" -*/ -void CertManager::newCertificate() -{ - CertificateWizardImpl wizard( this ); - wizard.exec(); -} - -/** - This slot is invoked when the user selects revoke certificate. - The slot will revoke the selected certificates -*/ -void CertManager::revokeCertificate() -{ - qDebug("Not Yet Implemented"); -} - -/** - This slot is invoked when the user selects extend certificate. - It will send an extension request for the selected certificates -*/ -void CertManager::extendCertificate() -{ - qDebug("Not Yet Implemented"); -} - - -// -// -// Downloading / Importing Certificates -// -// - - -/** - This slot is invoked when the user selects Certificates/Import/From File. -*/ -void CertManager::slotImportCertFromFile() -{ - const QString filter = "application/x-x509-ca-cert application/x-pkcs12 application/pkcs7-mime"; - //const QString filter = QString("*.pem *.der *.p7c *.p12|") + i18n("Certificates (*.pem *.der *.p7c *.p12)"); - slotImportCertFromFile( KFileDialog::getOpenUrl( KUrl(), filter, this, - i18n( "Select Certificate File" ) ) ); -} - -void CertManager::slotImportCertFromFile( const KUrl & certURL ) -{ - if ( !certURL.isValid() ) // empty or malformed - return; - - mPreviouslySelectedFingerprints.clear(); - - // Prevent two simultaneous imports - updateImportActions( false ); - - // Download the cert - KIO::StoredTransferJob* importJob = KIO::storedGet( certURL ); - importJob->ui()->setWindow( this ); - connect( importJob, SIGNAL(result(KJob*)), SLOT(slotImportResult(KJob*)) ); -} - -void CertManager::slotImportResult( KJob* job ) -{ - if ( job->error() ) { - static_cast(job)->ui()->showErrorMessage(); - } else { - KIO::StoredTransferJob* trJob = static_cast( job ); - startCertificateImport( trJob->data(), trJob->url().fileName() ); - } - - updateImportActions( true ); -} - -static void showCertificateDownloadError( QWidget * parent, const GpgME::Error & err, const QString& certDisplayName ) { - assert( err ); - const QString msg = i18n( "

An error occurred while trying " - "to download the certificate %1:

" - "

%2

" , - certDisplayName , - QString::fromLocal8Bit( err.asString() ) ); - - KMessageBox::error( parent, msg, i18n( "Certificate Download Failed" ) ); -} - -void CertManager::slotDownloadCertificate() { - mPreviouslySelectedFingerprints.clear(); - Q3PtrList items = mKeyListView->selectedItems(); - for ( Q3PtrListIterator it( items ) ; it.current() ; ++it ) - if ( !it.current()->key().isNull() ) - if ( const char * fpr = it.current()->key().primaryFingerprint() ) - slotStartCertificateDownload( fpr, it.current()->text(0) ); -} - -// Called from slotDownloadCertificate and from the certificate-details widget -void CertManager::slotStartCertificateDownload( const QString& fingerprint, const QString& displayName ) { - if ( fingerprint.isEmpty() ) - return; - - Kleo::DownloadJob * job = - Kleo::CryptoBackendFactory::instance()->smime()->downloadJob( false /* no armor */ ); - assert( job ); - - connect( job, SIGNAL(result(const GpgME::Error&,const QByteArray&)), - SLOT(slotCertificateDownloadResult(const GpgME::Error&,const QByteArray&)) ); - - connectJobToStatusBarProgress( job, i18n("Fetching certificate from server...") ); - - const GpgME::Error err = job->start( QStringList( fingerprint ) ); - if ( err ) - showCertificateDownloadError( this, err, displayName ); - else { - mProgressBar->setRange( 0, 0 ); - mJobsDisplayNameMap.insert( job, displayName ); - } -} - -QString CertManager::displayNameForJob( const Kleo::Job *job ) -{ - JobsDisplayNameMap::iterator it = mJobsDisplayNameMap.find( job ); - QString displayName; - if ( it != mJobsDisplayNameMap.end() ) { - displayName = *it; - mJobsDisplayNameMap.erase( it ); - } else { - kWarning() <<"Job not found in map:" << job; - } - return displayName; -} - -// Don't call directly! -void CertManager::slotCertificateDownloadResult( const GpgME::Error & err, const QByteArray & keyData ) { - - QString displayName = displayNameForJob( static_cast( sender() ) ); - - if ( err ) - showCertificateDownloadError( this, err, displayName ); - else - startCertificateImport( keyData, displayName ); - disconnectJobFromStatusBarProgress( err ); -} - -static void showCertificateImportError( QWidget * parent, const GpgME::Error & err, const QString& certDisplayName ) { - assert( err ); - const QString msg = i18n( "

An error occurred while trying " - "to import the certificate %1:

" - "

%2

" , - certDisplayName , - QString::fromLocal8Bit( err.asString() ) ); - KMessageBox::error( parent, msg, i18n( "Certificate Import Failed" ) ); -} - -void CertManager::startCertificateImport( const QByteArray & keyData, const QString& certDisplayName ) { - Kleo::ImportJob * job = Kleo::CryptoBackendFactory::instance()->smime()->importJob(); - assert( job ); - - connect( job, SIGNAL(result(const GpgME::ImportResult&)), - SLOT(slotCertificateImportResult(const GpgME::ImportResult&)) ); - - connectJobToStatusBarProgress( job, i18n("Importing certificates...") ); - - kDebug() <<"Importing certificate. keyData size:" << keyData.size(); - const GpgME::Error err = job->start( keyData ); - if ( err ) - showCertificateImportError( this, err, certDisplayName ); - else { - mProgressBar->setRange( 0, 0 ); - mJobsDisplayNameMap.insert( job, certDisplayName ); - } -} - -void CertManager::slotCertificateImportResult( const GpgME::ImportResult & res ) { - QString displayName = displayNameForJob( static_cast( sender() ) ); - - if ( res.error().isCanceled() ) { - // do nothing - } else if ( res.error() ) { - showCertificateImportError( this, res.error(), displayName ); - } else { - - const KLocalizedString normalLine = ki18n("%1%2"); - const KLocalizedString boldLine = ki18n("%1%2"); - - QStringList lines; - lines.push_back( normalLine.subs( i18n("Total number processed:") ) - .subs( res.numConsidered() ).toString() ); - lines.push_back( normalLine.subs( i18n("Imported:") ) - .subs( res.numImported() ).toString() ); - if ( res.newSignatures() ) - lines.push_back( normalLine.subs( i18n("New signatures:") ) - .subs( res.newSignatures() ).toString() ); - if ( res.newUserIDs() ) - lines.push_back( normalLine.subs( i18n("New user IDs:") ) - .subs( res.newUserIDs() ).toString() ); - if ( res.numKeysWithoutUserID() ) - lines.push_back( normalLine.subs( i18n("Keys without user IDs:") ) - .subs( res.numKeysWithoutUserID() ).toString() ); - if ( res.newSubkeys() ) - lines.push_back( normalLine.subs( i18n("New subkeys:") ) - .subs( res.newSubkeys() ).toString() ); - if ( res.newRevocations() ) - lines.push_back( boldLine.subs( i18n("Newly revoked:") ) - .subs( res.newRevocations() ).toString() ); - if ( res.notImported() ) - lines.push_back( boldLine.subs( i18n("Not imported:") ) - .subs( res.notImported() ).toString() ); - if ( res.numUnchanged() ) - lines.push_back( normalLine.subs( i18n("Unchanged:") ) - .subs( res.numUnchanged() ).toString() ); - if ( res.numSecretKeysConsidered() ) - lines.push_back( normalLine.subs( i18n("Secret keys processed:") ) - .subs( res.numSecretKeysConsidered() ).toString() ); - if ( res.numSecretKeysImported() ) - lines.push_back( normalLine.subs( i18n("Secret keys imported:") ) - .subs( res.numSecretKeysImported() ).toString() ); - if ( res.numSecretKeysConsidered() - res.numSecretKeysImported() - res.numSecretKeysUnchanged() > 0 ) - lines.push_back( boldLine.subs( i18n("Secret keys not imported:") ) - .subs( res.numSecretKeysConsidered() - - res.numSecretKeysImported() - - res.numSecretKeysUnchanged() ).toString() ); - if ( res.numSecretKeysUnchanged() ) - lines.push_back( normalLine.subs( i18n("Secret keys unchanged:") ) - .subs( res.numSecretKeysUnchanged() ).toString() ); - - KMessageBox::information( this, - i18n( "

Detailed results of importing %1:

" - "%2
" , - displayName, lines.join( QString() ) ), - i18n( "Certificate Import Result" ) ); - - disconnectJobFromStatusBarProgress( res.error() ); - // save the fingerprints of imported certs for later selection: - const std::vector imports = res.imports(); - for ( std::vector::const_iterator it = imports.begin() ; it != imports.end() ; ++it ) - mPreviouslySelectedFingerprints.insert( it->fingerprint() ); - } - importNextURLOrRedisplay(); -} - - - -/** - This slot is called when the dirmngr process that imports a - certificate file exists. -*/ -void CertManager::slotDirmngrExited(int exitCode, QProcess::ExitStatus exitStatus) { - if ( exitStatus == QProcess::CrashExit ) - KMessageBox::error( this, i18n( "The GpgSM process that tried to import the CRL file ended prematurely because of an unexpected error." ), i18n( "Certificate Manager Error" ) ); - else if ( exitCode ) - KMessageBox::error( this, i18n( "An error occurred when trying to import the CRL file. The output from GpgSM was:\n%1", mErrorbuffer ), i18n( "Certificate Manager Error" ) ); - else - KMessageBox::information( this, i18n( "CRL file imported successfully." ), i18n( "Certificate Manager Information" ) ); - - delete mDirmngrProc; mDirmngrProc = 0; - if ( !mImportCRLTempFile.isEmpty() ) - QFile::remove( mImportCRLTempFile ); - updateImportActions( true ); -} - -/** - This slot will import CRLs from a file. -*/ -void CertManager::importCRLFromFile() { - QString filter = QString("*.crl *.arl *-crl.der *-arl.der|") + i18n("Certificate Revocation List (*.crl *.arl *-crl.der *-arl.der)"); - KUrl url = KFileDialog::getOpenUrl( KUrl(), - filter, - this, - i18n( "Select CRL File" ) ); - if ( url.isValid() ) { - updateImportActions( false ); - if ( url.isLocalFile() ) { - startImportCRL( url.path(), false ); - updateImportActions( true ); - } else { - KTemporaryFile tempFile; - tempFile.setAutoRemove(false); - tempFile.open(); - KUrl destURL; - destURL.setPath( tempFile.fileName() ); - KIO::Job* copyJob = KIO::file_copy( url, destURL, 0600, KIO::Overwrite ); - copyJob->ui()->setWindow( this ); - connect( copyJob, SIGNAL( result( KJob * ) ), - SLOT( slotImportCRLJobFinished( KJob * ) ) ); - } - } -} - -void CertManager::slotImportCRLJobFinished( KJob *job ) -{ - KIO::FileCopyJob* fcjob = static_cast( job ); - QString tempFilePath = fcjob->destUrl().path(); - if ( job->error() ) { - static_cast(job)->ui()->showErrorMessage(); - QFile::remove( tempFilePath ); // unlink tempfile - updateImportActions( true ); - return; - } - startImportCRL( tempFilePath, true ); -} - -bool CertManager::connectAndStartDirmngr( const char * slot, const char * processname ) { - assert( slot ); - assert( processname ); - assert( mDirmngrProc ); - mErrorbuffer.clear(); - - connect( mDirmngrProc, SIGNAL(finished( int, QProcess::ExitStatus)), slot ); - - connect( mDirmngrProc, SIGNAL(readyReadStandardError () ), - this, SLOT(slotStderr() ) ); - mDirmngrProc->setOutputChannelMode(KProcess::OnlyStderrChannel); - - mDirmngrProc->start(); - - const bool ok = mDirmngrProc->waitForStarted(); - if( !ok ) { - delete mDirmngrProc; mDirmngrProc = 0; - KMessageBox::error( this, i18n( "Unable to start %1 process. Please check your installation.", processname ), i18n( "Certificate Manager Error" ) ); - return false; - } - return true; -} - -void CertManager::startImportCRL( const QString& filename, bool isTempFile ) -{ - assert( !mDirmngrProc ); - mImportCRLTempFile = isTempFile ? filename : QString(); - mDirmngrProc = new KProcess(); - *mDirmngrProc << "gpgsm" << "--call-dirmngr" << "loadcrl" << filename; - if ( !connectAndStartDirmngr( SLOT(slotDirmngrExited()), "gpgsm" ) ) { - updateImportActions( true ); - if ( isTempFile ) - QFile::remove( mImportCRLTempFile ); // unlink tempfile - } -} - -void CertManager::startClearCRLs() { - assert( !mDirmngrProc ); - mDirmngrProc = new KProcess(); - *mDirmngrProc << "dirmngr" << "--flush"; - //*mDirmngrProc << "gpgsm" << "--call-dimngr" << "flush"; // use this once it's implemented! - connectAndStartDirmngr( SLOT(slotClearCRLsResult()), "dirmngr" ); -} - -void CertManager::slotStderr() { - mErrorbuffer += QString::fromLocal8Bit( mDirmngrProc->readAllStandardError () ); -} - -/** - This slot will import CRLs from an LDAP server. -*/ -void CertManager::importCRLFromLDAP() -{ - qDebug("Not Yet Implemented"); -} - -void CertManager::slotViewCRLs() { - if ( !mCrlView ) - mCrlView = new CRLView( this ); - - mCrlView->show(); - mCrlView->slotUpdateView(); -} - - -void CertManager::slotClearCRLs() { - startClearCRLs(); -} - -void CertManager::slotClearCRLsResult() { - assert( mDirmngrProc ); - if ( mDirmngrProc->exitStatus() == QProcess::CrashExit ) - KMessageBox::error( this, i18n( "The DirMngr process that tried to clear the CRL cache ended prematurely because of an unexpected error." ), i18n( "Certificate Manager Error" ) ); - else if ( mDirmngrProc->exitCode() ) - KMessageBox::error( this, i18n( "An error occurred when trying to clear the CRL cache. The output from DirMngr was:\n%1", mErrorbuffer ), i18n( "Certificate Manager Error" ) ); - else - KMessageBox::information( this, i18n( "CRL cache cleared successfully." ), i18n( "Certificate Manager Information" ) ); - delete mDirmngrProc; mDirmngrProc = 0; -} - -static void showDeleteError( QWidget * parent, const GpgME::Error & err ) { - assert( err ); - const QString msg = i18n("

An error occurred while trying to delete " - "the certificates:

" - "

%1

", - QString::fromLocal8Bit( err.asString() ) ); - KMessageBox::error( parent, msg, i18n("Certificate Deletion Failed") ); -} - -static bool ByFingerprint( const GpgME::Key & left, const GpgME::Key & right ) { - return qstricmp( left.primaryFingerprint(), right.primaryFingerprint() ) < 0 ; -} - -static bool WithRespectToFingerprints( const GpgME::Key & left, const GpgME::Key & right ) { - return qstricmp( left.primaryFingerprint(), right.primaryFingerprint() ) == 0; -} - -void CertManager::slotDeleteCertificate() { - mItemsToDelete = mKeyListView->selectedItems(); - if ( mItemsToDelete.isEmpty() ) - return; - std::vector keys; - keys.reserve( mItemsToDelete.count() ); - QStringList keyDisplayNames; - for ( Q3PtrListIterator it( mItemsToDelete ) ; it.current() ; ++it ) - if ( !it.current()->key().isNull() ) { - keys.push_back( it.current()->key() ); - keyDisplayNames.push_back( it.current()->text( 0 ) ); - } - if ( keys.empty() ) - return; - - if ( !mHierarchyAnalyser ) { - mHierarchyAnalyser = new HierarchyAnalyser( this, "mHierarchyAnalyser" ); - Kleo::KeyListJob * job = Kleo::CryptoBackendFactory::instance()->smime()->keyListJob(); - assert( job ); - connect( job, SIGNAL(nextKey(const GpgME::Key&)), - mHierarchyAnalyser, SLOT(slotNextKey(const GpgME::Key&)) ); - connect( job, SIGNAL(result(const GpgME::KeyListResult&)), - this, SLOT(slotDeleteCertificate()) ); - connectJobToStatusBarProgress( job, i18n("Checking key dependencies...") ); - if ( const GpgME::Error error = job->start( QStringList() ) ) { - showKeyListError( this, error ); - delete mHierarchyAnalyser; mHierarchyAnalyser = 0; - } - return; - } else - disconnectJobFromStatusBarProgress( GpgME::Error() ); - - std::vector keysToDelete = keys; - for ( std::vector::const_iterator it = keys.begin() ; it != keys.end() ; ++it ) - if ( !it->isNull() ) { - const std::vector subjects - = mHierarchyAnalyser->subjectsForIssuerRecursive( it->primaryFingerprint() ); - keysToDelete.insert( keysToDelete.end(), subjects.begin(), subjects.end() ); - } - - std::sort( keysToDelete.begin(), keysToDelete.end(), ByFingerprint ); - keysToDelete.erase( std::unique( keysToDelete.begin(), keysToDelete.end(), - WithRespectToFingerprints ), - keysToDelete.end() ); - - delete mHierarchyAnalyser; mHierarchyAnalyser = 0; - - if ( keysToDelete.size() > keys.size() ) - if ( KMessageBox::warningContinueCancel( this, - i18n("Some or all of the selected " - "certificates are issuers (CA certificates) " - "for other, non-selected certificates.\n" - "Deleting a CA certificate will also delete " - "all certificates issued by it."), - i18n("Deleting CA Certificates") ) - != KMessageBox::Continue ) - return; - - const QString msg = keysToDelete.size() > keys.size() - ? i18np("Do you really want to delete this certificate and the %2 certificates it certified?", - "Do you really want to delete these %1 certificates and the %2 certificates they certified?", - keys.size(), keysToDelete.size() - keys.size() ) - : i18np("Do you really want to delete this certificate?", - "Do you really want to delete these %1 certificates?", keys.size() ) ; - - if ( KMessageBox::warningContinueCancelList( this, msg, keyDisplayNames, - i18n( "Delete Certificates" ), - KGuiItem( i18n( "Delete" ), "edit-delete" ), - KStandardGuiItem::cancel(), - "ConfirmDeleteCert", KMessageBox::Dangerous ) - != KMessageBox::Continue ) - return; - - if ( Kleo::DeleteJob * job = Kleo::CryptoBackendFactory::instance()->smime()->deleteJob() ) - job->slotCancel(); - else { - QString reason = i18n("Operation not supported by the backend."); - QString str = keys.size() == 1 - ? i18n("

An error occurred while trying to delete " - "the certificate:

" - "

%1

", reason ) - : i18n( "

An error occurred while trying to delete " - "the certificates:

" - "

%1

", reason ); - KMessageBox::error( this, str, i18n("Certificate Deletion Failed") ); - } - - mItemsToDelete.clear(); // re-create according to the real selection - for ( std::vector::const_iterator it = keysToDelete.begin() ; it != keysToDelete.end() ; ++it ) - if ( Kleo::KeyListViewItem * item = mKeyListView->itemByFingerprint( it->primaryFingerprint() ) ) - mItemsToDelete.append( item ); - - Kleo::MultiDeleteJob * job = new Kleo::MultiDeleteJob( Kleo::CryptoBackendFactory::instance()->smime() ); - assert( job ); - - connect( job, SIGNAL(result(const GpgME::Error&,const GpgME::Key&)), - SLOT(slotDeleteResult(const GpgME::Error&,const GpgME::Key&)) ); - - connectJobToStatusBarProgress( job, i18n("Deleting keys...") ); - - const GpgME::Error err = job->start( keys, true ); - if ( err ) - showDeleteError( this, err ); - else - mProgressBar->setRange( 0, 0 ); -} - -void CertManager::slotDeleteResult( const GpgME::Error & err, const GpgME::Key & ) { - if ( err ) - showDeleteError( this, err ); - else { - const int infinity = 100; // infinite loop guard... - mItemsToDelete.setAutoDelete( true ); - for ( int i = 0 ; i < infinity ; ++i ) { - Q3PtrListIterator it( mItemsToDelete ); - while ( Kleo::KeyListViewItem * cur = it.current() ) { - ++it; - if ( cur->childCount() == 0 ) { - mItemsToDelete.remove( cur ); - } - } - if ( mItemsToDelete.isEmpty() ) - break; - } - mItemsToDelete.setAutoDelete( false ); - Q_ASSERT( mItemsToDelete.isEmpty() ); - mItemsToDelete.clear(); - } - disconnectJobFromStatusBarProgress( err ); -} - -void CertManager::slotViewDetails( Kleo::KeyListViewItem * item ) { - if ( !item || item->key().isNull() ) - return; - - // - KDialog * dialog = new KDialog( this ); - dialog->setObjectName( "dialog" ); - dialog->setModal( false ); - dialog->setCaption( i18n("Additional Information for Key") ); - dialog->setButtons( KDialog::Close ); - dialog->setDefaultButton( KDialog::Close ); - - CertificateInfoWidgetImpl * top = new CertificateInfoWidgetImpl( item->key(), isRemote(), dialog ); - dialog->setMainWidget( top ); - // - connect( top, SIGNAL(requestCertificateDownload(const QString&, const QString&)), - SLOT(slotStartCertificateDownload(const QString&, const QString&)) ); - dialog->show(); -} - -void CertManager::slotViewDetails() -{ - Q3PtrList items = mKeyListView->selectedItems(); - if ( items.isEmpty() ) - return; - - // selectedItem() doesn't work in Extended mode. - // But we only want to show the details of one item... - slotViewDetails( items.first() ); -} - -void CertManager::slotSelectionChanged() -{ - mKeyListView->flushKeys(); - bool b = mKeyListView->hasSelection(); - mExportCertificateAction->setEnabled( b ); - mViewCertDetailsAction->setEnabled( b ); - mDeleteCertificateAction->setEnabled( b ); -#ifdef NOT_IMPLEMENTED_ANYWAY - mRevokeCertificateAction->setEnabled( b ); - mExtendCertificateAction->setEnabled( b ); -#endif - mDownloadCertificateAction->setEnabled( b && mRemote ); - mValidateCertificateAction->setEnabled( !mRemote ); -} - -void CertManager::slotExportCertificate() { - Q3PtrList items = mKeyListView->selectedItems(); - if ( items.isEmpty() ) - return; - - QStringList fingerprints; - for ( Q3PtrListIterator it( items ) ; it.current() ; ++it ) - if ( !it.current()->key().isNull() ) - if ( const char * fpr = it.current()->key().primaryFingerprint() ) - fingerprints.push_back( fpr ); - - startCertificateExport( fingerprints ); -} - -static void showCertificateExportError( QWidget * parent, const GpgME::Error & err ) { - assert( err ); - const QString msg = i18n("

An error occurred while trying to export " - "the certificate:

" - "

%1

", - QString::fromLocal8Bit( err.asString() ) ); - KMessageBox::error( parent, msg, i18n("Certificate Export Failed") ); -} - -void CertManager::startCertificateExport( const QStringList & fingerprints ) { - if ( fingerprints.empty() ) - return; - - // we need to use PEM (ascii armoured) format, since DER (binary) - // can't transport more than one certificate *sigh* this is madness :/ - Kleo::ExportJob * job = Kleo::CryptoBackendFactory::instance()->smime()->publicKeyExportJob( true ); - assert( job ); - - connect( job, SIGNAL(result(const GpgME::Error&,const QByteArray&)), - SLOT(slotCertificateExportResult(const GpgME::Error&,const QByteArray&)) ); - - connectJobToStatusBarProgress( job, i18n("Exporting certificate...") ); - - const GpgME::Error err = job->start( fingerprints ); - if ( err ) - showCertificateExportError( this, err ); - else - mProgressBar->setRange( 0, 0 ); -} - -// return true if we should proceed, false if we should abort -static bool checkOverwrite( const KUrl& url, bool& overwrite, QWidget* w ) -{ - if ( KIO::NetAccess::exists( url, KIO::NetAccess::DestinationSide /*dest*/, w ) ) { - if ( KMessageBox::Cancel == - KMessageBox::warningContinueCancel( - w, - i18n( "A file named \"%1\" already exists. " - "Are you sure you want to overwrite it?", url.prettyUrl() ), - i18n( "Overwrite File?" ), - KStandardGuiItem::overwrite() ) ) - return false; - overwrite = true; - } - return true; -} - -void CertManager::slotCertificateExportResult( const GpgME::Error & err, const QByteArray & data ) { - disconnectJobFromStatusBarProgress( err ); - if ( err ) { - showCertificateExportError( this, err ); - return; - } - - kDebug() <<"CertManager::slotCertificateExportResult(): got" << data.size() <<" bytes"; - - const QString filter = QString("*.pem|") + i18n("ASCII Armored Certificate Bundles (*.pem)"); - const KUrl url = KFileDialog::getOpenUrl( KUrl(), - filter, - this, - i18n( "Save Certificate" ) ); - if ( !url.isValid() ) - return; - - bool overwrite = false; - if ( !checkOverwrite( url, overwrite, this ) ) - return; - - KIO::Job* uploadJob = KIO::storedPut( data, url, -1, overwrite ? KIO::Overwrite : KIO::DefaultFlags ); - uploadJob->ui()->setWindow( this ); - connect( uploadJob, SIGNAL( result( KJob* ) ), - this, SLOT( slotUploadResult( KJob* ) ) ); -} - - -void CertManager::slotExportSecretKey() { - Kleo::KeySelectionDialog dlg( i18n("Secret Key Export"), - i18n("Select the secret key to export " - "(Warning: The PKCS#12 format is insecure; " - "exporting secret keys is discouraged):"), - std::vector(), - Kleo::KeySelectionDialog::SecretKeys|Kleo::KeySelectionDialog::SMIMEKeys, - false /* no multiple selection */, - false /* no remember choice box */, - this, "secret key export key selection dialog" ); - //dlg.setHideInvalidKeys( false ); - - if ( dlg.exec() != QDialog::Accepted ) - return; - - startSecretKeyExport( dlg.fingerprint() ); -} - -static void showSecretKeyExportError( QWidget * parent, const GpgME::Error & err ) { - assert( err ); - const QString msg = i18n("

An error occurred while trying to export " - "the secret key:

" - "

%1

", - QString::fromLocal8Bit( err.asString() ) ); - KMessageBox::error( parent, msg, i18n("Secret-Key Export Failed") ); -} - -void CertManager::startSecretKeyExport( const QString & fingerprint ) { - if ( fingerprint.isEmpty() ) - return; - - // PENDING(marc): let user choose between binary and PEM format? - - // Check if gpgsm supports --p12-charset - Kleo::CryptoConfig* config = Kleo::CryptoBackendFactory::instance()->config(); - QString charset; - if ( config && config->entry( "gpgsm", "Configuration", "p12-charset" ) ) { - // This comes from gnupg's sources, agent/minip12.c - // In fact, any charset supported by iconv would work, but we don't link to iconv directly... - static const char *charsets[] = { - "utf8", - "iso-8859-1", - "iso-8859-15", - "iso-8859-2", - "iso-8859-3", - "iso-8859-4", - "iso-8859-5", - "iso-8859-6", - "iso-8859-7", - "iso-8859-8", - "iso-8859-9", - "koi8-r", - "ibm437", - "ibm850", - "euc-jp", - "big5", - NULL - }; - QStringList charsetList; - for ( const char** c = charsets; *c; ++c ) { - charsetList.append( QString::fromLatin1( *c ) ); - } - - // TODO this selection could be done in a derived KeySelectionDialog which would add a combobox, - // it would be better integrated. - bool ok; - charset = KInputDialog::getItem( i18n("Exporting secret key..."), - i18n("Choose a charset for encoding the pkcs#12 passphrase (utf8 is recommended)"), - charsetList, - 0, false /*editable*/, - &ok, this ); - if ( !ok ) - return; - } - - Kleo::ExportJob * job = Kleo::CryptoBackendFactory::instance()->smime()->secretKeyExportJob( false, charset ); - assert( job ); - - connect( job, SIGNAL(result(const GpgME::Error&,const QByteArray&)), - SLOT(slotSecretKeyExportResult(const GpgME::Error&,const QByteArray&)) ); - - connectJobToStatusBarProgress( job, i18n("Exporting secret key...") ); - - const GpgME::Error err = job->start( QStringList( fingerprint ) ); - if ( err ) - showSecretKeyExportError( this, err ); - else - mProgressBar->setRange( 0, 0 ); -} - -void CertManager::slotSecretKeyExportResult( const GpgME::Error & err, const QByteArray & data ) { - disconnectJobFromStatusBarProgress( err ); - if ( err ) { - showSecretKeyExportError( this, err ); - return; - } - - kDebug() <<"CertManager::slotSecretKeyExportResult(): got" << data.size() <<" bytes"; - QString filter = QString("*.p12|") + i18n("PKCS#12 Key Bundle (*.p12)"); - KUrl url = KFileDialog::getOpenUrl( KUrl(), - filter, - this, - i18n( "Save Certificate" ) ); - if ( !url.isValid() ) - return; - - bool overwrite = false; - if ( !checkOverwrite( url, overwrite, this ) ) - return; - - KIO::Job* uploadJob = KIO::storedPut( data, url, -1, overwrite ? KIO::Overwrite : KIO::DefaultFlags ); - uploadJob->ui()->setWindow( this ); - connect( uploadJob, SIGNAL( result( KJob* ) ), - this, SLOT( slotUploadResult( KJob* ) ) ); -} - -void CertManager::slotUploadResult( KJob* job ) -{ - if ( job->error() ) - static_cast(job)->ui()->showErrorMessage(); -} - -void CertManager::slotDropped(const KUrl::List& lst) -{ - mURLsToImport = lst; - if ( !lst.empty() ) - importNextURLOrRedisplay(); -} - -void CertManager::importNextURLOrRedisplay() -{ - if ( !mURLsToImport.empty() ) { - // We can only import them one by one, otherwise the jobs would run into each other - KUrl url = mURLsToImport.front(); - mURLsToImport.pop_front(); - slotImportCertFromFile( url ); - } else { - if ( isRemote() ) - return; - startKeyListing( false, true, mPreviouslySelectedFingerprints ); - } -} - -void CertManager::slotStartWatchGnuPG() -{ - if( !QProcess::startDetached("kwatchgnupg" ) ) - KMessageBox::error( this, i18n( "Could not start GnuPG LogViewer (kwatchgnupg). " - "Please check your installation!" ), - i18n( "Kleopatra Error" ) ); -} - -#include "certmanager.moc" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/certmanager.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/certmanager.h --- kdepim-4.0.83/kleopatra/certmanager.h 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/certmanager.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,216 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - certmanager.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2001,2002,2004 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef _CERTMANAGER_H_ -#define _CERTMANAGER_H_ - -//#include - -#include -#include -#include -#include -#include -#include -#include - -namespace Kleo { - class KeyListView; - class KeyListViewItem; - class ProgressBar; - class Job; -} - -class KJob; -namespace KIO { - class Job; -} -class KProcess; -class KAction; - -class CRLView; -class HierarchyAnalyser; - -class LineEditAction; -class ComboAction; - -class KUrl; -class QStringList; -class QLabel; - -namespace GpgME { - class ImportResult; - class KeyListResult; - class Error; - class Key; -} - -class CertManager : public KXmlGuiWindow { - Q_OBJECT -public: - CertManager( bool remote = false, const QString& query = QString(), - const QString& import=QString(), - QWidget * parent=0, Qt::WFlags f=0 ); - ~CertManager(); - - bool isRemote() const { return mRemote; } - -signals: - void stopOperations(); - void enableOperations( bool ); - -private slots: - void slotStartCertificateDownload( const QString & fingerprint, const QString& displayName ); - void newCertificate(); - void revokeCertificate(); - void extendCertificate(); - void slotDeleteCertificate(); - void slotExportSecretKey(); - void slotExportCertificate(); - void slotUploadResult( KJob* job ); - - void slotImportCertFromFile(); - void slotImportCertFromFile( const KUrl & filename ); - void slotImportResult( KJob* ); - - void slotCertificateImportResult( const GpgME::ImportResult & result ); - void slotCertificateDownloadResult( const GpgME::Error & error, const QByteArray & keyData ); - void slotKeyListResult( const GpgME::KeyListResult & result ); - void slotDeleteResult( const GpgME::Error & error, const GpgME::Key & ); - void slotSecretKeyExportResult( const GpgME::Error & error, const QByteArray & keyData ); - void slotCertificateExportResult( const GpgME::Error & error, const QByteArray & keyData ); - void slotClearCRLsResult(); - - void importCRLFromFile(); - void importCRLFromLDAP(); - void slotImportCRLJobFinished( KJob * ); - - void slotDirmngrExited(int exitCode, QProcess::ExitStatus exitStatus); - void slotStderr(); - - void slotToggleRemote(int idx); - void slotToggleHierarchicalView( bool ); - - void slotViewCRLs(); - void slotClearCRLs(); - - void slotViewDetails(); - void slotViewDetails( Kleo::KeyListViewItem * item ); - void slotSelectionChanged(); - void slotDownloadCertificate(); - void slotStartWatchGnuPG(); - - void slotEditKeybindings(); - void slotShowConfigurationDialog(); - void slotConfigureGpgME(); - void slotContextMenu(Kleo::KeyListViewItem*, const QPoint& point); - void slotDropped(const KUrl::List&); - /** Schedule a repaint for the listview items. E.g. when the - colour config has changed */ - void slotRepaint(); - /** Schedule a validating keylisting for the selected items (or - all items, if none is selected). */ - void slotValidate() { startRedisplay( true ); } - /** Schedule a non-validating keylisting for the selected items - (or all items, if none are selected). */ - void slotRedisplay() { startRedisplay( false ); } - /** Start a keylisting with the current value of the query text as - pattern. */ - void slotSearch(); - - void slotExpandAll(); - void slotCollapseAll(); - void slotRefreshKeys(); - void slotRefreshKeysResult( const GpgME::Error & ); - -private: - void createStatusBar(); - void createActions(); - void updateStatusBarLabels(); - void updateImportActions( bool enable ); - void startKeyListing( bool, bool, const QStringList & ); - void startKeyListing( bool, bool, const std::set & ); - void startCertificateImport( const QByteArray & keyData, const QString& certDisplayName ); - void startImportCRL( const QString& fileName, bool isTempFile ); - void startClearCRLs(); - void startSecretKeyExport( const QString & fingerprint ); - void startCertificateExport( const QStringList & fingerprints ); - bool connectAndStartDirmngr( const char*, const char* ); - void connectJobToStatusBarProgress( Kleo::Job * job, const QString & initialText ); - void disconnectJobFromStatusBarProgress( const GpgME::Error & err ); - void importNextURLOrRedisplay(); - void startRedisplay( bool validating ); - QString displayNameForJob( const Kleo::Job *job ); - void readConfig( bool noQueryGiven ); - void writeConfig(); - -private: - Kleo::KeyListView * mKeyListView; - CRLView * mCrlView; - Kleo::ProgressBar * mProgressBar; - QLabel * mStatusLabel; - - KProcess * mDirmngrProc; - QString mErrorbuffer; - Q3PtrList mItemsToDelete; - KUrl::List mURLsToImport; - typedef QMap JobsDisplayNameMap; - JobsDisplayNameMap mJobsDisplayNameMap; - HierarchyAnalyser * mHierarchyAnalyser; - - LineEditAction * mLineEditAction; - ComboAction * mComboAction; - QAction * mFindAction; - QAction * mImportCertFromFileAction; - QAction * mImportCRLFromFileAction; - QAction * mExportCertificateAction; - QAction * mViewCertDetailsAction; - QAction * mDeleteCertificateAction; -#ifdef NOT_IMPLEMENTED_ANYWAY - KAction * mRevokeCertificateAction; - KAction * mExtendCertificateAction; -#endif - QAction * mExportSecretKeyAction; - QAction * mDownloadCertificateAction; - QAction * mValidateCertificateAction; - - QString mImportCRLTempFile; - QString mCurrentQuery; - std::set mPreviouslySelectedFingerprints; - bool mNextFindRemote : 1; // state of the combo, i.e. whether the next find action will be remote - bool mRemote : 1; // whether the currently displayed items are from a remote listing - bool mDirMngrFound : 1; - bool mHierarchicalView : 1; // whether to display the list view in hierarchical mode - -}; - -#endif // _CERTMANAGER_H_ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/CMakeLists.txt --- kdepim-4.0.83/kleopatra/CMakeLists.txt 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/CMakeLists.txt 2008-07-08 10:56:26.000000000 +0100 @@ -2,7 +2,7 @@ include(MacroOptionalAddSubdirectory) -set( kleopatra_version 1.9.1 ) +set( kleopatra_version 2.0.0-rc1 ) if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") if ( NOT KdeSubversion_FOUND ) find_package( KdeSubversion ) @@ -102,12 +102,15 @@ utils/kdlogtextwidget.cpp utils/headerview.cpp utils/scrollarea.cpp + utils/dragqueen.cpp + utils/multivalidator.cpp utils/hex.cpp utils/input.cpp utils/output.cpp utils/exception.cpp utils/formatting.cpp + utils/validation.cpp utils/wsastarter.cpp utils/classify.cpp utils/iodevicelogger.cpp @@ -135,7 +138,11 @@ dialogs/lookupcertificatesdialog.cpp dialogs/ownertrustdialog.cpp dialogs/selftestdialog.cpp - dialogs/signcertificatedialog.cpp + dialogs/certifycertificatedialog.cpp + dialogs/exportsecretkeydialog.cpp + dialogs/adduseriddialog.cpp + dialogs/certificatedetailsdialog.cpp + dialogs/exportcertificatesdialog.cpp crypto/certificateresolver.cpp crypto/task.cpp @@ -189,21 +196,28 @@ commands/decryptverifyclipboardcommand.cpp commands/clearcrlcachecommand.cpp commands/dumpcrlcachecommand.cpp + commands/dumpcertificatecommand.cpp commands/importcrlcommand.cpp commands/changeexpirycommand.cpp commands/changeownertrustcommand.cpp - commands/signcertificatecommand.cpp + commands/changepassphrasecommand.cpp + commands/certifycertificatecommand.cpp commands/selftestcommand.cpp + commands/exportsecretkeycommand.cpp + commands/exportopenpgpcertstoservercommand.cpp + commands/adduseridcommand.cpp + commands/newcertificatecommand.cpp ${_kleopatra_uiserver_files} conf/configuredialog.cpp - certificatewizardimpl.cpp + newcertificatewizard/listwidget.cpp + newcertificatewizard/newcertificatewizard.cpp + aboutdata.cpp systemtrayicon.cpp - exportcertificatesdialog.cpp - certificateinfowidgetimpl.cpp + kleopatraapplication.cpp main.cpp ) if ( KLEO_MODEL_TEST ) @@ -212,13 +226,22 @@ endif ( KLEO_MODEL_TEST ) kde4_add_ui_files( _kleopatra_SRCS - certificateinfowidget.ui - certificatewizard.ui + dialogs/certificationoptionswidget.ui dialogs/expirydialog.ui dialogs/lookupcertificatesdialog.ui dialogs/ownertrustdialog.ui + dialogs/selectchecklevelwidget.ui dialogs/selftestdialog.ui - dialogs/signcertificatedialog.ui + dialogs/exportsecretkeydialog.ui + dialogs/adduseriddialog.ui + dialogs/certificatedetailsdialog.ui + newcertificatewizard/listwidget.ui + newcertificatewizard/chooseprotocolpage.ui + newcertificatewizard/enterdetailspage.ui + newcertificatewizard/overviewpage.ui + newcertificatewizard/keycreationpage.ui + newcertificatewizard/resultpage.ui + newcertificatewizard/advancedsettingsdialog.ui ) kde4_add_kcfg_files( _kleopatra_SRCS kcfg/tooltippreferences.kcfgc @@ -256,6 +279,11 @@ ########### install files ############### install( FILES kleopatra_import.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) +install( FILES kleopatra_signencryptfiles.desktop + kleopatra_signencryptfolders.desktop + kleopatra_decryptverifyfiles.desktop + kleopatra_decryptverifyfolders.desktop + DESTINATION ${SERVICES_INSTALL_DIR}) install( FILES kleopatra.rc DESTINATION ${DATA_INSTALL_DIR}/kleopatra) kde4_install_icons( ${ICON_INSTALL_DIR} ) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/adduseridcommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/adduseridcommand.cpp --- kdepim-4.0.83/kleopatra/commands/adduseridcommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/adduseridcommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,227 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/adduseridcommand.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "adduseridcommand.h" + +#include "command_p.h" + +#include + +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +using namespace Kleo; +using namespace Kleo::Commands; +using namespace Kleo::Dialogs; +using namespace GpgME; + +class AddUserIDCommand::Private : public Command::Private { + friend class ::Kleo::Commands::AddUserIDCommand; + AddUserIDCommand * q_func() const { return static_cast( q ); } +public: + explicit Private( AddUserIDCommand * qq, KeyListController * c ); + ~Private(); + + void init(); + +private: + void slotDialogAccepted(); + void slotDialogRejected(); + void slotResult( const Error & err ); + +private: + void ensureDialogCreated(); + void createJob(); + void showErrorDialog( const Error & error ); + void showSuccessDialog(); + +private: + GpgME::Key key; + QPointer dialog; + QPointer job; +}; + + +AddUserIDCommand::Private * AddUserIDCommand::d_func() { return static_cast( d.get() ); } +const AddUserIDCommand::Private * AddUserIDCommand::d_func() const { return static_cast( d.get() ); } + +#define d d_func() +#define q q_func() + +AddUserIDCommand::Private::Private( AddUserIDCommand * qq, KeyListController * c ) + : Command::Private( qq, c ), + key(), + dialog(), + job() +{ + +} + +AddUserIDCommand::Private::~Private() { kDebug(); } + +AddUserIDCommand::AddUserIDCommand( KeyListController * c ) + : Command( new Private( this, c ) ) +{ + d->init(); +} + +AddUserIDCommand::AddUserIDCommand( QAbstractItemView * v, KeyListController * c ) + : Command( v, new Private( this, c ) ) +{ + d->init(); +} + +AddUserIDCommand::AddUserIDCommand( const GpgME::Key & key ) + : Command( key, new Private( this, 0 ) ) +{ + d->init(); +} + +void AddUserIDCommand::Private::init() { + +} + +AddUserIDCommand::~AddUserIDCommand() { kDebug(); } + +void AddUserIDCommand::doStart() { + + const std::vector keys = d->keys(); + if ( keys.size() != 1 || + keys.front().protocol() != GpgME::OpenPGP || + !keys.front().hasSecret() ) { + d->finished(); + return; + } + + d->key = keys.front(); + + d->ensureDialogCreated(); + assert( d->dialog ); + d->dialog->show(); +} + +void AddUserIDCommand::Private::slotDialogAccepted() { + assert( dialog ); + + createJob(); + if ( !job ) + finished(); + + else if ( const Error err = job->start( key, dialog->name(), dialog->email(), dialog->comment() ) ) { + showErrorDialog( err ); + finished(); + } +} + +void AddUserIDCommand::Private::slotDialogRejected() { + emit q->canceled(); + finished(); +} + +void AddUserIDCommand::Private::slotResult( const Error & err ) { + if ( err.isCanceled() ) + ; + else if ( err ) + showErrorDialog( err ); + else + showSuccessDialog(); + finished(); +} + +void AddUserIDCommand::doCancel() { + kDebug(); + if ( d->job ) + d->job->slotCancel(); +} + +void AddUserIDCommand::Private::ensureDialogCreated() { + if ( dialog ) + return; + + dialog = new AddUserIDDialog( view() ); + dialog->setAttribute( Qt::WA_DeleteOnClose ); + + connect( dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()) ); + connect( dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()) ); +} + +void AddUserIDCommand::Private::createJob() { + assert( !job ); + + const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( key.protocol() ); + if ( !backend ) + return; + + AddUserIDJob * const j = backend->addUserIDJob(); + if ( !j ) + return; + + connect( j, SIGNAL(progress(QString,int,int)), + q, SIGNAL(progress(QString,int,int)) ); + connect( j, SIGNAL(result(GpgME::Error)), + q, SLOT(slotResult(GpgME::Error)) ); + + job = j; +} + +void AddUserIDCommand::Private::showErrorDialog( const Error & err ) { + KMessageBox::error( view(), + i18nc("@info", + "An error occurred while trying to add the user-id: " + "%1", + QString::fromLocal8Bit( err.asString() ) ), + i18n("Add User-ID Error") ); +} + +void AddUserIDCommand::Private::showSuccessDialog() { + KMessageBox::information( view(), + i18n("User-ID successfully added."), + i18n("Add User-ID Succeeded") ); +} + +#undef d +#undef q + +#include "moc_adduseridcommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/adduseridcommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/adduseridcommand.h --- kdepim-4.0.83/kleopatra/commands/adduseridcommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/adduseridcommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,76 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/adduseridcommand.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_COMMANDS_ADDUSERIDCOMMAND_H__ +#define __KLEOPATRA_COMMANDS_ADDUSERIDCOMMAND_H__ + +#include + +namespace Kleo { +namespace Commands { + + class AddUserIDCommand : public Command { + Q_OBJECT + public: + explicit AddUserIDCommand( QAbstractItemView * view, KeyListController * parent ); + explicit AddUserIDCommand( KeyListController * parent ); + explicit AddUserIDCommand( const GpgME::Key & key ); + ~AddUserIDCommand(); + + /* reimp */ static Restrictions restrictions() { return OnlyOneKey|MustBeOpenPGP; } + + void setName( const QString & name ); + const QString & name() const; + + void setEmail( const QString & email ); + const QString & email() const; + + void setComment( const QString & comment ); + const QString & comment() const; + + private: + /* reimp */ void doStart(); + /* reimp */ void doCancel(); + + private: + class Private; + inline Private * d_func(); + inline const Private * d_func() const; + Q_PRIVATE_SLOT( d_func(), void slotResult(GpgME::Error) ) + Q_PRIVATE_SLOT( d_func(), void slotDialogAccepted() ) + Q_PRIVATE_SLOT( d_func(), void slotDialogRejected() ) + }; + +} +} + +#endif // __KLEOPATRA_COMMANDS_ADDUSERIDCOMMAND_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/certifycertificatecommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/certifycertificatecommand.cpp --- kdepim-4.0.83/kleopatra/commands/certifycertificatecommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/certifycertificatecommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,281 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/signcertificatecommand.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Softwarls Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "certifycertificatecommand.h" + +#include "command_p.h" + +#include "exportopenpgpcertstoservercommand.h" + +#include + +#include + +#include + +#include +#include +#include + +#include + +#include +#include +#include + +#include + +#include + +using namespace Kleo; +using namespace Kleo::Commands; +using namespace Kleo::Dialogs; +using namespace GpgME; + +class CertifyCertificateCommand::Private : public Command::Private { + friend class ::Kleo::Commands::CertifyCertificateCommand; + CertifyCertificateCommand * q_func() const { return static_cast( q ); } +public: + explicit Private( CertifyCertificateCommand * qq, KeyListController * c ); + ~Private(); + + void init(); + +private: + void slotDialogRejected(); + void slotResult( const Error & err ); + void slotCertificationPrepared(); + +private: + void ensureDialogCreated(); + void createJob(); + +private: + std::vector uids; + QPointer dialog; + QPointer job; +}; + + +CertifyCertificateCommand::Private * CertifyCertificateCommand::d_func() { return static_cast( d.get() ); } +const CertifyCertificateCommand::Private * CertifyCertificateCommand::d_func() const { return static_cast( d.get() ); } + +#define d d_func() +#define q q_func() + +CertifyCertificateCommand::Private::Private( CertifyCertificateCommand * qq, KeyListController * c ) + : Command::Private( qq, c ), + uids(), + dialog(), + job() +{ + +} + +CertifyCertificateCommand::Private::~Private() { kDebug(); } + +CertifyCertificateCommand::CertifyCertificateCommand( KeyListController * c ) + : Command( new Private( this, c ) ) +{ + d->init(); +} + +CertifyCertificateCommand::CertifyCertificateCommand( QAbstractItemView * v, KeyListController * c ) + : Command( v, new Private( this, c ) ) +{ + d->init(); +} + +CertifyCertificateCommand::CertifyCertificateCommand( const Key & key ) + : Command( key, new Private( this, 0 ) ) +{ + d->init(); +} + +CertifyCertificateCommand::CertifyCertificateCommand( const UserID & uid ) + : Command( uid.parent(), new Private( this, 0 ) ) +{ + std::vector( 1, uid ).swap( d->uids ); + d->init(); +} + +CertifyCertificateCommand::CertifyCertificateCommand( const std::vector & uids ) + : Command( uids.empty() ? Key() : uids.front().parent(), new Private( this, 0 ) ) +{ + d->uids = uids; + d->init(); +} + +void CertifyCertificateCommand::Private::init() { + +} + +CertifyCertificateCommand::~CertifyCertificateCommand() { kDebug(); } + +void CertifyCertificateCommand::setCertificationExportable( bool on ) { + +} + +void CertifyCertificateCommand::setCertificationRevocable( bool on ) { + +} + +void CertifyCertificateCommand::setCertifyingKey( const Key & signer ) { + +} + +void CertifyCertificateCommand::setUserIDs( const std::vector & uids ) { + d->uids = uids; + if ( !uids.empty() && d->key().isNull() ) + setKey( uids.front().parent() ); +} + +void CertifyCertificateCommand::setUserID( const UserID & uid ) { + setUserIDs( std::vector( 1, uid ) ); +} + +void CertifyCertificateCommand::doStart() { + + const std::vector keys = d->keys(); + if ( keys.size() != 1 || + keys.front().protocol() != GpgME::OpenPGP ) { + d->finished(); + return; + } + + std::vector secKeys = KeyCache::instance()->secretKeys(); + std::vector::iterator it = std::remove_if( secKeys.begin(), secKeys.end(), !bind( &Key::canCertify, _1 ) ); + it = std::remove_if( it, secKeys.end(), bind( &Key::protocol, _1 ) != OpenPGP ); + secKeys.erase( it, secKeys.end() ); + + if ( secKeys.empty() ) { + KMessageBox::error( d->view(), + i18n( "To certify other certificates, you first need to create an OpenPGP certificate for yourself. Choose File->New Certificate... to create one." ), + i18n( "Certification Not Possible" ) ); + d->finished(); + return; + } + const Key & key = keys.front(); + + Q_FOREACH( const UserID & uid, d->uids ) + if ( qstricmp( uid.parent().primaryFingerprint(), key.primaryFingerprint() ) != 0 ) { + kWarning() << "User-ID <-> Key mismatch!"; + d->finished(); + return; + } + + d->ensureDialogCreated(); + assert( d->dialog ); + d->dialog->setCertificateToCertify( d->key() ); + d->dialog->setCertificatesWithSecretKeys( secKeys ); + d->dialog->show(); +} + +void CertifyCertificateCommand::Private::slotDialogRejected() { + emit q->canceled(); + finished(); +} + +void CertifyCertificateCommand::Private::slotResult( const Error & err ) { + if ( !err && !err.isCanceled() && dialog && dialog->exportableCertificationSelected() && dialog->sendToServer() ) { + ExportOpenPGPCertsToServerCommand * const cmd = new ExportOpenPGPCertsToServerCommand( key() ); + cmd->start(); + } + + finished(); +} + +void CertifyCertificateCommand::Private::slotCertificationPrepared() { + assert( dialog ); + + createJob(); + assert( job ); + job->setExportable( dialog->exportableCertificationSelected() ); + job->setNonRevocable( dialog->nonRevocableCertificationSelected() ); + job->setUserIDsToSign( dialog->selectedUserIDs() ); + job->setSigningKey( dialog->selectedSecretKey() ); + job->setCheckLevel( dialog->selectedCheckLevel() ); + + dialog->connectJob( job ); + + if ( const Error err = job->start( key() ) ) { + dialog->setError( err ); + finished(); + } +} + +void CertifyCertificateCommand::doCancel() { + kDebug(); + if ( d->job ) + d->job->slotCancel(); +} + +void CertifyCertificateCommand::Private::ensureDialogCreated() { + if ( dialog ) + return; + + dialog = new CertifyCertificateDialog( view() ); + dialog->setAttribute( Qt::WA_DeleteOnClose ); + + connect( dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()) ); + connect( dialog, SIGNAL(certificationPrepared()), q, SLOT(slotCertificationPrepared()) ); +} + +void CertifyCertificateCommand::Private::createJob() { + if ( dialog ) + disconnect( dialog, SIGNAL(certificationPrepared()), q, SLOT(slotCertificationPrepared()) ); + + assert( !job ); + + assert( key().protocol() == OpenPGP ); + const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( key().protocol() ); + if ( !backend ) + return; + + SignKeyJob * const j = backend->signKeyJob(); + if ( !j ) + return; + + connect( j, SIGNAL(progress(QString,int,int)), + q, SIGNAL(progress(QString,int,int)) ); + connect( j, SIGNAL(result(GpgME::Error)), + q, SLOT(slotResult(GpgME::Error)) ); + + job = j; +} + + +#undef d +#undef q + +#include "moc_certifycertificatecommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/certifycertificatecommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/certifycertificatecommand.h --- kdepim-4.0.83/kleopatra/commands/certifycertificatecommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/certifycertificatecommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,81 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/signcertificatecommand.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_COMMANDS_SIGNCERTIFICATECOMMAND_H__ +#define __KLEOPATRA_COMMANDS_SIGNCERTIFICATECOMMAND_H__ + +#include + +namespace GpgME { + class UserID; +} + +namespace Kleo { +namespace Commands { + + class CertifyCertificateCommand : public Command { + Q_OBJECT + public: + explicit CertifyCertificateCommand( QAbstractItemView * view, KeyListController * parent ); + explicit CertifyCertificateCommand( KeyListController * parent ); + explicit CertifyCertificateCommand( const GpgME::Key & key ); + explicit CertifyCertificateCommand( const GpgME::UserID & uid ); + explicit CertifyCertificateCommand( const std::vector & uids ); + ~CertifyCertificateCommand(); + + /* reimp */ static Restrictions restrictions() { return OnlyOneKey|MustBeOpenPGP; } + + void setCertificationExportable( bool on ); + void setCertificationRevocable( bool on ); + + void setCertifyingKey( const GpgME::Key & key ); + + void setUserID( const GpgME::UserID & uid ); + void setUserIDs( const std::vector & uids ); + + private: + /* reimp */ void doStart(); + /* reimp */ void doCancel(); + + private: + class Private; + inline Private * d_func(); + inline const Private * d_func() const; + Q_PRIVATE_SLOT( d_func(), void slotResult(GpgME::Error) ) + Q_PRIVATE_SLOT( d_func(), void slotDialogRejected() ) + Q_PRIVATE_SLOT( d_func(), void slotCertificationPrepared() ) + }; + +} +} + +#endif // __KLEOPATRA_COMMANDS_SIGNCERTIFICATECOMMAND_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/changeexpirycommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/changeexpirycommand.cpp --- kdepim-4.0.83/kleopatra/commands/changeexpirycommand.cpp 2008-03-25 17:23:12.000000000 +0000 +++ kdepim-4.0.98/kleopatra/commands/changeexpirycommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -115,6 +115,12 @@ d->init(); } +ChangeExpiryCommand::ChangeExpiryCommand( const GpgME::Key & key ) + : Command( key, new Private( this, 0 ) ) +{ + d->init(); +} + void ChangeExpiryCommand::Private::init() { } @@ -167,11 +173,12 @@ void ChangeExpiryCommand::Private::slotResult( const Error & err ) { if ( err.isCanceled() ) - finished(); + ; else if ( err ) showErrorDialog( err ); else showSuccessDialog(); + finished(); } void ChangeExpiryCommand::doCancel() { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/changeexpirycommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/changeexpirycommand.h --- kdepim-4.0.83/kleopatra/commands/changeexpirycommand.h 2008-04-10 10:30:39.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/changeexpirycommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -43,6 +43,7 @@ public: explicit ChangeExpiryCommand( QAbstractItemView * view, KeyListController * parent ); explicit ChangeExpiryCommand( KeyListController * parent ); + explicit ChangeExpiryCommand( const GpgME::Key & key ); ~ChangeExpiryCommand(); /* reimp */ static Restrictions restrictions() { return OnlyOneKey|MustBeOpenPGP|NeedSecretKey; } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/changeownertrustcommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/changeownertrustcommand.cpp --- kdepim-4.0.83/kleopatra/commands/changeownertrustcommand.cpp 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/changeownertrustcommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -80,7 +80,6 @@ void showSuccessDialog(); private: - GpgME::Key key; QPointer dialog; QPointer job; }; @@ -94,7 +93,6 @@ ChangeOwnerTrustCommand::Private::Private( ChangeOwnerTrustCommand * qq, KeyListController * c ) : Command::Private( qq, c ), - key(), dialog(), job() { @@ -115,6 +113,12 @@ d->init(); } +ChangeOwnerTrustCommand::ChangeOwnerTrustCommand( const Key & key ) + : Command( key, new Private( this, 0 ) ) +{ + d->init(); +} + void ChangeOwnerTrustCommand::Private::init() { } @@ -123,19 +127,24 @@ void ChangeOwnerTrustCommand::doStart() { - const std::vector keys = d->keys(); - if ( keys.size() != 1 || - keys.front().protocol() != GpgME::OpenPGP || - keys.front().hasSecret() ) { + if ( d->keys().size() != 1 ) { d->finished(); return; } - d->key = keys.front(); + const Key key = d->key(); + if ( key.protocol() != GpgME::OpenPGP || key.hasSecret() && key.ownerTrust() == Key::Ultimate ) { + d->finished(); + return; + } d->ensureDialogCreated(); assert( d->dialog ); - d->dialog->setOwnerTrust( d->key.ownerTrust() ); + + d->dialog->setHasSecretKey( key.hasSecret() ); + d->dialog->setFormattedCertificateName( Formatting::formatForComboBox( key ) ); + d->dialog->setOwnerTrust( key.ownerTrust() ); + d->dialog->show(); } @@ -150,7 +159,7 @@ createJob(); assert( job ); - if ( const Error err = job->start( key, trust ) ) { + if ( const Error err = job->start( key(), trust ) ) { showErrorDialog( err ); finished(); } @@ -163,11 +172,12 @@ void ChangeOwnerTrustCommand::Private::slotResult( const Error & err ) { if ( err.isCanceled() ) - finished(); + ; else if ( err ) showErrorDialog( err ); else showSuccessDialog(); + finished(); } void ChangeOwnerTrustCommand::doCancel() { @@ -190,7 +200,7 @@ void ChangeOwnerTrustCommand::Private::createJob() { assert( !job ); - const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( key.protocol() ); + const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( key().protocol() ); if ( !backend ) return; @@ -210,7 +220,7 @@ KMessageBox::error( view(), i18n("

An error occurred while trying to change " "the owner trust for %1:

%2

", - Formatting::formatForComboBox( key ), + Formatting::formatForComboBox( key() ), QString::fromLocal8Bit( err.asString() ) ), i18n("Owner Trust Change Error") ); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/changeownertrustcommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/changeownertrustcommand.h --- kdepim-4.0.83/kleopatra/commands/changeownertrustcommand.h 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/changeownertrustcommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -43,9 +43,10 @@ public: explicit ChangeOwnerTrustCommand( QAbstractItemView * view, KeyListController * parent ); explicit ChangeOwnerTrustCommand( KeyListController * parent ); + explicit ChangeOwnerTrustCommand( const GpgME::Key & key ); ~ChangeOwnerTrustCommand(); - /* reimp */ static Restrictions restrictions() { return OnlyOneKey|MustBeOpenPGP; } + /* reimp */ static Restrictions restrictions() { return OnlyOneKey|MustBeOpenPGP|MayOnlyBeSecretKeyIfOwnerTrustIsNotYetUltimate; } private: /* reimp */ void doStart(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/changepassphrasecommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/changepassphrasecommand.cpp --- kdepim-4.0.83/kleopatra/commands/changepassphrasecommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/changepassphrasecommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,104 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/changepassphrasecommand.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "changepassphrasecommand.h" + +#include "command_p.h" + +#include + +#include + +#include +#include + +using namespace Kleo; +using namespace Kleo::Commands; +using namespace GpgME; + +ChangePassphraseCommand::ChangePassphraseCommand( KeyListController * c ) + : GnuPGProcessCommand( c ) +{ + +} + +ChangePassphraseCommand::ChangePassphraseCommand( QAbstractItemView * v, KeyListController * c ) + : GnuPGProcessCommand( v, c ) +{ + +} + +ChangePassphraseCommand::ChangePassphraseCommand( const Key & key ) + : GnuPGProcessCommand( key ) +{ + +} + +ChangePassphraseCommand::~ChangePassphraseCommand() {} + +QStringList ChangePassphraseCommand::arguments() const { + const Key key = d->key(); + if ( key.protocol() == OpenPGP ) + return QStringList() << gpgPath() << "--edit-key" << key.primaryFingerprint() << "passwd"; + else + return QStringList() << gpgSmPath() << "--passwd" << key.primaryFingerprint(); +} + +QString ChangePassphraseCommand::errorCaption() const { + return i18n( "Passphrase Change Error" ); +} + +QString ChangePassphraseCommand::successCaption() const { + return i18n( "Passphrase Change Finished" ); +} + +QString ChangePassphraseCommand::crashExitMessage( const QStringList & args ) const { + return i18nc("@info", + "The GPG or GpgSM process that tried to change the passphrase " + "ended prematurely because of an unexpected error." + "Please check the output of %1 for details.", args.join( " " ) ) ; +} + +QString ChangePassphraseCommand::errorExitMessage( const QStringList & args ) const { + return i18nc("@info", + "An error occurred while trying to change the passphrase. " + "The output from %1 was: %2", + args[0], errorString() ); +} + +QString ChangePassphraseCommand::successMessage( const QStringList & ) const { + return i18n( "Passphrase changed successfully." ); +} + +#include "moc_changepassphrasecommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/changepassphrasecommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/changepassphrasecommand.h --- kdepim-4.0.83/kleopatra/commands/changepassphrasecommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/changepassphrasecommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,67 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/changepassphrasecommand.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_COMMMANDS_CHANGEPASSPHRASECOMMAND_H__ +#define __KLEOPATRA_COMMMANDS_CHANGEPASSPHRASECOMMAND_H__ + +#include + +namespace Kleo { +namespace Commands { + + class ChangePassphraseCommand : public GnuPGProcessCommand { + Q_OBJECT + public: + explicit ChangePassphraseCommand( QAbstractItemView * view, KeyListController * parent ); + explicit ChangePassphraseCommand( KeyListController * parent ); + explicit ChangePassphraseCommand( const GpgME::Key & key ); + ~ChangePassphraseCommand(); + + /* reimp */ static Restrictions restrictions() { return OnlyOneKey; } + + private: + //* reimp */ bool preStartHook( QWidget * ) const; + + /* reimp */ QStringList arguments() const; + + /* reimp */ QString errorCaption() const; + /* reimp */ QString successCaption() const; + + /* reimp */ QString crashExitMessage( const QStringList & ) const; + /* reimp */ QString errorExitMessage( const QStringList & ) const; + /* reimp */ QString successMessage( const QStringList & ) const; + }; + +} +} + +#endif // __KLEOPATRA_COMMMANDS_CHANGEPASSPHRASECOMMAND_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/command.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/command.cpp --- kdepim-4.0.83/kleopatra/commands/command.cpp 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/command.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -42,10 +42,12 @@ #include using namespace Kleo; +using namespace GpgME; Command::Private::Private( Command * qq, KeyListController * controller ) : q( qq ), autoDelete( true ), + warnWhenRunningAtShutdown( true ), indexes_(), view_(), controller_( controller ) @@ -87,6 +89,30 @@ setView( v ); } +Command::Command( const Key & key ) + : QObject( 0 ), d( new Private( this, 0 ) ) +{ + d->keys_ = std::vector( 1, key ); +} + +Command::Command( const std::vector & keys ) + : QObject( 0 ), d( new Private( this, 0 ) ) +{ + d->keys_ = keys; +} + +Command::Command( const Key & key, Private * pp ) + : QObject( 0 ), d( pp ) +{ + d->keys_ = std::vector( 1, key ); +} + +Command::Command( const std::vector & keys, Private * pp ) + : QObject( 0 ), d( pp ) +{ + d->keys_ = keys; +} + Command::~Command() { kDebug(); } void Command::setAutoDelete( bool on ) { @@ -97,6 +123,14 @@ return d->autoDelete; } +void Command::setWarnWhenRunningAtShutdown( bool on ) { + d->warnWhenRunningAtShutdown = on; +} + +bool Command::warnWhenRunningAtShutdown() const { + return d->warnWhenRunningAtShutdown; +} + void Command::setView( QAbstractItemView * view ) { if ( view == d->view_ ) return; @@ -125,6 +159,16 @@ std::copy( idx.begin(), idx.end(), std::back_inserter( d->indexes_ ) ); } +void Command::setKey( const Key & key ) { + d->keys_.clear(); + if ( !key.isNull() ) + d->keys_.push_back( key ); +} + +void Command::setKeys( const std::vector & keys ) { + d->keys_ = keys; +} + void Command::start() { doStart(); } @@ -135,9 +179,9 @@ emit canceled(); } -void Command::addTemporaryView( const QString & title ) { +void Command::addTemporaryView( const QString & title, AbstractKeyListSortFilterProxyModel * proxy ) { if ( TabWidget * const tw = d->controller_ ? d->controller_->tabWidget() : 0 ) - if ( QAbstractItemView * const v = tw->addTemporaryView( title ) ) + if ( QAbstractItemView * const v = tw->addTemporaryView( title, proxy ) ) setView( v ); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/command.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/command.h --- kdepim-4.0.83/kleopatra/commands/command.h 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/command.h 2008-07-08 10:56:21.000000000 +0100 @@ -37,19 +37,28 @@ #include +#include + class QModelIndex; template class QList; class QAbstractItemView; +namespace GpgME { + class Key; +} + namespace Kleo { class KeyListController; + class AbstractKeyListSortFilterProxyModel; class Command : public QObject { Q_OBJECT public: explicit Command( KeyListController * parent ); explicit Command( QAbstractItemView * view, KeyListController * parent ); + explicit Command( const GpgME::Key & key ); + explicit Command( const std::vector & keys ); ~Command(); enum Restriction { @@ -61,8 +70,13 @@ MustBeOpenPGP = 16, MustBeCMS = 32, - AllRestrictions + // esoteric: + MayOnlyBeSecretKeyIfOwnerTrustIsNotYetUltimate = 64, // for set-owner-trust + + _AllRestrictions_Helper, + AllRestrictions = 2*(_AllRestrictions_Helper-1) - 1 }; + Q_DECLARE_FLAGS( Restrictions, Restriction ) static Restrictions restrictions() { return NoRestriction; } @@ -70,10 +84,15 @@ void setView( QAbstractItemView * view ); void setIndex( const QModelIndex & idx ); void setIndexes( const QList & idx ); + void setKey( const GpgME::Key & key ); + void setKeys( const std::vector & keys ); void setAutoDelete( bool on ); bool autoDelete() const; + void setWarnWhenRunningAtShutdown( bool warn ); + bool warnWhenRunningAtShutdown() const; + public Q_SLOTS: void start(); void cancel(); @@ -89,7 +108,7 @@ virtual void doCancel() = 0; protected: - void addTemporaryView( const QString & title ); + void addTemporaryView( const QString & title, AbstractKeyListSortFilterProxyModel * proxy=0 ); protected: class Private; @@ -97,6 +116,8 @@ protected: explicit Command( Private * pp ); explicit Command( QAbstractItemView * view, Private * pp ); + explicit Command( const std::vector & keys, Private * pp ); + explicit Command( const GpgME::Key & key, Private * pp ); }; } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/command_p.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/command_p.h --- kdepim-4.0.83/kleopatra/commands/command_p.h 2008-05-15 19:37:21.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/command_p.h 2008-07-08 10:56:21.000000000 +0100 @@ -63,8 +63,8 @@ std::copy( indexes_.begin(), indexes_.end(), std::back_inserter( result ) ); return result; } - GpgME::Key key() const { return model() && !indexes_.empty() ? model()->key( indexes_.front() ) : GpgME::Key::null ; } - std::vector keys() const { return model() ? model()->keys( indexes() ) : std::vector() ; } + GpgME::Key key() const { return keys_.empty() ? model() && !indexes_.empty() ? model()->key( indexes_.front() ) : GpgME::Key::null : keys_.front() ; } + std::vector keys() const { return keys_.empty() ? model() ? model()->keys( indexes() ) : std::vector() : keys_ ; } void finished() { emit q->finished(); @@ -79,6 +79,8 @@ private: bool autoDelete : 1; + bool warnWhenRunningAtShutdown : 1; + std::vector keys_; QList indexes_; QPointer view_; QPointer controller_; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/decryptverifyfilescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/decryptverifyfilescommand.cpp --- kdepim-4.0.83/kleopatra/commands/decryptverifyfilescommand.cpp 2008-04-24 14:11:59.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/decryptverifyfilescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -139,6 +139,16 @@ d->files = files; } +void DecryptVerifyFilesCommand::setOperation( DecryptVerifyOperation op ) { + try { + d->controller.setOperation( op ); + } catch ( ... ) {} +} + +DecryptVerifyOperation DecryptVerifyFilesCommand::operation() const { + return d->controller.operation(); +} + void DecryptVerifyFilesCommand::doStart() { try { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/decryptverifyfilescommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/decryptverifyfilescommand.h --- kdepim-4.0.83/kleopatra/commands/decryptverifyfilescommand.h 2008-04-24 14:11:59.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/decryptverifyfilescommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -37,6 +37,8 @@ #include +#include + class QStringList; namespace Kleo { @@ -53,6 +55,9 @@ void setFiles( const QStringList & files ); + void setOperation( DecryptVerifyOperation operation ); + DecryptVerifyOperation operation() const; + private: /* reimp */ void doStart(); /* reimp */ void doCancel(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/deletecertificatescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/deletecertificatescommand.cpp --- kdepim-4.0.83/kleopatra/commands/deletecertificatescommand.cpp 2008-04-10 10:30:39.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/deletecertificatescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -276,6 +276,7 @@ keys.size() ), i18n("Secret Key Deletion") ); d->finished(); + return; } const bool hadSecretKeyIssuers = it != keysEnd; @@ -316,6 +317,7 @@ { emit canceled(); d->finished(); + return; } std::sort( keys.begin(), keysEnd, _detail::ByFingerprint() ); @@ -354,6 +356,7 @@ != KMessageBox::Continue ) { emit canceled(); d->finished(); + return; } assert( !kdtools::any( openpgp.begin(), openpgp.end(), bind( &Key::hasSecret, _1 ) ) ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/detailscommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/detailscommand.cpp --- kdepim-4.0.83/kleopatra/commands/detailscommand.cpp 2008-04-23 16:51:50.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/detailscommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -35,29 +35,51 @@ #include "detailscommand.h" #include "command_p.h" -#include "../certificateinfowidgetimpl.h" - -#include - -#include +#include #include using namespace Kleo; -//using namespace Kleo::Commands; +using namespace Kleo::Commands; +using namespace Kleo::Dialogs; using namespace GpgME; class DetailsCommand::Private : public Command::Private { - friend class ::DetailsCommand; + friend class ::Kleo::Commands::DetailsCommand; DetailsCommand * q_func() const { return static_cast( q ); } public: explicit Private( DetailsCommand * qq, KeyListController * c ); ~Private(); - void init(); +private: + void ensureDialogCreated() { + if ( dialog ) + return; + + CertificateDetailsDialog * dlg = new CertificateDetailsDialog( view() ); + dlg->setAttribute( Qt::WA_DeleteOnClose ); + connect( dlg, SIGNAL(rejected()), q, SLOT(slotDialogClosed()) ); + + dialog = dlg; + } + + void ensureDialogVisible() { + ensureDialogCreated(); + if ( dialog->isVisible() ) + dialog->raise(); + else + dialog->show(); + } + + void init() { + q->setWarnWhenRunningAtShutdown( false ); + } private: - Key key; + void slotDialogClosed(); + +private: + QPointer dialog; }; DetailsCommand::Private * DetailsCommand::d_func() { return static_cast( d.get() ); } @@ -68,7 +90,7 @@ DetailsCommand::Private::Private( DetailsCommand * qq, KeyListController * c ) : Command::Private( qq, c ), - key() + dialog() { } @@ -78,52 +100,63 @@ DetailsCommand::DetailsCommand( KeyListController * p ) : Command( new Private( this, p ) ) { - + d->init(); } DetailsCommand::DetailsCommand( QAbstractItemView * v, KeyListController * p ) : Command( v, new Private( this, p ) ) { - + d->init(); } DetailsCommand::DetailsCommand( const Key & key, KeyListController * p ) : Command( new Private( this, p ) ) { assert( !key.isNull() ); - d->key = key; + d->init(); + setKey( key ); } DetailsCommand::DetailsCommand( const Key & key, QAbstractItemView * v, KeyListController * p ) : Command( v, new Private( this, p ) ) { assert( !key.isNull() ); - d->key = key; + d->init(); + setKey( key ); } DetailsCommand::~DetailsCommand() {} void DetailsCommand::doStart() { + const std::vector keys = d->keys(); Key key; - if ( !d->key.isNull() ) - key = d->key; - else if ( d->indexes().size() == 1 ) - key = d->Command::Private::key(); + if ( keys.size() == 1 ) + key = keys.front(); else qWarning( "DetailsCommand::doStart: can only work with one certificate at a time" ); - if ( !key.isNull() ) { - KDialog * const dlg = CertificateInfoWidgetImpl::createDialog( key, d->view() ); - assert( dlg ); - dlg->setAttribute( Qt::WA_DeleteOnClose ); - dlg->show(); + if ( key.isNull() ) { + d->finished(); + return; } - d->finished(); + d->ensureDialogCreated(); + + d->dialog->setKey( key ); + + d->ensureDialogVisible(); } -void DetailsCommand::doCancel() {} +void DetailsCommand::doCancel() { + if ( d->dialog ) + d->dialog->close(); +} + +void DetailsCommand::Private::slotDialogClosed() { + finished(); +} + #undef q_func #undef d_func diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/detailscommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/detailscommand.h --- kdepim-4.0.83/kleopatra/commands/detailscommand.h 2008-04-23 16:51:50.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/detailscommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -40,6 +40,7 @@ } namespace Kleo { +namespace Commands { class DetailsCommand : public Command { Q_OBJECT @@ -60,8 +61,10 @@ class Private; inline Private * d_func(); inline const Private * d_func() const; + Q_PRIVATE_SLOT( d_func(), void slotDialogClosed() ) }; } +} #endif /* __KLEOPATRA_COMMANDS_DETAILSCOMMAND_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/dumpcertificatecommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/dumpcertificatecommand.cpp --- kdepim-4.0.83/kleopatra/commands/dumpcertificatecommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/dumpcertificatecommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,325 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/dumpcertificatecommand.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "dumpcertificatecommand.h" + +#include "command_p.h" + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + + +static const int PROCESS_TERMINATE_TIMEOUT = 5000; // milliseconds + +namespace { + class DumpCertificateDialog : public QDialog { + Q_OBJECT + public: + explicit DumpCertificateDialog( QWidget * parent=0 ) + : QDialog( parent ), ui( this ) + { + + } + + Q_SIGNALS: + void updateRequested(); + + public Q_SLOTS: + void append( const QString & line ) { + ui.logTextWidget.message( line ); + } + void clear() { + ui.logTextWidget.clear(); + } + + private: + struct Ui { + KDLogTextWidget logTextWidget; + KPushButton updateButton, closeButton; + QVBoxLayout vlay; + QHBoxLayout hlay; + + explicit Ui( DumpCertificateDialog * q ) + : logTextWidget( q ), + updateButton( i18n("&Update"), q ), + closeButton( KStandardGuiItem::close(), q ), + vlay( q ), + hlay() + { + KDAB_SET_OBJECT_NAME( logTextWidget ); + KDAB_SET_OBJECT_NAME( updateButton ); + KDAB_SET_OBJECT_NAME( closeButton ); + KDAB_SET_OBJECT_NAME( vlay ); + KDAB_SET_OBJECT_NAME( hlay ); + + logTextWidget.setFont( KGlobalSettings::fixedFont() ); + logTextWidget.setMinimumVisibleLines( 25 ); + logTextWidget.setMinimumVisibleColumns( 80 ); + + vlay.addWidget( &logTextWidget, 1 ); + vlay.addLayout( &hlay ); + + hlay.addWidget( &updateButton ); + hlay.addStretch( 1 ); + hlay.addWidget( &closeButton ); + + connect( &updateButton, SIGNAL(clicked()), + q, SIGNAL(updateRequested()) ); + connect( &closeButton, SIGNAL(clicked()), + q, SLOT(close()) ); + } + } ui; + }; +} + +using namespace Kleo; +using namespace Kleo::Commands; + +static QByteArray chomped( QByteArray ba ) { + while ( ba.endsWith( '\n' ) || ba.endsWith( '\r' ) ) + ba.chop( 1 ); + return ba; +} + +class DumpCertificateCommand::Private : Command::Private { + friend class ::Kleo::Commands::DumpCertificateCommand; + DumpCertificateCommand * q_func() const { return static_cast( q ); } +public: + explicit Private( DumpCertificateCommand * qq, KeyListController * c ); + ~Private(); + + QString errorString() const { + return QString::fromLocal8Bit( errorBuffer ); + } + +private: + void init(); + void refreshView(); + +private: + void slotProcessFinished( int, QProcess::ExitStatus ); + + void slotProcessReadyReadStandardOutput() { + while ( process.canReadLine() ) { + const QString line = QString::fromUtf8( chomped( process.readLine() ) ); + if ( dialog ) + dialog->append( line ); + outputBuffer.push_back( line ); + } + } + + void slotProcessReadyReadStandardError() { + errorBuffer += process.readAllStandardError(); + } + + void slotUpdateRequested() { + if ( process.state() == QProcess::NotRunning ) + refreshView(); + } + + void slotDialogDestroyed() { + dialog = 0; + if ( process.state() != QProcess::NotRunning ) + q->cancel(); + else + finished(); + } + +private: + QPointer dialog; + KProcess process; + QByteArray errorBuffer; + QStringList outputBuffer; + bool useDialog; + bool canceled; +}; + +DumpCertificateCommand::Private * DumpCertificateCommand::d_func() { return static_cast( d.get() ); } +const DumpCertificateCommand::Private * DumpCertificateCommand::d_func() const { return static_cast( d.get() ); } + +#define d d_func() +#define q q_func() + +DumpCertificateCommand::Private::Private( DumpCertificateCommand * qq, KeyListController * c ) + : Command::Private( qq, c ), + process(), + errorBuffer(), + outputBuffer(), + useDialog( true ), + canceled( false ) +{ + process.setOutputChannelMode( KProcess::SeparateChannels ); + process.setReadChannel( KProcess::StandardOutput ); +} + +DumpCertificateCommand::Private::~Private() { + if ( dialog && !dialog->isVisible() ) + delete dialog; +} + +DumpCertificateCommand::DumpCertificateCommand( KeyListController * c ) + : Command( new Private( this, c ) ) +{ + d->init(); +} + +DumpCertificateCommand::DumpCertificateCommand( QAbstractItemView * v, KeyListController * c ) + : Command( v, new Private( this, c ) ) +{ + d->init(); +} + +DumpCertificateCommand::DumpCertificateCommand( const GpgME::Key & k ) + : Command( k, new Private( this, 0 ) ) +{ + d->init(); +} + +void DumpCertificateCommand::Private::init() { + connect( &process, SIGNAL(finished(int,QProcess::ExitStatus)), + q, SLOT(slotProcessFinished(int,QProcess::ExitStatus)) ); + connect( &process, SIGNAL(readyReadStandardError()), + q, SLOT(slotProcessReadyReadStandardError()) ); + connect( &process, SIGNAL(readyReadStandardOutput()), + q, SLOT(slotProcessReadyReadStandardOutput()) ); + if ( !key().isNull() ) + process << gpgSmPath() << "--dump-cert" << key().primaryFingerprint(); +} + +DumpCertificateCommand::~DumpCertificateCommand() {} + +void DumpCertificateCommand::setUseDialog( bool use ) { + d->useDialog = use; +} + +bool DumpCertificateCommand::useDialog() const { + return d->useDialog; +} + +QStringList DumpCertificateCommand::output() const { + return d->outputBuffer; +} + +void DumpCertificateCommand::doStart() { + + const std::vector keys = d->keys(); + if ( keys.size() != 1 || keys.front().protocol() != GpgME::CMS ) { + d->finished(); + return; + } + + if ( d->useDialog ) { + d->dialog = new DumpCertificateDialog; + d->dialog->setAttribute( Qt::WA_DeleteOnClose ); + d->dialog->setWindowTitle( i18n("Certificate Dump") ); + + connect( d->dialog, SIGNAL(updateRequested()), + this, SLOT(slotUpdateRequested()) ); + connect( d->dialog, SIGNAL(destroyed()), + this, SLOT(slotDialogDestroyed()) ); + } + + d->refreshView(); +} + +void DumpCertificateCommand::Private::refreshView() { + + if ( dialog ) + dialog->clear(); + errorBuffer.clear(); + outputBuffer.clear(); + + process.start(); + + if ( process.waitForStarted() ) { + if ( dialog ) + dialog->show(); + } else { + KMessageBox::error( dialog ? static_cast( dialog ) : view(), + i18n( "Unable to start process gpgsm. " + "Please check your installation." ), + i18n( "Dump Certificate Error" ) ); + finished(); + } +} + +void DumpCertificateCommand::doCancel() { + d->canceled = true; + if ( d->process.state() != QProcess::NotRunning ) { + d->process.terminate(); + QTimer::singleShot( PROCESS_TERMINATE_TIMEOUT, &d->process, SLOT(kill()) ); + } + if ( d->dialog ) + d->dialog->close(); + d->dialog = 0; +} + +void DumpCertificateCommand::Private::slotProcessFinished( int code, QProcess::ExitStatus status ) { + if ( !canceled ) + if ( status == QProcess::CrashExit ) + KMessageBox::error( dialog, + i18n( "The GpgSM process that tried to dump the certificate " + "ended prematurely because of an unexpected error. " + "Please check the output of gpgsm --dump-cert %1 for details.", + key().primaryFingerprint() ), + i18n( "Dump Certificate Error" ) ); + else if ( code ) + KMessageBox::error( dialog, + i18n( "An error occurred while trying to dump the certificate. " + "The output from GpgSM was:\n%1", errorString() ), + i18n( "Dump Certificate Error" ) ); + if ( !useDialog ) + slotDialogDestroyed(); +} + +#undef d +#undef q + +#include "moc_dumpcertificatecommand.cpp" +#include "dumpcertificatecommand.moc" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/dumpcertificatecommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/dumpcertificatecommand.h --- kdepim-4.0.83/kleopatra/commands/dumpcertificatecommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/dumpcertificatecommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,74 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/dumpcertificatecommand.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_COMMMANDS_DUMPCERTIFICATECOMMAND_H__ +#define __KLEOPATRA_COMMMANDS_DUMPCERTIFICATECOMMAND_H__ + +#include + +namespace Kleo { +namespace Commands { + + class DumpCertificateCommand : public Command { + Q_OBJECT + public: + explicit DumpCertificateCommand( QAbstractItemView * view, KeyListController * parent ); + explicit DumpCertificateCommand( KeyListController * parent ); + explicit DumpCertificateCommand( const GpgME::Key & key ); + ~DumpCertificateCommand(); + + static Restrictions restrictions() { return OnlyOneKey|MustBeCMS; } + + void setUseDialog( bool on ); + bool useDialog() const; + + QStringList output() const; + + private: + /* reimp */ void doStart(); + /* reimp */ void doCancel(); + + private: + class Private; + inline Private * d_func(); + inline const Private * d_func() const; + Q_PRIVATE_SLOT( d_func(), void slotProcessFinished( int, QProcess::ExitStatus ) ) + Q_PRIVATE_SLOT( d_func(), void slotProcessReadyReadStandardOutput() ) + Q_PRIVATE_SLOT( d_func(), void slotProcessReadyReadStandardError() ) + Q_PRIVATE_SLOT( d_func(), void slotUpdateRequested() ) + Q_PRIVATE_SLOT( d_func(), void slotDialogDestroyed() ) + }; + +} +} + +#endif // __KLEOPATRA_COMMMANDS_DUMPCERTIFICATECOMMAND_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/dumpcrlcachecommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/dumpcrlcachecommand.cpp --- kdepim-4.0.83/kleopatra/commands/dumpcrlcachecommand.cpp 2008-02-21 09:28:24.000000000 +0000 +++ kdepim-4.0.98/kleopatra/commands/dumpcrlcachecommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -37,6 +37,7 @@ #include "command_p.h" #include +#include #include #include @@ -187,7 +188,7 @@ { process.setOutputChannelMode( KProcess::SeparateChannels ); process.setReadChannel( KProcess::StandardOutput ); - process << "gpgsm" << "--call-dirmngr" << "listcrls"; + process << gpgSmPath() << "--call-dirmngr" << "listcrls"; } DumpCrlCacheCommand::Private::~Private() { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/exportcertificatecommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/exportcertificatecommand.cpp --- kdepim-4.0.83/kleopatra/commands/exportcertificatecommand.cpp 2008-02-13 15:45:39.000000000 +0000 +++ kdepim-4.0.98/kleopatra/commands/exportcertificatecommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -33,10 +33,11 @@ #include #include "exportcertificatecommand.h" -#include "exportcertificatesdialog.h" #include "command_p.h" +#include + #include #include #include @@ -58,9 +59,10 @@ #include #include -using namespace boost; -using namespace GpgME; using namespace Kleo; +using namespace Kleo::Dialogs; +using namespace GpgME; +using namespace boost; class ExportCertificateCommand::Private : public Command::Private { friend class ::ExportCertificateCommand; @@ -114,8 +116,36 @@ } +ExportCertificateCommand::ExportCertificateCommand( const Key & key ) + : Command( key, new Private( this, 0 ) ) +{ + +} + ExportCertificateCommand::~ExportCertificateCommand() {} +void ExportCertificateCommand::setOpenPGPFileName( const QString & fileName ) +{ + if ( !d->jobsPending ) + d->fileNames[OpenPGP] = fileName; +} + +QString ExportCertificateCommand::openPGPFileName() const +{ + return d->fileNames[OpenPGP]; +} + +void ExportCertificateCommand::setX509FileName( const QString & fileName ) +{ + if ( !d->jobsPending ) + d->fileNames[CMS] = fileName; +} + +QString ExportCertificateCommand::x509FileName() const +{ + return d->fileNames[CMS]; +} + void ExportCertificateCommand::doStart() { std::vector keys = d->keys(); @@ -143,20 +173,30 @@ bool ExportCertificateCommand::Private::requestFileNames( GpgME::Protocol protocol ) { - fileNames.clear(); if ( protocol == UnknownProtocol ) { + if ( !fileNames[OpenPGP].isEmpty() && !fileNames[CMS].isEmpty() ) + return true; const QPointer dlg( new ExportCertificatesDialog( view() ) ); + dlg->setOpenPgpExportFileName( fileNames[OpenPGP] ); + dlg->setCmsExportFileName( fileNames[CMS] ); const bool accepted = dlg->exec() == QDialog::Accepted && dlg ; if ( accepted ) { fileNames[OpenPGP] = dlg->openPgpExportFileName(); fileNames[CMS] = dlg->cmsExportFileName(); } + else + { + fileNames.clear(); + } delete dlg; return accepted; } + if ( !fileNames[protocol].isEmpty() ) + return true; + const QString fname = QFileDialog::getSaveFileName( view(), i18n( "Export Certificates" ), QString(), protocol == GpgME::OpenPGP ? i18n( "OpenPGP Certificates (.asc)" ) : i18n( "S/MIME Certificates (.pem)" ) ); fileNames[protocol] = fname; return !fname.isNull(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/exportcertificatecommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/exportcertificatecommand.h --- kdepim-4.0.83/kleopatra/commands/exportcertificatecommand.h 2008-04-10 10:30:39.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/exportcertificatecommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -41,10 +41,17 @@ public: explicit ExportCertificateCommand( QAbstractItemView * view, KeyListController * parent ); explicit ExportCertificateCommand( KeyListController * parent ); + explicit ExportCertificateCommand( const GpgME::Key & key ); ~ExportCertificateCommand(); /* reimp */ static Restrictions restrictions() { return NeedSelection; } + void setOpenPGPFileName( const QString & fileName ); + QString openPGPFileName() const; + + void setX509FileName( const QString & fileName ); + QString x509FileName() const; + private: /* reimp */ void doStart(); /* reimp */ void doCancel(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/exportopenpgpcertstoservercommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/exportopenpgpcertstoservercommand.cpp --- kdepim-4.0.83/kleopatra/commands/exportopenpgpcertstoservercommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/exportopenpgpcertstoservercommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,148 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/exportopenpgpcertstoservercommand.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "exportopenpgpcertstoservercommand.h" + +#include "command_p.h" + +#include + +#include +#include + +#include + +#include +#include + +using namespace Kleo; +using namespace Kleo::Commands; +using namespace GpgME; + +static bool haveKeyserverConfigured() { + const Kleo::CryptoConfig * const config = Kleo::CryptoBackendFactory::instance()->config(); + if ( !config ) + return false; + const Kleo::CryptoConfigEntry * const entry = config->entry( "gpg", "Keyserver", "keyserver" ); + return entry && !entry->stringValue().isEmpty(); +} + +ExportOpenPGPCertsToServerCommand::ExportOpenPGPCertsToServerCommand( KeyListController * c ) + : GnuPGProcessCommand( c ) +{ + +} + +ExportOpenPGPCertsToServerCommand::ExportOpenPGPCertsToServerCommand( QAbstractItemView * v, KeyListController * c ) + : GnuPGProcessCommand( v, c ) +{ + +} + + +ExportOpenPGPCertsToServerCommand::ExportOpenPGPCertsToServerCommand( const Key & key ) + : GnuPGProcessCommand( key ) +{ + +} + +ExportOpenPGPCertsToServerCommand::~ExportOpenPGPCertsToServerCommand() {} + +bool ExportOpenPGPCertsToServerCommand::preStartHook( QWidget * parent ) const { + if ( !haveKeyserverConfigured() ) + if ( KMessageBox::warningContinueCancel( parent, + i18nc("@info", + "No OpenPGP directory services have been configured." + "Since none is configured, Kleopatra will use " + "keys.gnupg.net as the server to export to." + "You can configure OpenPGP directory servers in Kleopatra's " + "configuration dialog." + "Do you want to continue with keys.gnupg.net " + "as the server to export to?" ), + i18n("OpenPGP Certificate Export"), + KStandardGuiItem::cont(), KStandardGuiItem::cancel(), + QLatin1String( "warn-export-openpgp-missing-keyserver" ) ) + != KMessageBox::Continue ) + return false; + return KMessageBox::warningContinueCancel( parent, + i18nc("@info", + "When OpenPGP certificates have been exported to a public directory server, " + "it is nearly impossible to remove them again." + "Before exporting your certificate to a public directory server, make sure that you " + "have created a revocation certificate so you can revoke the certificate if needed later." + "Are you sure you want to continue?"), + i18n("OpenPGP Certificate Export"), + KStandardGuiItem::cont(), KStandardGuiItem::cancel(), + QLatin1String( "warn-export-openpgp-nonrevocable" ) ) + == KMessageBox::Continue; +} + +QStringList ExportOpenPGPCertsToServerCommand::arguments() const { + QStringList result; + result << gpgPath(); + if ( !haveKeyserverConfigured() ) + result << "--keyserver" << "keys.gnupg.net"; + result << "--send-keys"; + Q_FOREACH( const Key & key, d->keys() ) + result << key.primaryFingerprint(); + return result; +} + +QString ExportOpenPGPCertsToServerCommand::errorCaption() const { + return i18n( "OpenPGP Certificate Export Error" ); +} + +QString ExportOpenPGPCertsToServerCommand::successCaption() const { + return i18n( "OpenPGP Certificate Export Finished" ); +} + +QString ExportOpenPGPCertsToServerCommand::crashExitMessage( const QStringList & args ) const { + return i18nc("@info", + "The GPG process that tried to export OpenPGP certificates " + "ended prematurely because of an unexpected error." + "Please check the output of %1 for details.", args.join( " " ) ) ; +} + +QString ExportOpenPGPCertsToServerCommand::errorExitMessage( const QStringList & args ) const { + return i18nc("@info", + "An error occurred while trying to export OpenPGP certificates. " + "The output from %1 was: %2", + args[0], errorString() ); +} + +QString ExportOpenPGPCertsToServerCommand::successMessage( const QStringList & ) const { + return i18n( "OpenPGP certificates exported successfully." ); +} + +#include "moc_exportopenpgpcertstoservercommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/exportopenpgpcertstoservercommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/exportopenpgpcertstoservercommand.h --- kdepim-4.0.83/kleopatra/commands/exportopenpgpcertstoservercommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/exportopenpgpcertstoservercommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,68 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/exportopenpgpcertstoservercommand.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_COMMMANDS_EXPORTOPENPGPCERTSTOSERVERCOMMAND_H__ +#define __KLEOPATRA_COMMMANDS_EXPORTOPENPGPCERTSTOSERVERCOMMAND_H__ + +#include + +namespace Kleo { +namespace Commands { + + class ExportOpenPGPCertsToServerCommand : public GnuPGProcessCommand { + Q_OBJECT + public: + explicit ExportOpenPGPCertsToServerCommand( QAbstractItemView * view, KeyListController * parent ); + explicit ExportOpenPGPCertsToServerCommand( KeyListController * parent ); + explicit ExportOpenPGPCertsToServerCommand( const GpgME::Key & key ); + + ~ExportOpenPGPCertsToServerCommand(); + + static Restrictions restrictions() { return MustBeOpenPGP; } + + private: + /* reimp */ bool preStartHook( QWidget * ) const; + + /* reimp */ QStringList arguments() const; + + /* reimp */ QString errorCaption() const; + /* reimp */ QString successCaption() const; + + /* reimp */ QString crashExitMessage( const QStringList & ) const; + /* reimp */ QString errorExitMessage( const QStringList & ) const; + /* reimp */ QString successMessage( const QStringList & ) const; + }; + +} +} + +#endif // __KLEOPATRA_COMMMANDS_EXPORTOPENPGPCERTSTOSERVERCOMMAND_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/exportsecretkeycommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/exportsecretkeycommand.cpp --- kdepim-4.0.83/kleopatra/commands/exportsecretkeycommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/exportsecretkeycommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,154 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/exportsecretkeycommand.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "exportsecretkeycommand.h" + +#include "command_p.h" + +#include + +#include + +#include + +#include +#include + +using namespace Kleo; +using namespace Kleo::Commands; +using namespace Kleo::Dialogs; +using namespace GpgME; + +ExportSecretKeyCommand::ExportSecretKeyCommand( KeyListController * c ) + : GnuPGProcessCommand( c ) +{ + +} + +ExportSecretKeyCommand::ExportSecretKeyCommand( QAbstractItemView * v, KeyListController * c ) + : GnuPGProcessCommand( v, c ) +{ + +} + +ExportSecretKeyCommand::ExportSecretKeyCommand( const Key & key ) + : GnuPGProcessCommand( key ) +{ + +} + +ExportSecretKeyCommand::~ExportSecretKeyCommand() {} + +void ExportSecretKeyCommand::setFileName( const QString & fileName ) { + m_filename = fileName; +} + +void ExportSecretKeyCommand::setPassphraseCharset( const QByteArray & charset ) { + m_charset = charset; +} + +void ExportSecretKeyCommand::setUseArmor( bool armor ) { + m_armor = armor; +} + +bool ExportSecretKeyCommand::preStartHook( QWidget * parent ) const { + if ( !m_filename.isEmpty() ) + return true; + + ExportSecretKeyDialog dlg( parent ); + dlg.setKey( d->key() ); + if ( !dlg.exec() ) + return false; + + m_filename = dlg.fileName(); + m_armor = dlg.useArmor(); + m_charset = dlg.charset(); + + return true; +} + +QStringList ExportSecretKeyCommand::arguments() const { + const Key key = d->key(); + QStringList result; + + if ( key.protocol() == OpenPGP ) + result << gpgPath(); + else + result << gpgSmPath(); + + result << "--output" << m_filename; + + if ( m_armor ) + result << "--armor"; + + if ( key.protocol() == CMS && !m_charset.isEmpty() ) + result << "--p12-charset" << m_charset; + + if ( key.protocol() == OpenPGP ) + result << "--export-secret-key"; + else + result << "--export-secret-key-p12"; + + result << key.primaryFingerprint(); + + return result; +} + +QString ExportSecretKeyCommand::errorCaption() const { + return i18n( "Secret Key Export Error" ); +} + +QString ExportSecretKeyCommand::successCaption() const { + return i18n( "Secret Key Export Finished" ); +} + +QString ExportSecretKeyCommand::crashExitMessage( const QStringList & args ) const { + return i18nc("@info", + "The GPG or GpgSM process that tried to export the secret key " + "ended prematurely because of an unexpected error." + "Please check the output of %1 for details.", args.join( " " ) ) ; +} + +QString ExportSecretKeyCommand::errorExitMessage( const QStringList & args ) const { + return i18nc("@info", + "An error occurred while trying to export the secret key. " + "The output from %1 was: %2", + args[0], errorString() ); +} + +QString ExportSecretKeyCommand::successMessage( const QStringList & ) const { + return i18n( "Secret key successfully exported." ); +} + +#include "moc_exportsecretkeycommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/exportsecretkeycommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/exportsecretkeycommand.h --- kdepim-4.0.83/kleopatra/commands/exportsecretkeycommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/exportsecretkeycommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,84 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/exportsecretkeycommand.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_COMMMANDS_EXPORTSECRETKEYCOMMAND_H__ +#define __KLEOPATRA_COMMMANDS_EXPORTSECRETKEYCOMMAND_H__ + +#include + +#include +#include + +namespace Kleo { +namespace Commands { + + class ExportSecretKeyCommand : public GnuPGProcessCommand { + Q_OBJECT + public: + explicit ExportSecretKeyCommand( QAbstractItemView * view, KeyListController * parent ); + explicit ExportSecretKeyCommand( KeyListController * parent ); + explicit ExportSecretKeyCommand( const GpgME::Key & key ); + ~ExportSecretKeyCommand(); + + void setFileName( const QString & fileName ); + QString fileName() const { return m_filename; } + + void setPassphraseCharset( const QByteArray & charset ); + QByteArray passphraseCharset() const { return m_charset; } + + void setUseArmor( bool armor ); + bool useArmor() const { return m_armor; } + + /* reimp */ static Restrictions restrictions() { return OnlyOneKey|NeedSecretKey; } + + private: + /* reimp */ bool preStartHook( QWidget * ) const; + + /* reimp */ QStringList arguments() const; + + /* reimp */ QString errorCaption() const; + /* reimp */ QString successCaption() const; + + /* reimp */ QString crashExitMessage( const QStringList & ) const; + /* reimp */ QString errorExitMessage( const QStringList & ) const; + /* reimp */ QString successMessage( const QStringList & ) const; + + private: + mutable QString m_filename; + mutable QByteArray m_charset; + mutable bool m_armor; + }; + +} +} + +#endif // __KLEOPATRA_COMMMANDS_EXPORTSECRETKEYCOMMAND_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/gnupgprocesscommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/gnupgprocesscommand.cpp --- kdepim-4.0.83/kleopatra/commands/gnupgprocesscommand.cpp 2008-04-30 14:59:56.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/gnupgprocesscommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -100,6 +100,12 @@ d->init(); } +GnuPGProcessCommand::GnuPGProcessCommand( const GpgME::Key & key ) + : Command( key, new Private( this, 0 ) ) +{ + d->init(); +} + void GnuPGProcessCommand::Private::init() { connect( &process, SIGNAL(finished(int,QProcess::ExitStatus)), q, SLOT(slotProcessFinished(int,QProcess::ExitStatus)) ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/gnupgprocesscommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/gnupgprocesscommand.h --- kdepim-4.0.83/kleopatra/commands/gnupgprocesscommand.h 2008-04-30 14:59:56.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/gnupgprocesscommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -46,6 +46,7 @@ protected: explicit GnuPGProcessCommand( QAbstractItemView * view, KeyListController * parent ); explicit GnuPGProcessCommand( KeyListController * parent ); + explicit GnuPGProcessCommand( const GpgME::Key & key ); ~GnuPGProcessCommand(); private: diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/importcertificatescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/importcertificatescommand.cpp --- kdepim-4.0.83/kleopatra/commands/importcertificatescommand.cpp 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/importcertificatescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -74,7 +74,7 @@ class ImportResultProxyModel : public AbstractKeyListSortFilterProxyModel { Q_OBJECT public: - explicit ImportResultProxyModel( const ImportResult & result, QObject * parent ) + explicit ImportResultProxyModel( const ImportResult & result, QObject * parent=0 ) : AbstractKeyListSortFilterProxyModel( parent ), m_result() { @@ -83,6 +83,11 @@ ~ImportResultProxyModel() {} + /* reimp */ ImportResultProxyModel * clone() const { + // compiler-generated copy ctor is fine! + return new ImportResultProxyModel( *this ); + } + void setImportResult( const ImportResult & result ) { m_result = result; updateFindCache( result ); @@ -170,33 +175,10 @@ ImportCertificatesCommand::~ImportCertificatesCommand() {} -static void inject_import_result_proxy_model( QAbstractItemView * qaiv, const ImportResult & res ) { - - if ( !qaiv ) - return; - QAbstractItemModel * m = qaiv->model(); - assert( m ); - QAbstractProxyModel * pm = qobject_cast( m ); - for ( QAbstractProxyModel * pit = pm ; pit ; pit = qobject_cast( pit->sourceModel() ) ) - pm = pit; - if ( pm ) - m = pm->sourceModel(); - assert( m ); - assert( !qobject_cast( m ) ); - ImportResultProxyModel * const irpm = new ImportResultProxyModel( res, qaiv ); - irpm->setSourceModel( m ); - if ( pm ) - pm->setSourceModel( irpm ); - else - qaiv->setModel( irpm ); - -} - void ImportCertificatesCommand::Private::setImportResultProxyModel( const ImportResult & result, const QString & id ) { if ( result.imports().empty() ) return; - q->addTemporaryView( id.isEmpty() ? i18n("Imported Certificates") : i18n( "Imported Certificates from %1", id ) ); - inject_import_result_proxy_model( view(), result ); + q->addTemporaryView( id.isEmpty() ? i18n("Imported Certificates") : i18n( "Imported Certificates from %1", id ), new ImportResultProxyModel( result ) ); if ( QTreeView * const tv = qobject_cast( view() ) ) tv->expandAll(); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/lookupcertificatescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/lookupcertificatescommand.cpp --- kdepim-4.0.83/kleopatra/commands/lookupcertificatescommand.cpp 2008-04-23 16:51:50.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/lookupcertificatescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -92,6 +93,9 @@ void slotCMSDownloadResult( const Error & err, const QByteArray & data ); void slotDetailsRequested( const Key & key ); void slotSaveAsRequested( const std::vector & keys ); + void slotDialogRejected() { + canceled(); + } private: using ImportCertificatesCommand::Private::showError; @@ -108,6 +112,7 @@ void startKeyListJob( GpgME::Protocol proto, const QString & str ); void startDownloadJob( const Key & key ); void checkForDownloadFinished(); + bool checkConfig() const; QWidget * dialogOrView() const { if ( dialog ) return dialog; else return view(); } @@ -169,6 +174,11 @@ void LookupCertificatesCommand::doStart() { + if ( !d->checkConfig() ) { + d->finished(); + return; + } + d->createDialog(); assert( d->dialog ); @@ -191,11 +201,16 @@ connect( dialog, SIGNAL(detailsRequested(GpgME::Key)), q, SLOT(slotDetailsRequested(GpgME::Key)) ); connect( dialog, SIGNAL(rejected()), - q, SLOT(cancel()) ); + q, SLOT(slotDialogRejected()) ); } void LookupCertificatesCommand::Private::slotSearchTextChanged( const QString & str ) { - dialog->setPassive( true ); + // pressing return might trigger both search and dialog destruction (search focused and default key set) + // On Windows, the dialog is then destroyed before this slot is called + if ( dialog ) { //thus test + dialog->setPassive( true ); + dialog->setCertificates( std::vector() ); + } startKeyListJob( CMS, str ); startKeyListJob( OpenPGP, str ); @@ -283,7 +298,7 @@ template QStringList filter_and_format_successful_downloads( const T & t ) { QStringList result; - + return result; } @@ -385,6 +400,36 @@ QString::fromLocal8Bit( result.error().asString() ) ) ); } +static bool haveOpenPGPKeyserverConfigured() { + const Kleo::CryptoConfig * const config = Kleo::CryptoBackendFactory::instance()->config(); + if ( !config ) + return false; + const Kleo::CryptoConfigEntry * const entry = config->entry( "gpg", "Keyserver", "keyserver" ); + return entry && !entry->stringValue().isEmpty(); +} + + +static bool haveX509DirectoryServerConfigured() { + const Kleo::CryptoConfig * const config = Kleo::CryptoBackendFactory::instance()->config(); + if ( !config ) + return false; + const Kleo::CryptoConfigEntry * const entry = config->entry( "dirmngr", "LDAP", "LDAP Server" ); + return entry && !entry->urlValueList().empty(); +} + + +bool LookupCertificatesCommand::Private::checkConfig() const { + const bool ok = haveOpenPGPKeyserverConfigured() || haveX509DirectoryServerConfigured(); + if ( !ok ) + KMessageBox::information( view(), i18nc("@info", + "You do not have any directory servers configured." + "You need to configure at least one directory server to " + "search on one." + "You can configure directory servers here: " + "Settings->Configure Kleopatra."), + i18nc("@title", "No Directory Servers Configured") ); + return ok; +} #undef d #undef q diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/lookupcertificatescommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/lookupcertificatescommand.h --- kdepim-4.0.83/kleopatra/commands/lookupcertificatescommand.h 2008-04-23 16:51:50.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/lookupcertificatescommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -61,6 +61,7 @@ Q_PRIVATE_SLOT( d_func(), void slotCMSDownloadResult(GpgME::Error,QByteArray) ) Q_PRIVATE_SLOT( d_func(), void slotDetailsRequested(GpgME::Key) ) Q_PRIVATE_SLOT( d_func(), void slotSaveAsRequested(std::vector) ) + Q_PRIVATE_SLOT( d_func(), void slotDialogRejected() ) }; } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/newcertificatecommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/newcertificatecommand.cpp --- kdepim-4.0.83/kleopatra/commands/newcertificatecommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/newcertificatecommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,152 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/newcertificatecommand.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Softwarls Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "newcertificatecommand.h" + +#include "command_p.h" + +#include + +using namespace Kleo; +using namespace Kleo::Commands; +using namespace GpgME; + +class NewCertificateCommand::Private : public Command::Private { + friend class ::Kleo::Commands::NewCertificateCommand; + NewCertificateCommand * q_func() const { return static_cast( q ); } +public: + explicit Private( NewCertificateCommand * qq, KeyListController * c ); + ~Private(); + + void init(); + +private: + void slotDialogRejected(); + void slotDialogAccepted(); + +private: + void ensureDialogCreated(); + +private: + Protocol protocol; + QPointer dialog; +}; + + +NewCertificateCommand::Private * NewCertificateCommand::d_func() { return static_cast( d.get() ); } +const NewCertificateCommand::Private * NewCertificateCommand::d_func() const { return static_cast( d.get() ); } + +#define d d_func() +#define q q_func() + +NewCertificateCommand::Private::Private( NewCertificateCommand * qq, KeyListController * c ) + : Command::Private( qq, c ), + protocol( UnknownProtocol ), + dialog() +{ + +} + +NewCertificateCommand::Private::~Private() {} + +NewCertificateCommand::NewCertificateCommand( KeyListController * c ) + : Command( new Private( this, c ) ) +{ + d->init(); +} + +NewCertificateCommand::NewCertificateCommand( QAbstractItemView * v, KeyListController * c ) + : Command( v, new Private( this, c ) ) +{ + d->init(); +} + +void NewCertificateCommand::Private::init() { + +} + +NewCertificateCommand::~NewCertificateCommand() {} + +void NewCertificateCommand::setProtocol( Protocol proto ) { + d->protocol = proto; + if ( d->dialog ) + d->dialog->setProtocol( proto ); +} + +Protocol NewCertificateCommand::protocol() const { + if ( d->dialog ) + return d->dialog->protocol(); + else + return d->protocol; +} + +void NewCertificateCommand::doStart() { + + d->ensureDialogCreated(); + assert( d->dialog ); + + if ( d->protocol != UnknownProtocol ) + d->dialog->setProtocol( d->protocol ); + + d->dialog->show(); +} + +void NewCertificateCommand::Private::slotDialogRejected() { + emit q->canceled(); + finished(); +} + +void NewCertificateCommand::Private::slotDialogAccepted() { + finished(); +} + +void NewCertificateCommand::doCancel() { + if ( d->dialog ) + d->dialog->close(); +} + +void NewCertificateCommand::Private::ensureDialogCreated() { + if ( dialog ) + return; + + dialog = new NewCertificateWizard( view() ); + dialog->setAttribute( Qt::WA_DeleteOnClose ); + + connect( dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()) ); + connect( dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()) ); +} + +#undef d +#undef q + +#include "moc_newcertificatecommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/newcertificatecommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/newcertificatecommand.h --- kdepim-4.0.83/kleopatra/commands/newcertificatecommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/newcertificatecommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,68 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + commands/newcertificatecommand.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_COMMANDS_NEWCERTIFICATECOMMAND_H__ +#define __KLEOPATRA_COMMANDS_NEWCERTIFICATECOMMAND_H__ + +#include + +#include + +namespace Kleo { +namespace Commands { + + class NewCertificateCommand : public Command { + Q_OBJECT + public: + explicit NewCertificateCommand( QAbstractItemView * view, KeyListController * parent ); + explicit NewCertificateCommand( KeyListController * parent ); + ~NewCertificateCommand(); + + void setProtocol( GpgME::Protocol proto ); + GpgME::Protocol protocol() const; + + private: + /* reimp */ void doStart(); + /* reimp */ void doCancel(); + + private: + class Private; + inline Private * d_func(); + inline const Private * d_func() const; + Q_PRIVATE_SLOT( d_func(), void slotDialogRejected() ) + Q_PRIVATE_SLOT( d_func(), void slotDialogAccepted() ) + }; + +} +} + +#endif // __KLEOPATRA_COMMANDS_NEWCERTIFICATECOMMAND_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/refreshopenpgpcertscommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/refreshopenpgpcertscommand.cpp --- kdepim-4.0.83/kleopatra/commands/refreshopenpgpcertscommand.cpp 2008-05-07 10:05:51.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/refreshopenpgpcertscommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -80,7 +80,7 @@ "configuration dialog." "Do you want to continue with keys.gnupg.net " "as fallback server?" ), - i18n("OpenPGP Certitifcate Refresh"), + i18n("OpenPGP Certificate Refresh"), KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QLatin1String( "warn-refresh-openpgp-missing-keyserver" ) ) != KMessageBox::Continue ) @@ -93,7 +93,7 @@ "connection, and can take up to an hour or more to complete, depending on " "your network connection, and the number of certificates to check. " "Are you sure you want to continue?"), - i18n("OpenPGP Certitifcate Refresh"), + i18n("OpenPGP Certificate Refresh"), KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QLatin1String( "warn-refresh-openpgp-expensive" ) ) == KMessageBox::Continue; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/refreshx509certscommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/refreshx509certscommand.cpp --- kdepim-4.0.83/kleopatra/commands/refreshx509certscommand.cpp 2008-05-07 10:05:51.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/refreshx509certscommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -65,7 +65,7 @@ "connection, and can take up to an hour or more to complete, depending on " "your network connection, and the number of certificates to check. " "Are you sure you want to continue?"), - i18n("X.509 Certitifcate Refresh"), + i18n("X.509 Certificate Refresh"), KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QLatin1String( "warn-refresh-x509-expensive" ) ) == KMessageBox::Continue; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/selftestcommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/selftestcommand.cpp --- kdepim-4.0.83/kleopatra/commands/selftestcommand.cpp 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/selftestcommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -64,6 +64,16 @@ using namespace Kleo::Dialogs; using namespace boost; +static const char * const components[] = { + 0, // gpgconf + "gpg", + "gpg-agent", + "scdaemon", + "gpgsm", + "dirmngr", +}; +static const unsigned int numComponents = sizeof components / sizeof *components; + class SelfTestCommand::Private : Command::Private { friend class ::Kleo::Commands::SelfTestCommand; SelfTestCommand * q_func() const { return static_cast( q ); } @@ -124,8 +134,10 @@ tests.push_back( makeGpgSmEngineCheckSelfTest() ); //emit q->info( i18n("Checking gpgconf installation...") ); tests.push_back( makeGpgConfEngineCheckSelfTest() ); - //emit q->info( i18n("Checking gpgconf configuration...") ); - tests.push_back( makeGpgConfCheckConfigurationSelfTest() ); + for ( unsigned int i = 0 ; i < numComponents ; ++i ) { + //emit q->info( i18n("Checking %1 configuration...", components[i]) ); + tests.push_back( makeGpgConfCheckConfigurationSelfTest( components[i] ) ); + } #ifdef HAVE_KLEOPATRACLIENT_LIBRARY //emit q->info( i18n("Checking Ui Server connectivity...") ); tests.push_back( makeUiServerConnectivitySelfTest() ); @@ -227,6 +239,7 @@ d->finished(); return; } + } else { d->ensureDialogCreated(); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/signcertificatecommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/signcertificatecommand.cpp --- kdepim-4.0.83/kleopatra/commands/signcertificatecommand.cpp 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/signcertificatecommand.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,220 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - commands/signcertificatecommand.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2008 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "signcertificatecommand.h" - -#include "command_p.h" - -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include - -using namespace Kleo; -using namespace Kleo::Commands; -using namespace Kleo::Dialogs; -using namespace GpgME; - -class SignCertificateCommand::Private : public Command::Private { - friend class ::Kleo::Commands::SignCertificateCommand; - SignCertificateCommand * q_func() const { return static_cast( q ); } -public: - explicit Private( SignCertificateCommand * qq, KeyListController * c ); - ~Private(); - - void init(); - -private: - void slotDialogAccepted(); - void slotDialogRejected(); - void slotResult( const Error & err ); - -private: - void ensureDialogCreated(); - void createJob(); - void showErrorDialog( const Error & error ); - void showSuccessDialog(); - -private: - GpgME::Key key; - QPointer dialog; - QPointer job; -}; - - -SignCertificateCommand::Private * SignCertificateCommand::d_func() { return static_cast( d.get() ); } -const SignCertificateCommand::Private * SignCertificateCommand::d_func() const { return static_cast( d.get() ); } - -#define d d_func() -#define q q_func() - -SignCertificateCommand::Private::Private( SignCertificateCommand * qq, KeyListController * c ) - : Command::Private( qq, c ), - key(), - dialog(), - job() -{ - -} - -SignCertificateCommand::Private::~Private() { kDebug(); } - -SignCertificateCommand::SignCertificateCommand( KeyListController * c ) - : Command( new Private( this, c ) ) -{ - d->init(); -} - -SignCertificateCommand::SignCertificateCommand( QAbstractItemView * v, KeyListController * c ) - : Command( v, new Private( this, c ) ) -{ - d->init(); -} - -void SignCertificateCommand::Private::init() { - -} - -SignCertificateCommand::~SignCertificateCommand() { kDebug(); } - -void SignCertificateCommand::doStart() { - - const std::vector keys = d->keys(); - if ( keys.size() != 1 || - keys.front().protocol() != GpgME::OpenPGP || - keys.front().hasSecret() ) { - d->finished(); - return; - } - - d->key = keys.front(); - - d->ensureDialogCreated(); - assert( d->dialog ); - d->dialog->show(); -} - -void SignCertificateCommand::Private::slotDialogAccepted() { - assert( dialog ); - - const SignKeyJob::SigningOption opt = dialog->signingOption(); - - createJob(); - assert( job ); - - if ( const Error err = job->start( key, opt ) ) { - showErrorDialog( err ); - finished(); - } -} - -void SignCertificateCommand::Private::slotDialogRejected() { - emit q->canceled(); - finished(); -} - -void SignCertificateCommand::Private::slotResult( const Error & err ) { - if ( err.isCanceled() ) - finished(); - else if ( err ) - showErrorDialog( err ); - else - showSuccessDialog(); -} - -void SignCertificateCommand::doCancel() { - kDebug(); - if ( d->job ) - d->job->slotCancel(); -} - -void SignCertificateCommand::Private::ensureDialogCreated() { - if ( dialog ) - return; - - dialog = new SignCertificateDialog( view() ); - dialog->setAttribute( Qt::WA_DeleteOnClose ); - - connect( dialog, SIGNAL(accepted()), q, SLOT(slotDialogAccepted()) ); - connect( dialog, SIGNAL(rejected()), q, SLOT(slotDialogRejected()) ); -} - -void SignCertificateCommand::Private::createJob() { - assert( !job ); - - const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( key.protocol() ); - if ( !backend ) - return; - - SignKeyJob * const j = backend->signKeyJob(); - if ( !j ) - return; - - connect( j, SIGNAL(progress(QString,int,int)), - q, SIGNAL(progress(QString,int,int)) ); - connect( j, SIGNAL(result(GpgME::Error)), - q, SLOT(slotResult(GpgME::Error)) ); - - job = j; -} - -void SignCertificateCommand::Private::showErrorDialog( const Error & err ) { - KMessageBox::error( view(), - i18n("

An error occurred while trying to sign the certificate %1:

%2

", - Formatting::formatForComboBox( key ), - QString::fromLocal8Bit( err.asString() ) ), - i18n("Certificate Signing Error") ); -} - -void SignCertificateCommand::Private::showSuccessDialog() { - KMessageBox::information( view(), - i18n("Certificate successfully signed."), - i18n("Signing Certificate Succeeded") ); -} - -#undef d -#undef q - -#include "moc_signcertificatecommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/signcertificatecommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/signcertificatecommand.h --- kdepim-4.0.83/kleopatra/commands/signcertificatecommand.h 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/signcertificatecommand.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,66 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - commands/signcertificatecommand.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2008 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __KLEOPATRA_COMMANDS_SIGNCERTIFICATECOMMAND_H__ -#define __KLEOPATRA_COMMANDS_SIGNCERTIFICATECOMMAND_H__ - -#include - -namespace Kleo { -namespace Commands { - - class SignCertificateCommand : public Command { - Q_OBJECT - public: - explicit SignCertificateCommand( QAbstractItemView * view, KeyListController * parent ); - explicit SignCertificateCommand( KeyListController * parent ); - ~SignCertificateCommand(); - - /* reimp */ static Restrictions restrictions() { return OnlyOneKey|MustBeOpenPGP; } - - private: - /* reimp */ void doStart(); - /* reimp */ void doCancel(); - - private: - class Private; - inline Private * d_func(); - inline const Private * d_func() const; - Q_PRIVATE_SLOT( d_func(), void slotResult(GpgME::Error) ) - Q_PRIVATE_SLOT( d_func(), void slotDialogAccepted() ) - Q_PRIVATE_SLOT( d_func(), void slotDialogRejected() ) - }; - -} -} - -#endif // __KLEOPATRA_COMMANDS_SIGNCERTIFICATECOMMAND_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/signencryptfilescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/signencryptfilescommand.cpp --- kdepim-4.0.83/kleopatra/commands/signencryptfilescommand.cpp 2008-04-24 14:11:59.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/signencryptfilescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -140,6 +140,84 @@ d->files = files; } +void SignEncryptFilesCommand::setSigningPolicy( Policy policy ) { + unsigned int mode = d->controller.operationMode(); + mode &= ~SignEncryptFilesController::SignMask; + switch ( policy ) { + case NoPolicy: + case Allow: + mode |= SignEncryptFilesController::SignAllowed ; + break; + case Deny: + mode |= SignEncryptFilesController::SignDisallowed ; + break; + case Force: + mode |= SignEncryptFilesController::SignForced ; + break; + } + try { + d->controller.setOperationMode( mode ); + } catch ( ... ) {} +} + +Policy SignEncryptFilesCommand::signingPolicy() const { + const unsigned int mode = d->controller.operationMode(); + switch ( mode & SignEncryptFilesController::SignMask ) { + default: + assert( !"This shouldn't happen!" ); + return NoPolicy; + case SignEncryptFilesController::SignAllowed: + return Allow; + case SignEncryptFilesController::SignForced: + return Force; + case SignEncryptFilesController::SignDisallowed: + return Deny; + } +} + +void SignEncryptFilesCommand::setEncryptionPolicy( Policy policy ) { + unsigned int mode = d->controller.operationMode(); + mode &= ~SignEncryptFilesController::EncryptMask; + switch ( policy ) { + case NoPolicy: + case Allow: + mode |= SignEncryptFilesController::EncryptAllowed ; + break; + case Deny: + mode |= SignEncryptFilesController::EncryptDisallowed ; + break; + case Force: + mode |= SignEncryptFilesController::EncryptForced ; + break; + } + try { + d->controller.setOperationMode( mode ); + } catch ( ... ) {} +} + +Policy SignEncryptFilesCommand::encryptionPolicy() const { + const unsigned int mode = d->controller.operationMode(); + switch ( mode & SignEncryptFilesController::EncryptMask ) { + default: + assert( !"This shouldn't happen!" ); + return NoPolicy; + case SignEncryptFilesController::EncryptAllowed: + return Allow; + case SignEncryptFilesController::EncryptForced: + return Force; + case SignEncryptFilesController::EncryptDisallowed: + return Deny; + } +} + +void SignEncryptFilesCommand::setProtocol( GpgME::Protocol proto ) { + d->controller.setProtocol( proto ); +} + +GpgME::Protocol SignEncryptFilesCommand::protocol() const { + return d->controller.protocol(); +} + void SignEncryptFilesCommand::doStart() { try { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/commands/signencryptfilescommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/commands/signencryptfilescommand.h --- kdepim-4.0.83/kleopatra/commands/signencryptfilescommand.h 2008-04-24 14:11:59.000000000 +0100 +++ kdepim-4.0.98/kleopatra/commands/signencryptfilescommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -37,6 +37,10 @@ #include +#include + +#include + class QStringList; namespace Kleo { @@ -53,6 +57,15 @@ void setFiles( const QStringList & files ); + void setSigningPolicy( Policy policy ); + Policy signingPolicy() const; + + void setEncryptionPolicy( Policy force ); + Policy encryptionPolicy() const; + + void setProtocol( GpgME::Protocol protocol ); + GpgME::Protocol protocol() const; + private: /* reimp */ void doStart(); /* reimp */ void doCancel(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/conf/dirservconfigpage.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/conf/dirservconfigpage.cpp --- kdepim-4.0.83/kleopatra/conf/dirservconfigpage.cpp 2008-04-30 14:59:54.000000000 +0100 +++ kdepim-4.0.98/kleopatra/conf/dirservconfigpage.cpp 2008-07-08 10:56:19.000000000 +0100 @@ -36,22 +36,20 @@ #include "libkleo/ui/directoryserviceswidget.h" #include "libkleo/kleo/cryptobackendfactory.h" +#include #include #include #include #include #include #include -#include +#include -#include #include #include #include #include -#include - using namespace Kleo; #if 0 // disabled, since it is apparently confusing @@ -130,6 +128,10 @@ static const char s_x509services_groupName[] = "LDAP"; static const char s_x509services_entryName[] = "LDAP Server"; +static const char s_x509services_new_componentName[] = "gpgsm"; +static const char s_x509services_new_groupName[] = "Configuration"; +static const char s_x509services_new_entryName[] = "keyserver"; + static const char s_pgpservice_componentName[] = "gpg"; static const char s_pgpservice_groupName[] = "Keyserver"; static const char s_pgpservice_entryName[] = "keyserver"; @@ -202,21 +204,43 @@ return str.isEmpty() ? KUrl::List() : KUrl( str ) ; } +static KUrl::List strings2urls( const QStringList & strs ) { + KUrl::List urls; + Q_FOREACH( const QString & str, strs ) + if ( !str.isEmpty() ) + urls.push_back( KUrl( str ) ); + return urls; +} + +static QStringList urls2strings( const KUrl::List & urls ) { + QStringList result; + Q_FOREACH( const KUrl & url, urls ) + result.push_back( url.url() ); + return result; +} + void DirectoryServicesConfigurationPage::load() { mWidget->clear(); - mX509ServicesEntry = configEntry( s_x509services_componentName, s_x509services_groupName, s_x509services_entryName, - Kleo::CryptoConfigEntry::ArgType_LDAPURL, true ); - if ( mX509ServicesEntry ) + // gpgsm/Configuration/keyserver is not provided by older gpgconf versions + if ( ( mX509ServicesEntry = configEntry( s_x509services_new_componentName, s_x509services_new_groupName, s_x509services_new_entryName, + Kleo::CryptoConfigEntry::ArgType_String, /*isList=*/true, /*showError=*/false ) ) ) + mWidget->addX509Services( strings2urls( mX509ServicesEntry->stringValueList() ) ); + else if ( ( mX509ServicesEntry = configEntry( s_x509services_componentName, s_x509services_groupName, s_x509services_entryName, + Kleo::CryptoConfigEntry::ArgType_LDAPURL, true ) ) ) mWidget->addX509Services( mX509ServicesEntry->urlValueList() ); + mWidget->setX509ReadOnly( mX509ServicesEntry && mX509ServicesEntry->isReadOnly() ); + mOpenPGPServiceEntry = configEntry( s_pgpservice_componentName, s_pgpservice_groupName, s_pgpservice_entryName, Kleo::CryptoConfigEntry::ArgType_String, false ); if ( mOpenPGPServiceEntry ) mWidget->addOpenPGPServices( string2urls( mOpenPGPServiceEntry->stringValue() ) ); + mWidget->setOpenPGPReadOnly( mOpenPGPServiceEntry && mOpenPGPServiceEntry->isReadOnly() ); + if ( mX509ServicesEntry ) if ( mOpenPGPServiceEntry ) mWidget->setAllowedProtocols( DirectoryServicesWidget::AllProtocols ); @@ -228,6 +252,10 @@ else mWidget->setDisabled( true ); + DirectoryServicesWidget::Protocols readOnlyProtocols; + if ( mX509ServicesEntry && mX509ServicesEntry->isReadOnly() ) + readOnlyProtocols = DirectoryServicesWidget::X509Protocol; + mTimeoutConfigEntry = configEntry( s_timeout_componentName, s_timeout_groupName, s_timeout_entryName, Kleo::CryptoConfigEntry::ArgType_UInt, false ); if ( mTimeoutConfigEntry ) { QTime time = QTime().addSecs( mTimeoutConfigEntry->uintValue() ); @@ -253,7 +281,10 @@ void DirectoryServicesConfigurationPage::save() { if ( mX509ServicesEntry ) - mX509ServicesEntry->setURLValueList( mWidget->x509Services() ); + if ( mX509ServicesEntry->argType() == Kleo::CryptoConfigEntry::ArgType_LDAPURL ) + mX509ServicesEntry->setURLValueList( mWidget->x509Services() ); + else + mX509ServicesEntry->setStringValueList( urls2strings( mWidget->x509Services() ) ); if ( mOpenPGPServiceEntry ) { const KUrl::List serv = mWidget->openPGPServices(); @@ -298,7 +329,10 @@ { // these guys don't have a default, to clear them: if ( mX509ServicesEntry ) - mX509ServicesEntry->setURLValueList( KUrl() ); + if ( mX509ServicesEntry->argType() == Kleo::CryptoConfigEntry::ArgType_LDAPURL ) + mX509ServicesEntry->setURLValueList( KUrl() ); + else + mX509ServicesEntry->setStringValueList( QStringList() ); if ( mOpenPGPServiceEntry ) mOpenPGPServiceEntry->setStringValue( QString() ); // these presumably have a default, use that one: @@ -329,15 +363,19 @@ const char* groupName, const char* entryName, Kleo::CryptoConfigEntry::ArgType argType, - bool isList ) + bool isList, + bool showError ) { Kleo::CryptoConfigEntry* entry = mConfig->entry( componentName, groupName, entryName ); + if ( !entry ) { - KMessageBox::error( this, i18n( "Backend error: gpgconf does not seem to know the entry for %1/%2/%3", componentName, groupName, entryName ) ); + if ( showError ) + KMessageBox::error( this, i18n( "Backend error: gpgconf does not seem to know the entry for %1/%2/%3", componentName, groupName, entryName ) ); return 0; } if( entry->argType() != argType || entry->isList() != isList ) { - KMessageBox::error( this, i18n( "Backend error: gpgconf has wrong type for %1/%2/%3: %4 %5", componentName, groupName, entryName, entry->argType(), entry->isList() ) ); + if ( showError ) + KMessageBox::error( this, i18n( "Backend error: gpgconf has wrong type for %1/%2/%3: %4 %5", componentName, groupName, entryName, entry->argType(), entry->isList() ) ); return 0; } return entry; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/conf/dirservconfigpage.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/conf/dirservconfigpage.h --- kdepim-4.0.83/kleopatra/conf/dirservconfigpage.h 2008-04-30 14:59:54.000000000 +0100 +++ kdepim-4.0.98/kleopatra/conf/dirservconfigpage.h 2008-07-08 10:56:19.000000000 +0100 @@ -65,7 +65,8 @@ const char* groupName, const char* entryName, Kleo::CryptoConfigEntry::ArgType argType, - bool isList ); + bool isList, + bool showError=true ); Kleo::DirectoryServicesWidget* mWidget; QTimeEdit* mTimeout; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/conf/kleopatra_config_dirserv.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/conf/kleopatra_config_dirserv.desktop --- kdepim-4.0.83/kleopatra/conf/kleopatra_config_dirserv.desktop 2008-06-11 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/conf/kleopatra_config_dirserv.desktop 2008-07-08 10:56:19.000000000 +0100 @@ -16,7 +16,7 @@ Name[bg]=Директорийни услуги Name[ca]=Serveis de directori Name[cs]=Adresářové služby -Name[da]=Opslagstjeneste +Name[da]=Directory-tjenester Name[de]=Verzeichnisdienste Name[el]=Υπηρεσίες καταλόγου Name[eo]=Dosierujaj Servoj @@ -64,6 +64,7 @@ Name[zh_TW]=目錄服務 Comment=Configuration of directory services Comment[ca]=Configuració dels serveis de directori +Comment[da]=Indstilling af directory-tjenester Comment[de]=Einrichtung von Verzeichnisdiensten Comment[el]=Ρυθμίσεις των υπηρεσιών καταλόγου Comment[et]=Kataloogiteenuste seadistused diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/conf/kleopatra_config_smimevalidation.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/conf/kleopatra_config_smimevalidation.desktop --- kdepim-4.0.83/kleopatra/conf/kleopatra_config_smimevalidation.desktop 2008-06-11 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/conf/kleopatra_config_smimevalidation.desktop 2008-07-08 10:56:19.000000000 +0100 @@ -14,6 +14,7 @@ Name=S/MIME Validation Name[ca]=Validació S/MIME +Name[da]=S/MIME-validering Name[de]=S/MIME-Prüfung Name[el]=Επαλήθευση S/MIME Name[et]=S/MIME valideerimine @@ -33,6 +34,7 @@ Name[zh_TW]=S/MIME 確認 Comment=Configuration of S/MIME certificate validation options Comment[ca]=Configuració de les opcions de validació dels certificats S/MIME +Comment[da]=Indstilling af tilvalg for S/MIME-certifikatvalidering Comment[de]=Einrichtung der Optionen zur S/MIME-Zertifikatüberprüfung Comment[el]=Ρύθμιση επιλογών επαλήθευσης πιστοποιητικών S/MIME Comment[et]=S/MIME sertifikaatide valideerimise valikute seadistamine diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/decryptverifyemailcontroller.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/decryptverifyemailcontroller.cpp --- kdepim-4.0.83/kleopatra/crypto/decryptverifyemailcontroller.cpp 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/decryptverifyemailcontroller.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -48,6 +49,8 @@ #include +#include + #include #include @@ -65,6 +68,7 @@ using namespace Kleo; using namespace Kleo::Crypto; using namespace Kleo::Crypto::Gui; +using namespace KMime::Types; class DecryptVerifyEMailController::Private { DecryptVerifyEMailController* const q; @@ -87,7 +91,7 @@ std::vector > m_inputs, m_signedDatas; std::vector > m_outputs; - + QPointer m_wizard; std::vector > m_results; std::vector > m_runnableTasks, m_completedTasks; @@ -97,6 +101,7 @@ DecryptVerifyOperation m_operation; Protocol m_protocol; VerificationMode m_verificationMode; + std::vector m_informativeSenders; }; DecryptVerifyEMailController::Private::Private( DecryptVerifyEMailController* qq ) @@ -121,7 +126,7 @@ void DecryptVerifyEMailController::doTaskDone( const Task* task, const shared_ptr & result ) { assert( task ); - + // We could just delete the tasks here, but we can't use // Qt::QueuedConnection here (we need sender()) and other slots // might not yet have executed. Therefore, we push completed tasks @@ -151,10 +156,10 @@ kleo_assert( m_runnableTasks.empty() ); Q_FOREACH ( const shared_ptr & i, m_results ) emit q->verificationResult( i->verificationResult() ); - // if there is a popup, wait for either the client cancel or the user closing the popup. + // if there is a popup, wait for either the client cancel or the user closing the popup. // Otherwise (silent case), finish immediately m_operationCompleted = true; - if ( m_silent ) + if ( m_silent ) q->emitDoneOrError(); } } @@ -168,9 +173,9 @@ w->setWindowTitle( i18n( "Decrypt/Verify E-Mail" ) ); w->setAttribute( Qt::WA_DeleteOnClose ); w->setStandaloneMode( true ); - const QPoint preferredPos = EMailOperationsPreferences().decryptVerifyPopupPosition(); - if ( !preferredPos.isNull() ) - w->move( preferredPos ); + const QRect preferredGeometry = EMailOperationsPreferences().decryptVerifyPopupGeometry(); + if ( preferredGeometry.isValid() ) + w->setGeometry( preferredGeometry ); connect( w.get(), SIGNAL(destroyed()), q, SLOT(slotWizardCanceled()), Qt::QueuedConnection ); m_wizard = w.release(); @@ -181,12 +186,17 @@ const uint numInputs = m_inputs.size(); const uint numMessages = m_signedDatas.size(); const uint numOutputs = m_outputs.size(); - + const uint numInformativeSenders = m_informativeSenders.size(); + // these are duplicated from DecryptVerifyCommandEMailBase::Private::checkForErrors with slightly modified error codes/messages if ( !numInputs ) throw Kleo::Exception( makeGnuPGError( GPG_ERR_CONFLICT ), i18n("At least one input needs to be provided") ); + if ( numInformativeSenders > 0 && numInformativeSenders != numInputs ) + throw Kleo::Exception( makeGnuPGError( GPG_ERR_CONFLICT ), //TODO use better error code if possible + i18n("Informative sender/signed data count mismatch") ); + if ( numMessages ) if ( numMessages != numInputs ) throw Kleo::Exception( makeGnuPGError( GPG_ERR_CONFLICT ), //TODO use better error code if possible @@ -207,16 +217,15 @@ const CryptoBackend::Protocol * const backend = CryptoBackendFactory::instance()->protocol( m_protocol ); if ( !backend ) - throw Kleo::Exception( makeGnuPGError( GPG_ERR_UNSUPPORTED_PROTOCOL ), - m_protocol == OpenPGP ? i18n("No backend support for OpenPGP") : - m_protocol == CMS ? i18n("No backend support for S/MIME") : QString() ); + throw Kleo::Exception( makeGnuPGError( GPG_ERR_UNSUPPORTED_PROTOCOL ), i18n("No backend support for %1", Formatting::displayName( m_protocol ) ) ); + if ( m_operation != Decrypt && !m_silent ) ensureWizardVisible(); std::vector< shared_ptr > tasks; - + for ( unsigned int i = 0 ; i < numInputs ; ++i ) { shared_ptr task; switch ( m_operation ) { @@ -236,6 +245,8 @@ shared_ptr t( new VerifyDetachedTask ); t->setInput( m_inputs.at( i ) ); t->setSignedData( m_signedDatas.at( i ) ); + if ( numInformativeSenders > 0 ) + t->setInformativeSender( m_informativeSenders.at( i ) ); t->setProtocol( m_protocol ); task = t; } else { @@ -243,6 +254,8 @@ t->setInput( m_inputs.at( i ) ); if ( numOutputs ) t->setOutput( m_outputs.at( i ) ); + if ( numInformativeSenders > 0 ) + t->setInformativeSender( m_informativeSenders.at( i ) ); t->setProtocol( m_protocol ); task = t; } @@ -254,15 +267,17 @@ t->setInput( m_inputs.at( i ) ); assert( numOutputs ); t->setOutput( m_outputs.at( i ) ); + if ( numInformativeSenders > 0 ) + t->setInformativeSender( m_informativeSenders.at( i ) ); t->setProtocol( m_protocol ); - task = t; + task = t; } } assert( task ); tasks.push_back( task ); } - + return tasks; } @@ -330,6 +345,11 @@ d->m_outputs = outputs; } +void DecryptVerifyEMailController::setInformativeSenders( const std::vector & senders ) +{ + d->m_informativeSenders = senders; +} + void DecryptVerifyEMailController::setWizardShown( bool shown ) { d->m_silent = !shown; @@ -372,7 +392,7 @@ // signal emissions. m_runnableTasks.clear(); - // a cancel() will result in a call to + // a cancel() will result in a call to if ( m_runningTask ) m_runningTask->cancel(); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/decryptverifyemailcontroller.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/decryptverifyemailcontroller.h --- kdepim-4.0.83/kleopatra/crypto/decryptverifyemailcontroller.h 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/decryptverifyemailcontroller.h 2008-07-08 10:56:20.000000000 +0100 @@ -47,6 +47,11 @@ class QFile; +namespace KMime { +namespace Types { + class Mailbox; +} +} namespace GpgME { class VerificationResult; } @@ -66,7 +71,7 @@ public: explicit DecryptVerifyEMailController( QObject * parent=0 ); explicit DecryptVerifyEMailController( const boost::shared_ptr & cmd, QObject * parent=0 ); - + ~DecryptVerifyEMailController(); void setInput( const boost::shared_ptr & input ); @@ -78,6 +83,8 @@ void setOutput( const boost::shared_ptr & output ); void setOutputs( const std::vector > & outputs ); + void setInformativeSenders( const std::vector & senders ); + void setWizardShown( bool shown ); void setOperation( DecryptVerifyOperation operation ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/decryptverifyfilescontroller.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/decryptverifyfilescontroller.cpp --- kdepim-4.0.83/kleopatra/crypto/decryptverifyfilescontroller.cpp 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/decryptverifyfilescontroller.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -68,7 +68,7 @@ DecryptVerifyFilesController* const q; public: - static QString heuristicBaseDirectory( const QStringList& fileNames ); + static QString heuristicBaseDirectory( const QStringList& fileNames ); static shared_ptr taskFromOperationWidget( const DecryptVerifyOperationWidget * w, const shared_ptr & file, const QDir & outDir, const shared_ptr & overwritePolicy ); explicit Private( DecryptVerifyFilesController* qq ); @@ -138,7 +138,7 @@ } break; } - + task->autodetectProtocolFromInput(); return task; } @@ -163,7 +163,7 @@ m_wizard->setTaskCollection( coll ); QTimer::singleShot( 0, q, SLOT( schedule() ) ); - + } catch ( const Kleo::Exception & e ) { reportError( e.error().encodedError(), e.message() ); } catch ( const std::exception & e ) { @@ -186,18 +186,17 @@ { assert( task ); assert( task == d->m_runningTask.get() ); - + // We could just delete the tasks here, but we can't use // Qt::QueuedConnection here (we need sender()) and other slots // might not yet have executed. Therefore, we push completed tasks // into a burial container - + d->m_completedTasks.push_back( d->m_runningTask ); d->m_runningTask.reset(); - const shared_ptr & dvr = boost::dynamic_pointer_cast( result ); - assert( dvr ); - d->m_results.push_back( dvr ); + if ( const shared_ptr & dvr = boost::dynamic_pointer_cast( result ) ) + d->m_results.push_back( dvr ); QTimer::singleShot( 0, this, SLOT(schedule()) ); } @@ -381,13 +380,18 @@ d->m_operation = op; } +DecryptVerifyOperation DecryptVerifyFilesController::operation() const +{ + return d->m_operation; +} + void DecryptVerifyFilesController::Private::cancelAllTasks() { // we just kill all runnable tasks - this will not result in // signal emissions. m_runnableTasks.clear(); - // a cancel() will result in a call to + // a cancel() will result in a call to if ( m_runningTask ) m_runningTask->cancel(); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/decryptverifyfilescontroller.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/decryptverifyfilescontroller.h --- kdepim-4.0.83/kleopatra/crypto/decryptverifyfilescontroller.h 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/decryptverifyfilescontroller.h 2008-07-08 10:56:20.000000000 +0100 @@ -64,6 +64,7 @@ void setFiles( const std::vector >& files ); void setOperation( DecryptVerifyOperation op ); + DecryptVerifyOperation operation() const; void start(); public Q_SLOTS: diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/decryptverifytask.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/decryptverifytask.cpp --- kdepim-4.0.83/kleopatra/crypto/decryptverifytask.cpp 2008-05-15 19:37:21.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/decryptverifytask.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -53,6 +54,8 @@ #include #include +#include + #include #include #include @@ -67,16 +70,19 @@ #include #include #include +#include #include // Qt::escape #include #include +#include using namespace Kleo::Crypto; using namespace Kleo; using namespace GpgME; using namespace boost; +using namespace KMime::Types; namespace { @@ -85,6 +91,64 @@ return job ? job->auditLogAsHtml() : QString(); } + +static bool addrspec_equal( const AddrSpec & lhs, const AddrSpec & rhs, Qt::CaseSensitivity cs ) { + return lhs.localPart.compare( rhs.localPart, cs ) == 0 && lhs.domain.compare( rhs.domain, Qt::CaseInsensitive ) == 0; +} + +static bool mailbox_equal( const Mailbox & lhs, const Mailbox & rhs, Qt::CaseSensitivity cs ) { + return addrspec_equal( lhs.addrSpec(), rhs.addrSpec(), cs ); +} + +static std::string stripAngleBrackets( const std::string & str ) { + if ( str.empty() ) + return str; + if ( str[0] == '<' && str[str.size()-1] == '>' ) + return str.substr( 1, str.size() - 2 ); + return str; +} + +static std::string email( const UserID & uid ) { + + if ( uid.parent().protocol() == OpenPGP ) + return stripAngleBrackets( uid.email() ); + + assert( uid.parent().protocol() == CMS ); + const std::string id = uid.id(); + if ( !id.empty() && id[0] == '<' ) + return stripAngleBrackets( id ); + return DN( uid.id() )["EMAIL"].trimmed().toUtf8().constData(); +} + +static std::vector extractMailboxes( const Key & key ) { + std::vector res; + Q_FOREACH( const UserID & id, key.userIDs() ) { + Mailbox mbox; + mbox.setAddress( email( id ).c_str() ); + if ( !mbox.addrSpec().isEmpty() ) + res.push_back( mbox ); + } + return res; +} + +static std::vector extractMailboxes( const std::vector & signers ) { + std::vector res; + Q_FOREACH( const Key & i, signers ) { + const std::vector bxs = extractMailboxes( i ); + res.insert( res.end(), bxs.begin(), bxs.end() ); + } + return res; +} + +static bool keyContainsMailbox( const Key & key, const Mailbox & mbox ) { + const std::vector mbxs = extractMailboxes( key ); + return std::find_if( mbxs.begin(), mbxs.end(), bind( mailbox_equal, mbox, _1, Qt::CaseInsensitive ) ) != mbxs.end(); +} + +static bool keysContainMailbox( const std::vector & keys, const Mailbox & mbox ) { + return std::find_if( keys.begin(), keys.end(), bind( keyContainsMailbox, _1, mbox ) ) != keys.end(); +} + static QString signatureSummaryToString( int summary ) { if ( summary & Signature::None ) @@ -139,10 +203,14 @@ return QString( "0x%1" ).arg( QString::fromAscii( fpr ).toUpper() ); } +static QString renderKeyLink( const QString & fpr, const QString & text ) { + return QString::fromLatin1( "%2" ).arg( fpr ).arg( text ); +} + static QString renderKey( const Key & key ) { if ( key.isNull() ) return i18n( "Unknown key" ); - return QString::fromLatin1( "%2" ).arg( key.primaryFingerprint(), Formatting::prettyName( key ) ); + return renderKeyLink( key.primaryFingerprint(), Formatting::prettyName( key ) ); } static QString renderKeyEMailOnlyNameAsFallback( const Key & key ) { @@ -150,7 +218,7 @@ return i18n( "Unknown key" ); const QString email = Formatting::prettyEMail( key ); const QString user = !email.isNull() ? email : Formatting::prettyName( key ); - return QString::fromLatin1( "%2" ).arg( key.primaryFingerprint(), user ); + return renderKeyLink( key.primaryFingerprint(), user ); } static QString formatDate( const QDateTime & dt ) { @@ -172,7 +240,7 @@ if ( haveSigner ) if ( haveDate ) return i18nc( "date, key owner, key ID", - "Signed on %1 by %2 (Key ID: %3).", + "Signed on %1 by %2 (Key ID: %3).", formatDate( dt ), signer, renderFingerprint( key.keyID() ) ); @@ -191,7 +259,7 @@ static QString formatInputOutputLabel( const QString & input, const QString & output, bool inputDeleted, bool outputDeleted ) { if ( output.isEmpty() ) return strikeOut( input, inputDeleted ); - return i18nc( "Input file --> Output file (rarr is arrow", "%1 → %2", + return i18nc( "Input file --> Output file (rarr is arrow", "%1 → %2", strikeOut( input, inputDeleted ), strikeOut( output, outputDeleted ) ); } @@ -237,6 +305,20 @@ return sig.summary() & Signature::Valid; } +} + +class DecryptVerifyResult::SenderInfo { +public: + explicit SenderInfo( const Mailbox & infSender, const std::vector & signers_ ) : informativeSender( infSender ), signers( signers_ ) {} + const Mailbox informativeSender; + const std::vector signers; + bool hasInformativeSender() const { return !informativeSender.addrSpec().isEmpty(); } + bool conflicts() const { return hasInformativeSender() && !keysContainMailbox( signers, informativeSender ); } + std::vector signerMailboxes() const {return extractMailboxes( signers ); } +}; + +namespace { + static Task::Result::VisualCode codeForVerificationResult( const VerificationResult & res ) { if ( res.isNull() ) @@ -253,7 +335,7 @@ return Task::Result::Warning; } -static QString formatVerificationResultOverview( const VerificationResult & res ) { +static QString formatVerificationResultOverview( const VerificationResult & res, const DecryptVerifyResult::SenderInfo & info ) { if ( res.isNull() ) return QString(); @@ -265,7 +347,7 @@ return i18n( "Verification failed: %1.", Qt::escape( QString::fromLocal8Bit( err.asString() ) ) ); const std::vector sigs = res.signatures(); - const std::vector signers = KeyCache::instance()->findSigners( res ); + const std::vector signers = info.signers; if ( sigs.empty() ) return i18n( "No signatures found." ); @@ -278,14 +360,25 @@ if ( warn > 0 ) return i18np("Not enough information to check signature validity.", "%1 signatures could not be verified.", warn ); - //All good: + //Good signature: + QString text; if ( sigs.size() == 1 ) { const Key key = DecryptVerifyResult::keyForSignature( sigs[0], signers ); if ( key.isNull() ) - return i18n( "Signature is valid." ); - return i18n( "Signed by %1", renderKeyEMailOnlyNameAsFallback( key ) ); + text = i18n( "Signature is valid." ); + else + text = i18n( "Signed by %1", renderKeyEMailOnlyNameAsFallback( key ) ); + if ( info.conflicts() ) + text += i18n( "
Warning: The sender's mail address is not stored in the %1 used for signing.", + key.isNull() ? i18n( "certificate" ) : renderKeyLink( key.primaryFingerprint(), i18n( "certificate" ) ) ); } - return i18np("Valid signature.", "%1 valid signatures.", sigs.size() ); + else { + text = i18np("Valid signature.", "%1 valid signatures.", sigs.size() ); + if ( info.conflicts() ) + text += i18n( "
Warning: The sender's mail address is not stored in the certificates used for signing." ); + } + + return text; } static QString formatDecryptionResultOverview( const DecryptionResult & result ) @@ -304,7 +397,7 @@ return QString(); QString text = formatSigningInformation( sig, key ) + "
"; - + const bool red = sig.summary() & Signature::Red; if ( sig.summary() & Signature::Valid ) return text + formatValidSignatureWithTrustLevel( key ); // ### TODO handle key.isNull()? @@ -326,15 +419,23 @@ return text + i18n("Invalid signature by %1: %2", renderKey( key ), signatureSummaryToString( sig.summary() ) ); } -static QString formatVerificationResultDetails( const VerificationResult & res ) +static QStringList format( const std::vector & mbxs ) { + QStringList res; + std::transform( mbxs.begin(), mbxs.end(), std::back_inserter( res ), bind( &Mailbox::prettyAddress, _1 ) ); + return res; +} + +static QString formatVerificationResultDetails( const VerificationResult & res, const DecryptVerifyResult::SenderInfo & info ) { const std::vector sigs = res.signatures(); const std::vector signers = KeyCache::instance()->findSigners( res ); QString details; - Q_FOREACH ( const Signature & sig, sigs ) + Q_FOREACH ( const Signature & sig, sigs ) details += formatSignature( sig, DecryptVerifyResult::keyForSignature( sig, signers ) ) + '\n'; details = details.trimmed(); details.replace( '\n', "
" ); + if ( info.conflicts() ) + details += i18n( "

The sender's address %1 is not stored in the certificate. Stored: %2

", info.informativeSender.prettyAddress(), format( info.signerMailboxes() ).join( i18nc("separator for a list of e-mail addresses", ", " ) ) ); return details; } @@ -343,40 +444,44 @@ if ( res.isNull() || !res.error() || res.error().isCanceled() ) return QString(); - if ( recipients.empty() ) + if ( recipients.empty() && res.numRecipients() > 0 ) return QString( "" + i18np( "One unknown recipient.", "%1 unknown recipients.", res.numRecipients() ) + "" ); QString details; - details += i18np( "Recipients:", "Recipients:", res.numRecipients() ); - if ( res.numRecipients() == 1 ) - return details + renderKey( recipients.front() ); + if ( !recipients.empty() ) { + details += i18np( "Recipients:", "Recipients:", res.numRecipients() ); + if ( res.numRecipients() == 1 ) + return details + renderKey( recipients.front() ); + + details += "
    "; + Q_FOREACH( const Key & key, recipients ) + details += "
  • " + renderKey( key ) + "
  • "; + if ( recipients.size() < res.numRecipients() ) + details += "
  • " + i18np( "One unknown recipient", "%1 unknown recipients", + res.numRecipients() - recipients.size() ) + "
  • "; - details += "
      "; - Q_FOREACH( const Key & key, recipients ) - details += "
    • " + renderKey( key ) + "
    • "; - if ( recipients.size() < res.numRecipients() ) - details += "
    • " + i18np( "One unknown recipient", "%1 unknown recipients", - res.numRecipients() - recipients.size() ) + "
    • "; + details += "
    "; + } - return details + "
"; + return details; } -static QString formatDecryptVerifyResultOverview( const DecryptionResult & dr, const VerificationResult & vr ) +static QString formatDecryptVerifyResultOverview( const DecryptionResult & dr, const VerificationResult & vr, const DecryptVerifyResult::SenderInfo & info ) { if ( IsErrorOrCanceled( dr ) ) return formatDecryptionResultOverview( dr ); - return formatVerificationResultOverview( vr ); + return formatVerificationResultOverview( vr, info ); } - static QString formatDecryptVerifyResultDetails( const DecryptionResult & dr, const VerificationResult & vr, - const std::vector & recipients ) + const std::vector & recipients, + const DecryptVerifyResult::SenderInfo & info ) { const QString drDetails = formatDecryptionResultDetails( dr, recipients ); if ( IsErrorOrCanceled( dr ) ) return drDetails; - return drDetails + ( drDetails.isEmpty() ? "" : "
" ) + formatVerificationResultDetails( vr ); + return drDetails + ( drDetails.isEmpty() ? "" : "
" ) + formatVerificationResultDetails( vr, info ); } } // anon namespace @@ -393,6 +498,7 @@ const QString & input, const QString & output, const QString & auditLog, + const Mailbox & informativeSender, DecryptVerifyResult* qq ) : q( qq ), m_type( type ), @@ -403,7 +509,8 @@ m_errorString( errString ), m_inputLabel( input ), m_outputLabel( output ), - m_auditLog( auditLog ) + m_auditLog( auditLog ), + m_informativeSender( informativeSender ) { } @@ -411,6 +518,8 @@ return formatInputOutputLabel( m_inputLabel, m_outputLabel, false, q->hasError() ); } + DecryptVerifyResult::SenderInfo makeSenderInfo() const; + bool isDecryptOnly() const { return m_type == Decrypt; } bool isVerifyOnly() const { return m_type == Verify; } bool isDecryptVerify() const { return m_type == DecryptVerify; } @@ -423,8 +532,13 @@ QString m_inputLabel; QString m_outputLabel; const QString m_auditLog; + const Mailbox m_informativeSender; }; +DecryptVerifyResult::SenderInfo DecryptVerifyResult::Private::makeSenderInfo() const { + return SenderInfo( m_informativeSender, KeyCache::instance()->findSigners( m_verificationResult ) ); +} + shared_ptr AbstractDecryptVerifyTask::fromDecryptResult( const DecryptionResult & dr, const QByteArray & plaintext, const QString & auditLog ) { return shared_ptr( new DecryptVerifyResult( Decrypt, @@ -435,7 +549,8 @@ QString(), inputLabel(), outputLabel(), - auditLog ) ); + auditLog, + informativeSender() ) ); } shared_ptr AbstractDecryptVerifyTask::fromDecryptResult( const GpgME::Error & err, const QString& what, const QString & auditLog ) { @@ -448,7 +563,8 @@ what, inputLabel(), outputLabel(), - auditLog ) ); + auditLog, + informativeSender() ) ); } shared_ptr AbstractDecryptVerifyTask::fromDecryptVerifyResult( const DecryptionResult & dr, const VerificationResult & vr, const QByteArray & plaintext, const QString & auditLog ) { @@ -461,7 +577,8 @@ QString(), inputLabel(), outputLabel(), - auditLog ) ); + auditLog, + informativeSender() ) ); } shared_ptr AbstractDecryptVerifyTask::fromDecryptVerifyResult( const GpgME::Error & err, const QString & details, const QString & auditLog ) { @@ -474,7 +591,8 @@ details, inputLabel(), outputLabel(), - auditLog ) ); + auditLog, + informativeSender() ) ); } shared_ptr AbstractDecryptVerifyTask::fromVerifyOpaqueResult( const VerificationResult & vr, const QByteArray & plaintext, const QString & auditLog ) { @@ -487,7 +605,8 @@ QString(), inputLabel(), outputLabel(), - auditLog ) ); + auditLog, + informativeSender() ) ); } shared_ptr AbstractDecryptVerifyTask::fromVerifyOpaqueResult( const GpgME::Error & err, const QString & details, const QString & auditLog ) { return shared_ptr( new DecryptVerifyResult( @@ -499,11 +618,12 @@ details, inputLabel(), outputLabel(), - auditLog ) ); + auditLog, + informativeSender() ) ); } shared_ptr AbstractDecryptVerifyTask::fromVerifyDetachedResult( const VerificationResult & vr, const QString & auditLog ) { - return shared_ptr( new DecryptVerifyResult( + return shared_ptr( new DecryptVerifyResult( Verify, vr, DecryptionResult(), @@ -512,7 +632,8 @@ QString(), inputLabel(), outputLabel(), - auditLog ) ); + auditLog, + informativeSender() ) ); } shared_ptr AbstractDecryptVerifyTask::fromVerifyDetachedResult( const GpgME::Error & err, const QString & details, const QString & auditLog ) { return shared_ptr( new DecryptVerifyResult( @@ -524,7 +645,8 @@ details, inputLabel(), outputLabel(), - auditLog ) ); + auditLog, + informativeSender() ) ); } DecryptVerifyResult::DecryptVerifyResult( DecryptVerifyOperation type, @@ -535,8 +657,9 @@ const QString & errString, const QString & inputLabel, const QString & outputLabel, - const QString & auditLog ) - : Task::Result(), d( new Private( type, vr, dr, stuff, errCode, errString, inputLabel, outputLabel, auditLog, this ) ) + const QString & auditLog, + const Mailbox & informativeSender ) + : Task::Result(), d( new Private( type, vr, dr, stuff, errCode, errString, inputLabel, outputLabel, auditLog, informativeSender, this ) ) { } @@ -546,9 +669,9 @@ if ( d->isDecryptOnly() ) ov = formatDecryptionResultOverview( d->m_decryptionResult ); else if ( d->isVerifyOnly() ) - ov = formatVerificationResultOverview( d->m_verificationResult ); - else - ov = formatDecryptVerifyResultOverview( d->m_decryptionResult, d->m_verificationResult ); + ov = formatVerificationResultOverview( d->m_verificationResult, d->makeSenderInfo() ); + else + ov = formatDecryptVerifyResultOverview( d->m_decryptionResult, d->m_verificationResult, d->makeSenderInfo() ); return i18nc( "label: result example: foo.sig: Verification failed. ", "%1: %2", d->label(), ov ); } @@ -557,8 +680,8 @@ if ( d->isDecryptOnly() ) return formatDecryptionResultDetails( d->m_decryptionResult, KeyCache::instance()->findRecipients( d->m_decryptionResult ) ); if ( d->isVerifyOnly() ) - return formatVerificationResultDetails( d->m_verificationResult ); - return formatDecryptVerifyResultDetails( d->m_decryptionResult, d->m_verificationResult, KeyCache::instance()->findRecipients( d->m_decryptionResult ) ); + return formatVerificationResultDetails( d->m_verificationResult, d->makeSenderInfo() ); + return formatDecryptVerifyResultDetails( d->m_decryptionResult, d->m_verificationResult, KeyCache::instance()->findRecipients( d->m_decryptionResult ), d->makeSenderInfo() ); } bool DecryptVerifyResult::hasError() const @@ -603,13 +726,25 @@ } class AbstractDecryptVerifyTask::Private { - +public: + Mailbox informativeSender; }; + AbstractDecryptVerifyTask::AbstractDecryptVerifyTask( QObject * parent ) : Task( parent ), d( new Private ) {} AbstractDecryptVerifyTask::~AbstractDecryptVerifyTask() {} + +Mailbox AbstractDecryptVerifyTask::informativeSender() const { + return d->informativeSender; +} + + +void AbstractDecryptVerifyTask::setInformativeSender( const Mailbox & sender ) { + d->informativeSender = sender; +} + class DecryptVerifyTask::Private { DecryptVerifyTask* const q; public: @@ -625,7 +760,7 @@ } void emitResult( const shared_ptr& result ); - + shared_ptr m_input; shared_ptr m_output; const CryptoBackend::Protocol* m_backend; @@ -686,7 +821,7 @@ kleo_assert( d->m_backend ); } -void DecryptVerifyTask::autodetectProtocolFromInput() +void DecryptVerifyTask::autodetectProtocolFromInput() { if ( d->m_input ) setProtocol( findProtocol( d->m_input->classification() ) ); @@ -719,7 +854,7 @@ void DecryptVerifyTask::cancel() { - + } void DecryptVerifyTask::doStart() @@ -750,7 +885,7 @@ } void emitResult( const shared_ptr& result ); - + shared_ptr m_input; shared_ptr m_output; const CryptoBackend::Protocol* m_backend; @@ -810,7 +945,7 @@ kleo_assert( d->m_backend ); } -void DecryptTask::autodetectProtocolFromInput() +void DecryptTask::autodetectProtocolFromInput() { if ( d->m_input ) setProtocol( findProtocol( d->m_input->classification() ) ); @@ -844,7 +979,7 @@ void DecryptTask::cancel() { - + } void DecryptTask::doStart() @@ -876,7 +1011,7 @@ } void emitResult( const shared_ptr& result ); - + shared_ptr m_input; shared_ptr m_output; const CryptoBackend::Protocol* m_backend; @@ -936,7 +1071,7 @@ kleo_assert( d->m_backend ); } -void VerifyOpaqueTask::autodetectProtocolFromInput() +void VerifyOpaqueTask::autodetectProtocolFromInput() { if ( d->m_input ) setProtocol( findProtocol( d->m_input->classification() ) ); @@ -969,7 +1104,7 @@ void VerifyOpaqueTask::cancel() { - + } void VerifyOpaqueTask::doStart() @@ -1001,7 +1136,7 @@ } void emitResult( const shared_ptr& result ); - + shared_ptr m_input, m_signedData; const CryptoBackend::Protocol* m_backend; Protocol m_protocol; @@ -1053,7 +1188,7 @@ kleo_assert( d->m_backend ); } -void VerifyDetachedTask::autodetectProtocolFromInput() +void VerifyDetachedTask::autodetectProtocolFromInput() { if ( d->m_input ) setProtocol( findProtocol( d->m_input->classification() ) ); @@ -1087,7 +1222,7 @@ void VerifyDetachedTask::cancel() { - + } void VerifyDetachedTask::doStart() diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/decryptverifytask.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/decryptverifytask.h --- kdepim-4.0.83/kleopatra/crypto/decryptverifytask.h 2008-05-15 19:37:21.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/decryptverifytask.h 2008-07-08 10:56:20.000000000 +0100 @@ -42,6 +42,11 @@ #include +namespace KMime { +namespace Types { + class Mailbox; +} +} namespace GpgME { class DecryptionResult; class VerificationResult; @@ -64,14 +69,17 @@ explicit AbstractDecryptVerifyTask( QObject* parent = 0 ); virtual ~AbstractDecryptVerifyTask(); virtual void autodetectProtocolFromInput() = 0; - + + KMime::Types::Mailbox informativeSender() const; + void setInformativeSender( const KMime::Types::Mailbox & senders ); + Q_SIGNALS: void decryptVerifyResult( const boost::shared_ptr & ); protected: boost::shared_ptr fromDecryptResult( const GpgME::DecryptionResult & dr, const QByteArray & plaintext, const QString & auditLog ); boost::shared_ptr fromDecryptResult( const GpgME::Error & err, const QString& details, const QString & auditLog ); - boost::shared_ptr fromDecryptVerifyResult( const GpgME::DecryptionResult & dr, const GpgME::VerificationResult & vr, const QByteArray & plaintext, const QString & auditLog ); + boost::shared_ptr fromDecryptVerifyResult( const GpgME::DecryptionResult & dr, const GpgME::VerificationResult & vr, const QByteArray & plaintext, const QString & auditLog ); boost::shared_ptr fromDecryptVerifyResult( const GpgME::Error & err, const QString & what, const QString & auditLog ); boost::shared_ptr fromVerifyOpaqueResult( const GpgME::VerificationResult & vr, const QByteArray & plaintext, const QString & auditLog ); boost::shared_ptr fromVerifyOpaqueResult( const GpgME::Error & err, const QString & details, const QString & auditLog ); @@ -116,7 +124,7 @@ kdtools::pimpl_ptr d; Q_PRIVATE_SLOT( d, void slotResult( GpgME::DecryptionResult, QByteArray ) ) }; - + class VerifyDetachedTask : public AbstractDecryptVerifyTask { Q_OBJECT public: @@ -147,7 +155,7 @@ kdtools::pimpl_ptr d; Q_PRIVATE_SLOT( d, void slotResult( GpgME::VerificationResult ) ) }; - + class VerifyOpaqueTask : public AbstractDecryptVerifyTask { Q_OBJECT public: @@ -214,7 +222,8 @@ class DecryptVerifyResult : public Task::Result { friend class ::Kleo::Crypto::AbstractDecryptVerifyTask; public: - + class SenderInfo; + /* reimp */ QString overview() const; /* reimp */ QString details() const; /* reimp */ bool hasError() const; @@ -243,7 +252,8 @@ const QString & errString, const QString & inputLabel, const QString & outputLabel, - const QString & auditLog ); + const QString & auditLog, + const KMime::Types::Mailbox & informativeSender ); private: class Private; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/gui/decryptverifyresultwidget.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/gui/decryptverifyresultwidget.cpp --- kdepim-4.0.83/kleopatra/crypto/gui/decryptverifyresultwidget.cpp 2008-04-10 10:30:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/gui/decryptverifyresultwidget.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,247 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - crypto/gui/decryptverifyresultwidget.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2007 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "decryptverifyresultwidget.h" - -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include // for Qt::escape - -using namespace Kleo; -using namespace Kleo::Crypto::Gui; -using namespace GpgME; -using namespace boost; - -static -// dup of same function in decryptverifycommand.cpp -const GpgME::Key & keyForSignature( const Signature & sig, const std::vector & keys ) { - if ( const char * const fpr = sig.fingerprint() ) { - const std::vector::const_iterator it - = std::lower_bound( keys.begin(), keys.end(), fpr, _detail::ByFingerprint() ); - if ( it != keys.end() && _detail::ByFingerprint()( *it, fpr ) ) - return *it; - } - static const Key null; - return null; -} - -static QString image( const char * img ) { - // ### escape? - return "iconPath( img, KIconLoader::Small ) + "\"/>"; -} - -static QColor color( const DecryptionResult & dr, const VerificationResult & vr ) { - if ( !dr.isNull() && dr.error() ) - return Qt::red; - if ( !vr.isNull() && vr.error() ) - return Qt::red; - return Qt::gray; -} - -static QColor color( const Signature & sig ) { - if ( sig.summary() & GpgME::Signature::Red ) - return Qt::red; - if ( sig.summary() & GpgME::Signature::Green ) - return Qt::green; - return Qt::yellow; -} - -DecryptVerifyResultWidget::DecryptVerifyResultWidget( QWidget * parent ) - : ResultDisplayWidget( parent ), - m_box( new QVBoxLayout( resultWidget() ) ) -{ - m_box->setMargin( 0 ); -} - -DecryptVerifyResultWidget::~DecryptVerifyResultWidget() {} - -void DecryptVerifyResultWidget::setResult( const DecryptionResult & decryptionResult, const VerificationResult & verificationResult ) { - - while ( QLayoutItem * child = m_box->takeAt(0) ) - delete child; - - const QString decryptionResultString = formatDecryptionResult( decryptionResult, KeyCache::instance()->findRecipients( decryptionResult ) ); - - m_box->addWidget( new QLabel( decryptionResult.error() || decryptionResult.error().isCanceled() - ? "" + decryptionResultString + "" - : "" + decryptionResultString + "
" + formatVerificationResult( verificationResult ) + "
", resultWidget() ) ); - setColor( color( decryptionResult, verificationResult ) ); - - const std::vector sigs = verificationResult.signatures(); - const std::vector signers = KeyCache::instance()->findSigners( verificationResult ); - Q_FOREACH ( const Signature & sig, sigs ) - m_box->addWidget( formatSignatureWidget( new QLabel( resultWidget() ), sig, keyForSignature( sig, signers ) ) ); - m_box->addStretch( 1 ); - - showResultWidget(); -} - -QString DecryptVerifyResultWidget::formatDecryptionResult( const DecryptionResult & res, const std::vector & recipients ) { - - if ( res.isNull() ) - return QString(); - - const Error err = res.error(); - - QString html; - - // Icon: - html += image( err ? "dialog-error" : "dialog-ok" ); - - // Summary: - html += ""; - if ( err.isCanceled() ) - html += i18n("Decryption canceled."); - else if ( err ) - html += i18n( "Decryption failed: %1.", Qt::escape( QString::fromLocal8Bit( err.asString() ) ) ); - else - html += i18n("Decryption succeeded." ); - html += ""; - - if ( err.isCanceled() || err || !res.numRecipients() ) - return html; - - // Details (if any): - html += "
"; - - if ( recipients.empty() ) - return html + "" + i18np( "One unknown recipient.", "%1 unknown recipients.", res.numRecipients() ) + ""; - - html += i18np( "Recipients:", "Recipients:", res.numRecipients() ); - if ( res.numRecipients() == 1 ) - return html + renderKey( recipients.front() ); - - html += "
    "; - Q_FOREACH( const Key & key, recipients ) - html += "
  • " + renderKey( key ) + "
  • "; - if ( recipients.size() < res.numRecipients() ) - html += "
  • " + i18np( "One unknown recipient", "%1 unknown recipients", - res.numRecipients() - recipients.size() ) + "
  • "; - - return html + "
"; -} - -QString DecryptVerifyResultWidget::formatVerificationResult( const VerificationResult & res ) const { - if ( res.isNull() ) - return QString(); - - const Error err = res.error(); - - QString html; - - // Icon: - html += image( err ? "dialog-error" : "dialog-ok" ); - - // Summary: - html += ""; - if ( err.isCanceled() ) - html += i18n("Verification canceled."); - else if ( err ) - html += i18n( "Verification failed: %1.", Qt::escape( QString::fromLocal8Bit( err.asString() ) ) ); - else - html += i18n("Verification succeeded."); - html += ""; - - return html; -} - -QString DecryptVerifyResultWidget::formatSignature( const Signature & sig, const Key & key ) { - if ( sig.isNull() ) - return QString(); - - const bool red = (sig.summary() & Signature::Red); - //const bool green = (sig.summary() & Signature::Green); - const bool valid = (sig.summary() & Signature::Valid); - - if ( red ) - if ( key.isNull() ) - if ( const char * fpr = sig.fingerprint() ) - return i18n("Bad signature by unknown key %1: %2", QString::fromLatin1( fpr ), QString::fromLocal8Bit( sig.status().asString() ) ); - else - return i18n("Bad signature by an unknown key: %1", QString::fromLocal8Bit( sig.status().asString() ) ); - else - return i18n("Bad signature by %1: %2", renderKey( key ), QString::fromLocal8Bit( sig.status().asString() ) ); - - else if ( valid ) - if ( key.isNull() ) - if ( const char * fpr = sig.fingerprint() ) - return i18n("Good signature by unknown key %1.", QString::fromLatin1( fpr ) ); - else - return i18n("Good signature by an unknown key."); - else - return i18n("Good signature by %1.", renderKey( key ) ); - - else - if ( key.isNull() ) - if ( const char * fpr = sig.fingerprint() ) - return i18n("Invalid signature by unknown key %1: %2", QString::fromLatin1( fpr ), QString::fromLocal8Bit( sig.status().asString() ) ); - else - return i18n("Invalid signature by an unknown key: %1", QString::fromLocal8Bit( sig.status().asString() ) ); - else - return i18n("Invalid signature by %1: %2", renderKey( key ), QString::fromLocal8Bit( sig.status().asString() ) ); -} - -static const char * icon( const Signature & sig ) { - if ( sig.summary() & GpgME::Signature::Green ) - return "dialog-ok"; - if ( sig.summary() & GpgME::Signature::Red ) - return "dialog-error"; - return "dialog-warning"; -} - -QLabel * DecryptVerifyResultWidget::formatSignatureWidget( QLabel * label, const Signature & sig, const Key & key ) { - if ( !label ) - return label; - connect( label, SIGNAL(linkActivated(QString)), this, SLOT(keyLinkActivated(QString)) ); - - label->setStyleSheet( styleSheet( color( sig ) ) ); - label->setText( image( ::icon( sig ) ) + "" + formatSignature( sig, key ) + "" ); - - return label; -} - -#include "moc_decryptverifyresultwidget.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/gui/decryptverifyresultwidget.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/gui/decryptverifyresultwidget.h --- kdepim-4.0.83/kleopatra/crypto/gui/decryptverifyresultwidget.h 2008-04-18 08:22:31.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/gui/decryptverifyresultwidget.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,76 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - crypto/gui/decryptverifyresultwidget.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2007 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __KLEOPATRA_CRYPTO_GUI_DECRYPTVERIFYRESULTWIDGET_H__ -#define __KLEOPATRA_CRYPTO_GUI_DECRYPTVERIFYRESULTWIDGET_H__ - -#include - -#include - -namespace GpgME { - class DecryptionResult; - class VerificationResult; - class Signature; - class Key; -} - -class QVBoxLayout; -class QLabel; - -namespace Kleo { -namespace Crypto { -namespace Gui { - - class DecryptVerifyResultWidget : public ResultDisplayWidget { - Q_OBJECT - public: - explicit DecryptVerifyResultWidget( QWidget * parent ); - ~DecryptVerifyResultWidget(); - - void setResult( const GpgME::DecryptionResult & decryptionResult, const GpgME::VerificationResult & verificationResult ); - - private: - QString formatDecryptionResult( const GpgME::DecryptionResult &, const std::vector & ); - QString formatVerificationResult( const GpgME::VerificationResult & ) const; - QString formatSignature( const GpgME::Signature &, const GpgME::Key & ); - QLabel * formatSignatureWidget( QLabel *, const GpgME::Signature &, const GpgME::Key & ); - - private: - QVBoxLayout * m_box; - }; - -} -} -} - -#endif /* __KLEOPATRA_CRYPTO_GUI_DECRYPTVERIFYRESULTWIDGET_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/gui/resolverecipientspage.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/gui/resolverecipientspage.cpp --- kdepim-4.0.83/kleopatra/crypto/gui/resolverecipientspage.cpp 2008-05-15 19:37:21.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/gui/resolverecipientspage.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -68,6 +68,7 @@ #include #include +#include #include #include @@ -123,7 +124,7 @@ wid->setProtocol( m_protocol ); item->setSizeHint( wid->sizeHint() ); m_listWidget->addItem( item ); - m_listWidget->setItemWidget( item, wid ); + m_listWidget->setItemWidget( item, wid ); widgets[id] = wid; items[id] = item; } @@ -170,12 +171,12 @@ return; delete items[id]; items.remove( id ); - delete widgets[id]; + delete widgets[id]; widgets.remove( id ); } void ResolveRecipientsPage::ListWidget::showSelectionDialog( const QString& id ) -{ +{ if ( !widgets.contains( id ) ) return; widgets[id]->showSelectionDialog(); @@ -208,12 +209,12 @@ m_certLabel->setText( i18n( "No certificate selected" ) ); layout->addWidget( m_certLabel ); m_certCombo = new QComboBox; - connect( m_certCombo, SIGNAL( currentIndexChanged( int ) ), + connect( m_certCombo, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) ); layout->addWidget( m_certCombo ); m_selectButton = new QToolButton; m_selectButton->setText( i18n( "..." ) ); - connect( m_selectButton, SIGNAL( clicked() ), + connect( m_selectButton, SIGNAL( clicked() ), this, SLOT( showSelectionDialog() ) ); layout->addWidget( m_selectButton ); layout->addSpacing( 15 ); @@ -223,7 +224,7 @@ void ResolveRecipientsPage::ItemWidget::updateVisibility() { m_certLabel->setVisible( m_certCombo->count() == 0 ); - m_certCombo->setVisible( m_certCombo->count() > 0 ); + m_certCombo->setVisible( m_certCombo->count() > 0 ); } ResolveRecipientsPage::ItemWidget::~ItemWidget() @@ -260,14 +261,20 @@ } } -void ResolveRecipientsPage::ItemWidget::showSelectionDialog() -{ - QPointer dlg = new CertificateSelectionDialog( this ); +static CertificateSelectionDialog * createCertificateSelectionDialog( QWidget* parent, GpgME::Protocol prot ) { + CertificateSelectionDialog * const dlg = new CertificateSelectionDialog( parent ); const CertificateSelectionDialog::Options options = CertificateSelectionDialog::SingleSelection | - CertificateSelectionDialog::EncryptOnly | - protocol2option( m_protocol ) ; + CertificateSelectionDialog::EncryptOnly | + CertificateSelectionDialog::MultiSelection | + protocol2option( prot ); dlg->setOptions( options ); + return dlg; +} + +void ResolveRecipientsPage::ItemWidget::showSelectionDialog() +{ + QPointer dlg = createCertificateSelectionDialog( this, m_protocol ); if ( dlg->exec() == QDialog::Accepted && dlg /* still with us? */ ) { const GpgME::Key cert = dlg->selectedCertificate(); @@ -276,7 +283,6 @@ selectCertificateInComboBox( cert ); } } - delete dlg; } @@ -292,12 +298,12 @@ void ResolveRecipientsPage::ItemWidget::addCertificateToComboBox( const GpgME::Key& key ) { - m_certCombo->addItem( Formatting::formatForComboBox( key ), QByteArray( key.keyID() ) ); + m_certCombo->addItem( Formatting::formatForComboBox( key ), QByteArray( key.keyID() ) ); if ( m_certCombo->count() == 1 ) m_certCombo->setCurrentIndex( 0 ); updateVisibility(); } - + void ResolveRecipientsPage::ItemWidget::resetCertificates() { std::vector certs; @@ -312,9 +318,9 @@ break; case UnknownProtocol: certs = m_cms; - certs.insert( certs.end(), m_pgp.begin(), m_pgp.end() ); + certs.insert( certs.end(), m_pgp.begin(), m_pgp.end() ); } - + m_certCombo->clear(); Q_FOREACH ( const Key& i, certs ) addCertificateToComboBox( i ); @@ -369,7 +375,7 @@ public: explicit Private( ResolveRecipientsPage * qq ); ~Private(); - + void setSelectedProtocol( Protocol protocol ); void selectionChanged(); void removeSelectedEntries(); @@ -379,7 +385,8 @@ void updateProtocolRBVisibility(); void protocolSelected( int prot ); void writeSelectedCertificatesToPreferences(); - + void completeChangedInternal(); + private: ListWidget* m_listWidget; QPushButton* m_addButton; @@ -396,6 +403,7 @@ ResolveRecipientsPage::Private::Private( ResolveRecipientsPage * qq ) : q( qq ), m_presetProtocol( UnknownProtocol ), m_selectedProtocol( m_presetProtocol ), m_multipleProtocolsAllowed( false ), m_recipientPreferences() { + connect( q, SIGNAL(completeChanged()), q, SLOT(completeChangedInternal()) ); q->setTitle( i18n( "Recipients" ) ); QVBoxLayout* const layout = new QVBoxLayout( q ); m_listWidget = new ListWidget; @@ -416,8 +424,8 @@ m_removeButton = new QPushButton; m_removeButton->setEnabled( false ); m_removeButton->setText( i18n( "Remove Selected" ) ); - connect( m_removeButton, SIGNAL( clicked() ), - q, SLOT( removeSelectedEntries() ) ); + connect( m_removeButton, SIGNAL( clicked() ), + q, SLOT( removeSelectedEntries() ) ); buttonLayout->addWidget( m_removeButton ); buttonLayout->addStretch(); layout->addWidget( buttonWidget ); @@ -439,6 +447,17 @@ ResolveRecipientsPage::Private::~Private() {} +void ResolveRecipientsPage::Private::completeChangedInternal() +{ + const bool isComplete = q->isComplete(); + const std::vector keys = q->resolvedCertificates(); + const bool haveSecret = std::find_if( keys.begin(), keys.end(), bind( &Key::hasSecret, _1 ) ) != keys.end(); + if ( isComplete && !haveSecret ) + q->setExplanation( i18n( "Warning: None of the selected certificates seems to be your own certificate. You will not be able to decrypt the encrypted data again." ) ); + else + q->setExplanation( QString() ); +} + void ResolveRecipientsPage::Private::updateProtocolRBVisibility() { const bool visible = !m_multipleProtocolsAllowed && m_presetProtocol == UnknownProtocol; @@ -452,19 +471,19 @@ m_pgpRB->click(); } } - + bool ResolveRecipientsPage::isComplete() const { const QStringList ids = d->m_listWidget->identifiers(); if ( ids.isEmpty() ) return false; - + Q_FOREACH ( const QString& i, ids ) { if ( d->m_listWidget->selectedCertificate( i ).isNull() ) return false; } - + return true; } @@ -533,23 +552,33 @@ void ResolveRecipientsPage::Private::addRecipient( const QString& id, const QString& name ) { - m_listWidget->addEntry( id, name ); + m_listWidget->addEntry( id, name ); } void ResolveRecipientsPage::Private::addRecipient( const Mailbox& mbox ) { - m_listWidget->addEntry( mbox ); + m_listWidget->addEntry( mbox ); } void ResolveRecipientsPage::Private::addRecipient() { + QPointer dlg = createCertificateSelectionDialog( q, q->selectedProtocol() ); + if ( dlg->exec() != QDialog::Accepted || !dlg /*q already deleted*/ ) + return; + const std::vector keys = dlg->selectedCertificates(); + int i = 0; - const QStringList existing = m_listWidget->identifiers(); - QString rec = i18n( "Recipient" ); - while ( existing.contains( rec ) ) - rec = i18nc( "%1 == number", "Recipient (%1)", ++i ); - addRecipient( rec, rec ); - m_listWidget->showSelectionDialog( rec ); + Q_FOREACH( const Key & key, keys ) { + const QStringList existing = m_listWidget->identifiers(); + QString rec = i18n( "Recipient" ); + while ( existing.contains( rec ) ) + rec = i18nc( "%1 == number", "Recipient (%1)", ++i ); + addRecipient( rec, rec ); + const std::vector pgp = key.protocol() == OpenPGP ? std::vector( 1, key ) : std::vector(); + const std::vector cms = key.protocol() == CMS ? std::vector( 1, key ) : std::vector(); + m_listWidget->setCertificates( rec, pgp, cms ); + } + emit q->completeChanged(); } namespace { @@ -585,7 +614,7 @@ uint pgpCount = 0; Q_FOREACH( const Mailbox& i, recipients ) { - //TODO: + //TODO: const QString address = i.prettyAddress(); d->addRecipient( i ); const std::vector pgp = makeSuggestions( d->m_recipientPreferences, i, OpenPGP ); @@ -648,7 +677,7 @@ { if ( !m_recipientPreferences ) return; - + Q_FOREACH ( const QString& i, m_listWidget->identifiers() ) { const Mailbox mbox = m_listWidget->mailbox( i ); @@ -662,7 +691,7 @@ m_recipientPreferences->setPreferredCertificate( mbox, CMS, cms ); } } - + void ResolveRecipientsPage::onNext() { d->writeSelectedCertificatesToPreferences(); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/gui/resolverecipientspage.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/gui/resolverecipientspage.h --- kdepim-4.0.83/kleopatra/crypto/gui/resolverecipientspage.h 2008-04-30 14:59:55.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/gui/resolverecipientspage.h 2008-07-08 10:56:20.000000000 +0100 @@ -48,7 +48,7 @@ } namespace KMime { -namespace Types { +namespace Types { class Mailbox; } } @@ -68,14 +68,14 @@ bool isComplete() const; - /** - * The protocol selected by the user (which is chosen by + /** + * The protocol selected by the user (which is chosen by * the user in case none was preset) */ GpgME::Protocol selectedProtocol() const; /** - * the protocol set before the dialog is shown. Defaults to + * the protocol set before the dialog is shown. Defaults to * GpgME::UnknownProtocol */ GpgME::Protocol presetProtocol() const; void setPresetProtocol( GpgME::Protocol protocol ); @@ -93,7 +93,7 @@ * Defaults to @p false. */ bool recipientsUserMutable() const; - void setRecipientsUserMutable( bool isMutable ); + void setRecipientsUserMutable( bool isMutable ); void setAdditionalRecipientsInfo( const std::vector & recipients ); @@ -116,6 +116,7 @@ Q_PRIVATE_SLOT( d, void protocolSelected( int ) ) Q_PRIVATE_SLOT( d, void addRecipient() ) Q_PRIVATE_SLOT( d, void removeSelectedEntries() ) + Q_PRIVATE_SLOT( d, void completeChangedInternal() ) class ListWidget; class ItemWidget; }; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/gui/resolverecipientspage_p.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/gui/resolverecipientspage_p.h --- kdepim-4.0.83/kleopatra/crypto/gui/resolverecipientspage_p.h 2008-02-13 15:45:38.000000000 +0000 +++ kdepim-4.0.98/kleopatra/crypto/gui/resolverecipientspage_p.h 2008-07-08 10:56:20.000000000 +0100 @@ -80,14 +80,14 @@ private Q_SLOTS: void onSelectionChange(); -private: +private: QListWidget* m_listWidget; - + QHash widgets; QHash items; GpgME::Protocol m_protocol; }; - + class Kleo::Crypto::Gui::ResolveRecipientsPage::ItemWidget : public QWidget { Q_OBJECT public: @@ -117,7 +117,7 @@ void selectCertificateInComboBox( const GpgME::Key& key ); void updateVisibility(); -private: +private: QString m_id; KMime::Types::Mailbox m_mailbox; QLabel* m_nameLabel; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/gui/resultitemwidget.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/gui/resultitemwidget.cpp --- kdepim-4.0.83/kleopatra/crypto/gui/resultitemwidget.cpp 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/gui/resultitemwidget.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -51,7 +51,7 @@ using namespace Kleo::Crypto; using namespace Kleo::Crypto::Gui; using namespace boost; - + namespace { //### TODO move outta here, make colors configurable static QColor colorForVisualCode( Task::Result::VisualCode code ) { @@ -88,13 +88,10 @@ { if ( !m_showDetailsLabel || !m_detailsLabel ) return; - + const bool detailsVisible = m_detailsLabel->isVisible(); - const bool hasAuditLog = !m_result->auditLogAsHtml().isEmpty(); - if ( detailsVisible ) - m_showDetailsLabel->setText( QString("%1
%2").arg( i18n( "Hide Details" ), hasAuditLog ? QString( "%1" ).arg( i18n( "Show Audit Log" ) ) : i18n( "No Audit Log available" ) ) ); - else - m_showDetailsLabel->setText( QString("%1").arg( i18n( "Show Details" ) ) ); + const QString auditLogLink = !m_result->auditLogAsHtml().isEmpty() ? QString( "%1" ).arg( i18n( "Show Audit Log" ) ) : i18n( "No Audit Log available" ); + m_showDetailsLabel->setText( QString( "%1
%2" ).arg( detailsVisible ? i18n( "Hide Details" ) : i18n( "Show Details" ), auditLogLink ) ); } ResultItemWidget::ResultItemWidget( const shared_ptr & result, QWidget * parent, Qt::WindowFlags flags ) : QWidget( parent, flags ), d( new Private( result, this ) ) @@ -124,12 +121,12 @@ layout->addWidget( hbox ); const QString details = d->m_result->details(); - + d->m_showDetailsLabel = new QLabel; connect( d->m_showDetailsLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotLinkActivated(QString)) ); hlay->addWidget( d->m_showDetailsLabel ); d->m_showDetailsLabel->setVisible( !details.isEmpty() ); - + d->m_detailsLabel = new QLabel; d->m_detailsLabel->setWordWrap( true ); d->m_detailsLabel->setTextFormat( Qt::RichText ); @@ -138,7 +135,7 @@ layout->addWidget( d->m_detailsLabel ); d->m_detailsLabel->setVisible( false ); - + d->m_closeButton = new KPushButton; d->m_closeButton->setGuiItem( KStandardGuiItem::close() ); d->m_closeButton->setFixedSize( d->m_closeButton->sizeHint() ); @@ -185,7 +182,7 @@ q->showDetails( !q->detailsVisible() ); return; } - + if ( url.host() == "showauditlog" ) { q->showAuditLog(); return; @@ -194,7 +191,7 @@ } void ResultItemWidget::showAuditLog() { - MessageBox::auditLog( this, d->m_result->auditLogAsHtml() ); + MessageBox::auditLog( parentWidget(), d->m_result->auditLogAsHtml() ); } void ResultItemWidget::showDetails( bool show ) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/gui/resultlistwidget.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/gui/resultlistwidget.cpp --- kdepim-4.0.83/kleopatra/crypto/gui/resultlistwidget.cpp 2008-05-07 10:05:51.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/gui/resultlistwidget.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -114,7 +114,7 @@ if ( !d->m_standaloneMode ) return; EMailOperationsPreferences prefs; - prefs.setDecryptVerifyPopupPosition( pos() ); + prefs.setDecryptVerifyPopupGeometry( geometry() ); prefs.writeConfig(); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/gui/signerresolvepage.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/gui/signerresolvepage.cpp --- kdepim-4.0.83/kleopatra/crypto/gui/signerresolvepage.cpp 2008-02-13 15:45:38.000000000 +0000 +++ kdepim-4.0.98/kleopatra/crypto/gui/signerresolvepage.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -91,8 +91,6 @@ void updateUi(); private: - - Operation operation; QButtonGroup* signEncryptGroup; QRadioButton* signAndEncryptRB; QRadioButton* encryptOnlyRB; @@ -116,8 +114,8 @@ }; SignerResolvePage::Private::Private( SignerResolvePage * qq ) - : q( qq ), operation( SignAndEncrypt ), protocol( GpgME::UnknownProtocol ), - signingMutable( true ), encryptionMutable( true ), + : q( qq ), protocol( GpgME::UnknownProtocol ), + signingMutable( true ), encryptionMutable( true ), signingSelected( false ), encryptionSelected( false ), validator( new ValidatorImpl ) { @@ -175,7 +173,7 @@ signerLayout->addWidget( cmsLabelLabel, 2, 0 ); cmsLabel = new QLabel; signerLayout->addWidget( cmsLabel, 2, 1, 1, 1, Qt::AlignLeft ); - + selectCertificatesButton = new QPushButton; selectCertificatesButton->setText( i18n( "Change Signing Certificates..." ) ); selectCertificatesButton->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed ); @@ -188,7 +186,6 @@ setCertificates( QMap() ); updateModeSelectionWidgets(); - updateUi(); } void SignerResolvePage::setValidator( const boost::shared_ptr& validator ) @@ -242,6 +239,7 @@ signAndEncryptRB->setVisible( buttonsVisible ); signingBox->setVisible( !noSigning ); encryptBox->setVisible( !noEncryption ); + updateUi(); } void SignerResolvePage::Private::selectCertificates() @@ -249,11 +247,11 @@ QPointer dlg = new SigningCertificateSelectionDialog( q ); if ( dlg->exec() == QDialog::Accepted && dlg ) { - const QMap certs = dlg->selectedCertificates(); + const QMap certs = dlg->selectedCertificates(); setCertificates( certs ); if ( signingPreferences && dlg->rememberAsDefault() ) { signingPreferences->setPreferredCertificate( OpenPGP, certs.value( OpenPGP ) ); - signingPreferences->setPreferredCertificate( CMS, certs.value( CMS ) ); + signingPreferences->setPreferredCertificate( CMS, certs.value( CMS ) ); } } @@ -263,16 +261,23 @@ void SignerResolvePage::Private::setOperation( int mode_ ) { - operation = static_cast( mode_ ); - signingBox->setEnabled( operation != EncryptOnly ); - encryptBox->setEnabled( operation != SignOnly ); + const Operation op = static_cast( mode_ ); + signingBox->setEnabled( op != EncryptOnly ); + encryptBox->setEnabled( op != SignOnly ); updateUi(); } SignerResolvePage::Operation SignerResolvePage::operation() const { - return d->operation; + const bool encrypt = encryptionSelected(); + const bool sign = signingSelected(); + assert( encrypt || sign ); + if ( !sign ) + return EncryptOnly; + if ( !encrypt ) + return SignOnly; + return SignAndEncrypt; } @@ -285,7 +290,7 @@ SignerResolvePage::~SignerResolvePage() {} -void SignerResolvePage::setSignersAndCandidates( const std::vector & signers, +void SignerResolvePage::setSignersAndCandidates( const std::vector & signers, const std::vector< std::vector > & keys ) { kleo_assert( signers.empty() || signers.size() == keys.size() ); @@ -294,7 +299,7 @@ { case 0: d->signerLabel->setText( QString() ); // TODO: use default identity? - break; + break; case 1: d->signerLabel->setText( signers.front().prettyAddress() ); break; @@ -386,7 +391,7 @@ d->encryptionMutable = ismutable; d->updateModeSelectionWidgets(); } - + void SignerResolvePage::setSigningUserMutable( bool ismutable ) { d->signingMutable = ismutable; @@ -415,7 +420,7 @@ void SignerResolvePage::setSigningPreferences( const boost::shared_ptr& prefs ) { - d->signingPreferences = prefs; + d->signingPreferences = prefs; QMap map; map[OpenPGP] = prefs ? prefs->preferredCertificate( OpenPGP ) : Key(); map[CMS] = prefs ? prefs->preferredCertificate( CMS ) : Key(); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/signencryptfilescontroller.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/signencryptfilescontroller.cpp --- kdepim-4.0.83/kleopatra/crypto/signencryptfilescontroller.cpp 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/signencryptfilescontroller.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -79,6 +79,7 @@ private: void ensureWizardCreated(); void ensureWizardVisible(); + void updateWizardMode(); void cancelAllTasks(); void reportError( int err, const QString & details ) { emit q->error( err, details ); @@ -171,8 +172,45 @@ void SignEncryptFilesController::setOperationMode( unsigned int mode ) { Private::assertValidOperation( mode ); d->operation = mode; - if ( d->wizard ) - d->wizard->setWindowTitle( d->titleForOperation( d->operation ) ); + d->updateWizardMode(); +} + +void SignEncryptFilesController::Private::updateWizardMode() { + if ( !wizard ) + return; + wizard->setWindowTitle( titleForOperation( operation ) ); + const unsigned int signOp = (operation & SignMask); + const unsigned int encrOp = (operation & EncryptMask); + switch ( signOp ) { + case SignForced: + case SignDisallowed: + wizard->setSigningSelected( signOp == SignForced ); + wizard->setSigningUserMutable( false ); + break; + default: + assert( !"Shouldn't happen" ); + case SignAllowed: + wizard->setSigningSelected( encrOp == EncryptDisallowed ); + wizard->setSigningUserMutable( true ); + break; + } + switch ( encrOp ) { + case EncryptForced: + case EncryptDisallowed: + wizard->setEncryptionSelected( encrOp == EncryptForced ); + wizard->setEncryptionUserMutable( false ); + break; + default: + assert( !"Shouldn't happen" ); + case EncryptAllowed: + wizard->setEncryptionSelected( true ); + wizard->setEncryptionUserMutable( true ); + break; + } +} + +unsigned int SignEncryptFilesController::operationMode() const { + return d->operation; } void SignEncryptFilesController::setFiles( const QStringList & files ) { @@ -404,12 +442,13 @@ return; std::auto_ptr w( new SignEncryptFilesWizard ); - w->setWindowTitle( titleForOperation( operation ) ); w->setAttribute( Qt::WA_DeleteOnClose ); connect( w.get(), SIGNAL(operationPrepared()), q, SLOT(slotWizardOperationPrepared()), Qt::QueuedConnection ); connect( w.get(), SIGNAL(canceled()), q, SLOT(slotWizardCanceled()), Qt::QueuedConnection ); wizard = w.release(); + + updateWizardMode(); } void SignEncryptFilesController::Private::ensureWizardVisible() { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/signencryptfilescontroller.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/signencryptfilescontroller.h --- kdepim-4.0.83/kleopatra/crypto/signencryptfilescontroller.h 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/signencryptfilescontroller.h 2008-07-08 10:56:20.000000000 +0100 @@ -72,6 +72,7 @@ EncryptMask = EncryptAllowed|EncryptForced }; void setOperationMode( unsigned int mode ); + unsigned int operationMode() const; void setFiles( const QStringList & files ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/crypto/signencryptfilestask.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/crypto/signencryptfilestask.cpp --- kdepim-4.0.83/kleopatra/crypto/signencryptfilestask.cpp 2008-05-15 19:37:21.000000000 +0100 +++ kdepim-4.0.98/kleopatra/crypto/signencryptfilestask.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -68,14 +68,14 @@ namespace { QString formatInputOutputLabel( const QString & input, const QString & output, bool inputDeleted, bool outputDeleted ) { - return i18nc( "Input file --> Output file (rarr is arrow", "%1 → %2", + return i18nc( "Input file --> Output file (rarr is arrow", "%1 → %2", inputDeleted ? QString("%1").arg( Qt::escape( input ) ) : Qt::escape( input ), outputDeleted ? QString("%1").arg( Qt::escape( output ) ) : Qt::escape( output ) ); } class ErrorResult : public Task::Result { public: - ErrorResult( bool sign, bool encrypt, const Error & err, const QString & errStr, const QString & input, const QString & output, const QString & auditLog ) + ErrorResult( bool sign, bool encrypt, const Error & err, const QString & errStr, const QString & input, const QString & output, const QString & auditLog ) : Task::Result(), m_sign( sign ), m_encrypt( encrypt ), m_error( err ), m_errString( errStr ), m_inputLabel( input ), m_outputLabel( output ), m_auditLog( auditLog ) {} /* reimp */ QString overview() const; @@ -93,7 +93,7 @@ const QString m_outputLabel; const QString m_auditLog; }; - + class SignEncryptFilesResult : public Task::Result { public: SignEncryptFilesResult( const SigningResult & sr, const QString & input, const QString & output, bool inputRemoved, bool outputCreated, const QString & auditLog ) @@ -129,12 +129,12 @@ static QString makeSigningOverview( const Error & err ) { if ( err.isCanceled() ) return i18n("Signing canceled."); - + if ( err ) return i18n("Signing failed." ); return i18n("Signing succeeded."); } - + static QString makeResultOverview( const SigningResult & result ) { return makeSigningOverview( result.error() ); } @@ -142,14 +142,14 @@ static QString makeEncryptionOverview( const Error & err ) { if ( err.isCanceled() ) return i18n("Encryption canceled."); - + if ( err ) return i18n("Encryption failed." ); return i18n("Encryption succeeded."); } - + static QString makeResultOverview( const EncryptionResult & result ) { return makeEncryptionOverview( result.error() ); } @@ -174,14 +174,14 @@ return Qt::escape( QString::fromLocal8Bit( err.asString() ) ); return QString(); } - + static QString makeResultDetails( const EncryptionResult & result ) { const Error err = result.error(); if ( err ) return Qt::escape( QString::fromLocal8Bit( err.asString() ) ); return i18n(" Encryption succeeded." ); } - + } @@ -192,7 +192,7 @@ const bool canceled = m_error.isCanceled(); if ( m_sign && m_encrypt ) return canceled ? i18n( "%1: Sign/encrypt canceled.", label ) : i18n( " %1: Sign/encrypt failed.", label ); - return i18nc( "label: result. Example: foo -> foo.gpg: Encryption failed.", "%1: %2", label, + return i18nc( "label: result. Example: foo -> foo.gpg: Encryption failed.", "%1: %2", label, m_sign ? makeSigningOverview( m_error ) :makeEncryptionOverview( m_error ) ); } @@ -228,7 +228,7 @@ bool encrypt : 1; bool detached : 1; bool removeInput : 1; - + QPointer job; shared_ptr m_overwritePolicy; }; @@ -431,6 +431,7 @@ kleo_assert( !result.isNull() ); output->finalize(); outputCreated = true; + input->finalize(); if ( removeInput ) { inputRemoved = QFile::remove( inputFileName ); } @@ -439,7 +440,7 @@ return; } } - + q->emitResult( shared_ptr( new SignEncryptFilesResult( result, input->label(), output->label(), inputRemoved, outputCreated, auditLog ) ) ); } @@ -464,7 +465,7 @@ return; } } - + q->emitResult( shared_ptr( new SignEncryptFilesResult( sresult, eresult, input->label(), output->label(), inputRemoved, outputCreated, auditLog ) ) ); } @@ -480,6 +481,7 @@ kleo_assert( !result.isNull() ); output->finalize(); outputCreated = true; + input->finalize(); if ( removeInput ) { inputRemoved = QFile::remove( inputFileName ); } @@ -511,16 +513,16 @@ QString SignEncryptFilesResult::errorString() const { const bool sign = !m_sresult.isNull(); const bool encrypt = !m_eresult.isNull(); - + kleo_assert( sign || encrypt ); if ( sign && encrypt ) { - return - m_sresult.error().code() ? makeResultDetails( m_sresult ) : + return + m_sresult.error().code() ? makeResultDetails( m_sresult ) : m_eresult.error().code() ? makeResultDetails( m_eresult ) : QString(); } - + return sign ? makeResultDetails( m_sresult ) : makeResultDetails( m_eresult ); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/customactions.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/customactions.cpp --- kdepim-4.0.83/kleopatra/customactions.cpp 2008-02-13 15:45:39.000000000 +0000 +++ kdepim-4.0.98/kleopatra/customactions.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,185 +0,0 @@ -/* - customactions.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2001,2002,2004 Klar�vdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "customactions.h" - -#include -#include -#include - -#include -#include - - -LabelAction::LabelAction( const QString & text, KActionCollection * parent, - const QString &name ) - : KAction( text, parent ) -{ - parent->addAction( name, this ); -} - -QWidget* LabelAction::createWidget( QWidget * parent ) -{ - QLabel *label = new QLabel( text(), parent ); - label->setObjectName( "kde toolbar widget" ); - return label; -} - -#ifdef __GNUC__ -#warning How to port the Kiosk stuff below? -#endif -/*int LabelAction::plug( QWidget * widget, int index ) { - if ( !KAuthorized::authorizeKAction( name() ) ) - return -1; - if ( widget->inherits( "KToolBar" ) ) { - KToolBar * bar = (KToolBar *)widget; - int id_ = getToolButtonID(); - QLabel* label = new QLabel( text(), bar ); - label->setObjectName( "kde toolbar widget" ); - bar->insertWidget( id_, label->width(), label, index ); - addContainer( bar, id_ ); - connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); - return containerCount() - 1; - } - - return KAction::plug( widget, index ); -}*/ - -LineEditAction::LineEditAction( const QString & text, KActionCollection * parent, - QObject * receiver, const char * member, const QString & name ) - : KAction( text, parent ), - _le(0), _receiver(receiver), _member(member) -{ - parent->addAction( name, this ); -} - -QWidget* LineEditAction::createWidget( QWidget * parent ) -{ - _le = new KLineEdit( parent ); - _le->setClearButtonShown(true); - connect( _le, SIGNAL( returnPressed() ), _receiver, _member ); - return _le; -} - -void LineEditAction::deleteWidget(QWidget* widget) -{ - if ( widget == _le ) - _le = 0; - delete widget; -} - -#ifdef __GNUC__ -#warning How to port the Kiosk stuff below? -#endif -/*int LineEditAction::plug( QWidget * widget, int index ) { - if ( !KAuthorized::authorizeKAction( name() ) ) - return -1; - if ( widget->inherits( "KToolBar" ) ) { - KToolBar *bar = (KToolBar *)widget; - int id_ = getToolButtonID(); - // The toolbar trick doesn't seem to work for lineedits - //_le = new QLineEdit( bar, "kde toolbar widget" ); - _le = new QLineEdit( bar ); - bar->insertWidget( id_, _le->width(), _le, index ); - bar->setStretchableWidget( _le ); - addContainer( bar, id_ ); - connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); - connect( _le, SIGNAL( returnPressed() ), _receiver, _member ); - return containerCount() - 1; - } - - return KAction::plug( widget, index ); -}*/ - -void LineEditAction::clear() { - if ( _le ) - _le->clear(); -} - -void LineEditAction::focusAll() { - if ( _le ) { - _le->selectAll(); - _le->setFocus(); - } -} - -QString LineEditAction::text() const { - if ( _le ) - return _le->text(); - return QString(); -} - -void LineEditAction::setText( const QString & txt ) { - if ( _le ) - _le->setText(txt); -} - - -ComboAction::ComboAction( const QStringList & lst, KActionCollection * parent, - QObject * receiver, const char * member, const QString & name, - int selectedID ) - : KAction( QString(), parent ), - _lst(lst), _receiver(receiver), _member(member), _selectedId( selectedID ) -{ - parent->addAction( name, this ); -} - -QWidget* ComboAction::createWidget( QWidget * parent ) -{ - KComboBox* box = new KComboBox( parent ); - box->addItems( _lst ); - connect( box, SIGNAL( highlighted(int) ), _receiver, _member ); - return box; -} - -#ifdef __GNUC__ -#warning How to port the Kiosk stuff below? -#endif -/*int ComboAction::plug( QWidget * widget, int index ) { - if ( !KAuthorized::authorizeKAction( name() ) ) - return -1; - if ( widget->inherits( "KToolBar" ) ) { - KToolBar *bar = (KToolBar *)widget; - int id_ = getToolButtonID(); - bar->insertCombo( _lst, id_, false, SIGNAL( highlighted(int) ), _receiver, _member ); - bar->setCurrentComboItem( id_,_selectedId ); - addContainer( bar, id_ ); - connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) ); - return containerCount() - 1; - } - - return KAction::plug( widget, index ); -}*/ - -#include "customactions.moc" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/customactions.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/customactions.h --- kdepim-4.0.83/kleopatra/customactions.h 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/customactions.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,88 +0,0 @@ -/* - customactions.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2001,2002,2004 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __CUSTOMACTIONS_H__ -#define __CUSTOMACTIONS_H__ - -#include -#include - -#include - -class KLineEdit; - -class LabelAction : public KAction { - Q_OBJECT -public: - LabelAction( const QString & text, KActionCollection * parent, - const QString & name ); - - QWidget* createWidget( QWidget* parent ); -}; - -class LineEditAction : public KAction { - Q_OBJECT -public: - LineEditAction( const QString & text, KActionCollection * parent, - QObject * receiver, const char * member, const QString & name ); - - void clear(); - void focusAll(); - QString text() const; - void setText( const QString & txt ); - QWidget* createWidget( QWidget* parent ); - void deleteWidget( QWidget* widget ); -private: - KLineEdit* _le; - QObject * _receiver; - const char * _member; -}; - -class ComboAction : public KAction { - Q_OBJECT -public: - ComboAction( const QStringList & lst, KActionCollection * parent, - QObject * receiver, const char * member, const QString & name, - int selectedID ); - - QWidget* createWidget( QWidget* parent ); - -private: - QStringList _lst; - QObject * _receiver; - const char * _member; - int _selectedId; -}; - - - -#endif // __CUSTOMACTIONS_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/adduseriddialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/adduseriddialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/adduseriddialog.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/adduseriddialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,148 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/adduseriddialog.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "adduseriddialog.h" + +#include "ui_adduseriddialog.h" + +#include + +#include +#include +#include + +#include + +using namespace Kleo; +using namespace Kleo::Dialogs; + +class AddUserIDDialog::Private { + friend class ::Kleo::Dialogs::AddUserIDDialog; + AddUserIDDialog * const q; +public: + explicit Private( AddUserIDDialog * qq ) + : q( qq ), + ui( q ) + { + + } + +private: + void slotUserIDChanged(); + +private: + struct UI : public Ui_AddUserIDDialog { + explicit UI( AddUserIDDialog * qq ) + : Ui_AddUserIDDialog() + { + setupUi( qq ); + + nameLE->setValidator( Validation::pgpName( nameLE ) ); + emailLE->setValidator( Validation::email( emailLE ) ); + commentLE->setValidator( Validation::pgpComment( commentLE ) ); + } + + QPushButton * okPB() const { + return buttonBox->button( QDialogButtonBox::Ok ); + } + } ui; +}; + +AddUserIDDialog::AddUserIDDialog( QWidget * p, Qt::WindowFlags f ) + : QDialog( p, f ), d( new Private( this ) ) +{ + +} + +AddUserIDDialog::~AddUserIDDialog() {} + + +void AddUserIDDialog::setName( const QString & name ) { + d->ui.nameLE->setText( name ); +} + +QString AddUserIDDialog::name() const { + return d->ui.nameLE->text().trimmed(); +} + +void AddUserIDDialog::setEmail( const QString & email ) { + d->ui.emailLE->setText( email ); +} + +QString AddUserIDDialog::email() const { + return d->ui.emailLE->text().trimmed(); +} + +void AddUserIDDialog::setComment( const QString & comment ) { + d->ui.commentLE->setText( comment ); +} + +QString AddUserIDDialog::comment() const { + return d->ui.commentLE->text().trimmed(); +} + + +void AddUserIDDialog::Private::slotUserIDChanged() { + + bool ok = false; + QString error; + + if ( !ui.nameLE->hasAcceptableInput() ) + error = i18nc("@info", "Real name must be at least 5 characters long."); + else if ( !ui.emailLE->hasAcceptableInput() ) + error = i18nc("@info", "EMail address is invalid."); + else if ( !ui.commentLE->hasAcceptableInput() ) + error = i18nc("@info", "Comment contains invalid characters."); + else + ok = true; + + ui.okPB()->setEnabled( ok ); + ui.errorLB->setText( error ); + + const QString name = q->name(); + const QString email = q->email(); + const QString comment = q->comment(); + + QStringList parts; + if ( !name.isEmpty() ) + parts.push_back( name ); + if ( !comment.isEmpty() ) + parts.push_back( QLatin1Char( '(' ) + comment + QLatin1Char( ')' ) ); + if ( !email.isEmpty() ) + parts.push_back( QLatin1Char( '<' ) + email + QLatin1Char( '>' ) ); + + ui.resultLB->setText( parts.join( QLatin1String( " " ) ) ); +} + +#include "moc_adduseriddialog.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/adduseriddialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/adduseriddialog.h --- kdepim-4.0.83/kleopatra/dialogs/adduseriddialog.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/adduseriddialog.h 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,72 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/addUserIDdialog.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_DIALOGS_ADDUSERIDDIALOG_H__ +#define __KLEOPATRA_DIALOGS_ADDUSERIDDIALOG_H__ + +#include + +#include + +class QString; + +namespace Kleo { +namespace Dialogs { + + class AddUserIDDialog : public QDialog { + Q_OBJECT + Q_PROPERTY( QString name READ name WRITE setName ) + Q_PROPERTY( QString email READ email WRITE setEmail ) + Q_PROPERTY( QString comment READ comment WRITE setComment ) + public: + explicit AddUserIDDialog( QWidget * parent=0, Qt::WindowFlags f=0 ); + ~AddUserIDDialog(); + + void setName( const QString & name ); + QString name() const; + + void setEmail( const QString & email ); + QString email() const; + + void setComment( const QString & comment ); + QString comment() const; + + private: + class Private; + kdtools::pimpl_ptr d; + Q_PRIVATE_SLOT( d, void slotUserIDChanged() ) + }; + +} +} + +#endif /* __KLEOPATRA_DIALOGS_ADDUSERIDDIALOG_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/adduseriddialog.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/adduseriddialog.ui --- kdepim-4.0.83/kleopatra/dialogs/adduseriddialog.ui 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/adduseriddialog.ui 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,237 @@ + + AddUserIDDialog + + + + 0 + 0 + 563 + 242 + + + + Add New User-ID + + + + + + &Real name: + + + nameLE + + + + + + + + + + &EMail address: + + + emailLE + + + + + + + + + + Co&mment (optional): + + + commentLE + + + + + + + + + + Qt::Horizontal + + + + + + + This is how it will look like: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 300 + 0 + + + + Qt::PlainText + + + + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 114 + 114 + 114 + + + + + + + + Foo + + + + + + + + + buttonBox + accepted() + AddUserIDDialog + accept() + + + 236 + 203 + + + 157 + 212 + + + + + buttonBox + rejected() + AddUserIDDialog + reject() + + + 325 + 203 + + + 286 + 212 + + + + + nameLE + textChanged(QString) + AddUserIDDialog + slotUserIDChanged() + + + 414 + 16 + + + 448 + 18 + + + + + emailLE + textChanged(QString) + AddUserIDDialog + slotUserIDChanged() + + + 412 + 54 + + + 450 + 58 + + + + + commentLE + textChanged(QString) + AddUserIDDialog + slotUserIDChanged() + + + 402 + 96 + + + 446 + 96 + + + + + + slotUserIDChanged() + + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certificatedetailsdialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certificatedetailsdialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/certificatedetailsdialog.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certificatedetailsdialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,443 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/certificatedetailsdialog.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "certificatedetailsdialog.h" + +#include "ui_certificatedetailsdialog.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include + +using namespace Kleo; +using namespace Kleo::Dialogs; +using namespace Kleo::Commands; +using namespace GpgME; +using namespace boost; + +static bool own( const std::vector & sigs ) { + const shared_ptr kc = KeyCache::instance(); + Q_FOREACH( const UserID::Signature & sig, sigs ) { + const Key signer = kc->findByKeyIDOrFingerprint( sig.signerKeyID() ); + if ( signer.isNull() || !signer.hasSecret() ) + return false; + } + return !sigs.empty(); +} + +class CertificateDetailsDialog::Private { + friend class ::Kleo::Dialogs::CertificateDetailsDialog; + CertificateDetailsDialog * const q; +public: + explicit Private( CertificateDetailsDialog * qq ) + : q( qq ), + key(), + certificationsModel(), + subkeysModel(), + ui( q ) + { + ui.certificationsTV->setModel( &certificationsModel ); + connect( ui.certificationsTV->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), + q, SLOT(slotCertificationSelectionChanged()) ); + + ui.subkeyTV->setModel( &subkeysModel ); + // no selection (yet) + + connect( KeyCache::instance().get(), SIGNAL(keysMayHaveChanged()), + q, SLOT(slotKeysMayHaveChanged()) ); + } + +private: + void startCommandImplementation( const QPointer & ptr, const char * slot ) { + connect( ptr, SIGNAL(finished()), q, slot ); + ptr->start(); + enableDisableWidgets(); + } + template + void startCommand( QPointer & ptr, const A & arg, const char * slot ) { + if ( ptr ) + return; + ptr = new T( arg ); + startCommandImplementation( ptr, slot ); + } + template + void startCommand( QPointer & ptr, const char * slot ) { + startCommand( ptr, this->key, slot ); + } + void commandFinished( QPointer & ptr ) { + ptr = 0; + enableDisableWidgets(); + } + + void slotChangePassphraseClicked() { + startCommand( changePassphraseCommand, SLOT(slotChangePassphraseCommandFinished()) ); + } + void slotChangePassphraseCommandFinished() { + commandFinished( changePassphraseCommand ); + } + + void slotChangeTrustLevelClicked() { + startCommand( changeOwnerTrustCommand, SLOT(slotChangeOwnerTrustCommandFinished()) ); + } + void slotChangeOwnerTrustCommandFinished() { + commandFinished( changeOwnerTrustCommand ); + } + + void slotChangeExpiryDateClicked() { + startCommand( changeExpiryDateCommand, SLOT(slotChangeExpiryDateCommandFinished()) ); + } + void slotChangeExpiryDateCommandFinished() { + commandFinished( changeExpiryDateCommand ); + } + + void slotAddUserIDClicked() { + startCommand( addUserIDCommand, SLOT(slotAddUserIDCommandFinished()) ); + } + void slotAddUserIDCommandFinished() { + commandFinished( addUserIDCommand ); + } + + void slotCertifyUserIDClicked() { + const std::vector uids = selectedUserIDs(); + if ( uids.empty() ) + return; + startCommand( signCertificateCommand, uids, SLOT(slotSignCertificateCommandFinished()) ); + } + void slotSignCertificateCommandFinished() { + commandFinished( signCertificateCommand ); + } + + void slotRevokeCertificateClicked() { + + } + + void slotRevokeUserIDClicked() { + + } + + void slotRevokeCertificationClicked() { + + } + + void slotShowCertificationsClicked() { + startSignatureListing(); + enableDisableWidgets(); + } + + void startSignatureListing() { + if ( keyListJob ) + return; + const CryptoBackend::Protocol * const protocol = CryptoBackendFactory::instance()->protocol( key.protocol() ); + if ( !protocol ) + return; + KeyListJob * const job = protocol->keyListJob( /*remote*/false, /*includeSigs*/true, /*validate*/true ); + if ( !job ) + return; + connect( job, SIGNAL(result(GpgME::KeyListResult)), + q, SLOT(slotSignatureListingDone(GpgME::KeyListResult)) ); + connect( job, SIGNAL(nextKey(GpgME::Key)), + q, SLOT(slotSignatureListingNextKey(GpgME::Key)) ); + if ( const Error err = job->start( QStringList( QString::fromLatin1( key.primaryFingerprint() ) ) ) ) + showSignatureListingErrorDialog( err ); + else + keyListJob = job; + } + void slotSignatureListingNextKey( const Key & key ) { + // don't lose the secret flags ... + Key merged = key; + merged.mergeWith( this->key ); + q->setKey( merged ); + + // fixup the tree view + ui.certificationsTV->expandAll(); + ui.certificationsTV->header()->resizeSections( QHeaderView::ResizeToContents ); + } + void slotSignatureListingDone( const KeyListResult & result ) { + if ( result.error().isCanceled() ) + ; + else if ( result.error() ) + showSignatureListingErrorDialog( result.error() ); + else + ; + keyListJob = 0; + enableDisableWidgets(); + } + void showSignatureListingErrorDialog( const Error & err ) { + KMessageBox::information( q, i18nc("@info", + "An error occurred while loading the certifications: " + "%1", + QString::fromLocal8Bit( err.asString() ) ), + i18nc("@title","Certifications Loading Failed") ); + } + + void slotCertificationSelectionChanged() { + enableDisableWidgets(); + } + + void slotKeysMayHaveChanged() { + if ( const char * const fpr = key.primaryFingerprint() ) + if ( !(key.keyListMode() & Extern) ) + q->setKey( KeyCache::instance()->findByFingerprint( fpr ) ); + } + + void slotDumpCertificate() { + + if ( dumpCertificateCommand ) + return; + + if ( key.protocol() != CMS ) { + ui.dumpLTW->clear(); + return; + } + + ui.dumpLTW->setLines( QStringList( i18n("Please wait while generating the dump...") ) ); + + dumpCertificateCommand = new DumpCertificateCommand( key ); + dumpCertificateCommand->setUseDialog( false ); + QPointer cmd = dumpCertificateCommand.data(); + startCommandImplementation( cmd, SLOT(slotDumpCertificateCommandFinished()) ); + } + + void slotDumpCertificateCommandFinished() { + ui.dumpLTW->setLines( dumpCertificateCommand->output() ); + } + +private: + void updateWidgetVisibility() { + const bool x509 = key.protocol() == CMS; + const bool pgp = key.protocol() == OpenPGP; + const bool secret = key.hasSecret(); + const bool sigs = (key.keyListMode() & Signatures); + const bool ultimateTrust = key.ownerTrust() == Key::Ultimate; + const bool external = (key.keyListMode() & Extern); + + // Overview Tab + ui.overviewActionsGB->setVisible( !external ); + ui.changePassphrasePB->setVisible( secret ); + ui.changeTrustLevelPB->setVisible( pgp && ( !secret || !ultimateTrust ) ); + ui.changeExpiryDatePB->setVisible( pgp && secret ); + + // Certifications Tab + ui.userIDsActionsGB->setVisible( !external && pgp ); + ui.certificationsActionGB->setVisible( !external && pgp ); + ui.addUserIDPB->setVisible( secret ); + ui.expandAllCertificationsPB->setVisible( pgp && sigs ); + ui.collapseAllCertificationsPB->setVisible( pgp && sigs ); + ui.showCertificationsPB->setVisible( pgp && !sigs ); + + // Technical Details Tab + ui.tabWidget->setTabEnabled( ui.tabWidget->indexOf( ui.detailsTab ), pgp ); + + // Chain tab + ui.tabWidget->setTabEnabled( ui.tabWidget->indexOf( ui.chainTab ), x509 ); + + // Dump tab + ui.tabWidget->setTabEnabled( ui.tabWidget->indexOf( ui.dumpTab ), x509 ); + + // not implemented: + ui.revokeCertificatePB->hide(); + ui.revokeUserIDPB->hide(); + ui.certificationsActionGB->hide(); + } + + QModelIndexList selectedCertificationsIndexes() const { + return ui.certificationsTV->selectionModel()->selectedRows(); + } + + std::vector selectedUserIDs() const { + const QModelIndexList mil = selectedCertificationsIndexes(); + std::vector uids = certificationsModel.userIDs( mil, true ); + uids.erase( std::remove_if( uids.begin(), uids.end(), mem_fn( &UserID::isNull ) ), uids.end() ); + return uids; + } + + std::vector selectedSignatures() const { + const QModelIndexList mil = selectedCertificationsIndexes(); + std::vector sigs = certificationsModel.signatures( mil ); + sigs.erase( std::remove_if( sigs.begin(), sigs.end(), mem_fn( &UserID::Signature::isNull ) ), sigs.end() ); + return sigs; + } + + void enableDisableWidgets() { + // Overview Tab + ui.changePassphrasePB->setEnabled( !changePassphraseCommand ); + ui.changeTrustLevelPB->setEnabled( !changeOwnerTrustCommand ); + ui.changeExpiryDatePB->setEnabled( !changeExpiryDateCommand ); + + // Certifications Tab + ui.addUserIDPB->setEnabled( !addUserIDCommand ); + ui.showCertificationsPB->setEnabled( !keyListJob ); + ui.showCertificationsPB->setText( keyListJob + ? i18n("(please wait while certifications are being loaded)") + : i18n("Load Certifications (may take a while)") ); + + const std::vector uids = selectedUserIDs(); + const std::vector sigs = selectedSignatures(); + + ui.certifyUserIDPB->setEnabled( !uids.empty() && sigs.empty() && !signCertificateCommand ); + ui.revokeUserIDPB->setEnabled( !uids.empty() && sigs.empty() ); + ui.revokeCertificationPB->setEnabled( uids.empty() && !sigs.empty() && own( sigs ) ); + } + + void updateLabel() { + ui.overviewLB->setText( Formatting::formatOverview( key ) ); + } + + void updateChainTab() { + ui.chainTW->clear(); + + if ( key.protocol() != CMS ) + return; + + QTreeWidgetItem * last = 0; + const std::vector chain = KeyCache::instance()->findIssuers( key, KeyCache::RecursiveSearch|KeyCache::IncludeSubject ); + if ( chain.empty() ) + return; + if ( !chain.back().isRoot() ) { + last = new QTreeWidgetItem( ui.chainTW ); + last->setText( 0, i18n("Issuer Certificate Not Found (%1)", + DN( chain.back().issuerName() ).prettyDN() ) ); + //last->setSelectable( false ); + const QBrush & fg = ui.chainTW->palette().brush( QPalette::Disabled, QPalette::WindowText ); + last->setForeground( 0, fg ); + } + for ( std::vector::const_reverse_iterator it = chain.rbegin(), end = chain.rend() ; it != end ; ++it ) { + last = last ? new QTreeWidgetItem( last ) : new QTreeWidgetItem( ui.chainTW ) ; + last->setText( 0, DN( it->userID(0).id() ).prettyDN() ); + //last->setSelectable( true ); + } + ui.chainTW->expandAll(); + } + + void propagateKey() { + certificationsModel.setKey( key ); + const QModelIndexList uidIndexes = certificationsModel.indexes( key.userIDs() ); + Q_FOREACH( const QModelIndex & idx, uidIndexes ) + ui.certificationsTV->setFirstColumnSpanned( idx.row(), idx.parent(), true ); + + subkeysModel.setKey( key ); + ui.subkeyTV->header()->resizeSections( QHeaderView::ResizeToContents ); + + updateChainTab(); + slotDumpCertificate(); + } + + +private: + Key key; + UserIDListModel certificationsModel; + SubkeyListModel subkeysModel; + + QPointer changePassphraseCommand; + QPointer changeOwnerTrustCommand; + QPointer changeExpiryDateCommand; + + QPointer addUserIDCommand; + QPointer signCertificateCommand; + + QPointer dumpCertificateCommand; + + QPointer keyListJob; + + struct UI : public Ui_CertificateDetailsDialog { + explicit UI( Dialogs::CertificateDetailsDialog * qq ) + : Ui_CertificateDetailsDialog() + { + setupUi( qq ); + + chainTW->header()->setResizeMode( 0, QHeaderView::Stretch ); + + dumpLTW->setFont( KGlobalSettings::fixedFont() ); + dumpLTW->setMinimumVisibleLines( 15 ); + dumpLTW->setMinimumVisibleColumns( 40 ); + + subkeyHLine->setTitle( i18nc("@title","Subkeys") ); + } + } ui; +}; + +CertificateDetailsDialog::CertificateDetailsDialog( QWidget * p, Qt::WindowFlags f ) + : QDialog( p, f ), d( new Private( this ) ) +{ + +} + +CertificateDetailsDialog::~CertificateDetailsDialog() {} + + +void CertificateDetailsDialog::setKey( const Key & key ) { + d->key = key; + d->updateWidgetVisibility(); + d->updateLabel(); + d->propagateKey(); + d->enableDisableWidgets(); +} + +Key CertificateDetailsDialog::key() const { + return d->key; +} + + +#include "moc_certificatedetailsdialog.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certificatedetailsdialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certificatedetailsdialog.h --- kdepim-4.0.83/kleopatra/dialogs/certificatedetailsdialog.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certificatedetailsdialog.h 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,86 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/certificatedetailsdialog.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_DIALOGS_CERTIFICATEDETAILS_H__ +#define __KLEOPATRA_DIALOGS_CERTIFICATEDETAILS_H__ + +#include + +#include + +class QDate; + +namespace GpgME { + class Key; +} + +namespace Kleo { +namespace Dialogs { + + class CertificateDetailsDialog : public QDialog { + Q_OBJECT + public: + explicit CertificateDetailsDialog( QWidget * parent=0, Qt::WindowFlags f=0 ); + ~CertificateDetailsDialog(); + + void setKey( const GpgME::Key & key ); + GpgME::Key key() const; + + private: + class Private; + kdtools::pimpl_ptr d; + Q_PRIVATE_SLOT( d, void slotChangePassphraseClicked() ) + Q_PRIVATE_SLOT( d, void slotChangePassphraseCommandFinished() ) + Q_PRIVATE_SLOT( d, void slotChangeTrustLevelClicked() ) + Q_PRIVATE_SLOT( d, void slotChangeOwnerTrustCommandFinished() ) + Q_PRIVATE_SLOT( d, void slotChangeExpiryDateClicked() ) + Q_PRIVATE_SLOT( d, void slotChangeExpiryDateCommandFinished() ) + Q_PRIVATE_SLOT( d, void slotRevokeCertificateClicked() ) + Q_PRIVATE_SLOT( d, void slotAddUserIDClicked() ) + Q_PRIVATE_SLOT( d, void slotAddUserIDCommandFinished() ) + Q_PRIVATE_SLOT( d, void slotRevokeUserIDClicked() ) + Q_PRIVATE_SLOT( d, void slotCertifyUserIDClicked() ) + Q_PRIVATE_SLOT( d, void slotSignCertificateCommandFinished() ) + Q_PRIVATE_SLOT( d, void slotRevokeCertificationClicked() ) + Q_PRIVATE_SLOT( d, void slotShowCertificationsClicked() ) + Q_PRIVATE_SLOT( d, void slotSignatureListingNextKey(GpgME::Key) ) + Q_PRIVATE_SLOT( d, void slotSignatureListingDone(GpgME::KeyListResult) ) + Q_PRIVATE_SLOT( d, void slotCertificationSelectionChanged() ) + Q_PRIVATE_SLOT( d, void slotKeysMayHaveChanged() ) + Q_PRIVATE_SLOT( d, void slotDumpCertificate() ) + Q_PRIVATE_SLOT( d, void slotDumpCertificateCommandFinished() ) + }; + +} +} + +#endif /* __KLEOPATRA_DIALOGS_CERTIFICATEDETAILS_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certificatedetailsdialog.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certificatedetailsdialog.ui --- kdepim-4.0.83/kleopatra/dialogs/certificatedetailsdialog.ui 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certificatedetailsdialog.ui 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,614 @@ + + CertificateDetailsDialog + + + + 0 + 0 + 666 + 514 + + + + Certificate Details + + + + + + + + 0 + 0 + 644 + 417 + + + + Overview + + + + + + Actions + + + + + + Change Passphrase... + + + false + + + + + + + Trust Certifications made by this Certificate... + + + false + + + + + + + Change Expiry Date... + + + false + + + + + + + Revoke this Certificate... + + + false + + + + + + + Qt::Vertical + + + + 0 + 1 + + + + + + + + + + + + 0 + 1 + + + + QFrame::NoFrame + + + false + + + + + + + + 1 + 0 + + + + Photo + + + + + + <p>At the moment, Kleopatra does not support photos in certificates. It has no support for adding, nor for displaying them. This is for the following reasons:</p> +<ul> +<li>Photos give a false sense of security.</li> +<li>Photos increase the size of certificates.</li> +</ul> + + + false + + + true + + + + + + + + + + + + 0 + 0 + 644 + 417 + + + + User-IDs and Certifications + + + + + + + + QAbstractItemView::ExtendedSelection + + + true + + + + + + + + + User-IDs + + + + + + Add... + + + false + + + + + + + Revoke... + + + false + + + + + + + Certify... + + + false + + + + + + + + + + Certifications + + + + + + Revoke... + + + false + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Expand All + + + false + + + + + + + Collapse All + + + false + + + + + + + + + + + + + + false + + + + + + + + + 0 + 0 + 644 + 417 + + + + Technical Details + + + + + + + + + + + + + + + + + + + QAbstractItemView::NoSelection + + + false + + + true + + + + + + + + + 0 + 0 + 644 + 417 + + + + Chain + + + + + + true + + + true + + + + 1 + + + + + + + + + + 0 + 0 + 644 + 417 + + + + Dump + + + + + + This is a dump of all information the backend has about this certificate: + + + + + + + + 0 + 0 + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close|QDialogButtonBox::Help + + + + + + + + KDLogTextWidget + QWidget +
utils/kdlogtextwidget.h
+ 1 +
+ + KDHorizontalLine + QFrame +
ui/kdhorizontalline.h
+ 1 +
+
+ + + + buttonBox + rejected() + CertificateDetailsDialog + reject() + + + 295 + 573 + + + 286 + 274 + + + + + changePassphrasePB + clicked() + CertificateDetailsDialog + slotChangePassphraseClicked() + + + 748 + 390 + + + 782 + 350 + + + + + changeTrustLevelPB + clicked() + CertificateDetailsDialog + slotChangeTrustLevelClicked() + + + 742 + 400 + + + 784 + 402 + + + + + changeExpiryDatePB + clicked() + CertificateDetailsDialog + slotChangeExpiryDateClicked() + + + 742 + 448 + + + 780 + 450 + + + + + revokeCertificatePB + clicked() + CertificateDetailsDialog + slotRevokeCertificateClicked() + + + 728 + 496 + + + 778 + 498 + + + + + addUserIDPB + clicked() + CertificateDetailsDialog + slotAddUserIDClicked() + + + 738 + 100 + + + 780 + 100 + + + + + revokeUserIDPB + clicked() + CertificateDetailsDialog + slotRevokeUserIDClicked() + + + 738 + 150 + + + 778 + 152 + + + + + certifyUserIDPB + clicked() + CertificateDetailsDialog + slotCertifyUserIDClicked() + + + 736 + 190 + + + 780 + 190 + + + + + revokeCertificationPB + clicked() + CertificateDetailsDialog + slotRevokeCertificationClicked() + + + 732 + 272 + + + 780 + 272 + + + + + showCertificationsPB + clicked() + CertificateDetailsDialog + slotShowCertificationsClicked() + + + 748 + 510 + + + 776 + 490 + + + + + expandAllCertificationsPB + clicked() + certificationsTV + expandAll() + + + 665 + 424 + + + 525 + 320 + + + + + collapseAllCertificationsPB + clicked() + certificationsTV + collapseAll() + + + 701 + 464 + + + 585 + 352 + + + + + + slotChangePassphraseClicked() + slotChangeTrustLevelClicked() + slotChangeExpiryDateClicked() + slotRevokeCertificateClicked() + slotAddUserIDClicked() + slotCertifyUserIDClicked() + slotRevokeUserIDClicked() + slotRevokeCertificationClicked() + slotShowCertificationsClicked() + +
diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certificateselectiondialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certificateselectiondialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/certificateselectiondialog.cpp 2008-04-30 14:59:55.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certificateselectiondialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -41,6 +41,8 @@ #include #include +#include +#include #include @@ -63,6 +65,7 @@ using namespace Kleo; using namespace Kleo::Dialogs; +using namespace Kleo::Commands; using namespace boost; using namespace GpgME; @@ -74,8 +77,19 @@ private: - void reload(); - void slotReloaded(); + void reload() { + ( new ReloadKeysCommand( 0 ) )->start(); + } + void create() { + NewCertificateCommand * cmd = new NewCertificateCommand( 0 ); + if ( ( options & AnyFormat ) != AnyFormat ) + cmd->setProtocol( (options & OpenPGPFormat) ? OpenPGP : CMS ); + cmd->start(); + } + void lookup() { + ( new LookupCertificatesCommand( 0 ) )->start(); + } + void slotKeysMayHaveChanged(); void slotCurrentViewChanged( QAbstractItemView * newView ); void slotSelectionChanged(); void slotDoubleClicked( const QModelIndex & idx ); @@ -125,11 +139,21 @@ QPushButton * const ok = buttonBox.addButton( QDialogButtonBox::Ok ); ok->setEnabled( false ); QPushButton * const cancel = buttonBox.addButton( QDialogButtonBox::Close ); - QPushButton * const reload = buttonBox.addButton( i18n("&Reload Certificates"), QDialogButtonBox::ActionRole ); + QPushButton * const reload = buttonBox.addButton( i18n("Reload"), QDialogButtonBox::ActionRole ); + QPushButton * const lookup = buttonBox.addButton( i18n("Lookup..."), QDialogButtonBox::ActionRole ); + QPushButton * const create = buttonBox.addButton( i18n("New..."), QDialogButtonBox::ActionRole ); + + lookup->setToolTip( i18nc("@info:tooltip","Lookup certificates on server") ); + reload->setToolTip( i18nc("@info:tooltip","Refresh certificate list") ); + create->setToolTip( i18nc("@info:tooltip","Create a new certificate") ); connect( &buttonBox, SIGNAL(accepted()), q, SLOT(accept()) ); connect( &buttonBox, SIGNAL(rejected()), q, SLOT(reject()) ); connect( reload, SIGNAL(clicked()), q, SLOT(reload()) ); + connect( lookup, SIGNAL(clicked()), q, SLOT(lookup()) ); + connect( create, SIGNAL(clicked()), q, SLOT(create()) ); + connect( KeyCache::instance().get(), SIGNAL(keysMayHaveChanged()), + q, SLOT(slotKeysMayHaveChanged()) ); } } ui; }; @@ -157,7 +181,7 @@ d->ui.tabWidget.loadViews( config.data() ); const KConfigGroup geometry( config, "Geometry" ); resize( geometry.readEntry( "size", size() ) ); - d->slotReloaded(); + d->slotKeysMayHaveChanged(); } CertificateSelectionDialog::~CertificateSelectionDialog() {} @@ -180,7 +204,7 @@ d->ui.tabWidget.setMultiSelection( options & MultiSelection ); - d->slotReloaded(); + d->slotKeysMayHaveChanged(); } CertificateSelectionDialog::Options CertificateSelectionDialog::options() const { @@ -237,21 +261,15 @@ QDialog::hideEvent( e ); } -void CertificateSelectionDialog::Private::reload() { - Command * const cmd = new ReloadKeysCommand( 0 ); - connect( cmd, SIGNAL(finsihed()), q, SLOT(slotReloaded()) ); - cmd->start(); -} - -void CertificateSelectionDialog::Private::slotReloaded() { +void CertificateSelectionDialog::Private::slotKeysMayHaveChanged() { q->setEnabled( true ); std::vector keys = (options & SecretKeys) ? KeyCache::instance()->secretKeys() : KeyCache::instance()->keys() ; filterAllowedKeys( keys ); const std::vector selected = q->selectedCertificates(); if ( AbstractKeyListModel * const model = ui.tabWidget.flatModel() ) - model->addKeys( keys ); + model->setKeys( keys ); if ( AbstractKeyListModel * const model = ui.tabWidget.hierarchicalModel() ) - model->addKeys( keys ); + model->setKeys( keys ); q->selectCertificates( selected ); } @@ -319,7 +337,7 @@ assert( model ); QItemSelectionModel * const sm = view->selectionModel(); assert( sm ); - sm->select( idx, QItemSelectionModel::ClearAndSelect ); + sm->select( idx, QItemSelectionModel::ClearAndSelect|QItemSelectionModel::Rows ); QMetaObject::invokeMethod( q, "accept", Qt::QueuedConnection ); } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certificateselectiondialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certificateselectiondialog.h --- kdepim-4.0.83/kleopatra/dialogs/certificateselectiondialog.h 2008-04-30 14:59:55.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certificateselectiondialog.h 2008-07-08 10:56:20.000000000 +0100 @@ -104,7 +104,9 @@ class Private; kdtools::pimpl_ptr d; Q_PRIVATE_SLOT( d, void reload() ) - Q_PRIVATE_SLOT( d, void slotReloaded() ) + Q_PRIVATE_SLOT( d, void create() ) + Q_PRIVATE_SLOT( d, void lookup() ) + Q_PRIVATE_SLOT( d, void slotKeysMayHaveChanged() ) Q_PRIVATE_SLOT( d, void slotSelectionChanged() ) Q_PRIVATE_SLOT( d, void slotDoubleClicked( QModelIndex ) ) Q_PRIVATE_SLOT( d, void slotCurrentViewChanged( QAbstractItemView * ) ) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certificationoptionswidget.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certificationoptionswidget.ui --- kdepim-4.0.83/kleopatra/dialogs/certificationoptionswidget.ui 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certificationoptionswidget.ui 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,159 @@ + + Kleo::Dialogs::CertifyCertificateDialogPrivate::CertificationOptionsWidget + + + + 0 + 0 + 879 + 523 + + + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Step 3: </span>Choose how to certify</p></body></html> + + + + + + + 1 + + + + + + + Choose which of your keys to sign with: + + + + + + + + + + + + + + Certification will be performed using certificate %1. + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + + + + + + Certify only for myself + + + true + + + + + + + Certify for everyone to see + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + Send certified certificate to server afterwards + + + true + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + exportableSignatureRB + toggled(bool) + sendToServerCB + setEnabled(bool) + + + 439 + 338 + + + 455 + 368 + + + + + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certifycertificatedialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certifycertificatedialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/certifycertificatedialog.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certifycertificatedialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,386 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/signcertificatedialog.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "certifycertificatedialog.h" +#include "certifycertificatedialog_p.h" + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include // Qt::escape + +#include + +using namespace boost; +using namespace GpgME; +using namespace Kleo; +using namespace Kleo::Dialogs; +using namespace Kleo::Dialogs::CertifyCertificateDialogPrivate; + + +void UserIDModel::setCertificateToCertify( const Key & key ) { + m_key = key; + clear(); + const std::vector ids = key.userIDs(); + for ( unsigned int i = 0; i < ids.size(); ++i ) { + QStandardItem * const item = new QStandardItem; + item->setText( Formatting::prettyUserID( key.userID( i ) ) ); + item->setData( i, UserIDIndex ); + item->setCheckable( true ); + item->setEditable( false ); + appendRow( item ); + } +} + +std::vector UserIDModel::checkedUserIDs() const { + std::vector ids; + for ( int i = 0; i < rowCount(); ++i ) + if ( item( i )->checkState() == Qt::Checked ) + ids.push_back( item( i )->data( UserIDIndex ).toUInt() ); + return ids; +} + +void SecretKeysModel::setSecretKeys( const std::vector & keys ) { + clear(); + m_secretKeys = keys; + for ( unsigned int i = 0; i < m_secretKeys.size(); ++i ) { + const Key key = m_secretKeys[i]; + QStandardItem * const item = new QStandardItem; + item->setText( Formatting::prettyNameAndEMail( key ) ); + item->setData( i, IndexRole ); + item->setEditable( false ); + appendRow( item ); + } +} + +Key SecretKeysModel::keyFromItem( const QStandardItem * item ) const { + assert( item ); + const unsigned int idx = item->data( IndexRole ).toUInt(); + assert( idx < m_secretKeys.size() ); + return m_secretKeys[idx]; +} + +Key SecretKeysModel::keyFromIndex( const QModelIndex & idx ) const { + return keyFromItem( itemFromIndex( idx ) ); +} + +SelectUserIDsPage::SelectUserIDsPage( QWidget * parent ) : QWizardPage( parent ), m_userIDModel() { + QVBoxLayout * const layout = new QVBoxLayout ( this ); + QLabel * const label = new QLabel; + label->setText( i18n( "Step 1: Please select the user IDs you wish to certify." ) ); + layout->addWidget( label ); + m_listView = new QListView; + m_listView->setModel( &m_userIDModel ); + connect( &m_userIDModel, SIGNAL(itemChanged(QStandardItem*)), this, SIGNAL(completeChanged()) ); + layout->addWidget( m_listView ); +} + +bool SelectUserIDsPage::isComplete() const { + return !selectedUserIDs().empty(); +} + +std::vector SelectUserIDsPage::selectedUserIDs() const { + return m_userIDModel.checkedUserIDs(); +} + +void SelectUserIDsPage::setCertificateToCertify( const Key & key ) { + m_userIDModel.setCertificateToCertify( key ); + +} + +SelectCheckLevelPage::SelectCheckLevelPage( QWidget * parent ) : QWizardPage( parent ), m_ui() { + m_ui.setupUi( this ); +} + +unsigned int SelectCheckLevelPage::checkLevel() const { + if ( m_ui.checkLevelNotCheckedRB->isChecked() ) + return 1; + if ( m_ui.checkLevelCasualRB->isChecked() ) + return 2; + if ( m_ui.checkLevelThoroughlyRB->isChecked() ) + return 3; + assert( !"No check level radiobutton checked" ); + return 0; +} + +OptionsPage::OptionsPage( QWidget * parent ) : QWizardPage( parent ), m_ui() { + m_ui.setupUi( this ); + m_ui.keyListView->setModel( &m_model ); + connect( m_ui.keyListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SIGNAL(completeChanged()) ); + setCommitPage( true ); + setButtonText( QWizard::CommitButton, i18n( "Certify" ) ); +} + + +bool OptionsPage::exportableCertificationSelected() const { + return m_ui.exportableSignatureRB->isChecked(); +} + +void OptionsPage::setCertificatesWithSecretKeys( const std::vector & keys ) { + assert( !keys.empty() ); + m_model.setSecretKeys( keys ); + if ( keys.size() == 1 ) { + m_ui.stackedWidget->setCurrentWidget( m_ui.singleKeyPage ); + m_ui.singleKeyLabel->setText( i18n( "Certification will be performed using certificate %1.", Formatting::prettyNameAndEMail( keys[0] ) ) ); + } else { + m_ui.stackedWidget->setCurrentWidget( m_ui.multipleKeysPage ); + } + emit completeChanged(); +} + +Key OptionsPage::selectedSecretKey() const { + const QModelIndexList idxs = m_ui.keyListView->selectionModel()->selectedIndexes(); + assert( idxs.size() <= 1 ); + return idxs.isEmpty() ? Key() : m_model.keyFromIndex( idxs[0] ); +} + +bool OptionsPage::sendToServer() const { + return m_ui.sendToServerCB->isChecked(); +} + +bool OptionsPage::validatePage() { + emit nextClicked(); + return true; +} + +bool OptionsPage::isComplete() const { + return !selectedSecretKey().isNull(); +} + +SummaryPage::SummaryPage( QWidget * parent ) : QWizardPage( parent ), m_complete( false ) { + QGridLayout * const layout = new QGridLayout( this ); + QLabel * const uidLabelLabel = new QLabel( i18n( "Signed user IDs:" ) ); + uidLabelLabel->setAlignment( Qt::AlignTop ); + int row = 0; + layout->addWidget( new QLabel( i18n( "Summary:" ) ), row, 0, 1, 2 ); + layout->addWidget( uidLabelLabel, ++row, 0 ); + layout->addWidget( m_userIDsLabel = new QLabel, row, 1 ); +#ifdef KLEO_SIGN_KEY_CERTLEVEL_SUPPORT + layout->addWidget( new QLabel( i18n( "Check level:" ) ), ++row, 0 ); + layout->addWidget( m_checkLevelLabel = new QLabel, row, 1 ); +#endif + layout->addWidget( new QLabel( i18n( "Selected secret certificate:" ) ), ++row, 0 ); + layout->addWidget( m_secretKeyLabel = new QLabel, row, 1 ); + m_secretKeyLabel->setTextFormat( Qt::PlainText ); + layout->addWidget( m_resultLabel = new QLabel, ++row, 0, 1, 2, Qt::AlignCenter ); + layout->setRowStretch( row, 1 ); + m_resultLabel->setAlignment( Qt::AlignCenter ); +} + +bool SummaryPage::isComplete() const { + return m_complete; +} + +void SummaryPage::setSummary( const SummaryPage::Summary & sum ) { + const Key key = sum.certificateToCertify; + QStringList ids; + Q_FOREACH ( const unsigned int i, sum.selectedUserIDs ) + ids += Qt::escape( Formatting::prettyUserID( key.userID( i ) ) ); + m_userIDsLabel->setText( "" + ids.join( "
" ) + "
" ); + m_secretKeyLabel->setText( sum.secretKey.isNull() ? i18n( "Default certificate" ) : Formatting::prettyNameAndEMail( sum.secretKey ) ); +#ifdef KLEO_SIGN_KEY_CERTLEVEL_SUPPORT + switch( sum.checkLevel ) { + case 0: + m_checkLevelLabel->setText( i18n( "No statement made" ) ); + break; + case 1: + m_checkLevelLabel->setText( i18n( "Not checked" ) ); + break; + case 2: + m_checkLevelLabel->setText( i18n( "Casually checked" ) ); + break; + case 3: + m_checkLevelLabel->setText( i18n( "Thoroughly checked" ) ); + break; + } +#endif +} + +void SummaryPage::setComplete( bool complete ) { + if ( complete == m_complete ) + return; + m_complete = complete; + emit completeChanged(); +} +void SummaryPage::setResult( const Error & err ) { + if ( err && !err.isCanceled() ) + m_resultLabel->setText( i18n( "The certificate could not be certified. Error: %1", Qt::escape( QString::fromLocal8Bit( err.asString() ) ) ) ); + else if ( err.isCanceled() ) + m_resultLabel->setText( "Certification canceled." ); + else + m_resultLabel->setText("Certification successful." ); +} + +class CertifyCertificateDialog::Private { + friend class ::Kleo::Dialogs::CertifyCertificateDialog; + CertifyCertificateDialog * const q; + +public: + explicit Private( CertifyCertificateDialog * qq ) + : q( qq ), + summaryPageId( 0 ), + selectUserIDsPage( 0 ), + selectCheckLevelPage( 0 ), + optionsPage( 0 ), + summaryPage( 0 ) + { + selectUserIDsPage = new SelectUserIDsPage( q ); + q->addPage( selectUserIDsPage ); + //selectCheckLevelPage = new SelectCheckLevelPage( q ); + //setting the cert level explicitely is not supported by the backend, + //thus we omit the page from the UI + //q->addPage( selectCheckLevelPage ); + optionsPage = new OptionsPage( q ); + q->addPage( optionsPage ); + summaryPage = new SummaryPage( q ); + summaryPageId = q->addPage( summaryPage ); + connect( optionsPage, SIGNAL(nextClicked()), q, SIGNAL(certificationPrepared()) ); + } + + void ensureSummaryPageVisible(); + + void certificationResult( const Error & error ); + + void setOperationCompleted() { + summaryPage->setComplete( true ); + } + + SummaryPage::Summary createSummary() const { + SummaryPage::Summary sum; + sum.selectedUserIDs = selectUserIDsPage->selectedUserIDs(); + sum.secretKey = optionsPage->selectedSecretKey(); + sum.certificateToCertify = selectUserIDsPage->certificateToCertify(); + //PENDING +#ifdef KLEO_SIGN_KEY_CERTLEVEL_SUPPORT + sum.checkLevel = selectCheckLevelPage->checkLevel(); +#endif + + sum.exportable = optionsPage->exportableCertificationSelected(); + sum.sendToServer = optionsPage->sendToServer(); + return sum; + } + + int summaryPageId; + SelectUserIDsPage * selectUserIDsPage; + SelectCheckLevelPage * selectCheckLevelPage; + OptionsPage * optionsPage; + SummaryPage * summaryPage; +}; + + + +CertifyCertificateDialog::CertifyCertificateDialog( QWidget * p, Qt::WindowFlags f ) + : QWizard( p, f ), d( new Private( this ) ) +{ +} + +CertifyCertificateDialog::~CertifyCertificateDialog() {} + +void CertifyCertificateDialog::setCertificateToCertify( const Key & key ) { + setWindowTitle( i18nc( "arg is name, email of certificate holder", "Certify Certificate: %1", Formatting::prettyName( key ) ) ); + d->selectUserIDsPage->setCertificateToCertify( key ); +} + +void CertifyCertificateDialog::setCertificatesWithSecretKeys( const std::vector & keys ) { + d->optionsPage->setCertificatesWithSecretKeys( keys ); +} + +bool CertifyCertificateDialog::exportableCertificationSelected() const { + return d->optionsPage->exportableCertificationSelected(); +} + +bool CertifyCertificateDialog::trustCertificationSelected() const { + return false; +} + +bool CertifyCertificateDialog::nonRevocableCertificationSelected() const { + return false; +} + +Key CertifyCertificateDialog::selectedSecretKey() const { + return d->optionsPage->selectedSecretKey(); +} + +bool CertifyCertificateDialog::sendToServer() const { + return d->optionsPage->sendToServer(); +} + +unsigned int CertifyCertificateDialog::selectedCheckLevel() const { + //PENDING +#ifdef KLEO_SIGN_KEY_CERTLEVEL_SUPPORT + return d->selectCheckLevelPage->checkLevel(); +#endif + return 0; +} + +void CertifyCertificateDialog::connectJob( SignKeyJob * job ) { + connect( job, SIGNAL(result(GpgME::Error)), this, SLOT(certificationResult(GpgME::Error)) ); + d->summaryPage->setSummary( d->createSummary() ); +} + +void CertifyCertificateDialog::setError( const Error & error ) { + d->setOperationCompleted(); + d->summaryPage->setResult( error ); + d->ensureSummaryPageVisible(); + if ( error.isCanceled() ) + close(); +} + +void CertifyCertificateDialog::Private::certificationResult( const Error & err ) { + setOperationCompleted(); + summaryPage->setResult( err ); + ensureSummaryPageVisible(); +} + +std::vector CertifyCertificateDialog::selectedUserIDs() const { + return d->selectUserIDsPage->selectedUserIDs(); +} + +void CertifyCertificateDialog::Private::ensureSummaryPageVisible() { + while ( q->currentId() != summaryPageId ) + q->next(); +} + +#include "moc_certifycertificatedialog.cpp" +#include "moc_certifycertificatedialog_p.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certifycertificatedialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certifycertificatedialog.h --- kdepim-4.0.83/kleopatra/dialogs/certifycertificatedialog.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certifycertificatedialog.h 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,93 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/signcertificatedialog.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_DIALOGS_SIGNCERTIFICATEDIALOG_H__ +#define __KLEOPATRA_DIALOGS_SIGNCERTIFICATEDIALOG_H__ + +#include + +#include + +#include + +#include + +#include + +namespace GpgME { + class Error; +} + +namespace Kleo { + class SignKeyJob; + +namespace Dialogs { + + class CertifyCertificateDialog : public QWizard { + Q_OBJECT + public: + explicit CertifyCertificateDialog( QWidget * parent=0, Qt::WindowFlags f=0 ); + ~CertifyCertificateDialog(); + + bool exportableCertificationSelected() const; + + bool trustCertificationSelected() const; + + bool nonRevocableCertificationSelected() const; + + std::vector selectedUserIDs() const; + + void setCertificatesWithSecretKeys( const std::vector & keys ); + GpgME::Key selectedSecretKey() const; + + bool sendToServer() const; + + unsigned int selectedCheckLevel() const; + + void setCertificateToCertify( const GpgME::Key & key ); + + void connectJob( Kleo::SignKeyJob * job ); + void setError( const GpgME::Error & error ); + + Q_SIGNALS: + void certificationPrepared(); + + private: + class Private; + kdtools::pimpl_ptr d; + Q_PRIVATE_SLOT( d, void certificationResult(GpgME::Error) ) + }; + +} +} + +#endif /* __KLEOPATRA_DIALOGS_SIGNCERTIFICATEDIALOG_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/certifycertificatedialog_p.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/certifycertificatedialog_p.h --- kdepim-4.0.83/kleopatra/dialogs/certifycertificatedialog_p.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/certifycertificatedialog_p.h 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,157 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/signcertificatedialog_p.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_DIALOGS_SIGNCERTIFICATEDIALOG_P_H__ +#define __KLEOPATRA_DIALOGS_SIGNCERTIFICATEDIALOG_P_H__ + +#include "ui_selectchecklevelwidget.h" +#include "ui_certificationoptionswidget.h" + +#include + +#include + +#include +#include + +class QListView; + +namespace Kleo { + namespace Dialogs { + namespace CertifyCertificateDialogPrivate { + class UserIDModel : public QStandardItemModel { + Q_OBJECT + public: + enum Role { + UserIDIndex=Qt::UserRole + }; + explicit UserIDModel( QObject * parent=0 ) : QStandardItemModel( parent ) {} + GpgME::Key certificateToCertify() const { return m_key; } + void setCertificateToCertify( const GpgME::Key & key ); + std::vector checkedUserIDs() const; + + private: + GpgME::Key m_key; + }; + + class SecretKeysModel : public QStandardItemModel { + Q_OBJECT + public: + enum Role { + IndexRole=Qt::UserRole + }; + explicit SecretKeysModel( QObject * parent=0 ) : QStandardItemModel( parent ) {} + void setSecretKeys( const std::vector & keys ); + GpgME::Key keyFromItem( const QStandardItem * item ) const; + GpgME::Key keyFromIndex( const QModelIndex & index ) const; + + private: + std::vector m_secretKeys; + }; + + class SelectUserIDsPage : public QWizardPage { + Q_OBJECT + public: + explicit SelectUserIDsPage( QWidget * parent=0 ); + /* reimp */ bool isComplete() const; + + std::vector selectedUserIDs() const; + void setCertificateToCertify( const GpgME::Key & ids ); + GpgME::Key certificateToCertify() const { return m_userIDModel.certificateToCertify(); } + + private: + QListView * m_listView; + UserIDModel m_userIDModel; + }; + + class SelectCheckLevelPage : public QWizardPage { + Q_OBJECT + public: + explicit SelectCheckLevelPage( QWidget * parent=0 ); + unsigned int checkLevel() const; + private: + Ui::SelectCheckLevelWidget m_ui; + }; + + class OptionsPage : public QWizardPage { + Q_OBJECT + public: + explicit OptionsPage( QWidget * parent=0 ); + + bool exportableCertificationSelected() const; + void setCertificatesWithSecretKeys( const std::vector & keys ); + GpgME::Key selectedSecretKey() const; + bool sendToServer() const; + + /* reimp */ bool validatePage(); + /* reimp */ bool isComplete() const; + + Q_SIGNALS: + void nextClicked(); + + private: + Ui::CertificationOptionsWidget m_ui; + SecretKeysModel m_model; + }; + + class SummaryPage : public QWizardPage { + Q_OBJECT + public: + explicit SummaryPage( QWidget * parent=0 ); + /* reimp */ bool isComplete() const; + void setComplete( bool complete ); + + void setResult( const GpgME::Error & err ); + + struct Summary { + std::vector selectedUserIDs; + unsigned int checkLevel; + GpgME::Key certificateToCertify; + GpgME::Key secretKey; + bool exportable; + bool sendToServer; + }; + + void setSummary( const Summary & summary ); + + private: + bool m_complete; + QLabel * m_userIDsLabel; + QLabel * m_secretKeyLabel; + QLabel * m_checkLevelLabel; + QLabel * m_resultLabel; + }; + } + } +} + +#endif diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/exportcertificatesdialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/exportcertificatesdialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/exportcertificatesdialog.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/exportcertificatesdialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,125 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/exportcertificatesdialog.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2007 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "exportcertificatesdialog.h" + +#include "libkleo/ui/filenamerequester.h" + +#include +#include +#include + +#include +#include + +using namespace Kleo; +using namespace Kleo::Dialogs; + +class ExportCertificatesDialog::Private { + friend class ::Kleo::Dialogs::ExportCertificatesDialog; + ExportCertificatesDialog * const q; +public: + explicit Private( ExportCertificatesDialog * qq ); + ~Private(); + void fileNamesChanged(); + +private: + FileNameRequester* pgpRequester; + FileNameRequester* cmsRequester; +}; + + +ExportCertificatesDialog::Private::Private( ExportCertificatesDialog * qq ) + : q( qq ) +{ + q->setButtons( KDialog::Ok | KDialog::Cancel ); + q->setButtonGuiItem( KDialog::Ok, KGuiItem( i18n( "Export" ) ) ); + QWidget* const main = new QWidget; + QGridLayout* const grid = new QGridLayout( main ); + QLabel* const pgpLabel = new QLabel; + pgpLabel->setText( i18n(" OpenPGP export file:" ) ); + grid->addWidget( pgpLabel, 0, 0 ); + pgpRequester = new FileNameRequester; + connect( pgpRequester, SIGNAL( fileNameChanged( QString ) ), q, SLOT( fileNamesChanged() ) ); + grid->addWidget( pgpRequester, 0, 1 ); + QLabel* const cmsLabel = new QLabel; + cmsLabel->setText( i18n( "S/MIME export file:" ) ); + grid->addWidget( cmsLabel, 1, 0 ); + cmsRequester = new FileNameRequester; + connect( cmsRequester, SIGNAL( fileNameChanged( QString ) ), q, SLOT( fileNamesChanged() ) ); + grid->addWidget( cmsRequester, 1, 1 ); + q->setMainWidget( main ); + fileNamesChanged(); +} + +ExportCertificatesDialog::Private::~Private() {} + + + +ExportCertificatesDialog::ExportCertificatesDialog( QWidget * parent, Qt::WFlags f ) + : KDialog( parent, f ), d( new Private( this ) ) +{ + +} + +void ExportCertificatesDialog::Private::fileNamesChanged() +{ + q->button( KDialog::Ok )->setEnabled( !pgpRequester->fileName().isEmpty() && !cmsRequester->fileName().isEmpty() ); +} + +ExportCertificatesDialog::~ExportCertificatesDialog() {} + + +void ExportCertificatesDialog::setOpenPgpExportFileName( const QString & fileName ) +{ + d->pgpRequester->setFileName( fileName ); +} + +QString ExportCertificatesDialog::openPgpExportFileName() const +{ + return d->pgpRequester->fileName(); +} + +void ExportCertificatesDialog::setCmsExportFileName( const QString & fileName ) +{ + d->cmsRequester->setFileName( fileName ); +} + +QString ExportCertificatesDialog::cmsExportFileName() const +{ + return d->cmsRequester->fileName(); +} + +#include "moc_exportcertificatesdialog.cpp" + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/exportcertificatesdialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/exportcertificatesdialog.h --- kdepim-4.0.83/kleopatra/dialogs/exportcertificatesdialog.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/exportcertificatesdialog.h 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,65 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/exportcertificatesdialog.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2007 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_DIALOGS_EXPORTCERTIFICATESDIALOG_H__ +#define __KLEOPATRA_DIALOGS_EXPORTCERTIFICATESDIALOG_H__ + +#include + +#include + +class QString; + +namespace Kleo { +namespace Dialogs { + + class ExportCertificatesDialog : public KDialog { + Q_OBJECT + public: + explicit ExportCertificatesDialog( QWidget * parent=0, Qt::WFlags f=0 ); + ~ExportCertificatesDialog(); + + void setOpenPgpExportFileName( const QString & fileName ); + QString openPgpExportFileName() const; + + void setCmsExportFileName( const QString & fileName ); + QString cmsExportFileName() const; + + private: + class Private; + kdtools::pimpl_ptr d; + Q_PRIVATE_SLOT( d, void fileNamesChanged() ) + }; +} +} + +#endif // __KLEOPATRA_DIALOGS_EXPORTCERTIFICATESDIALOG_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/exportsecretkeydialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/exportsecretkeydialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/exportsecretkeydialog.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/exportsecretkeydialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,192 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/exportsecretkeydialog.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "exportsecretkeydialog.h" + +#include "ui_exportsecretkeydialog.h" + +#include + +#include + +#include +#include +#include + +#include + +using namespace Kleo; +using namespace Kleo::Dialogs; +using namespace GpgME; + +// This comes from gnupg's sources, agent/minip12.c +// In fact, any charset supported by iconv would work, but we don't link to iconv directly... +static const char *charsets[] = { + "utf8", + "iso-8859-1", + "iso-8859-15", + "iso-8859-2", + "iso-8859-3", + "iso-8859-4", + "iso-8859-5", + "iso-8859-6", + "iso-8859-7", + "iso-8859-8", + "iso-8859-9", + "koi8-r", + "ibm437", + "ibm850", + "euc-jp", + "big5", +}; +static const unsigned int numCharsets = sizeof charsets / sizeof *charsets; + +class ExportSecretKeyDialog::Private { + friend class ::Kleo::Dialogs::ExportSecretKeyDialog; + ExportSecretKeyDialog * const q; +public: + explicit Private( ExportSecretKeyDialog * qq ) + : q( qq ), + ui( q ) + { + + } + +private: + void updateWidgets() { + const bool x509 = key.protocol() == CMS; + ui.charsetCB->setVisible( x509 ); + ui.charsetLB->setVisible( x509 ); + } + + void updateLabel() { + ui.descriptionLB->setText( i18nc("@info", + "Please select export options for %1:", + Formatting::formatForComboBox( key ) ) ); + } +private: + Key key; + + struct UI : public Ui_ExportSecretKeyDialog { + explicit UI( Dialogs::ExportSecretKeyDialog * qq ) + : Ui_ExportSecretKeyDialog() + { + setupUi( qq ); + + outputFileFR->setExistingOnly( false ); + outputFileFR->setFilter( QDir::Files ); + + for ( unsigned int i = 0 ; i < numCharsets ; ++i ) + charsetCB->addItem( QString::fromLatin1( charsets[i] ) ); + charsetCB->setCurrentIndex( -1 ); + + } + } ui; +}; + +ExportSecretKeyDialog::ExportSecretKeyDialog( QWidget * p, Qt::WindowFlags f ) + : QDialog( p, f ), d( new Private( this ) ) +{ + +} + +ExportSecretKeyDialog::~ExportSecretKeyDialog() {} + + +void ExportSecretKeyDialog::setKey( const Key & key ) { + if ( qstricmp( key.primaryFingerprint(), d->key.primaryFingerprint() ) == 0 ) + return; + d->key = key; + d->updateWidgets(); + d->updateLabel(); +} + +Key ExportSecretKeyDialog::key() const { + return d->key; +} + +void ExportSecretKeyDialog::setFileName( const QString & fileName ) { + d->ui.outputFileFR->setFileName( fileName ); +} + +QString ExportSecretKeyDialog::fileName() const { + return d->ui.outputFileFR->fileName(); +} + +void ExportSecretKeyDialog::setCharset( const QByteArray & charset ) { + for ( unsigned int i = 0 ; i < sizeof charsets / sizeof *charsets ; ++i ) + if ( charset == charsets[i] ) { + d->ui.charsetCB->setCurrentIndex( i ); + return; + } +} + +QByteArray ExportSecretKeyDialog::charset() const { + if ( d->ui.charsetCB->isVisible() ) + return d->ui.charsetCB->currentText().toLatin1(); + else + return QByteArray(); +} + +void ExportSecretKeyDialog::setUseArmor( bool on ) { + d->ui.armorCB->setChecked( on ); +} + +bool ExportSecretKeyDialog::useArmor() const { + return d->ui.armorCB->isChecked(); +} + +void ExportSecretKeyDialog::accept() { + const QString fn = fileName(); + if ( fn.isEmpty() ) { + KMessageBox::information( this, i18nc("@info", + "You have to enter an output filename." ), + i18nc("@title", "Incomplete data") ); + d->ui.outputFileFR->setFocus(); + return; + } + + const QByteArray cs = charset(); + if ( d->key.protocol() == CMS && cs.isEmpty() ) { + KMessageBox::information( this, i18nc("@info", + "You have to choose a passphrase character set." ), + i18nc("@title", "Incomplete data") ); + d->ui.charsetCB->setFocus(); + return; + } + + QDialog::accept(); +} + +#include "moc_exportsecretkeydialog.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/exportsecretkeydialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/exportsecretkeydialog.h --- kdepim-4.0.83/kleopatra/dialogs/exportsecretkeydialog.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/exportsecretkeydialog.h 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,78 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + dialogs/exportsecretkeydialog.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRA_DIALOGS_EXPORTSECRETKEY_H__ +#define __KLEOPATRA_DIALOGS_EXPORTSECRETKEY_H__ + +#include + +#include + +class QDate; + +namespace GpgME { + class Key; +} + +namespace Kleo { +namespace Dialogs { + + class ExportSecretKeyDialog : public QDialog { + Q_OBJECT + public: + explicit ExportSecretKeyDialog( QWidget * parent=0, Qt::WindowFlags f=0 ); + ~ExportSecretKeyDialog(); + + void setKey( const GpgME::Key & key ); + GpgME::Key key() const; + + void setFileName( const QString & fileName ); + QString fileName() const; + + void setCharset( const QByteArray & charset ); + QByteArray charset() const; + + void setUseArmor( bool armor ); + bool useArmor() const; + + protected Q_SLOTS: + /* reimp */ void accept(); + + private: + class Private; + kdtools::pimpl_ptr d; + }; + +} +} + +#endif /* __KLEOPATRA_DIALOGS_EXPORTSECRETKEY_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/exportsecretkeydialog.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/exportsecretkeydialog.ui --- kdepim-4.0.83/kleopatra/dialogs/exportsecretkeydialog.ui 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/exportsecretkeydialog.ui 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,131 @@ + + ExportSecretKeyDialog + + + + 0 + 0 + 372 + 194 + + + + Export Secret Key + + + + + + true + + + + + + + Output file: + + + outputFileFR + + + + + + + Passphrase charset: + + + charsetCB + + + + + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + ASCII armor + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + + + + Kleo::FileNameRequester + QWidget +
ui/filenamerequester.h
+ 1 +
+
+ + + + buttonBox + accepted() + ExportSecretKeyDialog + accept() + + + 227 + 165 + + + 157 + 193 + + + + + buttonBox + rejected() + ExportSecretKeyDialog + reject() + + + 295 + 171 + + + 286 + 193 + + + + +
diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/lookupcertificatesdialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/lookupcertificatesdialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/lookupcertificatesdialog.cpp 2008-04-30 14:59:55.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/lookupcertificatesdialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -212,7 +212,7 @@ // enable/disable everything except 'close', based on passive: Q_FOREACH( QObject * const o, q->children() ) if ( QWidget * const w = qobject_cast( o ) ) - w->setDisabled( passive && w != ui.closePB() ); + w->setDisabled( passive && w != ui.closePB() && w != ui.buttonBox ); if ( passive ) return; @@ -233,6 +233,7 @@ } else { ui.importPB()->setEnabled( selection.size() == 1 ); } + ui.importPB()->setDefault( false ); // otherwise Import becomes default button if enabled and return triggers both a search and accept() } #include "moc_lookupcertificatesdialog.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/lookupcertificatesdialog.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/lookupcertificatesdialog.ui --- kdepim-4.0.83/kleopatra/dialogs/lookupcertificatesdialog.ui 2008-04-23 16:51:49.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/lookupcertificatesdialog.ui 2008-07-08 10:56:20.000000000 +0100 @@ -5,7 +5,7 @@ 0 0 - 544 + 553 292 @@ -113,7 +113,7 @@ - false + true diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/ownertrustdialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/ownertrustdialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/ownertrustdialog.cpp 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/ownertrustdialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -38,13 +38,13 @@ #include "ui_ownertrustdialog.h" -#include +#include #include -using namespace GpgME; using namespace Kleo; using namespace Kleo::Dialogs; +using namespace GpgME; class OwnerTrustDialog::Private { @@ -53,38 +53,35 @@ public: explicit Private( OwnerTrustDialog * qq ) : q( qq ), + formattedCertificateName( i18n("(unknown certificate)") ), + hasSecret( false ), + advancedMode( false ), ui( qq ) { -#if 0 - connect( ui.inSB, SIGNAL(valueChanged(int)), - q, SLOT(slotInAmountChanged()) ); - connect( ui.inCB, SIGNAL(currentIndexChanged(int)), - q, SLOT(slotInUnitChanged()) ); - connect( ui.onCW, SIGNAL(selectionChanged()), - q, SLOT(slotOnDateChanged()) ); - assert( ui.inCB->currentIndex() == inUnit ); -#endif } private: - void slotOwnerTrustChanged( Key::OwnerTrust ); - + void slotTrustLevelChanged() { + enableDisableWidgets(); + } + + void enableDisableWidgets(); + private: + QString formattedCertificateName; + bool hasSecret : 1; + bool advancedMode : 1; struct UI : public Ui::OwnerTrustDialog { explicit UI( Dialogs::OwnerTrustDialog * qq ) : Ui::OwnerTrustDialog() { setupUi( qq ); -#define addTrustItem(item) trustCB->addItem( Formatting::ownerTrustShort( item ), item ); - addTrustItem( Key::Unknown ) - addTrustItem( Key::Undefined ) - addTrustItem( Key::Never) - addTrustItem( Key::Marginal ) - addTrustItem( Key::Full ) - addTrustItem( Key::Ultimate ) -#undef addTrustItem + } + + QPushButton * okPB() const { + return buttonBox->button( QDialogButtonBox::Ok ); } } ui; }; @@ -97,23 +94,76 @@ OwnerTrustDialog::~OwnerTrustDialog() {} +void OwnerTrustDialog::setFormattedCertificateName( const QString & formatted ) { + if ( formatted.isEmpty() ) + return; + d->formattedCertificateName = formatted; + setWindowTitle( i18nc( "@title", "Change Trust Level of %1", formatted ) ); + d->ui.label->setText( i18nc( "@info", "How much do you trust certifications made by %1 to correctly verify authenticity of certificates?", formatted ) ); +} -void OwnerTrustDialog::setOwnerTrust( Key::OwnerTrust trust ) { - const int idx = d->ui.trustCB->findData( trust ); - assert( idx != -1 ); - d->ui.trustCB->setCurrentIndex( idx ); +QString OwnerTrustDialog::formattedCertificateName() const { + return d->formattedCertificateName; } -Key::OwnerTrust OwnerTrustDialog::ownerTrust() const { - return static_cast( d->ui.trustCB->itemData( d->ui.trustCB->currentIndex() ).toUInt() ); +void OwnerTrustDialog::setHasSecretKey( bool secret ) { + d->hasSecret = secret; + d->enableDisableWidgets(); + setOwnerTrust( ownerTrust() ); } +bool OwnerTrustDialog::hasSecretKey() const { + return d->hasSecret; +} + +void OwnerTrustDialog::setAdvancedMode( bool advanced ) { + d->advancedMode = advanced; + d->enableDisableWidgets(); + setOwnerTrust( ownerTrust() ); +} + +bool OwnerTrustDialog::isAdvancedMode() const { + return d->advancedMode; +} -void OwnerTrustDialog::Private::slotOwnerTrustChanged( Key::OwnerTrust trust ) { - +void OwnerTrustDialog::Private::enableDisableWidgets() { + ui.unknownRB ->setEnabled( !hasSecret || advancedMode ); + ui.neverRB ->setEnabled( !hasSecret || advancedMode ); + ui.marginalRB->setEnabled( !hasSecret || advancedMode ); + ui.fullRB ->setEnabled( !hasSecret || advancedMode ); + ui.ultimateRB->setEnabled( hasSecret || advancedMode ); + ui.okPB()->setEnabled( q->ownerTrust() != Key::Undefined ); } +static void force_set_checked( QAbstractButton * b, bool on ) { + // work around Qt bug (tested: 4.1.4, 4.2.3, 4.3.4) + const bool autoExclusive = b->autoExclusive(); + b->setAutoExclusive( false ); + b->setChecked( b->isEnabled() && on ); + b->setAutoExclusive( autoExclusive ); +} +void OwnerTrustDialog::setOwnerTrust( Key::OwnerTrust trust ) { + force_set_checked( d->ui.unknownRB, trust == Key::Unknown ); + force_set_checked( d->ui.neverRB, trust == Key::Never ); + force_set_checked( d->ui.marginalRB,trust == Key::Marginal ); + force_set_checked( d->ui.fullRB, trust == Key::Full ); + force_set_checked( d->ui.ultimateRB,trust == Key::Ultimate ); + d->enableDisableWidgets(); +} +Key::OwnerTrust OwnerTrustDialog::ownerTrust() const { + if ( d->ui.unknownRB->isChecked() ) + return Key::Unknown; + if ( d->ui.neverRB->isChecked() ) + return Key::Never; + if ( d->ui.marginalRB->isChecked() ) + return Key::Marginal; + if ( d->ui.fullRB->isChecked() ) + return Key::Full; + if ( d->ui.ultimateRB->isChecked() ) + return Key::Ultimate; + return Key::Undefined; +} #include "moc_ownertrustdialog.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/ownertrustdialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/ownertrustdialog.h --- kdepim-4.0.83/kleopatra/dialogs/ownertrustdialog.h 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/ownertrustdialog.h 2008-07-08 10:56:20.000000000 +0100 @@ -48,13 +48,22 @@ explicit OwnerTrustDialog( QWidget * parent=0, Qt::WindowFlags f=0 ); ~OwnerTrustDialog(); - void setOwnerTrust( GpgME::Key::OwnerTrust ); + void setFormattedCertificateName( const QString & formatted ); + QString formattedCertificateName() const; + + void setHasSecretKey( bool secret ); + bool hasSecretKey() const; + + void setAdvancedMode( bool advanced ); + bool isAdvancedMode() const; + + void setOwnerTrust( GpgME::Key::OwnerTrust ); GpgME::Key::OwnerTrust ownerTrust() const; private: class Private; kdtools::pimpl_ptr d; - Q_PRIVATE_SLOT( d, void slotOwnerTrustChanged(GpgME::Key::OwnerTrust) ) + Q_PRIVATE_SLOT( d, void slotTrustLevelChanged() ) }; } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/ownertrustdialog.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/ownertrustdialog.ui --- kdepim-4.0.83/kleopatra/dialogs/ownertrustdialog.ui 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/ownertrustdialog.ui 2008-07-08 10:56:20.000000000 +0100 @@ -1,36 +1,313 @@ - Kleo::Dialogs::OwnerTrustDialog - + OwnerTrustDialog + 0 0 - 442 - 356 + 700 + 680 - - Change Trust in Certificate Owner - - + + + QLayout::SetMinimumSize + - - TODO: Display Certificate information and text about trust levels + + true - + + + + + I don't know + + + true + + + + + + + true + + + <i>(unknown trust)</i> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + true + + + <font size="-1">Choose this if you have no opinion about the trustworthyness of the certificate's owner.<br>Certifications at this trust level are ignored when checking the validity of OpenPGP certificates.</font> + + + true + + + + + + + + + + + I do NOT trust them + + + + + + + false + + + <i>(never trust)</i> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + <font size="-1">Choose this if you explicitly do <em>not</em> trust the certificate owner, e.g. because you have knowledge of him certifying without checking or without the certificate owner's consent.<br>Certifications at this trust level are ignored when checking the validity of OpenPGP certificates.</font> + + + true + + + + + + + + + + + I believe checks are casual + + + + + + + false + + + <i>(marginal trust)</i> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + <font size="-1">Choose this if you trust certifications are not done blindly, but not very accuratly, either.<br>Certificates will only become valid with multiple certifications (typically three) at this trust level. This is usually a good choice.</font> + + + true + + + + + + + + + + + I believe checks are very accurate + + + + + + + false + + + <i>(full trust)</i> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + - New trust level: + <font size="-1">Choose this if you trust certifications are done very accurately.<br>Certificates will become valid with just a single certification at this trust level, so assign this much trust with care.</font> + + + true + + + + + + + + + + + false + + + This is my certificate - + + + false + + + <i>(ultimate trust)</i> + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + <font size="-1">Choose this if and only if this is your certificate. This is the default if the secret key is available, but if you imported this certificate, you might need to adjust the trust level yourself.<br>Certificates will become valid with just a single certification at this trust level.</font> + + + true + + @@ -39,9 +316,9 @@ Qt::Vertical - + - 20 + 501 40 @@ -53,23 +330,36 @@ Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + label + unknownRB + neverRB + marginalRB + fullRB + ultimateRB + buttonBox + label_7 + label_8 + label_9 + label_10 + label_11 + label_6 buttonBox accepted() - Kleo::Dialogs::OwnerTrustDialog + OwnerTrustDialog accept() - 227 - 369 + 434 + 670 157 @@ -80,12 +370,12 @@ buttonBox rejected() - Kleo::Dialogs::OwnerTrustDialog + OwnerTrustDialog reject() - 295 - 375 + 502 + 670 286 @@ -93,5 +383,248 @@ + + unknownRB + toggled(bool) + label_2 + setEnabled(bool) + + + 248 + 56 + + + 246 + 106 + + + + + neverRB + toggled(bool) + label_3 + setEnabled(bool) + + + 217 + 174 + + + 243 + 262 + + + + + marginalRB + toggled(bool) + label_4 + setEnabled(bool) + + + 257 + 300 + + + 285 + 368 + + + + + fullRB + toggled(bool) + label_5 + setEnabled(bool) + + + 311 + 406 + + + 345 + 474 + + + + + ultimateRB + toggled(bool) + label_6 + setEnabled(bool) + + + 217 + 512 + + + 247 + 580 + + + + + unknownRB + toggled(bool) + label_7 + setEnabled(bool) + + + 317 + 46 + + + 468 + 54 + + + + + neverRB + toggled(bool) + label_8 + setEnabled(bool) + + + 319 + 162 + + + 368 + 168 + + + + + marginalRB + toggled(bool) + label_9 + setEnabled(bool) + + + 321 + 284 + + + 370 + 288 + + + + + fullRB + toggled(bool) + label_10 + setEnabled(bool) + + + 323 + 382 + + + 364 + 388 + + + + + ultimateRB + toggled(bool) + label_11 + setEnabled(bool) + + + 325 + 496 + + + 380 + 497 + + + + + unknownRB + toggled(bool) + OwnerTrustDialog + slotTrustLevelChanged() + + + 35 + 54 + + + 21 + 78 + + + + + neverRB + toggled(bool) + OwnerTrustDialog + slotTrustLevelChanged() + + + 61 + 160 + + + 11 + 184 + + + + + marginalRB + toggled(bool) + OwnerTrustDialog + slotTrustLevelChanged() + + + 41 + 282 + + + 13 + 310 + + + + + fullRB + toggled(bool) + OwnerTrustDialog + slotTrustLevelChanged() + + + 83 + 386 + + + 17 + 416 + + + + + ultimateRB + toggled(bool) + OwnerTrustDialog + slotTrustLevelChanged() + + + 57 + 496 + + + 19 + 538 + + + + + slotTrustLevelChanged() + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/selectchecklevelwidget.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/selectchecklevelwidget.ui --- kdepim-4.0.83/kleopatra/dialogs/selectchecklevelwidget.ui 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/selectchecklevelwidget.ui 2008-07-08 10:56:20.000000000 +0100 @@ -0,0 +1,148 @@ + + Kleo::Dialogs::CertifyCertificateDialogPrivate::SelectCheckLevelWidget + + + + 0 + 0 + 959 + 606 + + + + + + + <b>Step 2:</b> How thoroughly have you checked that this key actually belongs to the person it claims it's from? + + + true + + + + + + + I have not checked at all + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Describe semantics here... + + + true + + + + + + + I have checked casually + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + Choose this if you know the person, and have asked him whether this was his key, but you have not verified he is actually in posession of the secret key. + + + true + + + + + + + I have checked very thoroughly + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + false + + + Choose this if you have e.g. checked the ID card of the person, and have verified that he is in posession of the secret key (e.g. by sending encrypted mails to him and asking him to decrypt them). + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/selftestdialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/selftestdialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/selftestdialog.cpp 2008-05-15 19:37:21.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/selftestdialog.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -39,6 +39,7 @@ #include #include +#include #include @@ -179,6 +180,11 @@ } private: + void updateColumnSizes() { + ui.resultsTV->header()->resizeSections( QHeaderView::ResizeToContents ); + } + +private: QModelIndex selectedRow() const { const QItemSelectionModel * const ism = ui.resultsTV->selectionModel(); if ( !ism ) @@ -233,10 +239,12 @@ void SelfTestDialog::addSelfTest( const shared_ptr & test ) { d->model.append( std::vector< shared_ptr >( 1, test ) ); + d->updateColumnSizes(); } void SelfTestDialog::addSelfTests( const std::vector< shared_ptr > & tests ) { d->model.append( tests ); + d->updateColumnSizes(); } void SelfTestDialog::setRunAtStartUp( bool on ) { diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/selftestdialog.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/selftestdialog.ui --- kdepim-4.0.83/kleopatra/dialogs/selftestdialog.ui 2008-05-15 19:37:21.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/selftestdialog.ui 2008-07-08 10:56:20.000000000 +0100 @@ -13,10 +13,13 @@ Kleopatra Self-Test Results + + QLayout::SetMinimumSize + - <para>These are the results of the Kleopatra self-test suite. Details are available in tooltips.</para><para>Note that all but the first failure might be consecutive.</para> + <para>These are the results of the Kleopatra self-test suite. Details are available in tooltips.</para><para>Note that all but the first failure might be due to prior tests failing.</para> true @@ -32,6 +35,12 @@ false + + + 0 + 1 + + 0 @@ -191,7 +200,7 @@ 354 - 467 + 398 375 diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/signcertificatedialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/signcertificatedialog.cpp --- kdepim-4.0.83/kleopatra/dialogs/signcertificatedialog.cpp 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/signcertificatedialog.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,91 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - dialogs/signcertificatedialog.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2008 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include - -#include "signcertificatedialog.h" - -#include "ui_signcertificatedialog.h" - -#include - -#include - -using namespace GpgME; -using namespace Kleo; -using namespace Kleo::Dialogs; - - -class SignCertificateDialog::Private { - friend class ::Kleo::Dialogs::SignCertificateDialog; - SignCertificateDialog * const q; -public: - explicit Private( SignCertificateDialog * qq ) - : q( qq ), - ui( qq ) - { - } - -private: - - struct UI : public Ui::SignCertificateDialog { - explicit UI( Dialogs::SignCertificateDialog * qq ) - : Ui::SignCertificateDialog() - { - setupUi( qq ); - } - } ui; -}; - -SignCertificateDialog::SignCertificateDialog( QWidget * p, Qt::WindowFlags f ) - : QDialog( p, f ), d( new Private( this ) ) -{ - -} - -SignCertificateDialog::~SignCertificateDialog() {} - -void SignCertificateDialog::setSigningOption( SignKeyJob::SigningOption option ) { - if ( option == SignKeyJob::LocalSignature ) - d->ui.localRB->setChecked( true ); - else - d->ui.exportableRB->setChecked( true ); -} - -SignKeyJob::SigningOption SignCertificateDialog::signingOption() const { - return d->ui.localRB->isChecked() ? SignKeyJob::LocalSignature : SignKeyJob::ExportableSignature; -} - - -#include "moc_signcertificatedialog.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/signcertificatedialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/signcertificatedialog.h --- kdepim-4.0.83/kleopatra/dialogs/signcertificatedialog.h 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/signcertificatedialog.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,64 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - dialogs/signcertificatedialog.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2008 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __KLEOPATRA_DIALOGS_SIGNCERTIFICATEDIALOG_H__ -#define __KLEOPATRA_DIALOGS_SIGNCERTIFICATEDIALOG_H__ - -#include - -#include - -#include - -#include - -namespace Kleo { -namespace Dialogs { - - class SignCertificateDialog : public QDialog { - Q_OBJECT - public: - explicit SignCertificateDialog( QWidget * parent=0, Qt::WindowFlags f=0 ); - ~SignCertificateDialog(); - - void setSigningOption( Kleo::SignKeyJob::SigningOption option ); - Kleo::SignKeyJob::SigningOption signingOption() const; - - private: - class Private; - kdtools::pimpl_ptr d; - }; - -} -} - -#endif /* __KLEOPATRA_DIALOGS_SIGNCERTIFICATEDIALOG_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/dialogs/signcertificatedialog.ui /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/dialogs/signcertificatedialog.ui --- kdepim-4.0.83/kleopatra/dialogs/signcertificatedialog.ui 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/dialogs/signcertificatedialog.ui 1970-01-01 01:00:00.000000000 +0100 @@ -1,99 +0,0 @@ - - Kleo::Dialogs::SignCertificateDialog - - - - 0 - 0 - 442 - 356 - - - - Sign Certificate - - - - - - Signature Mode - - - - - - Local signature - - - - - - - Exportable signature - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - Kleo::Dialogs::SignCertificateDialog - accept() - - - 227 - 369 - - - 157 - 274 - - - - - buttonBox - rejected() - Kleo::Dialogs::SignCertificateDialog - reject() - - - 295 - 375 - - - 286 - 274 - - - - - diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/exportcertificatesdialog.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/exportcertificatesdialog.cpp --- kdepim-4.0.83/kleopatra/exportcertificatesdialog.cpp 2008-02-13 15:45:39.000000000 +0000 +++ kdepim-4.0.98/kleopatra/exportcertificatesdialog.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,114 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - exportcertificatesdialog.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2007 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "exportcertificatesdialog.h" - -#include "libkleo/ui/filenamerequester.h" - -#include -#include -#include - -#include -#include - -using namespace Kleo; - -class ExportCertificatesDialog::Private { - friend class ::ExportCertificatesDialog; - ExportCertificatesDialog * const q; -public: - explicit Private( ExportCertificatesDialog * qq ); - ~Private(); - void fileNamesChanged(); - -private: - FileNameRequester* pgpRequester; - FileNameRequester* cmsRequester; -}; - - -ExportCertificatesDialog::Private::Private( ExportCertificatesDialog * qq ) - : q( qq ) -{ - q->setButtons( KDialog::Ok | KDialog::Cancel ); - q->setButtonGuiItem( KDialog::Ok, KGuiItem( i18n( "Export" ) ) ); - QWidget* const main = new QWidget; - QGridLayout* const grid = new QGridLayout( main ); - QLabel* const pgpLabel = new QLabel; - pgpLabel->setText( i18n(" OpenPGP export file:" ) ); - grid->addWidget( pgpLabel, 0, 0 ); - pgpRequester = new FileNameRequester; - connect( pgpRequester, SIGNAL( fileNameChanged( QString ) ), q, SLOT( fileNamesChanged() ) ); - grid->addWidget( pgpRequester, 0, 1 ); - QLabel* const cmsLabel = new QLabel; - cmsLabel->setText( i18n( "S/MIME export file:" ) ); - grid->addWidget( cmsLabel, 1, 0 ); - cmsRequester = new FileNameRequester; - connect( cmsRequester, SIGNAL( fileNameChanged( QString ) ), q, SLOT( fileNamesChanged() ) ); - grid->addWidget( cmsRequester, 1, 1 ); - q->setMainWidget( main ); - fileNamesChanged(); -} - -ExportCertificatesDialog::Private::~Private() {} - - - -ExportCertificatesDialog::ExportCertificatesDialog( QWidget * parent, Qt::WFlags f ) - : KDialog( parent, f ), d( new Private( this ) ) -{ - -} - -void ExportCertificatesDialog::Private::fileNamesChanged() -{ - q->button( KDialog::Ok )->setEnabled( !pgpRequester->fileName().isEmpty() && !cmsRequester->fileName().isEmpty() ); -} - -ExportCertificatesDialog::~ExportCertificatesDialog() {} - - -QString ExportCertificatesDialog::openPgpExportFileName() const -{ - return d->pgpRequester->fileName(); -} - -QString ExportCertificatesDialog::cmsExportFileName() const -{ - return d->cmsRequester->fileName(); -} - -#include "moc_exportcertificatesdialog.cpp" - diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/exportcertificatesdialog.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/exportcertificatesdialog.h --- kdepim-4.0.83/kleopatra/exportcertificatesdialog.h 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/exportcertificatesdialog.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,60 +0,0 @@ -/* -*- mode: c++; c-basic-offset:4 -*- - exportcertificatesdialog.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2007 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __KLEOPATRA__EXPORTCERTIFICATESDIALOG_H__ -#define __KLEOPATRA__EXPORTCERTIFICATESDIALOG_H__ - -#include - -#include - -class QString; - -namespace Kleo { - - class ExportCertificatesDialog : public KDialog { - Q_OBJECT - public: - explicit ExportCertificatesDialog( QWidget * parent=0, Qt::WFlags f=0 ); - ~ExportCertificatesDialog(); - - QString openPgpExportFileName() const; - QString cmsExportFileName() const; - - private: - class Private; - kdtools::pimpl_ptr d; - Q_PRIVATE_SLOT( d, void fileNamesChanged() ) - }; -} - -#endif // __KLEOPATRA__EXPORTCERTIFICATESDIALOG_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/hierarchyanalyser.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/hierarchyanalyser.cpp --- kdepim-4.0.83/kleopatra/hierarchyanalyser.cpp 2008-02-13 15:45:39.000000000 +0000 +++ kdepim-4.0.98/kleopatra/hierarchyanalyser.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,80 +0,0 @@ -/* - hierarchyanalyser.cpp - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2004 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#include - -#include "hierarchyanalyser.h" - -#include -#include -#include - -HierarchyAnalyser::HierarchyAnalyser( QObject * parent, const char * name ) - : QObject( parent ) -{ - setObjectName( name ); -} - -HierarchyAnalyser::~HierarchyAnalyser() { - -} - -void HierarchyAnalyser::slotNextKey( const GpgME::Key & key ) { - if ( key.isNull() ) - return; - if ( key.isRoot() || !key.chainID() || !*key.chainID() ) - // root keys have themselves as issuer - we don't want them to - // have parents, though: - mSubjectsByIssuer[0].push_back( key ); - else - mSubjectsByIssuer[key.chainID()].push_back( key ); -} - -const std::vector & HierarchyAnalyser::subjectsForIssuer( const char * issuer_dn ) const { - static const std::vector empty; - std::map< QByteArray, std::vector >::const_iterator it = - mSubjectsByIssuer.find( issuer_dn ); - return it == mSubjectsByIssuer.end() ? empty : it->second ; -} - -std::vector HierarchyAnalyser::subjectsForIssuerRecursive( const char * issuer_dn ) const { - std::vector keys = subjectsForIssuer( issuer_dn ); - for ( unsigned int i = 0 ; i < keys.size() ; ++i ) // can't use iterators here, since appending would invalidate them - if ( const char * fpr = keys[i].primaryFingerprint() ) { - const std::vector & tmp = subjectsForIssuer( fpr ); - std::copy( tmp.begin(), tmp.end(), std::back_inserter( keys ) ); - } - return keys; -} - - -#include "hierarchyanalyser.moc" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/hierarchyanalyser.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/hierarchyanalyser.h --- kdepim-4.0.83/kleopatra/hierarchyanalyser.h 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/hierarchyanalyser.h 1970-01-01 01:00:00.000000000 +0100 @@ -1,65 +0,0 @@ -/* -*- mode: c++ -*- - hierarchyanalyser.h - - This file is part of Kleopatra, the KDE keymanager - Copyright (c) 2004 Klarälvdalens Datakonsult AB - - Kleopatra is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Kleopatra is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - In addition, as a special exception, the copyright holders give - permission to link the code of this program with any edition of - the Qt library by Trolltech AS, Norway (or with modified versions - of Qt that use the same license as Qt), and distribute linked - combinations including the two. You must obey the GNU General - Public License in all respects for all of the code used other than - Qt. If you modify this file, you may extend this exception to - your version of the file, but you are not obligated to do so. If - you do not wish to do so, delete this exception statement from - your version. -*/ - -#ifndef __HIERARCHYANALYSER_H__ -#define __HIERARCHYANALYSER_H__ - -#include - -#include - -#include -#include - -class HierarchyAnalyser : public QObject { - Q_OBJECT -public: - HierarchyAnalyser( QObject * parent=0, const char * name=0 ); - ~HierarchyAnalyser(); - - const std::vector & rootItems() const { - return subjectsForIssuer( 0 ); - } - const std::vector & subjectsForIssuer( const char * issuer_fpr ) const; - std::vector subjectsForIssuerRecursive( const char * issuer_fpr ) const; - - void clear() { mSubjectsByIssuer.clear(); } - -public slots: - void slotNextKey( const GpgME::Key & key ); - -private: - std::map< QByteArray, std::vector > mSubjectsByIssuer; -}; - - -#endif // __HIERARCHYANALYSER_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kcfg/emailoperationspreferences.kcfg /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kcfg/emailoperationspreferences.kcfg --- kdepim-4.0.83/kleopatra/kcfg/emailoperationspreferences.kcfg 2008-04-30 14:59:56.000000000 +0100 +++ kdepim-4.0.98/kleopatra/kcfg/emailoperationspreferences.kcfg 2008-07-08 10:56:21.000000000 +0100 @@ -16,9 +16,9 @@ Minimize the number of steps when encrypting emails, use preset defaults unless problems occurr false - - - The remembered position of the Decrypt/Verify Result Popup used by clients which do not support inline display of D/V results, such as MS Outlook. + + + The remembered size and position of the Decrypt/Verify Result Popup used by clients which do not support inline display of D/V results, such as MS Outlook. diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kleopatraapplication.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kleopatraapplication.cpp --- kdepim-4.0.83/kleopatra/kleopatraapplication.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/kleopatraapplication.cpp 2008-07-08 10:56:26.000000000 +0100 @@ -0,0 +1,353 @@ +/* + kleopatraapplication.cpp + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#include + +#include "kleopatraapplication.h" + +#include "mainwindow.h" +#include "systemtrayicon.h" + +#include +#include +#include +#include +#include + +#include + +#ifdef HAVE_USABLE_ASSUAN +# include +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include + +using namespace Kleo; +using namespace Kleo::Commands; +using namespace boost; + +static void add_resources() { + KGlobal::locale()->insertCatalog( "libkleopatra" ); + KIconLoader::global()->addAppDir( "libkleopatra" ); + KIconLoader::global()->addAppDir( "kdepim" ); +} + +static const struct { + const char * option; + const char * description; + char short_option[4]; +} kleo_options[] = { + { "daemon", I18N_NOOP("Run UI server only, hide main window"), "" }, + { "openpgp", I18N_NOOP("Use OpenPGP for the following operation"), "p" }, + { "cms", I18N_NOOP("Use CMS (X.509, S/MIME) for the following operation"), "c" }, + { "import-certificate", I18N_NOOP("Import certificate file(s)"), "i" }, + { "encrypt", I18N_NOOP("Encrypt file(s)"), "e" }, + { "sign", I18N_NOOP("Sign file(s)"), "s" }, + { "encrypt-sign", I18N_NOOP("Encrypt and/or sign file(s)"), "E" }, + { "decrypt", I18N_NOOP("Decrypt file(s)"), "d" }, + { "verify", I18N_NOOP("Verify file/signature"), "V" }, + { "decrypt-verify", I18N_NOOP("Decrypt and/or verify files(s)"), "D" }, + //{ "show-certificate", I18N_NOOP("Show Certificate(s) by fingerprint(s)"), "" }, +}; + + +static KCmdLineOptions make_kleopatra_args() { + KCmdLineOptions options; +#ifdef HAVE_USABLE_ASSUAN + options.add("uiserver-socket ", ki18n("Location of the socket the ui server is listening on" )); +#endif + for ( unsigned int i = 0 ; i < sizeof kleo_options / sizeof *kleo_options ; ++i ) { + if ( *kleo_options[i].short_option ) + options.add( kleo_options[i].short_option ); + options.add( kleo_options[i].option, ki18n( kleo_options[i].description ) ); + } + options.add("+[File]", ki18n("File(s) to process")); + return options; +} + +// static +KCmdLineOptions KleopatraApplication::commandLineOptions() { + static KCmdLineOptions options = make_kleopatra_args(); + return options; +} + +static QList default_logging_options() { + QList result; + result.push_back( "io" ); + return result; +} + +class KleopatraApplication::Private { +public: + Private() : ignoreNewInstance( true ) {} + +public: + bool ignoreNewInstance; + SystemTrayIconFor sysTray; + shared_ptr keyCache; + shared_ptr log; + shared_ptr watcher; + +public: + void setupKeyCache() { + keyCache = KeyCache::mutableInstance(); + watcher.reset( new FileSystemWatcher ); + + watcher->addPaths( gnupgFileWatchList() ); + watcher->setDelay( 1000 ); + keyCache->addFileSystemWatcher( watcher ); + } + + void setupLogging() { + log = Log::mutableInstance(); + + const QByteArray envOptions = qgetenv( "KLEOPATRA_LOGOPTIONS" ); + const bool logAll = envOptions.trimmed() == "all"; + const QList options = envOptions.isEmpty() ? default_logging_options() : envOptions.split( ',' ) ; + + const QByteArray dirNative = qgetenv( "KLEOPATRA_LOGDIR" ); + if ( dirNative.isEmpty() ) + return; + const QString dir = QFile::decodeName( dirNative ); + const QString logFileName = QDir( dir ).absoluteFilePath( QString::fromLatin1( "kleopatra.log.%1" ).arg( mygetpid() ) ); + std::auto_ptr logFile( new QFile( logFileName ) ); + if ( !logFile->open( QIODevice::WriteOnly | QIODevice::Append ) ) { + kDebug() << "Could not open file for logging: " << logFileName << "\nLogging disabled"; + return; + } + + log->setOutputDirectory( dir ); + if ( logAll || options.contains( "io" ) ) + log->setIOLoggingEnabled( true ); + qInstallMsgHandler( Log::messageHandler ); + +#ifdef HAVE_USABLE_ASSUAN + if ( logAll || options.contains( "pipeio" ) ) + KDPipeIODevice::setDebugLevel( KDPipeIODevice::Debug ); + UiServer::setLogStream( log->logFile() ); +#endif + + } +}; + + +KleopatraApplication::KleopatraApplication() + : KUniqueApplication(), d( new Private ) +{ + add_resources(); + d->setupKeyCache(); + d->setupLogging(); + d->sysTray.show(); + setQuitOnLastWindowClosed( false ); +} + +KleopatraApplication::~KleopatraApplication() { + // work around kdelibs bug https://bugs.kde.org/show_bug.cgi?id=162514 + KGlobal::config()->sync(); +} + +static QStringList files_from_args( const shared_ptr & args ) { + QStringList result; + for ( int i = 0, end = args->count() ; i < end ; ++i ) { + const KUrl url = args->url(i); + if ( url.protocol() == QLatin1String("file") ) + result.push_back( url.toLocalFile() ); + } + return result; +} + +namespace { + typedef void (KleopatraApplication::*Func)( const QStringList &, GpgME::Protocol ); + struct _Funcs { + const char * opt; + Func func; + }; +} + +int KleopatraApplication::newInstance() { + kDebug() << "ignoreNewInstance =" << d->ignoreNewInstance; + if ( d->ignoreNewInstance ) + return 0; + + const shared_ptr args( KCmdLineArgs::parsedArgs(), mem_fn( &KCmdLineArgs::clear ) ); + + const QStringList files = files_from_args( args ); + + const bool openpgp = args->isSet( "openpgp" ); + const bool cms = args->isSet( "cms" ); + + kDebug( openpgp ) << "found OpenPGP"; + kDebug( cms ) << "found CMS"; + + if ( openpgp && cms ) { + kDebug() << "ambigious protocol: --openpgp and --cms"; + return 1; + } + + static const _Funcs funcs[] = { + { "import-certificate", &KleopatraApplication::importCertificatesFromFile }, + { "encrypt", &KleopatraApplication::encryptFiles }, + { "sign", &KleopatraApplication::signFiles }, + { "encrypt-sign", &KleopatraApplication::signEncryptFiles }, + { "decrypt", &KleopatraApplication::decryptFiles }, + { "verify", &KleopatraApplication::verifyFiles }, + { "decrypt-verify", &KleopatraApplication::decryptVerifyFiles }, + }; + + const _Funcs * const it1 = std::find_if( begin( funcs ), end( funcs ), + bind( &KCmdLineArgs::isSet, args, bind( &_Funcs::opt, _1 ) ) ); + + if ( const Func func = it1 == end( funcs ) ? 0 : it1->func ) { + const _Funcs * it2 = std::find_if( it1+1, end( funcs ), + bind( &KCmdLineArgs::isSet, args, bind( &_Funcs::opt, _1 ) ) ); + if ( it2 != end( funcs ) ) { + kDebug() << "ambiguous command" << it1->opt << "vs." << it2->opt; + return 1; + } + if ( files.empty() ) { + kDebug() << it1->opt << "without arguments"; + return 1; + } + kDebug() << "found" << it1->opt; + (this->*func)( files, openpgp ? GpgME::OpenPGP : cms ? GpgME::CMS : GpgME::UnknownProtocol ); + } else { + if ( files.empty() ) { + kDebug() << "openOrRaiseMainWindow"; + openOrRaiseMainWindow(); + } else { + kDebug() << "files without command"; // possible? + return 1; + } + } + + return 0; +} + +const SystemTrayIconFor * KleopatraApplication::sysTrayIcon() const { + return &d->sysTray; +} + +SystemTrayIconFor * KleopatraApplication::sysTrayIcon() { + return &d->sysTray; +} + +const MainWindow * KleopatraApplication::mainWindow() const { + return d->sysTray.mainWindow(); +} + +MainWindow * KleopatraApplication::mainWindow() { + return d->sysTray.mainWindow(); +} + +void KleopatraApplication::openOrRaiseMainWindow() { + d->sysTray.openOrRaiseMainWindow(); +} + +void KleopatraApplication::openOrRaiseConfigDialog() { + d->sysTray.openOrRaiseConfigDialog(); +} + +void KleopatraApplication::importCertificatesFromFile( const QStringList & files, GpgME::Protocol /*proto*/) { + openOrRaiseMainWindow(); + if ( !files.empty() ) + d->sysTray.mainWindow()->importCertificatesFromFile( files ); +} + +void KleopatraApplication::encryptFiles( const QStringList & files, GpgME::Protocol proto ) { + SignEncryptFilesCommand * const cmd = new SignEncryptFilesCommand( files, 0 ); + cmd->setEncryptionPolicy( Force ); + cmd->setSigningPolicy( Allow ); + if ( proto != GpgME::UnknownProtocol ) + cmd->setProtocol( proto ); + cmd->start(); +} + +void KleopatraApplication::signFiles( const QStringList & files, GpgME::Protocol proto ) { + SignEncryptFilesCommand * const cmd = new SignEncryptFilesCommand( files, 0 ); + cmd->setSigningPolicy( Force ); + cmd->setEncryptionPolicy( Deny ); + if ( proto != GpgME::UnknownProtocol ) + cmd->setProtocol( proto ); + cmd->start(); +} + +void KleopatraApplication::signEncryptFiles( const QStringList & files, GpgME::Protocol proto ) { + SignEncryptFilesCommand * const cmd = new SignEncryptFilesCommand( files, 0 ); + if ( proto != GpgME::UnknownProtocol ) + cmd->setProtocol( proto ); + cmd->start(); +} + +void KleopatraApplication::decryptFiles( const QStringList & files, GpgME::Protocol /*proto*/ ) { + DecryptVerifyFilesCommand * const cmd = new DecryptVerifyFilesCommand( files, 0 ); + cmd->setOperation( Decrypt ); + cmd->start(); +} + +void KleopatraApplication::verifyFiles( const QStringList & files, GpgME::Protocol /*proto*/ ) { + DecryptVerifyFilesCommand * const cmd = new DecryptVerifyFilesCommand( files, 0 ); + cmd->setOperation( Verify ); + cmd->start(); +} + +void KleopatraApplication::decryptVerifyFiles( const QStringList & files, GpgME::Protocol /*proto*/ ) { + DecryptVerifyFilesCommand * const cmd = new DecryptVerifyFilesCommand( files, 0 ); + cmd->start(); +} + +void KleopatraApplication::setIgnoreNewInstance( bool ignore ) { + d->ignoreNewInstance = ignore; +} + +bool KleopatraApplication::ignoreNewInstance() const { + return d->ignoreNewInstance; +} + +#include "moc_kleopatraapplication.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kleopatraapplication.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kleopatraapplication.h --- kdepim-4.0.83/kleopatra/kleopatraapplication.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/kleopatraapplication.h 2008-07-08 10:56:26.000000000 +0100 @@ -0,0 +1,81 @@ +/* + kleopatraapplication.h + + This file is part of Kleopatra, the KDE keymanager + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + Kleopatra is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Kleopatra is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifndef __KLEOPATRAAPPLICATION_H__ +#define __KLEOPATRAAPPLICATION_H__ + +#include + +#include + +#include + +class KCmdLineOptions; +class MainWindow; +template class SystemTrayIconFor; + +class KleopatraApplication : public KUniqueApplication { + Q_OBJECT +public: + KleopatraApplication(); + ~KleopatraApplication(); + + static KCmdLineOptions commandLineOptions(); + + /* reimp */ int newInstance(); + + const MainWindow * mainWindow() const; + MainWindow * mainWindow(); + + const SystemTrayIconFor * sysTrayIcon() const; + SystemTrayIconFor * sysTrayIcon(); + + void setIgnoreNewInstance( bool on ); + bool ignoreNewInstance() const; + +public Q_SLOTS: + void openOrRaiseMainWindow(); + void openOrRaiseConfigDialog(); + void importCertificatesFromFile( const QStringList & files, GpgME::Protocol proto ); + void encryptFiles( const QStringList & files, GpgME::Protocol proto ); + void signFiles( const QStringList & files, GpgME::Protocol proto ); + void signEncryptFiles( const QStringList & files, GpgME::Protocol proto ); + void decryptFiles( const QStringList & files, GpgME::Protocol proto ); + void verifyFiles( const QStringList & files, GpgME::Protocol proto ); + void decryptVerifyFiles( const QStringList & files, GpgME::Protocol proto ); + +private: + class Private; + kdtools::pimpl_ptr d; +}; + +#endif // __KLEOPATRAAPPLICATION_H__ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kleopatra_decryptverifyfiles.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kleopatra_decryptverifyfiles.desktop --- kdepim-4.0.83/kleopatra/kleopatra_decryptverifyfiles.desktop 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/kleopatra_decryptverifyfiles.desktop 2008-07-09 12:03:59.000000000 +0100 @@ -0,0 +1,28 @@ +[Desktop Entry] +Type=Service +Encoding=UTF-8 +MimeType=application/pgp;application/pgp-encrypted;application/pgp-signature;application/pkcs7-mime;applicaton/pkcs7-signature; +X-KDE-ServiceTypes=KonqPopupMenu/Plugin +Name=Kleopatra Decrypt/Verify Files +Name[ca]=Desxifrat/verificació de fitxers del Kleopatra +Name[da]=Kleopatra dekryptér/verificér filer +Name[et]=Kleopatra failide lahtikrüptimine/kontrollimine +Name[pt]=Descodificação/Verificação de Ficheiros do Kleopatra +Name[pt_BR]=Descodificação/Verificação de Ficheiros do Kleopatra +Name[uk]=Розшифрування/Перевірка файлів у Kleopatra +Name[zh_CN]=Kleopatra 解密/验证文件 +Name[zh_TW]=Kleopatra 解密/檢查檔案 +Actions=kleodecryptverifyfiles; + +[Desktop Action kleodecryptverifyfiles] +Name=Decrypt/Verify File +Name[ca]=Desxifrat/verificació de fitxers +Name[da]=Dekryptér/verificér filer +Name[et]=Faili lahtikrüptimine/kontrollimine +Name[pt]=Descodificar/Verificar o Ficheiro +Name[pt_BR]=Descodificar/Verificar o Ficheiro +Name[uk]=Розшифрувати/Перевірити файл +Name[zh_CN]=解密/验证文件 +Name[zh_TW]=解密/檢查檔案 +Icon=kleopatra +Exec=kleopatra --decrypt-verify %F diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kleopatra_decryptverifyfolders.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kleopatra_decryptverifyfolders.desktop --- kdepim-4.0.83/kleopatra/kleopatra_decryptverifyfolders.desktop 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/kleopatra_decryptverifyfolders.desktop 2008-07-09 12:03:59.000000000 +0100 @@ -0,0 +1,27 @@ +[Desktop Entry] +Type=Service +Encoding=UTF-8 +X-KDE-ServiceTypes=inode/directory,KonqPopupMenu/Plugin +Name=Kleopatra Decrypt/Verify All Files In Folder +Name[ca]=Desxifrat/verificació de fitxers de tots els fitxers en una carpeta del Kleopatra +Name[da]=Kleopatra dekryptér/verificér all filer i mappe +Name[et]=Kleopatra kõigi kataloogi failide lahtikrüptimine/kontrollimine +Name[pt]=Descodificação/Verificação de Todos os Ficheiros da Pasta do Kleopatra +Name[pt_BR]=Descodificação/Verificação de Todos os Ficheiros da Pasta do Kleopatra +Name[uk]=Розшифрування/Перевірка всіх файлів у теці у Kleopatra +Name[zh_CN]=在文件夹中的全部 Kleopatra 解密/验证文件 +Name[zh_TW]=Kleopatra 解密/檢查所有資料夾中的檔案 +Actions=kleodecryptverifyfiles; + +[Desktop Action kleodecryptverifyfiles] +Name=Decrypt/Verify All Files In Folder +Name[ca]=Desxifrat/verificació de fitxers de tots els fitxers en una carpeta +Name[da]=Dekryptér/verificér alle filer i mappe +Name[et]=Kõigi kataloogi failide lahtikrüptimine/kontrollimine +Name[pt]=Descodificar/Verificar Todos os Ficheiros na Pasta +Name[pt_BR]=Descodificar/Verificar Todos os Ficheiros na Pasta +Name[uk]=Розшифрувати/Перевірити всі файли у теці +Name[zh_CN]=文件夹中的全部解密/验证文件 +Name[zh_TW]=解密/檢查所有資料夾中的檔案 +Icon=kleopatra +Exec=kleopatra --decrypt-verify %F diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kleopatra_import.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kleopatra_import.desktop --- kdepim-4.0.83/kleopatra/kleopatra_import.desktop 2008-01-15 01:57:37.000000000 +0000 +++ kdepim-4.0.98/kleopatra/kleopatra_import.desktop 2008-07-09 12:03:59.000000000 +0100 @@ -1,14 +1,26 @@ [Desktop Entry] +Type=Application +Encoding=UTF-8 +Icon=kleopatra +Exec=kleopatra --import-certificate %F +MimeType=application/pkcs7-mime;application/x-x509-ca-cert;application/x-pkcs12;application/pgp-keys; +Categories=Qt;KDE;Utility;Security;X-KDE-Utilities-PIM; + Name=Kleopatra Name[is]=Kleópatra Name[mk]=Клеопатра Name[ne]=क्लेओपेट्रा Name[ta]=க்ளியோபட்ரா Name[x-test]=xxKleopatraxx -Type=Application -Exec=kleopatra --import-certificate %u -#Icon=kleopatra +Comment=Certificate Manager and Unified Crypto GUI +Comment[ca]=Gestor de certificats i IGU criptogràfica unificada +Comment[da]=Certifikathåndtering og forenet krypterings-GUI +Comment[et]=Sertifikaadihaldur ja ühendatud krüptimise graafiline kasutajaliides +Comment[pt]=Gestor de Certificados e GUI Unificada de Criptografia +Comment[pt_BR]=Gestor de Certificados e GUI Unificada de Criptografia +Comment[uk]=Засіб для керування сертифікатами і уніфікований графічний інтерфейс шифрування +Comment[zh_CN]=证书管理器和统一加密用户图形界面 +Comment[zh_TW]=憑證管理與統一加密介面 NoDisplay=true -MimeType=application/pkcs7-mime;application/x-x509-ca-cert;application/x-pkcs12; X-KDE-StartupNotify=true diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kleopatra.rc /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kleopatra.rc --- kdepim-4.0.83/kleopatra/kleopatra.rc 2008-05-21 09:33:38.000000000 +0100 +++ kdepim-4.0.98/kleopatra/kleopatra.rc 2008-07-08 10:56:26.000000000 +0100 @@ -1,5 +1,5 @@ - + &File @@ -11,6 +11,7 @@ + @@ -32,24 +33,30 @@ &Certificates - + + + + &Tools - - + + + + + + &Settings - &Window @@ -84,7 +91,7 @@ &Certificates - + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kleopatra_signencryptfiles.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kleopatra_signencryptfiles.desktop --- kdepim-4.0.83/kleopatra/kleopatra_signencryptfiles.desktop 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/kleopatra_signencryptfiles.desktop 2008-07-09 12:03:59.000000000 +0100 @@ -0,0 +1,69 @@ +[Desktop Entry] +Type=Service +Encoding=UTF-8 +# all files inherit from application/octet-stream +MimeType=application/octet-stream; +X-KDE-ServiceTypes=KonqPopupMenu/Plugin +Name=Kleopatra Sign/Encrypt Files +Name[ca]=Signatura/Xifrat de fitxers del Kleopatra +Name[da]=Kleopatra signér/kryptér filer +Name[et]=Kleopatra failide allkirjastamine/krüptimine +Name[pt]=Assinatura/Encriptação de Ficheiros do Kleopatra +Name[pt_BR]=Assinatura/Encriptação de Ficheiros do Kleopatra +Name[uk]=Підписування/Шифрування файлів у Kleopatra +Name[zh_CN]=Kleopatra 签名/加密文件 +Name[zh_TW]=Kleopatra 簽署/加密檔案 +Actions=kleoencryptsignfiles;kleoencryptfiles;kleosignfilesopenpgp;kleosignfilescms; + +[Desktop Action kleoencryptsignfiles] +Name=Encrypt & Sign File +Name[ca]=Signatura i xifrat de fitxer +Name[da]=Kryptér og signér fil +Name[et]=Faili krüptimine ja allkirjastamine +Name[pt]=Encriptar & Assinar o Ficheiro +Name[pt_BR]=Encriptar & Assinar o Ficheiro +Name[uk]=Зашифрувати і підписати файл +Name[zh_CN]=加密并签名文件 +Name[zh_TW]=加密與簽署檔案 +Icon=kleopatra +Exec=kleopatra --sign-encrypt %F + +[Desktop Action kleoencryptfiles] +Name=Encrypt File +Name[ca]=Xifrat de fitxer +Name[da]=Kryptér fil +Name[et]=Faili krüptimine +Name[pt]=Cifrar o Ficheiro +Name[pt_BR]=Cifrar o Ficheiro +Name[uk]=Зашифрувати файл +Name[zh_CN]=加密文件 +Name[zh_TW]=加密檔案 +Icon=kleopatra +Exec=kleopatra --encrypt %F + +[Desktop Action kleosignfilesopenpgp] +Name=OpenPGP-Sign File +Name[ca]=Signatura OpenPGP de fitxer +Name[da]=OpenPGP-signér fil +Name[et]=Faili OpenPGP-allkirjastamine +Name[pt]=Assinar o Ficheiro com o OpenPGP +Name[pt_BR]=Assinar o Ficheiro com o OpenPGP +Name[uk]=Підписати файл з OpenPGP +Name[zh_CN]=OpenPGP 签名文件 +Name[zh_TW]=OpenPGP─簽署檔案 +Icon=kleopatra +Exec=kleopatra --openpgp --sign %F + +[Desktop Action kleosignfilescms] +Name=S/MIME-Sign File +Name[ca]=Signatura S/MIME de fitxer +Name[da]=S/MIME-signér fil +Name[et]=Faili S/MIME-allkirjastamine +Name[pt]=Assinar o Ficheiro com o S/MIME +Name[pt_BR]=Assinar o Ficheiro com o S/MIME +Name[uk]=Підписати файл з S/MIME +Name[zh_CN]=S/MIME 签名文件 +Name[zh_TW]=S/MIME─簽署檔案 +Icon=kleopatra +Exec=kleopatra --cms --sign %F + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/kleopatra_signencryptfolders.desktop /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/kleopatra_signencryptfolders.desktop --- kdepim-4.0.83/kleopatra/kleopatra_signencryptfolders.desktop 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/kleopatra_signencryptfolders.desktop 2008-07-09 12:03:59.000000000 +0100 @@ -0,0 +1,40 @@ +[Desktop Entry] +Type=Service +Encoding=UTF-8 +X-KDE-ServiceTypes=inode/directory,KonqPopupMenu/Plugin +Actions=kleosignencryptfolder;kleoencryptfolder; +Name=Kleopatra Sign/Encrypt Folders +Name[ca]=Signatura/Xifrat de carpetes del Kleopatra +Name[da]=Kleopatra signér/kryptér mapper +Name[et]=Kleopatra kataloogide allkirjastamine/krüptimine +Name[pt]=Assinatura/Encriptação de Pastas do Kleopatra +Name[pt_BR]=Assinatura/Encriptação de Pastas do Kleopatra +Name[uk]=Підписування/Шифрування тек у Kleopatra +Name[zh_CN]=Kleopatra 签名/加密文件夹 +Name[zh_TW]=Kleopatra 簽署/加密資料夾 + +[Desktop Action kleosignencryptfolder] +Name=Archive, Sign & Encrypt Folder +Name[ca]=Arxivat, signatura i xifrat de carpeta +Name[da]=Arkivér, signér og kryptér mappe +Name[et]=Kataloogi arhiveerimine, allkirjastamine ja krüptimine +Name[pt]=Arquivar, Assinar e Encriptar a Pasta +Name[pt_BR]=Arquivar, Assinar e Encriptar a Pasta +Name[uk]=Архівувати, підписати і зашифрувати теку +Name[zh_CN]=归档、签名并加密文件夹 +Name[zh_TW]=歸檔,簽署與加密資料夾 +Icon=kleopatra +Exec=kleopatra --sign-encrypt %F + +[Desktop Action kleoencryptfolder] +Name=Archive & Encrypt Folder +Name[ca]=Arxivat i xifrat de carpeta +Name[da]=Arkivér og kryptér mappe +Name[et]=Kataloogi arhiveerimine ja krüptimine +Name[pt]=Arquivar e Cifrar a Pasta +Name[pt_BR]=Arquivar e Cifrar a Pasta +Name[uk]=Зробити архів теки і зашифрувати +Name[zh_CN]=归档并加密文件夹 +Name[zh_TW]=歸檔並加密資料夾 +Icon=kleopatra +Exec=kleopatra --encrypt %F diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/CMakeLists.txt --- kdepim-4.0.83/kleopatra/libkleopatraclient/CMakeLists.txt 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/CMakeLists.txt 2008-07-08 10:56:21.000000000 +0100 @@ -1,9 +1,11 @@ -set( libkleopatraclient_soversion 0.1.0 ) +set( libkleopatraclient_soversion 0.2.0 ) set( libkleopatraclient_version ${libkleopatraclient_soversion} ) add_subdirectory( core ) add_subdirectory( gui ) +add_subdirectory( tests ) + install( FILES kleopatraclient_export.h DESTINATION ${INCLUDE_INSTALL_DIR}/libkleopatraclient diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/core/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/core/CMakeLists.txt --- kdepim-4.0.83/kleopatra/libkleopatraclient/core/CMakeLists.txt 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/core/CMakeLists.txt 2008-07-08 10:56:21.000000000 +0100 @@ -15,7 +15,8 @@ initialization.cpp command.cpp selectcertificatecommand.cpp - #connection.cpp + signencryptfilescommand.cpp + decryptverifyfilescommand.cpp ) set_target_properties( kleopatraclientcore @@ -26,7 +27,7 @@ if ( WIN32 ) - target_link_libraries( kleopatraclientcore ${QT_QTCORE_LIBRARY} ${ASSUAN_VANILLA_LIBRARIES} Ws2_32 ) + target_link_libraries( kleopatraclientcore ${QT_QTCORE_LIBRARY} ${ASSUAN_VANILLA_LIBRARIES} ws2_32 ) else ( WIN32 ) target_link_libraries( kleopatraclientcore ${QT_QTCORE_LIBRARY} ${ASSUAN_PTHREAD_LIBRARIES} ) endif ( WIN32 ) @@ -42,6 +43,7 @@ initialization.h command.h selectcertificatecommand.h + signencryptfilescommand.h DESTINATION ${INCLUDE_INSTALL_DIR}/libkleopatraclient/core ) diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/core/command.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/core/command.cpp --- kdepim-4.0.83/kleopatra/libkleopatraclient/core/command.cpp 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/core/command.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -47,10 +47,61 @@ #include #include +#include using namespace KLEOPATRACLIENT_NAMESPACE; using namespace boost; +// copied from kleopatra/utils/hex.cpp +static std::string hexencode( const std::string & in ) { + std::string result; + result.reserve( 3 * in.size() ); + + static const char hex[] = "0123456789ABCDEF"; + + for ( std::string::const_iterator it = in.begin(), end = in.end() ; it != end ; ++it ) + switch ( const unsigned char ch = *it ) { + default: + if ( ch >= '!' && ch <= '~' || ch > 0xA0 ) { + result += ch; + break; + } + // else fall through + case ' ': + result += '+'; + break; + case '"': + case '#': + case '$': + case '%': + case '\'': + case '+': + case '=': + result += '%'; + result += hex[ (ch & 0xF0) >> 4 ]; + result += hex[ (ch & 0x0F) ]; + break; + } + + return result; +} + +#ifdef UNUSED +static std::string hexencode( const char * in ) { + if ( !in ) + return std::string(); + return hexencode( std::string( in ) ); +} +#endif + +static QByteArray hexencode( const QByteArray & in ) { + if ( in.isNull() ) + return QByteArray(); + const std::string result = hexencode( std::string( in.constData() ) ); + return QByteArray( result.data(), result.size() ); +} +// end copied from kleopatra/utils/hex.cpp + Command::Command( QObject * p ) : QObject( p ), d( new Private( this ) ) { @@ -198,6 +249,16 @@ return it != d->inputs.options.end() && it->second.isCritical; } +void Command::setFilePaths( const QStringList & filePaths ) { + const QMutexLocker locker( &d->mutex ); + d->inputs.filePaths = filePaths; +} + +QStringList Command::filePaths() const { + const QMutexLocker locker( &d->mutex ); + return d->inputs.filePaths; +} + QByteArray Command::receivedData() const { const QMutexLocker locker( &d->mutex ); return d->outputs.data; @@ -295,6 +356,10 @@ return my_assuan_transact( ctx, QString().sprintf( "OPTION %s", name ).toUtf8().constData() ); } +static int send_file( const AssuanClientContext & ctx, const QString & file ) { + return my_assuan_transact( ctx, QString().sprintf( "FILE %s", hexencode( QFile::encodeName( file ) ).constData() ).toUtf8().constData() ); +} + void Command::Private::run() { // Take a snapshot of the input data, and clear the output data: @@ -386,6 +451,13 @@ qDebug() << "Failed to send non-critical option" << it->first.c_str() << ":" << to_error_string( err ); } + Q_FOREACH( const QString & filePath, in.filePaths ) + if ( ( err = send_file( ctx, filePath ) ) ) { + out.errorString = tr("Failed to send file path %1: %2") + .arg( filePath, to_error_string( err ) ); + goto leave; + } + #if 0 setup I/O; #endif diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/core/command.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/core/command.h --- kdepim-4.0.83/kleopatra/libkleopatraclient/core/command.h 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/core/command.h 2008-07-08 10:56:21.000000000 +0100 @@ -71,6 +71,9 @@ bool isOptionSet( const char * name ) const; bool isOptionCritical( const char * name ) const; + void setFilePaths( const QStringList & filePaths ); + QStringList filePaths() const; + QByteArray receivedData() const; void setCommand( const char * command ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/core/command_p.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/core/command_p.h --- kdepim-4.0.83/kleopatra/libkleopatraclient/core/command_p.h 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/core/command_p.h 2008-07-08 10:56:21.000000000 +0100 @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -66,6 +67,7 @@ struct Inputs { Inputs() : parentWId( 0 ) {} std::map options; + QStringList filePaths; WId parentWId; QByteArray command; } inputs; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/core/decryptverifyfilescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/core/decryptverifyfilescommand.cpp --- kdepim-4.0.83/kleopatra/libkleopatraclient/core/decryptverifyfilescommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/core/decryptverifyfilescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,35 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + core/decryptverifyfilescommand.cpp + + This file is part of KleopatraClient, the Kleopatra interface library + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + KleopatraClient is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + KleopatraClient is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "decryptverifyfilescommand.h" + +using namespace KLEOPATRACLIENT_NAMESPACE; + +DecryptVerifyFilesCommand::DecryptVerifyFilesCommand( QObject * p ) + : Command( p ) +{ + setCommand( "DECRYPT_VERIFY_FILES" ); + setOption( "nohup" ); +} + +DecryptVerifyFilesCommand::~DecryptVerifyFilesCommand() {} + +#include "moc_decryptverifyfilescommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/core/decryptverifyfilescommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/core/decryptverifyfilescommand.h --- kdepim-4.0.83/kleopatra/libkleopatraclient/core/decryptverifyfilescommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/core/decryptverifyfilescommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,45 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + core/decryptverifyfilescommand.h + + This file is part of KleopatraClient, the Kleopatra interface library + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + KleopatraClient is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + KleopatraClient is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef __LIBKLEOPATRACLIENT_CORE_DECRYPTVERIFYFILESCOMMAND_H__ +#define __LIBKLEOPATRACLIENT_CORE_DECRYPTVERIFYFILESCOMMAND_H__ + +#include + +namespace KLEOPATRACLIENT_NAMESPACE { + + class KLEOPATRACLIENTCORE_EXPORT DecryptVerifyFilesCommand : public Command { + Q_OBJECT + public: + explicit DecryptVerifyFilesCommand( QObject * parent=0 ); + ~DecryptVerifyFilesCommand(); + + // Inputs + + using Command::setFilePaths; + using Command::filePaths; + + // No Outputs + }; + +} + +#endif /* __LIBKLEOPATRACLIENT_CORE_DECRYPTVERIFYFILESCOMMAND_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/core/signencryptfilescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/core/signencryptfilescommand.cpp --- kdepim-4.0.83/kleopatra/libkleopatraclient/core/signencryptfilescommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/core/signencryptfilescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,35 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + core/signencryptfilescommand.cpp + + This file is part of KleopatraClient, the Kleopatra interface library + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + KleopatraClient is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + KleopatraClient is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "signencryptfilescommand.h" + +using namespace KLEOPATRACLIENT_NAMESPACE; + +SignEncryptFilesCommand::SignEncryptFilesCommand( QObject * p ) + : Command( p ) +{ + setCommand( "SIGN_ENCRYPT_FILES" ); + setOption( "nohup" ); +} + +SignEncryptFilesCommand::~SignEncryptFilesCommand() {} + +#include "moc_signencryptfilescommand.cpp" diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/core/signencryptfilescommand.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/core/signencryptfilescommand.h --- kdepim-4.0.83/kleopatra/libkleopatraclient/core/signencryptfilescommand.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/core/signencryptfilescommand.h 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,45 @@ +/* -*- mode: c++; c-basic-offset:4 -*- + core/signencryptfilescommand.h + + This file is part of KleopatraClient, the Kleopatra interface library + Copyright (c) 2008 Klarälvdalens Datakonsult AB + + KleopatraClient is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + KleopatraClient is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef __LIBKLEOPATRACLIENT_CORE_SIGNENCRYPTFILESCOMMAND_H__ +#define __LIBKLEOPATRACLIENT_CORE_SIGNENCRYPTFILESCOMMAND_H__ + +#include + +namespace KLEOPATRACLIENT_NAMESPACE { + + class KLEOPATRACLIENTCORE_EXPORT SignEncryptFilesCommand : public Command { + Q_OBJECT + public: + explicit SignEncryptFilesCommand( QObject * parent=0 ); + ~SignEncryptFilesCommand(); + + // Inputs + + using Command::setFilePaths; + using Command::filePaths; + + // No Outputs + }; + +} + +#endif /* __LIBKLEOPATRACLIENT_CORE_SIGNENCRYPTFILESCOMMAND_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/tests/CMakeLists.txt /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/tests/CMakeLists.txt --- kdepim-4.0.83/kleopatra/libkleopatraclient/tests/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/tests/CMakeLists.txt 2008-06-25 08:58:30.000000000 +0100 @@ -0,0 +1,14 @@ +set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) + +include_directories( ${CMAKE_SOURCE_DIR}/kleopatra ) + +set( kleoclient_TESTS + test_signencryptfilescommand + test_decryptverifyfilescommand + ) + +foreach( _kleoclient_test ${kleoclient_TESTS} ) + kde4_add_executable( "${_kleoclient_test}" TEST "${_kleoclient_test}.cpp" ) + target_link_libraries( "${_kleoclient_test}" kleopatraclientcore ${QT_QTGUI_LIBRARY} ) +endforeach( _kleoclient_test ) + diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/tests/test_decryptverifyfilescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/tests/test_decryptverifyfilescommand.cpp --- kdepim-4.0.83/kleopatra/libkleopatraclient/tests/test_decryptverifyfilescommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/tests/test_decryptverifyfilescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,29 @@ +#include + +#include "test_util.h" + +#include + +using namespace KLEOPATRACLIENT_NAMESPACE; + +int main( int argc, char * argv[] ) { + + QApplication app( argc, argv ); + + DecryptVerifyFilesCommand cmd; + cmd.setFilePaths( filePathsFromArgs( argc, argv ) ); + + app.connect( &cmd, SIGNAL(finished()), SLOT(quit()) ); + + cmd.start(); + + int rc = app.exec(); + + if ( cmd.error() && !cmd.wasCanceled() ) + QMessageBox::information( 0, QLatin1String( "Kleopatra Error" ), + QString::fromLatin1( "There was an error while connecting to Kleopatra: %1" ) + .arg( cmd.errorString() ) ); + + return rc; + +} diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/tests/test_signencryptfilescommand.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/tests/test_signencryptfilescommand.cpp --- kdepim-4.0.83/kleopatra/libkleopatraclient/tests/test_signencryptfilescommand.cpp 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/tests/test_signencryptfilescommand.cpp 2008-07-08 10:56:21.000000000 +0100 @@ -0,0 +1,29 @@ +#include + +#include "test_util.h" + +#include + +using namespace KLEOPATRACLIENT_NAMESPACE; + +int main( int argc, char * argv[] ) { + + QApplication app( argc, argv ); + + SignEncryptFilesCommand cmd; + cmd.setFilePaths( filePathsFromArgs( argc, argv ) ); + + app.connect( &cmd, SIGNAL(finished()), SLOT(quit()) ); + + cmd.start(); + + int rc = app.exec(); + + if ( cmd.error() && !cmd.wasCanceled() ) + QMessageBox::information( 0, QLatin1String( "Kleopatra Error" ), + QString::fromLatin1( "There was an error while connecting to Kleopatra: %1" ) + .arg( cmd.errorString() ) ); + + return rc; + +} diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/libkleopatraclient/tests/test_util.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/libkleopatraclient/tests/test_util.h --- kdepim-4.0.83/kleopatra/libkleopatraclient/tests/test_util.h 1970-01-01 01:00:00.000000000 +0100 +++ kdepim-4.0.98/kleopatra/libkleopatraclient/tests/test_util.h 2008-06-25 08:58:30.000000000 +0100 @@ -0,0 +1,15 @@ +#ifndef __LIBKLEOPATRACLIENT_TESTS_TEST_UTIL_H__ +#define __LIBKLEOPATRACLIENT_TESTS_TEST_UTIL_H__ + +#include +#include +#include + +static QStringList filePathsFromArgs( int argc, char * argv[] ) { + QStringList result; + for ( int i = 1 ; i < argc ; ++i ) + result.push_back( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() ); + return result; +} + +#endif /* __LIBKLEOPATRACLIENT_TESTS_TEST_UTIL_H__ */ diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/main.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/main.cpp --- kdepim-4.0.83/kleopatra/main.cpp 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/main.cpp 2008-07-08 10:56:26.000000000 +0100 @@ -33,21 +33,15 @@ #include #include "aboutdata.h" -#include "systemtrayicon.h" +#include "kleopatraapplication.h" #include "mainwindow.h" #include #include -#include "libkleo/kleo/cryptobackendfactory.h" - #include -#include -#include -#include #ifdef HAVE_USABLE_ASSUAN -# include "kleo-assuan.h" # include # include # include @@ -67,30 +61,21 @@ } #endif -#include - #include #include -#include #include #include -#include #include -#include -#include -#include #include // for Qt::escape -#include #include #include -#include #include +#include +#include #include -#include -#include #include using namespace boost; @@ -102,20 +87,6 @@ } } -static QStringList watchList() { - const QString home = Kleo::gnupgHomeDirectory(); - QFileInfo info( home ); - if ( !info.isDir() ) - return QStringList(); - QDir homeDir( home ); - QStringList fileList = homeDir.entryList( QDir::AllEntries | QDir::NoDotAndDotDot ); - fileList.removeAll( "dirmngr-cache.d" ); - QStringList result; - Q_FOREACH( const QString& i, fileList ) - result.push_back( homeDir.absoluteFilePath( i ) ); - return result; -} - static bool selfCheck( KSplashScreen & splash ) { splash.showMessage( i18n("Performing Self-Check...") ); Kleo::Commands::SelfTestCommand cmd( 0 ); @@ -136,49 +107,6 @@ } } -static QString environmentVariable( const QString& var, const QString& defaultValue=QString() ) -{ - const QStringList env = QProcess::systemEnvironment(); - Q_FOREACH ( const QString& i, env ) - { - if ( !i.startsWith( var + '=' ) ) - continue; - - const int equalPos = i.indexOf( '=' ); - assert( equalPos >= 0 ); - return i.mid( equalPos + 1 ); - } - return defaultValue; -} - -static void setupLogging() -{ - const QString envOptions = environmentVariable( "KLEOPATRA_LOGOPTIONS", "io" ); - const bool logAll = envOptions.trimmed() == "all"; - const QStringList options = envOptions.split( ',' ); - - const QString dir = environmentVariable( "KLEOPATRA_LOGDIR" ); - if ( dir.isEmpty() ) - return; - std::auto_ptr logFile( new QFile( dir + "/kleo-log" ) ); - if ( !logFile->open( QIODevice::WriteOnly | QIODevice::Append ) ) { - kDebug() << "Could not open file for logging: " << dir + "/kleo-log\nLogging disabled"; - return; - } - - Kleo::Log::mutableInstance()->setOutputDirectory( dir ); - if ( logAll || options.contains( "io" ) ) - Kleo::Log::mutableInstance()->setIOLoggingEnabled( true ); - qInstallMsgHandler( Kleo::Log::messageHandler ); - -#ifdef HAVE_USABLE_ASSUAN - if ( logAll || options.contains( "pipeio" ) ) - KDPipeIODevice::setDebugLevel( KDPipeIODevice::Debug ); - - assuan_set_assuan_log_stream( Kleo::Log::instance()->logFile() ); -#endif -} - static void fillKeyCache( KSplashScreen * splash, Kleo::UiServer * server ) { QEventLoop loop; @@ -197,40 +125,21 @@ int main( int argc, char** argv ) { + { + const unsigned int threads = QThreadPool::globalInstance()->maxThreadCount(); + QThreadPool::globalInstance()->setMaxThreadCount( qMin( 2U, threads ) ); + } + AboutData aboutData; KCmdLineArgs::init(argc, argv, &aboutData); - KCmdLineOptions options; - options.add("daemon", ki18n("Run UI server only, hide main window")); - options.add("import-certificate ", ki18n("Name of certificate file to import")); -#ifdef HAVE_USABLE_ASSUAN - options.add("uiserver-socket ", ki18n("Location of the socket the ui server is listening on" ) ); -#endif - - KCmdLineArgs::addCmdLineOptions( options ); + KCmdLineArgs::addCmdLineOptions( KleopatraApplication::commandLineOptions() ); - KUniqueApplication app; + KleopatraApplication app; - // pin KeyCache to a shared_ptr to define it's minimum lifetime: - const boost::shared_ptr keyCache = Kleo::KeyCache::mutableInstance(); - const boost::shared_ptr log = Kleo::Log::mutableInstance(); - const boost::shared_ptr watcher( new Kleo::FileSystemWatcher ); - - watcher->addPaths( watchList() ); - watcher->setDelay( 1000 ); - keyCache->addFileSystemWatcher( watcher ); - setupLogging(); - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - KGlobal::locale()->insertCatalog( "libkleopatra" ); - KIconLoader::global()->addAppDir( "libkleopatra" ); - KIconLoader::global()->addAppDir( "kdepim" ); - - SystemTrayIconFor sysTray; - sysTray.show(); - KSplashScreen splash( UserIcon( "kleopatra_splashscreen" ), Qt::WindowStaysOnTopHint ); int rc; @@ -238,10 +147,11 @@ try { Kleo::UiServer server( args->getOption("uiserver-socket") ); - server.enableCryptoCommands( false ); - QObject::connect( &server, SIGNAL(startKeyManagerRequested()), - &sysTray, SLOT(openOrRaiseMainWindow()) ); + &app, SLOT(openOrRaiseMainWindow()) ); + + QObject::connect( &server, SIGNAL(startConfigDialogRequested()), + &app, SLOT(openOrRaiseConfigDialog()) ); #define REGISTER( Command ) server.registerCommandFactory( boost::shared_ptr( new Kleo::GenericAssuanCommandFactory ) ) REGISTER( DecryptCommand ); @@ -261,12 +171,9 @@ #undef REGISTER server.start(); - - sysTray.setToolTip( i18n( "Kleopatra UI Server listening on %1", server.socketName() ) ); #endif const bool daemon = args->isSet("daemon"); - const QStringList certificateToImport = args->getOptionList("import-certificate"); if ( !daemon ) splash.show(); @@ -278,22 +185,21 @@ fillKeyCache( &splash, 0 ); #endif + app.setIgnoreNewInstance( false ); + if ( !daemon ) { - MainWindow* mainWindow = new MainWindow; - if ( !certificateToImport.isEmpty() ) - mainWindow->importCertificatesFromFile( certificateToImport ); - mainWindow->show(); - sysTray.setMainWindow( mainWindow ); - splash.finish( mainWindow ); + app.newInstance(); + splash.finish( app.mainWindow() ); } - args->clear(); - QApplication::setQuitOnLastWindowClosed( false ); rc = app.exec(); #ifdef HAVE_USABLE_ASSUAN + app.setIgnoreNewInstance( true ); QObject::disconnect( &server, SIGNAL(startKeyManagerRequested()), - &sysTray, SLOT(openOrRaiseMainWindow()) ); + &app, SLOT(openOrRaiseMainWindow()) ); + QObject::disconnect( &server, SIGNAL(startConfigDialogRequested()), + &app, SLOT(openOrRaiseConfigDialog()) ); server.stop(); server.waitForStopped(); @@ -304,13 +210,11 @@ "You can use Kleopatra as a certificate manager, but cryptographic plugins that " "rely on a GPG UI Server being present might not work correctly, or at all.", Qt::escape( QString::fromUtf8( e.what() ) ) )); + app.setIgnoreNewInstance( false ); rc = app.exec(); + app.setIgnoreNewInstance( true ); } #endif - // work around kdelibs bug https://bugs.kde.org/show_bug.cgi?id=162514 - KGlobal::config()->sync(); - - return rc; } diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/mainwindow.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/mainwindow.cpp --- kdepim-4.0.83/kleopatra/mainwindow.cpp 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/mainwindow.cpp 2008-07-08 10:56:26.000000000 +0100 @@ -34,8 +34,6 @@ #include "mainwindow.h" -#include "certificatewizardimpl.h" - #include "models/keylistmodel.h" #include "models/keylistsortfilterproxymodel.h" @@ -44,7 +42,10 @@ #include "view/keylistcontroller.h" #include "commands/exportcertificatecommand.h" +#include "commands/exportopenpgpcertstoservercommand.h" +#include "commands/exportsecretkeycommand.h" #include "commands/importcertificatefromfilecommand.h" +#include "commands/changepassphrasecommand.h" #include "commands/lookupcertificatescommand.h" #include "commands/reloadkeyscommand.h" #include "commands/refreshx509certscommand.h" @@ -55,18 +56,20 @@ #include "commands/signencryptfilescommand.h" #include "commands/clearcrlcachecommand.h" #include "commands/dumpcrlcachecommand.h" +#include "commands/dumpcertificatecommand.h" #include "commands/importcrlcommand.h" #include "commands/changeexpirycommand.h" #include "commands/changeownertrustcommand.h" #include "commands/selftestcommand.h" -#include "commands/signcertificatecommand.h" - -#include "conf/configuredialog.h" +#include "commands/certifycertificatecommand.h" +#include "commands/adduseridcommand.h" +#include "commands/newcertificatecommand.h" #include "utils/detail_p.h" #include "utils/gnupg-helper.h" #include "utils/stl_util.h" #include "utils/action_data.h" +#include "utils/classify.h" #include #include @@ -93,6 +96,8 @@ #include #include #include +#include +#include #include #include @@ -103,6 +108,12 @@ #include +#ifdef Q_OS_WIN32 +static const bool OS_WIN = true; +#else +static const bool OS_WIN = false; +#endif + using namespace Kleo; using namespace Kleo::Commands; using namespace boost; @@ -188,7 +199,9 @@ void refreshOpenPGPCertificates() { createAndStart(); } - + void changePassphrase() { + createAndStart(); + } void deleteCertificates() { createAndStart(); } @@ -201,8 +214,11 @@ void signEncryptFiles() { createAndStart(); } - void signCertificate() { - createAndStart(); + void certifyCertificate() { + createAndStart(); + } + void addUserID() { + createAndStart(); } void decryptVerifyFiles() { createAndStart(); @@ -210,6 +226,12 @@ void exportCertificates() { createAndStart(); } + void exportCertificatesToServer() { + createAndStart(); + } + void exportSecretKey() { + createAndStart(); + } void importCertificatesFromFile() { createAndStart(); } @@ -222,6 +244,9 @@ void dumpCrlCache() { createAndStart(); } + void dumpCertificate() { + createAndStart(); + } void importCrlFromFile() { createAndStart(); } @@ -232,13 +257,30 @@ void editKeybindings() { KShortcutsDialog::configure( q->actionCollection(), KShortcutsEditor::LetterShortcutsAllowed ); } - void newCertificate(); + void newCertificate() { + createAndStart(); + } void selfTest() { createAndStart(); } void configureBackend(); - void preferences(); + + void showHandbook(); + + void gnupgLogViewer() { + if( !QProcess::startDetached("kwatchgnupg" ) ) + KMessageBox::error( q, i18n( "Could not start the GnuPG Log Viewer (kwatchgnupg). " + "Please check your installation!" ), + i18n( "Error Starting KWatchGnuPG" ) ); + } + + void gnupgAdministrativeConsole() { + if( !QProcess::startDetached("kgpgconf" ) ) + KMessageBox::error( q, i18n( "Could not start the GnuPG Administrative Console (kgpgconf). " + "Please check your installation!" ), + i18n( "Error Starting KGpgConf" ) ); + } void slotConfigCommitted(); void slotContextMenuRequested( QAbstractItemView *, const QPoint & p ) { @@ -265,8 +307,6 @@ Kleo::AbstractKeyListModel * hierarchicalModel; Kleo::KeyListController controller; - QPointer configureDialog; - struct UI { TabWidget tabWidget; @@ -292,7 +332,6 @@ flatModel( AbstractKeyListModel::createFlatKeyListModel( q ) ), hierarchicalModel( AbstractKeyListModel::createHierarchicalKeyListModel( q ) ), controller( q ), - configureDialog(), ui( q ) { KDAB_SET_OBJECT_NAME( controller ); @@ -348,6 +387,10 @@ "document-new", q, SLOT(newCertificate()), "Ctrl+N", false, true }, { "file_export_certificates", i18n("Export Certificates..."), QString(), "document-export", q, SLOT(exportCertificates()), "Ctrl+E", false, true }, + { "file_export_certificates_to_server", i18n("Export Certificates to Server..."), QString(), + "document-export", q, SLOT(exportCertificatesToServer()), "Ctrl+Shift+E", false, true }, + { "file_export_secret_keys", i18n("Export Secret Key..."), QString(), + "document-export", q, SLOT(exportSecretKey()), QString(), false, true }, { "file_lookup_certificates", i18n("Lookup Certificates on Server..."), QString(), "edit-find", q, SLOT(lookupCertificates()), "Shift+Ctrl+I", false, true }, { "file_import_certificates", i18n("Import Certificates..."), QString(), @@ -366,13 +409,25 @@ // Certificate menu { "certificates_delete", i18n("Delete" ), QString()/*i18n("Delete selected certificates")*/, "edit-delete", q, SLOT(deleteCertificates()), "Delete", false, true }, - { "certificates_sign_certificate", i18n("Sign Certificate..."), QString(), - 0, q, SLOT(signCertificate()), QString(), false, true }, + { "certificates_certify_certificate", i18n("Certify Certificate..."), QString(), + 0, q, SLOT(certifyCertificate()), QString(), false, true }, { "certificates_change_expiry", i18n("Change Expiry Date..."), QString(), 0, q, SLOT(changeCertificateExpiry()), QString(), false, true }, { "certificates_change_owner_trust", i18n("Change Owner Trust..."), QString(), - 0, q, SLOT(changeCertificateOwnerTrust()), QString(), false, true }, + 0, q, SLOT(changeCertificateOwnerTrust()), QString(), false, true }, + { "certificates_change_passphrase", i18n("Change Passphrase..."), QString(), + 0, q, SLOT(changePassphrase()), QString(), false, true }, + { "certificates_add_userid", i18n("Add User-ID..."), QString(), + 0, q, SLOT(addUserID()), QString(), false, true }, + { "certificates_dump_certificate", i18n("Dump Certificate"), QString(), + 0, q, SLOT(dumpCertificate()), QString(), false, true }, // Tools menu + { "tools_start_kwatchgnupg", i18n("GnuPG Log Viewer"), QString(), + "kwatchgnupg", q, SLOT(gnupgLogViewer()), QString(), false, !OS_WIN }, +#if 0 + { "tools_start_kgpgconf", i18n("GnuPG Administrative Console"), QString(), + "kgpgconf", q, SLOT(gnupgLogViewer()), QString(), false, true }, +#endif { "tools_refresh_x509_certificates", i18n("Refresh X.509 Certificates"), QString(), "view-refresh", q, SLOT(refreshX509Certificates()), QString(), false, true }, { "tools_refresh_openpgp_certificates", i18n("Refresh OpenPGP Certificates"), QString(), @@ -383,11 +438,11 @@ 0, q, SLOT(dumpCrlCache()), QString(), false, true }, { "crl_import_crl", i18n("Import CRL From File..."), QString(), 0, q, SLOT(importCrlFromFile()), QString(), false, true }, + { "configure_backend", i18n("Configure GnuPG Backend..."), QString(), + 0, q, SLOT(configureBackend()), QString(), false, true }, // Settings menu { "settings_self_test", i18n("Perform Self-Test"), QString(), 0, q, SLOT(selfTest()), QString(), false, true }, - { "configure_backend", i18n("Configure GnuPG Backend..."), QString(), - 0, q, SLOT(configureBackend()), QString(), false, true }, // Window menu // (come from ui.tabWidget) }; @@ -404,7 +459,10 @@ KStandardAction::quit( q, SLOT(closeAndQuit()), q->actionCollection() ); KStandardAction::configureToolbars( q, SLOT(configureToolbars()), q->actionCollection() ); KStandardAction::keyBindings( q, SLOT(editKeybindings()), q->actionCollection() ); - KStandardAction::preferences( q, SLOT(preferences()), q->actionCollection() ); + KStandardAction::preferences( q, SIGNAL(configDialogRequested()), q->actionCollection() ); + + q->createStandardStatusBarAction(); + q->setStandardToolBarMenuEnabled( true ); // ### somehow make this better... @@ -414,9 +472,16 @@ controller.registerActionForCommand( coll->action( "view_redisplay" ) ); controller.registerActionForCommand( coll->action( "certificates_delete" ) ); controller.registerActionForCommand( coll->action( "certificates_change_expiry" ) ); + controller.registerActionForCommand( coll->action( "certificates_change_owner_trust" ) ); + controller.registerActionForCommand( coll->action( "certificates_change_passphrase" ) ); + controller.registerActionForCommand( coll->action( "certificates_certify_certificate" ) ); + controller.registerActionForCommand( coll->action( "certificates_add_userid" ) ); + controller.registerActionForCommand( coll->action( "certificates_dump_certificate" ) ); controller.registerActionForCommand( coll->action( "file_sign_encrypt_files" ) ); controller.registerActionForCommand( coll->action( "file_decrypt_verify_files" ) ); controller.registerActionForCommand( coll->action( "file_export_certificates" ) ); + controller.registerActionForCommand( coll->action( "file_export_certificates_to_server" ) ); + controller.registerActionForCommand( coll->action( "file_export_secret_keys" ) ); controller.registerActionForCommand( coll->action( "file_import_certificates" ) ); controller.registerActionForCommand( coll->action( "file_lookup_certificates" ) ); controller.registerActionForCommand( coll->action( "crl_clear_crl_cache" ) ); @@ -429,12 +494,6 @@ ui.tabWidget.createActions( coll ); } -void MainWindow::Private::newCertificate() { - QPointer wiz( new CertificateWizardImpl( q ) ); - wiz->exec(); - delete wiz; -} - void MainWindow::Private::configureBackend() { Kleo::CryptoConfig * const config = Kleo::CryptoBackendFactory::instance()->config(); if ( !config ) { @@ -460,19 +519,6 @@ } } -void MainWindow::Private::preferences() { - if ( !configureDialog ) { - configureDialog = new ConfigureDialog( q ); - configureDialog->setAttribute( Qt::WA_DeleteOnClose ); - connect( configureDialog, SIGNAL(configCommitted()), q, SLOT(slotConfigCommitted()) ); - } - - if ( configureDialog->isVisible() ) - configureDialog->raise(); - else - configureDialog->show(); -} - void MainWindow::Private::slotConfigCommitted() { controller.updateConfig(); } @@ -482,13 +528,15 @@ // so do not let it touch the event... kDebug(); if ( d->controller.hasRunningCommands() ) { - const int ret = KMessageBox::warningContinueCancel( this, i18n("There are still some background operations ongoing. " - "These will be terminated when closing the window. " - "Proceed?"), - i18n("Ongoing Background Tasks") ); - if ( ret != KMessageBox::Continue ) { - e->ignore(); - return; + if ( d->controller.shutdownWarningRequired() ) { + const int ret = KMessageBox::warningContinueCancel( this, i18n("There are still some background operations ongoing. " + "These will be terminated when closing the window. " + "Proceed?"), + i18n("Ongoing Background Tasks") ); + if ( ret != KMessageBox::Continue ) { + e->ignore(); + return; + } } d->controller.cancelCommands(); if ( d->controller.hasRunningCommands() ) { @@ -544,16 +592,14 @@ void MainWindow::dragEnterEvent( QDragEnterEvent * e ) { kDebug(); - if ( ( e->possibleActions() & Qt::CopyAction ) && - can_decode_local_files( e->mimeData() ) ) + if ( can_decode_local_files( e->mimeData() ) ) e->acceptProposedAction(); } void MainWindow::dropEvent( QDropEvent * e ) { kDebug(); - if ( !( e->possibleActions() & Qt::CopyAction ) || - !can_decode_local_files( e->mimeData() ) ) + if ( !can_decode_local_files( e->mimeData() ) ) return; e->setDropAction( Qt::CopyAction ); diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/mainwindow.h /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/mainwindow.h --- kdepim-4.0.83/kleopatra/mainwindow.h 2008-05-29 12:19:34.000000000 +0100 +++ kdepim-4.0.98/kleopatra/mainwindow.h 2008-07-08 10:56:26.000000000 +0100 @@ -46,6 +46,9 @@ public Q_SLOTS: void importCertificatesFromFile( const QStringList & files ); +Q_SIGNALS: + void configDialogRequested(); + protected: void closeEvent( QCloseEvent * e ); void showEvent( QShowEvent * e ); @@ -57,27 +60,33 @@ kdtools::pimpl_ptr d; Q_PRIVATE_SLOT( d, void changeCertificateExpiry() ) Q_PRIVATE_SLOT( d, void changeCertificateOwnerTrust() ) + Q_PRIVATE_SLOT( d, void changePassphrase() ) Q_PRIVATE_SLOT( d, void closeAndQuit() ) Q_PRIVATE_SLOT( d, void signEncryptFiles() ) - Q_PRIVATE_SLOT( d, void signCertificate() ) + Q_PRIVATE_SLOT( d, void certifyCertificate() ) Q_PRIVATE_SLOT( d, void decryptVerifyFiles() ) Q_PRIVATE_SLOT( d, void certificateDetails() ) Q_PRIVATE_SLOT( d, void deleteCertificates() ) Q_PRIVATE_SLOT( d, void importCertificatesFromFile() ) Q_PRIVATE_SLOT( d, void lookupCertificates() ) Q_PRIVATE_SLOT( d, void exportCertificates() ) + Q_PRIVATE_SLOT( d, void exportCertificatesToServer() ) + Q_PRIVATE_SLOT( d, void exportSecretKey() ) Q_PRIVATE_SLOT( d, void reloadCertificates() ) Q_PRIVATE_SLOT( d, void refreshX509Certificates() ) Q_PRIVATE_SLOT( d, void refreshOpenPGPCertificates() ) Q_PRIVATE_SLOT( d, void clearCrlCache() ) Q_PRIVATE_SLOT( d, void dumpCrlCache() ) + Q_PRIVATE_SLOT( d, void dumpCertificate() ) Q_PRIVATE_SLOT( d, void importCrlFromFile() ) Q_PRIVATE_SLOT( d, void newCertificate() ) + Q_PRIVATE_SLOT( d, void addUserID() ) Q_PRIVATE_SLOT( d, void selfTest() ) Q_PRIVATE_SLOT( d, void configureBackend() ) Q_PRIVATE_SLOT( d, void configureToolbars() ) Q_PRIVATE_SLOT( d, void editKeybindings() ) - Q_PRIVATE_SLOT( d, void preferences() ) + Q_PRIVATE_SLOT( d, void gnupgLogViewer() ) + Q_PRIVATE_SLOT( d, void gnupgAdministrativeConsole() ) Q_PRIVATE_SLOT( d, void slotConfigCommitted() ) Q_PRIVATE_SLOT( d, void slotContextMenuRequested(QAbstractItemView*,QPoint) ) }; diff -Nru /tmp/WkVVUJRft8/kdepim-4.0.83/kleopatra/models/keycache.cpp /tmp/rIRHhfyqQE/kdepim-4.0.98/kleopatra/models/keycache.cpp --- kdepim-4.0.83/kleopatra/models/keycache.cpp 2008-04-23 16:51:49.000000000 +0100 +++ kdepim-4.0.98/kleopatra/models/keycache.cpp 2008-07-08 10:56:20.000000000 +0100 @@ -61,6 +61,7 @@ #include #include #include +#include #include #include @@ -114,7 +115,7 @@ updateAutoKeyListingTimer(); } - template < template