diff -Nru kdepim-4.13.0/agents/archivemailagent/akonadi_archivemail_agent.notifyrc kdepim-4.13.3/agents/archivemailagent/akonadi_archivemail_agent.notifyrc --- kdepim-4.13.0/agents/archivemailagent/akonadi_archivemail_agent.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/archivemailagent/akonadi_archivemail_agent.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -8,6 +8,7 @@ Comment[da]=Agent til mail-arkivering Comment[de]=Agent zur E-Mail-Archivierung Comment[el]=Πράκτορας αρχειοθέτησης αλληλογραφίας +Comment[en_GB]=Archive Mail Agent Comment[es]=Agente de archivado de correo Comment[et]=Kirjade arhiveerimise agent Comment[fi]=Postin arkistointiagentti @@ -50,6 +51,7 @@ Name[da]=Agent til mail-arkivering Name[de]=Agent zur E-Mail-Archivierung Name[el]=Πράκτορας αρχειοθέτησης αλληλογραφίας +Name[en_GB]=Archive Mail Agent Name[es]=Agente de archivado de correo Name[et]=Kirjade arhiveerimise agent Name[fi]=Postin arkistointiagentti @@ -93,6 +95,7 @@ Name[da]=Mail-arkivering gennemført Name[de]=E-Mail-Archivierung beendet Name[el]=Η αρχειοθέτηση της αλληλογραφίας ολοκληρώθηκε +Name[en_GB]=Archive Mail finished Name[es]=Archivado de correo terminado Name[et]=Kirjad on arhiveeritud Name[fi]=Postin arkistointi valmis @@ -137,6 +140,7 @@ Name[da]=Mail-arkivering startet Name[de]=E-Mail-Archivierung gestartet Name[el]=Η αρχειοθέτηση της αλληλογραφίας ξεκίνησε +Name[en_GB]=Archive Mail started Name[es]=Archivado de correo iniciado Name[et]=Kirjade arhiveerimine algas Name[fi]=Postin arkistointi käynnistetty @@ -181,6 +185,7 @@ Name[da]=Fejl i mail-arkivering Name[de]=E-Mail-Archivierungsfehler Name[el]=Σφάλμα στην αρχειοθέτηση της αλληλογραφίας +Name[en_GB]=Archive Mail Error Name[es]=Error de archivado de correo Name[et]=Kirjade arhiveerimise tõrge Name[fi]=Postin arkistointivirhe diff -Nru kdepim-4.13.0/agents/archivemailagent/archivejob.cpp kdepim-4.13.3/agents/archivemailagent/archivejob.cpp --- kdepim-4.13.0/agents/archivemailagent/archivejob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/archivemailagent/archivejob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -54,6 +54,12 @@ deleteLater(); return; } + if (mInfo->url().isEmpty()) { + qDebug()<<" Path is empty"; + mManager->collectionDoesntExist(mInfo); + deleteLater(); + return; + } MailCommon::BackupJob *backupJob = new MailCommon::BackupJob(); backupJob->setRootFolder( MailCommon::Util::updatedCollection(collection) ); diff -Nru kdepim-4.13.0/agents/archivemailagent/archivemailagent.cpp kdepim-4.13.3/agents/archivemailagent/archivemailagent.cpp --- kdepim-4.13.0/agents/archivemailagent/archivemailagent.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/archivemailagent/archivemailagent.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -74,10 +74,15 @@ void ArchiveMailAgent::setEnableAgent(bool enabled) { - ArchiveMailAgentSettings::setEnabled(enabled); - ArchiveMailAgentSettings::self()->writeConfig(); - if (!enabled) { - pause(); + if (enabled != ArchiveMailAgentSettings::enabled()) { + ArchiveMailAgentSettings::setEnabled(enabled); + ArchiveMailAgentSettings::self()->writeConfig(); + if (!enabled) { + mTimer->stop(); + pause(); + } else { + mTimer->start(); + } } } @@ -145,9 +150,14 @@ } } -void ArchiveMailAgent::printArchiveListInfo() +QString ArchiveMailAgent::printArchiveListInfo() +{ + return mArchiveManager->printArchiveListInfo(); +} + +QString ArchiveMailAgent::printCurrentListInfo() { - mArchiveManager->printArchiveListInfo(); + return mArchiveManager->printCurrentListInfo(); } AKONADI_AGENT_MAIN( ArchiveMailAgent ) diff -Nru kdepim-4.13.0/agents/archivemailagent/archivemailagent.desktop kdepim-4.13.3/agents/archivemailagent/archivemailagent.desktop --- kdepim-4.13.0/agents/archivemailagent/archivemailagent.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/archivemailagent/archivemailagent.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,6 +7,7 @@ Name[da]=Agent til mail-arkivering Name[de]=Agent zur E-Mail-Archivierung Name[el]=Πράκτορας αρχειοθέτησης αλληλογραφίας +Name[en_GB]=Archive Mail Agent Name[es]=Agente de archivado de correo Name[et]=Kirjade arhiveerimise agent Name[fi]=Postin arkistointiagentti @@ -49,6 +50,7 @@ Comment[da]=Agent til mail-arkivering Comment[de]=Agent zur E-Mail-Archivierung Comment[el]=Πράκτορας αρχειοθέτησης αλληλογραφίας +Comment[en_GB]=Archive Mail Agent Comment[es]=Agente de archivado de correo Comment[et]=Kirjade arhiveerimise agent Comment[fi]=Postin arkistointiagentti diff -Nru kdepim-4.13.0/agents/archivemailagent/archivemailagent.h kdepim-4.13.3/agents/archivemailagent/archivemailagent.h --- kdepim-4.13.0/agents/archivemailagent/archivemailagent.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/archivemailagent/archivemailagent.h 2014-07-09 12:18:50.000000000 +0000 @@ -35,12 +35,12 @@ ~ArchiveMailAgent(); void showConfigureDialog(qlonglong windowId = 0); - void printArchiveListInfo(); + QString printArchiveListInfo(); void setEnableAgent(bool b); bool enabledAgent() const; - + QString printCurrentListInfo(); Q_SIGNALS: void archiveNow(ArchiveMailInfo *info); void needUpdateConfigDialogBox(); diff -Nru kdepim-4.13.0/agents/archivemailagent/archivemailmanager.cpp kdepim-4.13.3/agents/archivemailagent/archivemailmanager.cpp --- kdepim-4.13.0/agents/archivemailagent/archivemailmanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/archivemailagent/archivemailmanager.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -155,15 +155,40 @@ mArchiveMailKernel->jobScheduler()->resume(); } -void ArchiveMailManager::printArchiveListInfo() +QString ArchiveMailManager::printCurrentListInfo() { + QString infoStr; Q_FOREACH (ArchiveMailInfo *info, mListArchiveInfo) { - kDebug()<<"info: collectionId:"<saveCollectionId() - <<" saveSubCollection ?"<saveSubCollection() - <<" lastDateSaved:"<lastDateSaved() - <<" number of archive:"<maximumArchiveCount() - <<" directory"<url() - <<" enabled ?"<isEnabled(); + if (!infoStr.isEmpty()) + infoStr += QLatin1Char('\n'); + infoStr += infoToStr(info); } + return infoStr; +} + +QString ArchiveMailManager::infoToStr(ArchiveMailInfo *info) const +{ + QString infoStr = QLatin1String("collectionId: ") + QString::number(info->saveCollectionId()) + QLatin1Char('\n'); + infoStr += QLatin1String("save sub collection: ") + (info->saveSubCollection() ? QLatin1String("true") : QLatin1String("false")) + QLatin1Char('\n'); + infoStr += QLatin1String("last Date Saved: ") + info->lastDateSaved().toString() + QLatin1Char('\n'); + infoStr += QLatin1String("maximum achive number: ") + QString::number(info->maximumArchiveCount()) + QLatin1Char('\n'); + infoStr += QLatin1String("directory: ") + info->url().pathOrUrl() + QLatin1Char('\n'); + infoStr += QLatin1String("Enabled: ") + (info->isEnabled() ? QLatin1String("true") : QLatin1String("false")); + return infoStr; +} + +QString ArchiveMailManager::printArchiveListInfo() +{ + QString infoStr; + const QStringList collectionList = mConfig->groupList().filter( QRegExp( QLatin1String("ArchiveMailCollection \\d+") ) ); + const int numberOfCollection = collectionList.count(); + for (int i = 0 ; i < numberOfCollection; ++i) { + KConfigGroup group = mConfig->group(collectionList.at(i)); + ArchiveMailInfo info(group); + if (!infoStr.isEmpty()) + infoStr += QLatin1Char('\n'); + infoStr += infoToStr(&info); + } + return infoStr; } diff -Nru kdepim-4.13.0/agents/archivemailagent/archivemailmanager.h kdepim-4.13.3/agents/archivemailagent/archivemailmanager.h --- kdepim-4.13.0/agents/archivemailagent/archivemailmanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/archivemailagent/archivemailmanager.h 2014-07-09 12:18:50.000000000 +0000 @@ -37,9 +37,11 @@ void pause(); void resume(); - void printArchiveListInfo(); + QString printArchiveListInfo(); void collectionDoesntExist(ArchiveMailInfo *info); + QString printCurrentListInfo(); + public Q_SLOTS: void load(); void slotArchiveNow(ArchiveMailInfo *info); @@ -48,6 +50,7 @@ void needUpdateConfigDialogBox(); private: + QString infoToStr(ArchiveMailInfo *info) const; void removeCollectionId(Akonadi::Collection::Id id); KSharedConfig::Ptr mConfig; QList mListArchiveInfo; diff -Nru kdepim-4.13.0/agents/archivemailagent/org.freedesktop.Akonadi.ArchiveMailAgent.xml kdepim-4.13.3/agents/archivemailagent/org.freedesktop.Akonadi.ArchiveMailAgent.xml --- kdepim-4.13.0/agents/archivemailagent/org.freedesktop.Akonadi.ArchiveMailAgent.xml 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/archivemailagent/org.freedesktop.Akonadi.ArchiveMailAgent.xml 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,12 @@ - + + + + + + diff -Nru kdepim-4.13.0/agents/CMakeLists.txt kdepim-4.13.3/agents/CMakeLists.txt --- kdepim-4.13.0/agents/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/CMakeLists.txt 2014-07-09 12:18:50.000000000 +0000 @@ -6,6 +6,4 @@ add_subdirectory(archivemailagent) add_subdirectory(mailfilteragent) add_subdirectory(notesagent) -#comment until 4.13 -#add_subdirectory(followupreminderagent) install(FILES folderarchiveagent.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/akonadi/agents") diff -Nru kdepim-4.13.0/agents/folderarchiveagent.desktop kdepim-4.13.3/agents/folderarchiveagent.desktop --- kdepim-4.13.0/agents/folderarchiveagent.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/folderarchiveagent.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=Agent til mappe-arkivering Name[de]=Agent zur Ordner-Archivierung Name[el]=Πράκτορας φακέλου αρχειοθέτησης +Name[en_GB]=Folder Archive Agent Name[es]=Agente de archivado de carpeta +Name[et]=Kausta arhiveerimise agent Name[fi]=Kansioiden arkistointiagentti Name[fr]=Agent d'archivage de dossiers Name[gl]=Axente de Arquivo de Cartafoles @@ -38,7 +40,9 @@ Comment[da]=Agent til mappe-arkivering muliggør at gemme e-mails i en specifik arkivmappe Comment[de]=Der Agent zur Ordner-Archivierung ermöglicht das Speichern von E-Mails in angegebenen Archivordnern Comment[el]=Ο πράκτορας φακέλου αρχειοθέτησης σας επιτρέπει να αποθηκεύετε μηνύματα ηλ. αλληλογραφίας σε έναν συγκεκριμένο φάκελο αρχειοθέτησης +Comment[en_GB]=Folder Archive Agent allows to store mails in specific archive folder Comment[es]=El agente de archivado de carpeta permite almacenar correos en una carpeta de archivos específica +Comment[et]=Kausta arhiveerimise agent võimaldab salvestada kirju spetsiaalsesse arhiivikausta Comment[fi]=Kansioiden arkistointiagentti mahdollistaa postien tallettamisen erityisiin arkistokansioihin Comment[fr]=L'agent d'archivage de dossiers permet de stocker des courriers électroniques dans un dossier d'archive Comment[gl]=O Axente de Arquivo de Cartafoles permite almacenar o correo nun cartafol de arquivo específico diff -Nru kdepim-4.13.0/agents/followupreminderagent/akonadi_followupreminder_agent.notifyrc kdepim-4.13.3/agents/followupreminderagent/akonadi_followupreminder_agent.notifyrc --- kdepim-4.13.0/agents/followupreminderagent/akonadi_followupreminder_agent.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/akonadi_followupreminder_agent.notifyrc 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -[Global] -IconName=kmail -Comment=Followup reminder agent -Comment[bs]=Prateći agent koji Vas podsjeća -Comment[ca]=Agent per a recordatoris de seguiment -Comment[ca@valencia]=Agent per a recordatoris de seguiment -Comment[da]=Agent til opfølgningspåmindelse -Comment[de]=Agent zur Erinnerung an Folgenachrichten -Comment[el]=Πράκτορας υπενθύμισης συνέχισης επικοινωνίας -Comment[es]=Agente de recordatorio de seguimiento -Comment[fi]=Vastaamisesta muistuttaja -Comment[fr]=Agent de rappel des messages suivis -Comment[gl]=Axente de lembranzas de seguimento -Comment[hu]=Nyomkövető emlékeztető ügynök -Comment[ia]=Agente de memorar de continuation (Followup Reminder Agent) -Comment[it]=Agente per gli avvisi delle azioni da seguire -Comment[kk]=Жауап беру туралы ескерту агенті -Comment[nb]=Agent for påminnelse om oppfølging -Comment[nds]=Antwoortnaricht-Anstoothölper -Comment[nl]=Agent voor herinneren aan vervolgactie -Comment[pl]=Agent ponaglającego przypominania -Comment[pt]=Agente de chamadas de seguimento -Comment[pt_BR]=Agente de Acompanhamento -Comment[ru]=Агент напоминания о продолжении -Comment[sk]=Agent pripomienky sledovania -Comment[sr]=Агент подсећања на одговор -Comment[sr@ijekavian]=Агент подсећања на одговор -Comment[sr@ijekavianlatin]=Agent podsećanja na odgovor -Comment[sr@latin]=Agent podsećanja na odgovor -Comment[sv]=Påminnelseuppföljningsmodul -Comment[tr]=Takip hatırlatma aracı -Comment[uk]=Агент стеження за нагадуваннями -Comment[x-test]=xxFollowup reminder agentxx -Comment[zh_TW]=回覆提醒代理程式 - diff -Nru kdepim-4.13.0/agents/followupreminderagent/CMakeLists.txt kdepim-4.13.3/agents/followupreminderagent/CMakeLists.txt --- kdepim-4.13.0/agents/followupreminderagent/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -project(followupreminderagent) - -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" ) - -include_directories( - ${CMAKE_SOURCE_DIR}/messagecomposer/ -) - -set(followupreminderagent_SRCS - followupreminderagent.cpp - followupreminderconfiguredialog.cpp - followupremindermanager.cpp -) - -qt4_add_dbus_adaptor(followupreminderagent_SRCS org.freedesktop.Akonadi.FollowUpReminder.xml followupreminderagent.h FollowUpReminderAgent) - -kde4_add_kcfg_files(followupreminderagent_SRCS - followupreminderagentsettings.kcfgc -) - -kde4_add_executable(akonadi_followupreminder_agent ${followupreminderagent_SRCS}) - -target_link_libraries(akonadi_followupreminder_agent - ${KDEPIMLIBS_AKONADI_LIBS} - ${KDEPIMLIBS_AKONADI_KMIME_LIBS} -) - -if (Q_WS_MAC) - set_target_properties(akonadi_followupreminder_agent PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/Info.plist.template) - set_target_properties(akonadi_followupreminder_agent PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.akonadi_followupreminder_agent") - set_target_properties(akonadi_followupreminder_agent PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "KDE Akonadi Followup Reminder Agent") -endif () - -install(TARGETS akonadi_followupreminder_agent ${INSTALL_TARGETS_DEFAULT_ARGS} ) - -install(FILES followupreminder.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/akonadi/agents") - -install(FILES akonadi_followupreminder_agent.notifyrc DESTINATION "${DATA_INSTALL_DIR}/akonadi_followupreminder_agent" ) - diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupreminderagent.cpp kdepim-4.13.3/agents/followupreminderagent/followupreminderagent.cpp --- kdepim-4.13.0/agents/followupreminderagent/followupreminderagent.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupreminderagent.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "followupreminderagent.h" -#include "followupreminderadaptor.h" -#include "followupreminderconfiguredialog.h" -#include "followupreminderagentsettings.h" -#include - -#include - - -//#define DEBUG_FOLLOWUPREMINDERAGENT 1 - -FollowUpReminderAgent::FollowUpReminderAgent(const QString &id) - : Akonadi::AgentBase( id ) -{ - KGlobal::locale()->insertCatalog( QLatin1String("akonadi_followupreminder_agent") ); - new FollowUpReminderAgentAdaptor(this); - Akonadi::DBusConnectionPool::threadConnection().registerObject( QLatin1String( "/FollowUpReminder" ), this, QDBusConnection::ExportAdaptors ); - Akonadi::DBusConnectionPool::threadConnection().registerService( QLatin1String( "org.freedesktop.Akonadi.FollowUpReminder" ) ); - if (FollowUpReminderAgentSettings::enabled()) { -#ifdef DEBUG_FOLLOWUPREMINDERAGENT - //QTimer::singleShot(1000, mManager, SLOT(load())); -#else - //QTimer::singleShot(1000*60*4, mManager, SLOT(load())); -#endif - } -} - -FollowUpReminderAgent::~FollowUpReminderAgent() -{ -} - -void FollowUpReminderAgent::setEnableAgent(bool b) -{ - FollowUpReminderAgentSettings::self()->setEnabled(b); -} - -bool FollowUpReminderAgent::enabledAgent() const -{ - return FollowUpReminderAgentSettings::self()->enabled(); -} - -void FollowUpReminderAgent::showConfigureDialog(qlonglong windowId) -{ - //TODO -} - -void FollowUpReminderAgent::configure( WId windowId ) -{ - showConfigureDialog((qulonglong)windowId); -} - - -AKONADI_AGENT_MAIN( FollowUpReminderAgent ) - diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupreminderagent.h kdepim-4.13.3/agents/followupreminderagent/followupreminderagent.h --- kdepim-4.13.0/agents/followupreminderagent/followupreminderagent.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupreminderagent.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 FOLLOWUPREMINDERAGENT_H -#define FOLLOWUPREMINDERAGENT_H - -#include -class FollowUpReminderAgent : public Akonadi::AgentBase, public Akonadi::AgentBase::ObserverV3 -{ - Q_OBJECT -public: - explicit FollowUpReminderAgent(const QString &id); - ~FollowUpReminderAgent(); - - void setEnableAgent(bool b); - bool enabledAgent() const; - - void showConfigureDialog(qlonglong windowId = 0); - -public Q_SLOTS: - void configure( WId windowId ); -}; - -#endif // FOLLOWUPREMINDERAGENT_H diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupreminderagentsettings.kcfg kdepim-4.13.3/agents/followupreminderagent/followupreminderagentsettings.kcfg --- kdepim-4.13.0/agents/followupreminderagent/followupreminderagentsettings.kcfg 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupreminderagentsettings.kcfg 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - - - true - - - diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupreminderagentsettings.kcfgc kdepim-4.13.3/agents/followupreminderagent/followupreminderagentsettings.kcfgc --- kdepim-4.13.0/agents/followupreminderagent/followupreminderagentsettings.kcfgc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupreminderagentsettings.kcfgc 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -# Code generation options for kconfig_compiler -File=followupreminderagentsettings.kcfg -ClassName=FollowUpReminderAgentSettings -Singleton=true -Mutators=true diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupreminderconfiguredialog.cpp kdepim-4.13.3/agents/followupreminderagent/followupreminderconfiguredialog.cpp --- kdepim-4.13.0/agents/followupreminderagent/followupreminderconfiguredialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupreminderconfiguredialog.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "followupreminderconfiguredialog.h" - -#include -#include - -#include - -FollowUpReminderConfigureDialog::FollowUpReminderConfigureDialog(QWidget *parent) - : KDialog(parent) -{ - setCaption( i18n("Configure") ); - setWindowIcon( KIcon( QLatin1String("kmail") ) ); - setButtons( Help|Ok|Cancel ); - - QWidget *mainWidget = new QWidget( this ); - QHBoxLayout *mainLayout = new QHBoxLayout( mainWidget ); -} - -FollowUpReminderConfigureDialog::~FollowUpReminderConfigureDialog() -{ - -} - diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupreminderconfiguredialog.h kdepim-4.13.3/agents/followupreminderagent/followupreminderconfiguredialog.h --- kdepim-4.13.0/agents/followupreminderagent/followupreminderconfiguredialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupreminderconfiguredialog.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 FOLLOWUPREMINDERCONFIGUREDIALOG_H -#define FOLLOWUPREMINDERCONFIGUREDIALOG_H - -#include - -class FollowUpReminderConfigureDialog : public KDialog -{ - Q_OBJECT -public: - explicit FollowUpReminderConfigureDialog(QWidget *parent = 0); - ~FollowUpReminderConfigureDialog(); -}; - -#endif // FOLLOWUPREMINDERCONFIGUREDIALOG_H diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupreminder.desktop kdepim-4.13.3/agents/followupreminderagent/followupreminder.desktop --- kdepim-4.13.0/agents/followupreminderagent/followupreminder.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupreminder.desktop 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -[Desktop Entry] -Name=Followup Reminder Agent -Name[bs]=Prateći agent koji Vas podsjeća -Name[ca]=Agent per a recordatoris de seguiment -Name[ca@valencia]=Agent per a recordatoris de seguiment -Name[da]=Agent til opfølgningspåmindelse -Name[de]=Agent zur Erinnerung an Folgenachrichten -Name[el]=Πράκτορας υπενθύμισης συνέχισης επικοινωνίας -Name[es]=Agente de recordatorio de seguimiento -Name[fi]=Vastaamisesta muistuttaja -Name[fr]=Agent de rappel des messages suivis -Name[gl]=Axente de lembranzas de seguimento -Name[hu]=Nyomkövető emlékeztető ügynök -Name[ia]=Followup Reminder Agent -Name[it]=Agente per gli avvisi delle azioni da seguire -Name[kk]=Жауап беру туралы ескерту агенті -Name[nb]=Agent for påminnelse om oppfølging -Name[nds]=Antwoortnaricht-Anstoothölper -Name[nl]=Agent voor herinneren aan vervolgactie -Name[pl]=Agent ponaglającego przypominania -Name[pt]=Agente de Chamadas de Seguimento -Name[pt_BR]=Agente de Acompanhamento -Name[ru]=Агент напоминания о продолжении -Name[sk]=Agent pripomienky spracovania -Name[sr]=Агент подсећања на одговор -Name[sr@ijekavian]=Агент подсећања на одговор -Name[sr@ijekavianlatin]=Agent podsećanja na odgovor -Name[sr@latin]=Agent podsećanja na odgovor -Name[sv]=Påminnelseuppföljningsmodul -Name[tr]=Takip Hatırlatma Aracı -Name[uk]=Агент нагадування про відповіді -Name[x-test]=xxFollowup Reminder Agentxx -Name[zh_TW]=回覆提醒代理程式 -Comment=Followup Reminder Agent allows to remind you when an email was not answered. -Comment[bs]=Prateći agent koji Vas podsjeća omogućava vam informaciju kada neki email nije odgovoren. -Comment[ca]=L'agent per a recordatoris de seguiment permet recordar quan no s'ha rebut resposta d'un correu electrònic. -Comment[ca@valencia]=L'agent per a recordatoris de seguiment permet recordar quan no s'ha rebut resposta d'un correu electrònic. -Comment[da]=Agent til opfølgningspåmindelse muliggør at minde dig om når e-mail ikke er blevet besvaret. -Comment[de]=Der Agent zur Erinnerung an Folgenachrichten erinnert Sie, wenn eine E-Mail nicht beantwortet wurde. -Comment[el]=Ο πράκτορας υπενθύμισης συνέχισης επικοινωνίας σας υπενθυμίζει πότε ένα μήνυμα ηλ. αλληλογραφίας δεν έχει απαντηθεί. -Comment[es]=El agente de recordatorio de seguimiento permite recordarle cuando no se contestó un correo. -Comment[fi]=Vastaamisesta muistuttaja voi muistuttaa sinua, kun sähköpostiin ei ole vastattu. -Comment[fr]=L'agent de rappel des messages suivis permet de se rappeler lorsqu'il n'y a pas eu de réponse à un courriel. -Comment[gl]=O Axente de lembranzas de seguimento permite lembrarlle cando non se respondeu a unha mensaxe de correo. -Comment[hu]=A Nyomkövető emlékeztető ügynök lehetővé teszi, hogy emlékeztesse önt, ha egy levél nem lett megválaszolva. -Comment[ia]=Follorwup Reminder Agent permitte te de memorar te quando un message de e-posta esseva sin responsa. -Comment[it]=L'agente per gli avvisi delle azioni da seguire permette di avvisarti quando un messaggio di posta non ha avuto una risposta. -Comment[kk]=Жауап беру туралы ескерту агенті эл.поштаға жауап берілмегеніңізді ескереді. -Comment[nb]=Agenten for påminnelse om oppfølging kan minne deg om at det ikke er sendt svar på en e-post. -Comment[nds]=De Antwoortnaricht-Anstoothölper stööt Di an, wenn Du op en Nettbreef noch nich antert hest. -Comment[nl]=Agent voor herinneren aan vervolgactie stelt u in staat om u te herinneren aan een nog niet beantwoord e-mailbericht. -Comment[pl]=Agent ponaglającego przypominania przypomina ci gdy nie odpowiedziano na wiadomość. -Comment[pt]=O Agente de Chamadas de Seguimento permite recordar quando uma mensagem não foi respondida. -Comment[pt_BR]=O Agente de Acompanhamento permite-lhe lembrar de um e-mail não respondido. -Comment[ru]=Агент напоминания о продолжении будет напоминать вам о письмах, на которые вы не ответили. -Comment[sk]=Agent pripomienky spracovania vám umožní upozorniť vás, keď e-mail nemá odpoveď. -Comment[sr]=Агент подсећања на одговор издаје подсетнике о неодговореној е‑пошти. -Comment[sr@ijekavian]=Агент подсећања на одговор издаје подсетнике о неодговореној е‑пошти. -Comment[sr@ijekavianlatin]=Agent podsećanja na odgovor izdaje podsetnike o neodgovorenoj e‑pošti. -Comment[sr@latin]=Agent podsećanja na odgovor izdaje podsetnike o neodgovorenoj e‑pošti. -Comment[sv]=Påminnelseuppföljningsmodulen gör det möjligt att få en påminnelse när ett brev inte besvarats. -Comment[tr]=Takip hatırlatma aracı, bir e-posta yanıtlanmadığında hatırlatılmanızı sağlar. -Comment[uk]=Агент нагадування про відповіді нагадуватиме вам про електронні листи, на які ви не дали відповіді. -Comment[x-test]=xxFollowup Reminder Agent allows to remind you when an email was not answered.xx -Comment[zh_TW]=回覆提醒代理程式會在電子郵件未回覆時提醒您。 -Type=AkonadiAgent -Exec=akonadi_followupreminder_agent -Icon=kmail -X-Akonadi-MimeTypes=message/rfc822 -X-Akonadi-Capabilities=Unique,Autostart -X-Akonadi-Identifier=akonadi_followupreminder_agent diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupremindermanager.cpp kdepim-4.13.3/agents/followupreminderagent/followupremindermanager.cpp --- kdepim-4.13.0/agents/followupreminderagent/followupremindermanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupremindermanager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "followupremindermanager.h" - -FollowUpReminderManager::FollowUpReminderManager(QObject *parent) - : QObject(parent) -{ -} - -FollowUpReminderManager::~FollowUpReminderManager() -{ - -} - diff -Nru kdepim-4.13.0/agents/followupreminderagent/followupremindermanager.h kdepim-4.13.3/agents/followupreminderagent/followupremindermanager.h --- kdepim-4.13.0/agents/followupreminderagent/followupremindermanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/followupremindermanager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 FOLLOWUPREMINDERMANAGER_H -#define FOLLOWUPREMINDERMANAGER_H - -#include - -class FollowUpReminderManager : public QObject -{ - Q_OBJECT -public: - explicit FollowUpReminderManager(QObject *parent = 0); - ~FollowUpReminderManager(); -}; - -#endif // FOLLOWUPREMINDERMANAGER_H diff -Nru kdepim-4.13.0/agents/followupreminderagent/Messages.sh kdepim-4.13.3/agents/followupreminderagent/Messages.sh --- kdepim-4.13.0/agents/followupreminderagent/Messages.sh 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/Messages.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -#! /bin/sh -$XGETTEXT `find . -name '*.h' -o -name '*.cpp' | grep -v '/tests/'` -o $podir/akonadi_followupreminder_agent.pot diff -Nru kdepim-4.13.0/agents/followupreminderagent/org.freedesktop.Akonadi.FollowUpReminder.xml kdepim-4.13.3/agents/followupreminderagent/org.freedesktop.Akonadi.FollowUpReminder.xml --- kdepim-4.13.0/agents/followupreminderagent/org.freedesktop.Akonadi.FollowUpReminder.xml 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/followupreminderagent/org.freedesktop.Akonadi.FollowUpReminder.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff -Nru kdepim-4.13.0/agents/mailfilteragent/akonadi_mailfilter_agent.notifyrc kdepim-4.13.3/agents/mailfilteragent/akonadi_mailfilter_agent.notifyrc --- kdepim-4.13.0/agents/mailfilteragent/akonadi_mailfilter_agent.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/mailfilteragent/akonadi_mailfilter_agent.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -8,6 +8,7 @@ Comment[da]=Mailfilteragent Comment[de]=Agent zur E-Mail-Filterung Comment[el]=Πράκτορας φιλτραρίσματος αλληλογραφίας +Comment[en_GB]=Mail Filter Agent Comment[es]=Agente de filtro de correo Comment[et]=Kirjade filtreerimise agent Comment[fi]=Sähköpostisuodatin @@ -49,6 +50,7 @@ Name[da]=Mailfilteragent Name[de]=Agent zur E-Mail-Filterung Name[el]=Πράκτορας φιλτραρίσματος αλληλογραφίας +Name[en_GB]=Mail Filter Agent Name[es]=Agente de filtro de correo Name[et]=Kirjade filtreerimise agent Name[fi]=Sähköpostisuodatin @@ -92,6 +94,7 @@ Name[da]=Mailfilterlog aktiveret Name[de]=E-Mail-Filterprotokoll aktiviert Name[el]=Η καταγραφή φιλτραρίσματος μηνυμάτων ενεργοποιήθηκε +Name[en_GB]=Mail filter log enabled Name[es]=Registro de filtro de correo activado Name[et]=Kirjade filtreerimise logi on lubatud Name[fi]=Sähköpostisuodatinloki käytössä diff -Nru kdepim-4.13.0/agents/mailfilteragent/mailfilteragent.cpp kdepim-4.13.3/agents/mailfilteragent/mailfilteragent.cpp --- kdepim-4.13.0/agents/mailfilteragent/mailfilteragent.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/mailfilteragent/mailfilteragent.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -57,6 +57,7 @@ : Akonadi::AgentBase( id ), m_filterLogDialog( 0 ) { + KGlobal::locale()->insertCatalog(QLatin1String("libmailcommon")); Akonadi::AttributeFactory::registerAttribute(); DummyKernel *kernel = new DummyKernel( this ); CommonKernel->registerKernelIf( kernel ); //register KernelIf early, it is used by the Filter classes diff -Nru kdepim-4.13.0/agents/mailfilteragent/mailfilteragent.desktop kdepim-4.13.3/agents/mailfilteragent/mailfilteragent.desktop --- kdepim-4.13.0/agents/mailfilteragent/mailfilteragent.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/mailfilteragent/mailfilteragent.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,6 +7,7 @@ Name[da]=Mailfilteragent Name[de]=Agent zur E-Mail-Filterung Name[el]=Πράκτορας φιλτραρίσματος αλληλογραφίας +Name[en_GB]=Mail Filter Agent Name[es]=Agente de filtro de correo Name[et]=Kirjade filtreerimise agent Name[fi]=Sähköpostisuodatin @@ -47,6 +48,7 @@ Comment[da]=Udvidelse til at filtrere e-mails Comment[de]=Erweiterung zur Filterung von E-Mails Comment[el]=Επέκταση φιλτραρίσματος αλληλογραφίας +Comment[en_GB]=Extension to filter emails Comment[es]=Extensión para filtrar correos Comment[et]=Laiendus e-kirjade filtreerimiseks Comment[fi]=Sähköpostien suodatuslaajennus diff -Nru kdepim-4.13.0/agents/notesagent/akonadi_notes_agent.notifyrc kdepim-4.13.3/agents/notesagent/akonadi_notes_agent.notifyrc --- kdepim-4.13.0/agents/notesagent/akonadi_notes_agent.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/notesagent/akonadi_notes_agent.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -8,9 +8,12 @@ Comment[da]=Noter-agent Comment[de]=Notizen-Agent Comment[el]=Πράκτορας σημειώσεων +Comment[en_GB]=Notes Agent Comment[es]=Agente de notas +Comment[et]=Märkmete agent Comment[fi]=Muistiinpanoagentti Comment[fr]=Agent pour les notes +Comment[gl]=Axente de Notas Comment[hu]=Jegyzetek ügynök Comment[ia]=Agente de Notas Comment[it]=Agente delle note @@ -39,9 +42,12 @@ Name[da]=Modtog en note Name[de]=Notiz erhalten Name[el]=Λήψη σημείωσης +Name[en_GB]=Received a note Name[es]=Recibida una nota +Name[et]=Saadi märge Name[fi]=Muistiinpano vastaanotettu Name[fr]=Note reçue +Name[gl]=Recibiuse unha nota Name[hu]=Fogadott egy jegyzet Name[ia]=Il ha recipite un nota Name[it]=Nota ricevuta diff -Nru kdepim-4.13.0/agents/notesagent/notesagentalarmdialog.cpp kdepim-4.13.3/agents/notesagent/notesagentalarmdialog.cpp --- kdepim-4.13.0/agents/notesagent/notesagentalarmdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/notesagent/notesagentalarmdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -207,7 +207,11 @@ KMime::Message::Ptr noteMessage = item.payload(); if (!noteMessage) return; - const QString caption = noteMessage->subject(false)->asUnicodeString(); + const KMime::Headers::Subject * const subject = noteMessage->subject(false); + QString caption; + if (subject) { + caption = subject->asUnicodeString(); + } QPointer dlg = new NoteShared::NoteAlarmDialog(caption, this); dlg->setAlarm(attr->dateTime()); if (dlg->exec()) { diff -Nru kdepim-4.13.0/agents/notesagent/notesagent.desktop kdepim-4.13.3/agents/notesagent/notesagent.desktop --- kdepim-4.13.0/agents/notesagent/notesagent.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/notesagent/notesagent.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,9 +7,12 @@ Name[da]=Noter-agent Name[de]=Notizen-Agent Name[el]=Πράκτορας σημειώσεων +Name[en_GB]=Notes Agent Name[es]=Agente de notas +Name[et]=Märkmete agent Name[fi]=Muistiinpanoagentti Name[fr]=Agent pour les notes +Name[gl]=Axente de Notas Name[hu]=Jegyzetek ügynök Name[ia]=Agente de Notas (Notes Agent) Name[it]=Agente delle note @@ -36,9 +39,12 @@ Comment[da]=Tilføjer noter modtaget via netværk og håndterer bekendtgørelse af notealarmer Comment[de]=Fügt Notizen hinzu, die über das Netzwerk erhalten wurden und verarbeitet Benachrichtigungen über Notiz-Erinnerungen Comment[el]=Προσθέτει σημειώσεις που έχουν ληφθεί δικτυακά και χειρίζεται τις ειδοποιήσεις συναγερμού σημειώσεων +Comment[en_GB]=Adds notes received via network and handles note alarm notifications Comment[es]=Añade notas recibidas vía red y maneja notificaciones de alarmas de notas +Comment[et]=Märkmete lisamine võrgu kaudu ja märkmehäirete märguannete käitlemine Comment[fi]=Lisää verkon välityksellä vastaanotetut muistiinpanot ja käsittelee muistiinpanojen hälytysilmoitukset Comment[fr]=Ajoute les notes reçus par le réseau et gère les notifications d'alarme +Comment[gl]=Engade notas recibidas a través da rede e xestiona as notificacións das alarmas das notas Comment[hu]=Hálózatról fogadott jegyzeteket ad hozzá és kezeli a jegyzetriasztási értesítéseket Comment[ia]=Adde notas recipite via rete e manea notificationes de nota de alarma Comment[it]=Aggiunge le note ricevute via rete e gestisce le notifiche di avvisi delle note diff -Nru kdepim-4.13.0/agents/notesagent/notesagentnotedialog.cpp kdepim-4.13.3/agents/notesagent/notesagentnotedialog.cpp --- kdepim-4.13.0/agents/notesagent/notesagentnotedialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/notesagent/notesagentnotedialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -81,7 +81,9 @@ const Akonadi::Item item = lstItem.first(); KMime::Message::Ptr noteMessage = item.payload(); if (noteMessage) { - mSubject->setText(noteMessage->subject(false)->asUnicodeString()); + const KMime::Headers::Subject * const subject = noteMessage->subject(false); + if (subject) + mSubject->setText(subject->asUnicodeString()); if ( noteMessage->contentType()->isHTMLText() ) { mNote->setAcceptRichText(true); mNote->setHtml(noteMessage->mainBodyPart()->decodedText()); diff -Nru kdepim-4.13.0/agents/sendlateragent/akonadi_sendlater_agent.notifyrc kdepim-4.13.3/agents/sendlateragent/akonadi_sendlater_agent.notifyrc --- kdepim-4.13.0/agents/sendlateragent/akonadi_sendlater_agent.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/sendlateragent/akonadi_sendlater_agent.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -7,7 +7,9 @@ Comment[da]=Agent til send senere Comment[de]=Agent zum späteren Senden Comment[el]=Πράκτορας ετεροχρονισμένης αποστολής +Comment[en_GB]=Send Later Agent Comment[es]=Agente de enviar más tarde +Comment[et]=Hilisema saatmise agent Comment[fi]=Lähetä myöhemmin -agentti Comment[fr]=Agent d'envoi différé Comment[gl]=Axente para enviar máis tarde @@ -45,7 +47,9 @@ Name[da]=E-mail sendt Name[de]=E-Mail wurde versendet Name[el]=το μήνυμα εσταλη +Name[en_GB]=Mail is sent Name[es]=Correo enviado +Name[et]=Kiri on saadetud Name[fi]=Posti on lähetetty Name[fr]=Courriel envoyé Name[gl]=Enviouse o correo @@ -84,7 +88,9 @@ Name[da]=Afsendelse af e-mail mislykkedes Name[de]=Das Versenden der E-Mail ist fehlgeschlagen Name[el]=Η αποστολή της αλληλογραφίας απέτυχε +Name[en_GB]=Send mail failed Name[es]=Falló el envío del correo +Name[et]=Kirja saatmine nurjus Name[fi]=Postin lähetys epäonnistui Name[fr]=Erreur lors de l'envoi du courriel Name[gl]=Non foi posíbel enviar o correo diff -Nru kdepim-4.13.0/agents/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml kdepim-4.13.3/agents/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml --- kdepim-4.13.0/agents/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/sendlateragent/org.freedesktop.Akonadi.SendLaterAgent.xml 2014-07-09 12:18:50.000000000 +0000 @@ -10,7 +10,9 @@ - + + + diff -Nru kdepim-4.13.0/agents/sendlateragent/sendlateragent.cpp kdepim-4.13.3/agents/sendlateragent/sendlateragent.cpp --- kdepim-4.13.0/agents/sendlateragent/sendlateragent.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/sendlateragent/sendlateragent.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -156,9 +156,9 @@ } } -void SendLaterAgent::printDebugInfo() +QString SendLaterAgent::printDebugInfo() { - mManager->printDebugInfo(); + return mManager->printDebugInfo(); } AKONADI_AGENT_MAIN( SendLaterAgent ) diff -Nru kdepim-4.13.0/agents/sendlateragent/sendlateragent.desktop kdepim-4.13.3/agents/sendlateragent/sendlateragent.desktop --- kdepim-4.13.0/agents/sendlateragent/sendlateragent.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/sendlateragent/sendlateragent.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=Agent til send senere Name[de]=Agent zum späteren Senden Name[el]=Πράκτορας ετεροχρονισμένης αποστολής +Name[en_GB]=Send Later Agent Name[es]=Agente de enviar después +Name[et]=Hilisema saatmise agent Name[fi]=Lähetä myöhemmin -agentti Name[fr]=Agent d'envoi différé Name[gl]=Axente para enviar máis tarde @@ -41,7 +43,9 @@ Comment[da]=Agent til send senere Comment[de]=Agent zum späteren Senden Comment[el]=Πράκτορας ετεροχρονισμένης αποστολής +Comment[en_GB]=Send Later Agent Comment[es]=Agente de enviar más tarde +Comment[et]=Hilisema saatmise agent Comment[fi]=Lähetä myöhemmin -agentti Comment[fr]=Agent d'envoi différé Comment[gl]=Axente para enviar máis tarde diff -Nru kdepim-4.13.0/agents/sendlateragent/sendlateragent.h kdepim-4.13.3/agents/sendlateragent/sendlateragent.h --- kdepim-4.13.0/agents/sendlateragent/sendlateragent.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/sendlateragent/sendlateragent.h 2014-07-09 12:18:50.000000000 +0000 @@ -32,7 +32,7 @@ void showConfigureDialog(qlonglong windowId = 0); - void printDebugInfo(); + QString printDebugInfo(); void setEnableAgent(bool b); bool enabledAgent() const; diff -Nru kdepim-4.13.0/agents/sendlateragent/sendlatermanager.cpp kdepim-4.13.3/agents/sendlateragent/sendlatermanager.cpp --- kdepim-4.13.0/agents/sendlateragent/sendlatermanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/sendlateragent/sendlatermanager.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -67,8 +67,11 @@ const int numberOfItems = itemList.count(); for (int i = 0 ; i < numberOfItems; ++i) { KConfigGroup group = mConfig->group(itemList.at(i)); - SendLater::SendLaterInfo *info = new SendLater::SendLaterInfo(group); - mListSendLaterInfo.append(info); + SendLater::SendLaterInfo *info = new SendLater::SendLaterInfo(group); + if (info->isValid()) + mListSendLaterInfo.append(info); + else + delete info; } createSendInfoList(); } @@ -216,16 +219,26 @@ removeInfo(info->itemId()); } -void SendLaterManager::printDebugInfo() +QString SendLaterManager::printDebugInfo() { + QString infoStr; Q_FOREACH (SendLater::SendLaterInfo *info, mListSendLaterInfo) { - kDebug() <<" recusive "<isRecurrence() << - " id :"<itemId()<< - " date :"<dateTime().toString()<< - " last saved date"<lastDateTimeSend().toString()<< - " subject :"<subject()<< - " to :"<to(); - } + if (!infoStr.isEmpty()) + infoStr += QLatin1Char('\n'); + infoStr += infoToStr(info); + } + return infoStr; +} + +QString SendLaterManager::infoToStr(SendLater::SendLaterInfo *info) +{ + QString infoStr = QLatin1String("Recusive ") + (info->isRecurrence() ? QLatin1String("true") : QLatin1String("false")); + infoStr += QLatin1String("Item id :") + QString::number(info->itemId()); + infoStr += QLatin1String("Send date:") + info->dateTime().toString(); + infoStr += QLatin1String("Last saved date: ") + info->lastDateTimeSend().toString(); + infoStr += QLatin1String("Mail subject :") + info->subject(); + infoStr += QLatin1String("To: ") + info->to(); + return infoStr; } MessageComposer::AkonadiSender *SendLaterManager::sender() const diff -Nru kdepim-4.13.0/agents/sendlateragent/sendlatermanager.h kdepim-4.13.3/agents/sendlateragent/sendlatermanager.h --- kdepim-4.13.0/agents/sendlateragent/sendlatermanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/agents/sendlateragent/sendlatermanager.h 2014-07-09 12:18:50.000000000 +0000 @@ -52,7 +52,7 @@ void sendDone(SendLater::SendLaterInfo *info); void sendError(SendLater::SendLaterInfo *info, ErrorType type); - void printDebugInfo(); + QString printDebugInfo(); void stopAll(); void itemRemoved(Akonadi::Item::Id id); @@ -72,6 +72,7 @@ void createSendInfoList(); private: + QString infoToStr(SendLater::SendLaterInfo *info); void removeLaterInfo(SendLater::SendLaterInfo *info); SendLater::SendLaterInfo *searchInfo(Akonadi::Item::Id id); void recreateSendList(); diff -Nru kdepim-4.13.0/akregator/configuration/akregator_config_advanced.desktop kdepim-4.13.3/akregator/configuration/akregator_config_advanced.desktop --- kdepim-4.13.0/akregator/configuration/akregator_config_advanced.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/akregator/configuration/akregator_config_advanced.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -121,6 +121,7 @@ X-KDE-Keywords[da]=akregator, indstil, indstillinger, avanceret X-KDE-Keywords[de]=Akregator,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,weiterführend X-KDE-Keywords[el]=akregator, διαμόρφωση, ρυθμίσεις, για προχωρημένους +X-KDE-Keywords[en_GB]=akregator, configure, settings, advanced X-KDE-Keywords[es]=akregator, configurar, preferencias, avanzado X-KDE-Keywords[et]=akregator, seadistamine, seadistused, muu X-KDE-Keywords[fi]=akregator, configure, settings, asetukset, advanced, lisäasetukset diff -Nru kdepim-4.13.0/akregator/configuration/akregator_config_appearance.desktop kdepim-4.13.3/akregator/configuration/akregator_config_appearance.desktop --- kdepim-4.13.0/akregator/configuration/akregator_config_appearance.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/akregator/configuration/akregator_config_appearance.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -140,6 +140,7 @@ X-KDE-Keywords[da]=akregator, indstil, indstillinger, avanceret, udseende X-KDE-Keywords[de]=Akregator,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,Erscheinungsbild,Aussehen,Handhabung X-KDE-Keywords[el]=akregator, διαμόρφωση, ρυθμίσεις, εμφάνιση, μορφή, αίσθηση +X-KDE-Keywords[en_GB]=akregator, configure, settings, appearance, look, feel X-KDE-Keywords[es]=akregator, configurar, preferencias, apariencia, aspecto, sensación X-KDE-Keywords[et]=akregator, seadistamine, seadistused, välimus X-KDE-Keywords[fi]=akregator, configure, settings, asetukset, appearance, look, ulkoasu, ulkonäkö, feel, tuntuma diff -Nru kdepim-4.13.0/akregator/configuration/akregator_config_archive.desktop kdepim-4.13.3/akregator/configuration/akregator_config_archive.desktop --- kdepim-4.13.0/akregator/configuration/akregator_config_archive.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/akregator/configuration/akregator_config_archive.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -120,6 +120,7 @@ X-KDE-Keywords[da]=akregator, indstil, indstillinger, arkiv X-KDE-Keywords[de]=Akregator,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,Archiv X-KDE-Keywords[el]=akregator, διαμόρφωση, ρυθμίσεις, αρχειοθήκη +X-KDE-Keywords[en_GB]=akregator, configure, settings, archive X-KDE-Keywords[es]=akregator, configurar, preferencias, archivo X-KDE-Keywords[et]=akregator, seadistamine, seadistused, arhiiv X-KDE-Keywords[fi]=akregator, configure, settings, asetukset, archive, arkisto diff -Nru kdepim-4.13.0/akregator/configuration/akregator_config_browser.desktop kdepim-4.13.3/akregator/configuration/akregator_config_browser.desktop --- kdepim-4.13.0/akregator/configuration/akregator_config_browser.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/akregator/configuration/akregator_config_browser.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -120,6 +120,7 @@ X-KDE-Keywords[da]=akregator, indstil, indstillinger, browser, web, intern X-KDE-Keywords[de]=Akregator,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,Browser,Web,intern X-KDE-Keywords[el]=akregator, διαμόρφωση, ρυθμίσεις, Περιηγητής, Ιστός, Εσωτερικός +X-KDE-Keywords[en_GB]=akregator, configure, settings, Browser, Web, Internal X-KDE-Keywords[es]=akregator, configurar, preferencias, navegador, web, interno X-KDE-Keywords[et]=akregator, seadistamine, seadistused, brauser, veeb X-KDE-Keywords[fi]=akregator, configure, settings, asetukset, Browser, Selain, Web, Internal, Sisäinen diff -Nru kdepim-4.13.0/akregator/configuration/akregator_config_general.desktop kdepim-4.13.3/akregator/configuration/akregator_config_general.desktop --- kdepim-4.13.0/akregator/configuration/akregator_config_general.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/akregator/configuration/akregator_config_general.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -141,6 +141,7 @@ X-KDE-Keywords[da]=akregator, indstil, indstillinger, generelt X-KDE-Keywords[de]=Akregator,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,allgemein X-KDE-Keywords[el]=akregator, διαμόρφωση, ρυθμίσεις, Γενικά +X-KDE-Keywords[en_GB]=akregator, configure, settings, General X-KDE-Keywords[es]=akregator, configurar, preferencias, general X-KDE-Keywords[et]=akregator, seadistamine, seadistused, üldine X-KDE-Keywords[fi]=akregator, configure, settings, asetukset, General, Yleiset diff -Nru kdepim-4.13.0/akregator/plugins/mk4storage/metakit/src/viewx.cpp kdepim-4.13.3/akregator/plugins/mk4storage/metakit/src/viewx.cpp --- kdepim-4.13.0/akregator/plugins/mk4storage/metakit/src/viewx.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/akregator/plugins/mk4storage/metakit/src/viewx.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -12,7 +12,7 @@ ///////////////////////////////////////////////////////////////////////////// -c4_Sequence::c4_Sequence(): _refCount(0), _dependencies(0), _propertyLimit(0), +c4_Sequence::c4_Sequence(): _refCount(0), _dependencies(0), _propertyLimit(0), _propertyMap(0), _tempBuf(0){} c4_Sequence::~c4_Sequence() { diff -Nru kdepim-4.13.0/akregator/plugins/onlinesync/akregator_config_onlinesync.desktop kdepim-4.13.3/akregator/plugins/onlinesync/akregator_config_onlinesync.desktop --- kdepim-4.13.0/akregator/plugins/onlinesync/akregator_config_onlinesync.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/akregator/plugins/onlinesync/akregator_config_onlinesync.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -15,6 +15,7 @@ X-KDE-Keywords[da]=akregator, indstil, indstillinger, online læsere X-KDE-Keywords[de]=Akregator,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,online Reader X-KDE-Keywords[el]=akregator, διαμόρφωση, ρυθμίσεις, αναγνώστες στο διαδίκτυο +X-KDE-Keywords[en_GB]=akregator, configure, settings, online readers X-KDE-Keywords[es]=akregator, configurar, preferencias lectores en línea X-KDE-Keywords[et]=akregator, seadistamine, seadistused, internetilugejad X-KDE-Keywords[fi]=akregator, configure, asetukset, settings, online readers, verkkolukijat, online-lukijat diff -Nru kdepim-4.13.0/akregator/plugins/sharemicroblog/akregator_config_sharemicroblog.desktop kdepim-4.13.3/akregator/plugins/sharemicroblog/akregator_config_sharemicroblog.desktop --- kdepim-4.13.0/akregator/plugins/sharemicroblog/akregator_config_sharemicroblog.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/akregator/plugins/sharemicroblog/akregator_config_sharemicroblog.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -15,6 +15,7 @@ X-KDE-Keywords[da]=akregator, indstil, indstillinger, online læsere X-KDE-Keywords[de]=Akregator,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,online Reader X-KDE-Keywords[el]=akregator, διαμόρφωση, ρυθμίσεις, αναγνώστες στο διαδίκτυο +X-KDE-Keywords[en_GB]=akregator, configure, settings, online readers X-KDE-Keywords[es]=akregator, configurar, preferencias lectores en línea X-KDE-Keywords[et]=akregator, seadistamine, seadistused, internetilugejad X-KDE-Keywords[fi]=akregator, configure, asetukset, settings, online readers, verkkolukijat, online-lukijat diff -Nru kdepim-4.13.0/cmake/modules/FindLinkGrammar.cmake kdepim-4.13.3/cmake/modules/FindLinkGrammar.cmake --- kdepim-4.13.0/cmake/modules/FindLinkGrammar.cmake 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/cmake/modules/FindLinkGrammar.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -# Try to find Linkgrammar -# Once done, this module with define: -# LinkGrammar_FOUND - True if LinkGrammar was found -# LinkGrammar_INCLUDE_DIR - The LinkGrammar include directory -# LinkGrammar_LIBRARIES - The LinkGrammar libraries - -# Copyright (c) 2013, Laurent Montel, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -find_path(LinkGrammar_INCLUDE_DIR link-grammar/link-includes.h) - -find_library(LinkGrammar_LIBRARIES NAMES link-grammar) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(LinkGrammar DEFAULT_MSG LinkGrammar_LIBRARIES LinkGrammar_INCLUDE_DIR) - -mark_as_advanced(LinkGrammar_INCLUDE_DIR LinkGrammar_LIBRARIES) diff -Nru kdepim-4.13.0/CMakeLists.txt kdepim-4.13.3/CMakeLists.txt --- kdepim-4.13.0/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/CMakeLists.txt 2014-07-09 12:18:50.000000000 +0000 @@ -89,7 +89,7 @@ set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}") endif() -set(KDEPIM_VERSION "4.13${KDEPIM_DEV_VERSION}") +set(KDEPIM_VERSION "4.13.3${KDEPIM_DEV_VERSION}") configure_file(kdepim-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/kdepim-version.h @ONLY) @@ -100,7 +100,7 @@ find_package(KDE4 4.12.0 REQUIRED) include(KDE4Defaults) -find_package(KdepimLibs 4.13.0) +find_package(KdepimLibs 4.13.3) set_package_properties(KdepimLibs PROPERTIES DESCRIPTION "The KDEPIM libraries" URL "http://www.kde.org" TYPE REQUIRED) ############### Load the CTest options ############### @@ -166,7 +166,7 @@ # Otherwise... ############### Find the stuff we need ############### # Akonadi - find_package(Akonadi 1.12.0 QUIET CONFIG) + find_package(Akonadi 1.12.1 QUIET CONFIG) set_package_properties(Akonadi PROPERTIES DESCRIPTION "Akonadi server libraries" URL "http://pim.kde.org/akonadi" TYPE REQUIRED PURPOSE "Akonadi is required to build KDEPIM") find_package(ZLIB) @@ -245,7 +245,6 @@ add_subdirectory(kdgantt2) add_subdirectory(icons) add_subdirectory(composereditor-ng) - add_subdirectory(grammar) add_subdirectory(messagecore) add_subdirectory(grantleetheme) add_subdirectory(messagelist) @@ -281,7 +280,6 @@ add_definitions(-DKMAIL_SUPPORTED) endif() - macro_optional_add_subdirectory(pimactivity) macro_optional_add_subdirectory(korganizer) macro_optional_add_subdirectory(korgac) macro_optional_add_subdirectory(sieveeditor) diff -Nru kdepim-4.13.0/composereditor-ng/composerview.cpp kdepim-4.13.3/composereditor-ng/composerview.cpp --- kdepim-4.13.0/composereditor-ng/composerview.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/composereditor-ng/composerview.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -259,6 +259,7 @@ void ComposerView::addExtraAction(QMenu *menu) { + Q_UNUSED(menu); //Redefine if necessary. } diff -Nru kdepim-4.13.0/console/calendarjanitor/main.cpp kdepim-4.13.3/console/calendarjanitor/main.cpp --- kdepim-4.13.0/console/calendarjanitor/main.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/console/calendarjanitor/main.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -39,6 +39,7 @@ # include # include # include +# include #endif static const char progName[] = "calendarjanitor"; diff -Nru kdepim-4.13.0/contactthemeeditor/contacteditormainwindow.cpp kdepim-4.13.3/contactthemeeditor/contacteditormainwindow.cpp --- kdepim-4.13.0/contactthemeeditor/contacteditormainwindow.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/contactthemeeditor/contacteditormainwindow.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -196,19 +196,19 @@ if (directory.isEmpty()) return; closeThemeEditor(); - loadTheme(directory); - mRecentFileAction->addUrl(KUrl(directory)); + if (loadTheme(directory)) + mRecentFileAction->addUrl(KUrl(directory)); mSaveAction->setEnabled(false); } -void ContactEditorMainWindow::loadTheme(const QString &directory) +bool ContactEditorMainWindow::loadTheme(const QString &directory) { if (!directory.isEmpty()) { const QString filename = directory + QDir::separator() + QLatin1String("theme.themerc"); QFile file(filename); if (!file.exists()) { KMessageBox::error(this, i18n("Directory does not contain a theme file. We cannot load theme.")); - return; + return false; } mContactEditor = new ContactEditorPage(QString(), QString()); @@ -218,6 +218,7 @@ setCentralWidget(mContactEditor); updateActions(); } + return true; } diff -Nru kdepim-4.13.0/contactthemeeditor/contacteditormainwindow.h kdepim-4.13.3/contactthemeeditor/contacteditormainwindow.h --- kdepim-4.13.0/contactthemeeditor/contacteditormainwindow.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/contactthemeeditor/contacteditormainwindow.h 2014-07-09 12:18:50.000000000 +0000 @@ -59,7 +59,7 @@ SaveAndCreateNewTheme }; - void loadTheme(const QString &directory); + bool loadTheme(const QString &directory); void readConfig(); void updateActions(); bool saveCurrentProject(ActionSaveTheme act); diff -Nru kdepim-4.13.0/contactthemeeditor/contactthemeeditor.desktop kdepim-4.13.3/contactthemeeditor/contactthemeeditor.desktop --- kdepim-4.13.0/contactthemeeditor/contactthemeeditor.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/contactthemeeditor/contactthemeeditor.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=Tema-editor til kontakter Name[de]=Designeditor für Kontakte Name[el]=Επεξεργαστής θεμάτων επαφών +Name[en_GB]=Contact Theme Editor Name[es]=Editor de temas de Contact +Name[et]=Kontaktiteema redaktor Name[fi]=Yhteystietoteemamuokkain Name[fr]=Éditeur de thème pour les contacts Name[gl]=Editor de Temas de Contacto @@ -43,7 +45,9 @@ GenericName[da]=Tema-editor til kontakter GenericName[de]=Designeditor für Kontakte GenericName[el]=Επεξεργαστής θεμάτων επαφών +GenericName[en_GB]=Contact Theme Editor GenericName[es]=Editor de temas de Contact +GenericName[et]=Kontaktiteema redaktor GenericName[fi]=Yhteystietoteemamuokkain GenericName[fr]=Éditeur de thème pour les contacts GenericName[gl]=Editor de Temas de Contacto diff -Nru kdepim-4.13.0/debian/changelog kdepim-4.13.3/debian/changelog --- kdepim-4.13.0/debian/changelog 2014-04-10 20:52:58.000000000 +0000 +++ kdepim-4.13.3/debian/changelog 2018-03-25 16:02:11.000000000 +0000 @@ -1,3 +1,32 @@ +kdepim (4:4.13.3-0ubuntu0.2) trusty-security; urgency=medium + + * SECURITY UPDATE: Send Later with Delay bypasses OpenPGP (LP: #1698180): + - fix-CVE-2017-9604.patch + - CVE-2017-9604 + + -- Simon Quigley Sun, 25 Mar 2018 11:02:11 -0500 + +kdepim (4:4.13.3-0ubuntu0.1) trusty; urgency=medium + + * New upstream bugfix release (LP: #1349296) + + -- Philip Muškovac Mon, 04 Aug 2014 20:26:09 +0200 + +kdepim (4:4.13.2-0ubuntu0.1) trusty; urgency=medium + + * New upstream bugfix release (LP: #1327591) + + -- Philip Muškovac Wed, 18 Jun 2014 12:47:46 +0200 + +kdepim (4:4.13.1-0ubuntu0.1) trusty; urgency=medium + + * New upstream bugfix release (LP: #1318142) + - Add kubuntu_revert_9fed45112711cf203a03ba3b3ed5ca0ee796c836.diff and + kubuntu_revert_e6ebd9b593dfd366b8c57932cc3167a8a3ec5b3b.diff to prevent + the removal of libgrammar4 and libpimactivity4 + + -- Philip Muškovac Wed, 04 Jun 2014 16:50:43 +0200 + kdepim (4:4.13.0-0ubuntu1) trusty; urgency=medium [ Jonathan Riddell ] diff -Nru kdepim-4.13.0/debian/control kdepim-4.13.3/debian/control --- kdepim-4.13.0/debian/control 2014-04-10 20:52:58.000000000 +0000 +++ kdepim-4.13.3/debian/control 2014-07-28 08:59:41.000000000 +0000 @@ -9,7 +9,7 @@ George Kiagiadakis , Eshat Cakar Build-Depends: kde-sc-dev-latest (>= 4:4.10.2), cmake, debhelper (>= 7.3.16), pkg-kde-tools (>= 0.12), - kdepimlibs5-dev (>= 4:4.13.0), libphonon-dev (>= 4:4.6.0really4.3.80), + kdepimlibs5-dev (>= 4:4.13.3), libphonon-dev (>= 4:4.6.0really4.3.80), pkg-config, libgpgme11-dev, libboost1.54-dev (>= 1.40.0-2), libboost-graph1.54-dev (>= 1.40.0-2), libsasl2-dev, xsltproc, libxss-dev, libqca2-dev (>= 2.0.0), libassuan-dev, @@ -18,7 +18,7 @@ libakonadi-dev (>= 1.7.2), shared-desktop-ontologies (>= 0.6.50), libgrantlee-dev, libqtwebkit-dev, libqt4-opengl-dev, libprison-dev, libindicate-qt-dev, libxml2-dev, sharutils, - libkactivities-dev (>= 4:4.13.0), liblink-grammar4-dev, libqjson-dev, baloo-dev (>= 4:4.13.0), + libkactivities-dev (>= 4:4.13.3), liblink-grammar4-dev, libqjson-dev, baloo-dev (>= 4:4.13.3), libkgapi-dev (>= 2.1.0) Build-Depends-Indep: dblatex Standards-Version: 3.9.3 @@ -71,7 +71,7 @@ kontact (>= ${binary:Version}), korganizer (>= ${binary:Version}), ktimetracker (>= ${binary:Version}), kde-config-pimactivity (>= ${binary:Version}), libkdepim4 (= ${binary:Version}), libpimcommon4 (= ${binary:Version}), - kdepimlibs5-dev (>= 4:4.13.0), libphonon-dev (>= 4:4.6.0really4.3.80), + kdepimlibs5-dev (>= 4:4.13.3), libphonon-dev (>= 4:4.6.0really4.3.80), libgpgme11-dev, libboost1.54-dev, libboost-graph1.54-dev, libsasl2-dev, libxss-dev, libqca2-dev (>= 2.0.0), libpisock-dev, libassuan-dev, libstreams-dev, libstreamanalyzer-dev, libsearchclient-dev, libstrigihtmlgui-dev, diff -Nru kdepim-4.13.0/debian/patches/fix-CVE-2017-9604.patch kdepim-4.13.3/debian/patches/fix-CVE-2017-9604.patch --- kdepim-4.13.0/debian/patches/fix-CVE-2017-9604.patch 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/debian/patches/fix-CVE-2017-9604.patch 2018-03-25 16:02:11.000000000 +0000 @@ -0,0 +1,70 @@ +Description: Make sure that we use plugin when we use sendlater feature, and make sure to sign/encrypt it + This fixes CVE-2017-9604. +Author: Montel Laurent +Origin: backport +Bug-Ubuntu: https://bugs.launchpad.net/bugs/1698180 +Applied-Upstream: commit:78c5552, commit:c54706e +Last-Update: 2018-03-25 +--- a/messagecomposer/composer/composerviewbase.cpp ++++ b/messagecomposer/composer/composerviewbase.cpp +@@ -288,7 +288,7 @@ void MessageComposer::ComposerViewBase:: + } + } + +- if ( m_neverEncrypt && saveIn != MessageComposer::MessageSender::SaveInNone ) { ++ if ( m_neverEncrypt && saveIn != MessageComposer::MessageSender::SaveInNone && !mSendLaterInfo) { + // we can't use the state of the mail itself, to remember the + // signing and encryption state, so let's add a header instead + m_msg->setHeader( new KMime::Headers::Generic( "X-KMail-SignatureActionEnabled", m_msg.get(), +--- a/kmail/editor/kmcomposewin.cpp ++++ b/kmail/editor/kmcomposewin.cpp +@@ -2667,7 +2667,7 @@ void KMComposeWin::printComposeResult( K + + //---------------------------------------------------------------------------- + void KMComposeWin::doSend( MessageComposer::MessageSender::SendMethod method, +- MessageComposer::MessageSender::SaveIn saveIn ) ++ MessageComposer::MessageSender::SaveIn saveIn, bool willSendItWithoutReediting) + { + if (mNumProgressUploadFile > 0) { + KMessageBox::sorry( this, i18np( "There is %1 file upload in progress.", +@@ -2683,7 +2683,7 @@ void KMComposeWin::doSend( MessageCompos + } + + +- if ( saveIn == MessageComposer::MessageSender::SaveInNone ) { // don't save as draft or template, send immediately ++ if ( saveIn == MessageComposer::MessageSender::SaveInNone || willSendItWithoutReediting) { // don't save as draft or template, send immediately + if ( KPIMUtils::firstEmailAddress( from() ).isEmpty() ) { + if ( !( mShowHeaders & HDR_FROM ) ) { + mShowHeaders |= HDR_FROM; +@@ -2844,6 +2844,7 @@ void KMComposeWin::slotSendLater() + return; + if ( !checkRecipientNumber() ) + return; ++ mComposerBase->setSendLaterInfo(0); + if ( mComposerBase->editor()->checkExternalEditorFinished() ) { + const bool wasRegistered = (SendLater::SendLaterUtil::sentLaterAgentWasRegistered() && SendLater::SendLaterUtil::sentLaterAgentEnabled()); + if (wasRegistered) { +@@ -2867,9 +2868,9 @@ void KMComposeWin::slotSendLater() + { + mComposerBase->setSendLaterInfo(info); + if (info->isRecurrence()) { +- doSend( MessageComposer::MessageSender::SendLater, MessageComposer::MessageSender::SaveInTemplates ); ++ doSend( MessageComposer::MessageSender::SendLater, MessageComposer::MessageSender::SaveInTemplates, true); + } else { +- doSend( MessageComposer::MessageSender::SendLater, MessageComposer::MessageSender::SaveInDrafts ); ++ doSend( MessageComposer::MessageSender::SendLater, MessageComposer::MessageSender::SaveInDrafts, true); + } + break; + } +--- a/kmail/editor/kmcomposewin.h ++++ b/kmail/editor/kmcomposewin.h +@@ -577,7 +577,8 @@ private: + * Send the message. + */ + void doSend( MessageComposer::MessageSender::SendMethod method=MessageComposer::MessageSender::SendDefault, +- MessageComposer::MessageSender::SaveIn saveIn = MessageComposer::MessageSender::SaveInNone ); ++ MessageComposer::MessageSender::SaveIn saveIn = MessageComposer::MessageSender::SaveInNone, ++ bool willSendItWithoutReediting = false); + + void doDelayedSend( MessageComposer::MessageSender::SendMethod method, MessageComposer::MessageSender::SaveIn saveIn ); + diff -Nru kdepim-4.13.0/debian/patches/kubuntu_revert_9fed45112711cf203a03ba3b3ed5ca0ee796c836.diff kdepim-4.13.3/debian/patches/kubuntu_revert_9fed45112711cf203a03ba3b3ed5ca0ee796c836.diff --- kdepim-4.13.0/debian/patches/kubuntu_revert_9fed45112711cf203a03ba3b3ed5ca0ee796c836.diff 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/debian/patches/kubuntu_revert_9fed45112711cf203a03ba3b3ed5ca0ee796c836.diff 2014-05-11 01:06:23.000000000 +0000 @@ -0,0 +1,1762 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5b42d0e..be16204 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -245,6 +245,7 @@ else() + add_subdirectory(kdgantt2) + add_subdirectory(icons) + add_subdirectory(composereditor-ng) ++ add_subdirectory(grammar) + add_subdirectory(messagecore) + add_subdirectory(grantleetheme) + add_subdirectory(messagelist) +diff --git a/MAINTAINERS b/MAINTAINERS +index 9e9eb76..b4a69dd 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -9,6 +9,7 @@ calendarsupport Sérgio Martins + calendarviews Sérgio Martins + contactthemeeditor Laurent Montel + composereditor-ng Laurent Montel ++grammar Laurent Montel + grantleethemeeditor Laurent Montel + headerthemeeditor Laurent Montel + importwizard Laurent Montel +diff --git a/cmake/modules/FindLinkGrammar.cmake b/cmake/modules/FindLinkGrammar.cmake +new file mode 100644 +index 0000000..5bb8df1 +--- /dev/null ++++ b/cmake/modules/FindLinkGrammar.cmake +@@ -0,0 +1,19 @@ ++# Try to find Linkgrammar ++# Once done, this module with define: ++# LinkGrammar_FOUND - True if LinkGrammar was found ++# LinkGrammar_INCLUDE_DIR - The LinkGrammar include directory ++# LinkGrammar_LIBRARIES - The LinkGrammar libraries ++ ++# Copyright (c) 2013, Laurent Montel, ++# ++# Redistribution and use is allowed according to the terms of the BSD license. ++# For details see the accompanying COPYING-CMAKE-SCRIPTS file. ++ ++find_path(LinkGrammar_INCLUDE_DIR link-grammar/link-includes.h) ++ ++find_library(LinkGrammar_LIBRARIES NAMES link-grammar) ++ ++include(FindPackageHandleStandardArgs) ++find_package_handle_standard_args(LinkGrammar DEFAULT_MSG LinkGrammar_LIBRARIES LinkGrammar_INCLUDE_DIR) ++ ++mark_as_advanced(LinkGrammar_INCLUDE_DIR LinkGrammar_LIBRARIES) +diff --git a/grammar/CMakeLists.txt b/grammar/CMakeLists.txt +new file mode 100644 +index 0000000..a88fad1 +--- /dev/null ++++ b/grammar/CMakeLists.txt +@@ -0,0 +1,30 @@ ++project(grammar) ++add_definitions( -DQT_NO_CAST_FROM_ASCII ) ++add_definitions( -DQT_NO_CAST_TO_ASCII ) ++ ++include_directories( .) ++ ++set(libgrammar_SRCS ++ grammarhighlighter.cpp ++ grammarclient.cpp ++ backgroundgrammarchecker.cpp ++ grammarsettings.cpp ++ grammarplugin.cpp ++ grammarloader.cpp ++ grammarchecker.cpp ++ widgets/grammarcomboboxlanguage.cpp ++ widgets/grammarconfigurewidget.cpp ++) ++ ++kde4_add_library(grammar ${LIBRARY_TYPE} ${libgrammar_SRCS}) ++ ++target_link_libraries(grammar ${KDE4_KDEUI_LIBS}) ++ ++ ++set_target_properties( grammar PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) ++install(TARGETS grammar ${INSTALL_TARGETS_DEFAULT_ARGS} ) ++ ++add_subdirectory(plugins) ++ ++add_subdirectory(tests) ++ +diff --git a/grammar/TODO b/grammar/TODO +new file mode 100644 +index 0000000..cc3c06d +--- /dev/null ++++ b/grammar/TODO +@@ -0,0 +1 @@ ++Add more grammer plugins here +diff --git a/grammar/backgroundgrammarchecker.cpp b/grammar/backgroundgrammarchecker.cpp +new file mode 100644 +index 0000000..35057a6 +--- /dev/null ++++ b/grammar/backgroundgrammarchecker.cpp +@@ -0,0 +1,43 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "backgroundgrammarchecker.h" ++ ++namespace Grammar { ++ ++class BackgroundGrammarCheckerPrivate ++{ ++public: ++ BackgroundGrammarCheckerPrivate(BackgroundGrammarChecker *qq) ++ : q(qq) ++ { ++ ++ } ++ BackgroundGrammarChecker *q; ++}; ++ ++BackgroundGrammarChecker::BackgroundGrammarChecker(QObject *parent) ++ : QObject(parent), d(new BackgroundGrammarCheckerPrivate(this)) ++{ ++} ++ ++BackgroundGrammarChecker::~BackgroundGrammarChecker() ++{ ++ delete d; ++} ++} ++ +diff --git a/grammar/backgroundgrammarchecker.h b/grammar/backgroundgrammarchecker.h +new file mode 100644 +index 0000000..debd657 +--- /dev/null ++++ b/grammar/backgroundgrammarchecker.h +@@ -0,0 +1,38 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 BACKGROUNDGRAMMARCHECKER_H ++#define BACKGROUNDGRAMMARCHECKER_H ++ ++#include ++ ++namespace Grammar { ++class BackgroundGrammarCheckerPrivate; ++class BackgroundGrammarChecker : QObject ++{ ++ Q_OBJECT ++public: ++ explicit BackgroundGrammarChecker(QObject *parent = 0); ++ ~BackgroundGrammarChecker(); ++ ++private: ++ friend class BackgroundGrammarCheckerPrivate; ++ BackgroundGrammarCheckerPrivate * const d; ++}; ++} ++ ++#endif // BACKGROUNDGRAMMARCHECKER_H +diff --git a/grammar/grammar_export.h b/grammar/grammar_export.h +new file mode 100644 +index 0000000..49c838c +--- /dev/null ++++ b/grammar/grammar_export.h +@@ -0,0 +1,43 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2007 David Faure ++ ++ 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 GRAMMAR_EXPORT_H ++#define GRAMMAR_EXPORT_H ++ ++/* needed for KDE_EXPORT and KDE_IMPORT macros */ ++#include ++ ++#ifndef GRAMMAR_EXPORT ++# if defined(KDEPIM_STATIC_LIBS) ++ /* No export/import for static libraries */ ++# define GRAMMAR_EXPORT ++# elif defined(MAKE_GRAMMAR_LIB) ++ /* We are building this library */ ++# define GRAMMAR_EXPORT KDE_EXPORT ++# else ++ /* We are using this library */ ++# define GRAMMAR_EXPORT KDE_IMPORT ++# endif ++#endif ++ ++# ifndef GRAMMAR_EXPORT_DEPRECATED ++# define GRAMMAR_EXPORT_DEPRECATED KDE_DEPRECATED GRAMMAR_EXPORT ++# endif ++ ++#endif +diff --git a/grammar/grammarchecker.cpp b/grammar/grammarchecker.cpp +new file mode 100644 +index 0000000..4faa1a9 +--- /dev/null ++++ b/grammar/grammarchecker.cpp +@@ -0,0 +1,65 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarchecker.h" ++#include "grammarloader.h" ++ ++#include ++#include ++ ++#include ++ ++namespace Grammar { ++ ++class GrammarCheckerPrivate ++{ ++public: ++ GrammarCheckerPrivate(GrammarChecker *qq) ++ : q(qq) ++ { ++ ++ } ++ GrammarChecker *q; ++}; ++ ++ ++GrammarChecker::GrammarChecker(const QString &lang) ++ : d(new GrammarCheckerPrivate(this)) ++{ ++} ++ ++GrammarChecker::~GrammarChecker() ++{ ++ delete d; ++} ++ ++QMap GrammarChecker::availableLanguage() const ++{ ++ GrammarLoader *l = GrammarLoader::openGrammarLoader(); ++ const QStringList lst = l->languages(); ++ QMap langs; ++ foreach(const QString &tag, lst) { ++ const QString description= QString::fromLatin1("%1 (%2)") ++ .arg(KGlobal::locale()->languageCodeToName(tag)) ++ .arg(KGlobal::locale()->countryCodeToName(tag)); ++ langs.insert(description, tag); ++ } ++ ++ return langs; ++} ++ ++} +diff --git a/grammar/grammarchecker.h b/grammar/grammarchecker.h +new file mode 100644 +index 0000000..678fa77 +--- /dev/null ++++ b/grammar/grammarchecker.h +@@ -0,0 +1,40 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARCHECKER_H ++#define GRAMMARCHECKER_H ++ ++#include ++#include ++ ++namespace Grammar { ++class GrammarCheckerPrivate; ++class GrammarChecker ++{ ++public: ++ GrammarChecker(const QString &lang = QString()); ++ ~GrammarChecker(); ++ ++ QMap availableLanguage() const; ++ ++private: ++ friend class GrammarCheckerPrivate; ++ GrammarCheckerPrivate * const d; ++}; ++} ++ ++#endif // GRAMMARCHECKER_H +diff --git a/grammar/grammarclient.cpp b/grammar/grammarclient.cpp +new file mode 100644 +index 0000000..19a9d4e +--- /dev/null ++++ b/grammar/grammarclient.cpp +@@ -0,0 +1,28 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarclient_p.h" ++ ++namespace Grammar { ++ ++GrammarClient::GrammarClient(QObject *parent) ++ : QObject(parent) ++{ ++} ++ ++} ++#include "moc_grammarclient_p.cpp" +diff --git a/grammar/grammarclient_p.h b/grammar/grammarclient_p.h +new file mode 100644 +index 0000000..28b54ab +--- /dev/null ++++ b/grammar/grammarclient_p.h +@@ -0,0 +1,47 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARCLIENT_H ++#define GRAMMARCLIENT_H ++ ++#include "grammar_export.h" ++ ++#include ++#include ++#include ++ ++ ++namespace Grammar { ++class GrammarPlugin; ++class GRAMMAR_EXPORT GrammarClient : public QObject ++{ ++ Q_OBJECT ++public: ++ explicit GrammarClient(QObject *parent = 0); ++ ++ virtual int reliability() const = 0; ++ ++ virtual QStringList languages() const = 0; ++ ++ virtual QString name() const = 0; ++ ++ virtual Grammar::GrammarPlugin *createGrammarChecker(const QString &language) = 0; ++}; ++ ++} ++ ++#endif // GRAMMARCLIENT_H +diff --git a/grammar/grammarhighlighter.cpp b/grammar/grammarhighlighter.cpp +new file mode 100644 +index 0000000..084c3d2 +--- /dev/null ++++ b/grammar/grammarhighlighter.cpp +@@ -0,0 +1,86 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarhighlighter.h" ++ ++namespace Grammar { ++ ++class GrammarPrivate { ++public: ++ GrammarPrivate(GrammarHighlighter *qq) ++ : active(true), ++ q(qq) ++ { ++ ++ } ++ QString currentLanguage; ++ QColor grammarErrorColor; ++ bool active; ++ GrammarHighlighter *q; ++}; ++ ++GrammarHighlighter::GrammarHighlighter(QTextEdit *textEdit) ++ : QSyntaxHighlighter(textEdit), d(new GrammarPrivate(this)) ++{ ++} ++ ++GrammarHighlighter::~GrammarHighlighter() ++{ ++ delete d; ++} ++ ++QString GrammarHighlighter::currentLanguage() const ++{ ++ return d->currentLanguage; ++} ++ ++void GrammarHighlighter::setCurrentLanguage(const QString &lang) ++{ ++ d->currentLanguage = lang; ++} ++ ++void GrammarHighlighter::highlightBlock(const QString &text) ++{ ++ if (text.isEmpty() || !d->active) ++ return; ++ ++ //TODO ++ setCurrentBlockState(0); ++} ++ ++void GrammarHighlighter::setActive(bool active) ++{ ++ d->active = active; ++} ++ ++bool GrammarHighlighter::isActive() const ++{ ++ return d->active; ++} ++ ++void GrammarHighlighter::setGrammarColor(const QColor &color) ++{ ++ d->grammarErrorColor = color; ++} ++ ++QColor GrammarHighlighter::grammarColor() const ++{ ++ return d->grammarErrorColor; ++} ++ ++ ++} +diff --git a/grammar/grammarhighlighter.h b/grammar/grammarhighlighter.h +new file mode 100644 +index 0000000..7662197 +--- /dev/null ++++ b/grammar/grammarhighlighter.h +@@ -0,0 +1,53 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARHIGHLIGHTER_H ++#define GRAMMARHIGHLIGHTER_H ++ ++#include ++ ++#include "grammar_export.h" ++ ++namespace Grammar ++{ ++class GrammarPrivate; ++class GRAMMAR_EXPORT GrammarHighlighter : public QSyntaxHighlighter ++{ ++ Q_OBJECT ++public: ++ explicit GrammarHighlighter(QTextEdit *textEdit); ++ ~GrammarHighlighter(); ++ ++ QString currentLanguage() const; ++ void setCurrentLanguage(const QString &lang); ++ ++ void setActive(bool active); ++ bool isActive() const; ++ ++ void setGrammarColor(const QColor &color); ++ QColor grammarColor() const; ++ ++protected: ++ void highlightBlock(const QString &text); ++ ++private: ++ friend class GrammarPrivate; ++ GrammarPrivate * const d; ++}; ++} ++ ++#endif // GRAMMARHIGHLIGHTER_H +diff --git a/grammar/grammarloader.cpp b/grammar/grammarloader.cpp +new file mode 100644 +index 0000000..e8c75ea +--- /dev/null ++++ b/grammar/grammarloader.cpp +@@ -0,0 +1,123 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarloader.h" ++#include "grammarclient_p.h" ++#include "grammarsettings.h" ++ ++#include ++#include ++#include ++ ++namespace Grammar { ++class GrammarLoaderPrivate ++{ ++public: ++ GrammarLoaderPrivate(GrammarLoader *qq) ++ : settings(0), ++ q(qq) ++ { ++ } ++ ++ ~GrammarLoaderPrivate() ++ { ++ plugins.clear(); ++ } ++ ++ void loadPlugins() ++ { ++ plugins = KServiceTypeTrader::self()->query(QString::fromLatin1("Grammar/GrammarClient")); ++ ++ KService::List::const_iterator end(plugins.constEnd()); ++ for (KService::List::const_iterator itr = plugins.constBegin(); itr != end; ++itr ) { ++ loadPlugin((*itr)); ++ } ++ } ++ ++ void loadPlugin(const KSharedPtr &service) ++ { ++ QString error; ++ ++ Grammar::GrammarClient *client = service->createInstance(q, QVariantList(), &error); ++ if (client) { ++ const QStringList languages = client->languages(); ++ clients.append(client->name()); ++ QStringList::const_iterator itrEnd(languages.end()); ++ for (QStringList::const_iterator itr = languages.begin(); itr != itrEnd; ++itr) { ++ if (!languageClients[*itr].isEmpty() && (client->reliability() < languageClients[*itr].first()->reliability())) ++ languageClients[*itr].append(client); ++ else ++ languageClients[*itr].prepend(client); ++ } ++ //kDebug() << "Successfully loaded plugin:" << service->entryPath(); ++ } else { ++ kDebug() << error; ++ } ++ } ++ ++ ++ KService::List plugins; ++ QStringList clients; ++ // ++ QMap > languageClients; ++ GrammarSettings *settings; ++ GrammarLoader *q; ++}; ++ ++K_GLOBAL_STATIC(GrammarLoader, s_loader) ++ ++GrammarLoader *GrammarLoader::openGrammarLoader() ++{ ++ if (s_loader.isDestroyed()) { ++ return 0; ++ } ++ ++ return s_loader; ++} ++ ++GrammarLoader::GrammarLoader() ++ : d(new GrammarLoaderPrivate(this)) ++{ ++ d->settings = new GrammarSettings;// ++ d->loadPlugins(); ++ KConfig config(QString::fromLatin1("grammarrc")); ++ KConfigGroup grp = config.group(QLatin1String("General")); ++ d->settings->readSettings(grp); ++} ++ ++GrammarLoader::~GrammarLoader() ++{ ++ delete d; ++} ++ ++QStringList GrammarLoader::clients() const ++{ ++ return d->clients; ++} ++ ++QStringList GrammarLoader::languages() const ++{ ++ return d->languageClients.keys(); ++} ++ ++GrammarSettings *GrammarLoader::settings() const ++{ ++ return d->settings; ++} ++ ++} ++ +diff --git a/grammar/grammarloader.h b/grammar/grammarloader.h +new file mode 100644 +index 0000000..c4a3ecf +--- /dev/null ++++ b/grammar/grammarloader.h +@@ -0,0 +1,52 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARLOADER_H ++#define GRAMMARLOADER_H ++#include ++ ++#include "grammar_export.h" ++ ++namespace Grammar { ++class GrammarLoaderPrivate; ++class GrammarSettings; ++class GRAMMAR_EXPORT GrammarLoader : public QObject ++{ ++ Q_OBJECT ++public: ++ static GrammarLoader *openGrammarLoader(); ++ ++ GrammarLoader(); ++ ~GrammarLoader(); ++ ++ QStringList clients() const; ++ ++ QStringList languages() const; ++ ++ GrammarSettings *settings() const; ++ ++Q_SIGNALS: ++ void configurationChanged(); ++ ++ ++private: ++ friend class GrammarLoaderPrivate; ++ GrammarLoaderPrivate * const d; ++}; ++} ++ ++#endif // GRAMMARLOADER_H +diff --git a/grammar/grammarplugin.cpp b/grammar/grammarplugin.cpp +new file mode 100644 +index 0000000..ff678c5 +--- /dev/null ++++ b/grammar/grammarplugin.cpp +@@ -0,0 +1,48 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarplugin_p.h" ++ ++namespace Grammar { ++ ++class GrammarPluginPrivate ++{ ++public: ++ GrammarPluginPrivate() ++ { ++ ++ } ++ QString lang; ++}; ++ ++GrammarPlugin::GrammarPlugin(const QString &lang) ++ : d(new GrammarPluginPrivate) ++{ ++ d->lang = lang; ++} ++ ++GrammarPlugin::~GrammarPlugin() ++{ ++ delete d; ++} ++ ++QString GrammarPlugin::language() const ++{ ++ return d->lang; ++} ++ ++} +diff --git a/grammar/grammarplugin_p.h b/grammar/grammarplugin_p.h +new file mode 100644 +index 0000000..c33facb +--- /dev/null ++++ b/grammar/grammarplugin_p.h +@@ -0,0 +1,41 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARPLUGIN_H ++#define GRAMMARPLUGIN_H ++ ++#include "grammar_export.h" ++ ++#include ++ ++namespace Grammar { ++class GrammarPluginPrivate; ++class GRAMMAR_EXPORT GrammarPlugin ++{ ++public: ++ ~GrammarPlugin(); ++ ++ QString language() const; ++protected: ++ GrammarPlugin(const QString &lang); ++private: ++ friend class GrammarPluginPrivate; ++ GrammarPluginPrivate * const d; ++}; ++} ++ ++#endif // GRAMMARPLUGIN_H +diff --git a/grammar/grammarsettings.cpp b/grammar/grammarsettings.cpp +new file mode 100644 +index 0000000..a854cbb +--- /dev/null ++++ b/grammar/grammarsettings.cpp +@@ -0,0 +1,64 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarsettings.h" ++ ++#include ++#include ++ ++namespace Grammar { ++ ++class GrammarSettingsPrivate ++{ ++public: ++ GrammarSettingsPrivate() ++ { ++ } ++ QString defaultLanguage; ++}; ++ ++GrammarSettings::GrammarSettings() ++ : d(new GrammarSettingsPrivate) ++{ ++} ++ ++GrammarSettings::~GrammarSettings() ++{ ++ delete d; ++} ++ ++void GrammarSettings::setDefaultLanguage(const QString &lang) ++{ ++ d->defaultLanguage = lang; ++} ++ ++QString GrammarSettings::defaultLanguage() const ++{ ++ return d->defaultLanguage; ++} ++ ++void GrammarSettings::saveSettings(KConfigGroup &group) ++{ ++ group.writeEntry("DefaultLanguage", d->defaultLanguage); ++} ++ ++void GrammarSettings::readSettings(const KConfigGroup &group) ++{ ++ d->defaultLanguage = group.readEntry("DefaultLanguage"); ++} ++ ++} +diff --git a/grammar/grammarsettings.h b/grammar/grammarsettings.h +new file mode 100644 +index 0000000..5e41ec7 +--- /dev/null ++++ b/grammar/grammarsettings.h +@@ -0,0 +1,44 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARSETTINGS_H ++#define GRAMMARSETTINGS_H ++ ++#include ++class KConfigGroup; ++ ++namespace Grammar { ++class GrammarSettingsPrivate; ++class GrammarSettings ++{ ++public: ++ GrammarSettings(); ++ ~GrammarSettings(); ++ ++ void setDefaultLanguage(const QString &lang); ++ QString defaultLanguage() const; ++ ++ void saveSettings(KConfigGroup &group); ++ void readSettings(const KConfigGroup &group); ++ ++private: ++ friend class GrammarSettingsPrivate; ++ GrammarSettingsPrivate * const d; ++}; ++} ++ ++#endif // GRAMMARSETTINGS_H +diff --git a/grammar/plugins/CMakeLists.txt b/grammar/plugins/CMakeLists.txt +new file mode 100644 +index 0000000..1d80828 +--- /dev/null ++++ b/grammar/plugins/CMakeLists.txt +@@ -0,0 +1,12 @@ ++project(plugins) ++find_package(LinkGrammar) ++set_package_properties(LinkGrammar PROPERTIES DESCRIPTION "Grammar checking Library" ++ URL "http://www.abisource.com/projects/link-grammar/" ++ TYPE OPTIONAL ++ PURPOSE "Required by Grammar-Check plugin" ++ ) ++ ++if(LINKGRAMMAR_FOUND) ++ add_subdirectory(linkgrammar) ++endif() ++ +diff --git a/grammar/plugins/linkgrammar/CMakeLists.txt b/grammar/plugins/linkgrammar/CMakeLists.txt +new file mode 100644 +index 0000000..24116c7 +--- /dev/null ++++ b/grammar/plugins/linkgrammar/CMakeLists.txt +@@ -0,0 +1,17 @@ ++project(linkgrammarchecker) ++ ++include_directories(${LinkGrammar_INCLUDE_DIR}) ++set( linkgrammarchecker_SRCS grammarlinkclient.cpp grammarlinkplugin.cpp) ++ ++kde4_add_plugin(grammar_link ${linkgrammarchecker_SRCS}) ++ ++target_link_libraries(grammar_link ${KDE4_KDECORE_LIBS} ${LinkGrammar_LIBRARIES} grammar) ++ ++install(TARGETS grammar_link DESTINATION ${PLUGIN_INSTALL_DIR} ) ++ ++ ++########### install files ############### ++ ++install( FILES grammar_link.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) ++ ++ +diff --git a/grammar/plugins/linkgrammar/grammar_link.desktop b/grammar/plugins/linkgrammar/grammar_link.desktop +new file mode 100644 +index 0000000..ce65a01 +--- /dev/null ++++ b/grammar/plugins/linkgrammar/grammar_link.desktop +@@ -0,0 +1,48 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=Grammar/GrammarClient ++X-KDE-Library=grammar_link ++X-KDE-PluginInfo-Author=Laurent Montel ++X-KDE-PluginInfo-Email=montel@kde.org ++X-KDE-PluginInfo-Name=grammar_link ++X-KDE-PluginInfo-Version=0.0.1 ++X-KDE-PluginInfo-Website=http://www.kde.org ++X-KDE-PluginInfo-Category=Clients ++X-KDE-PluginInfo-Depends= ++X-KDE-PluginInfo-License=LGPL ++X-KDE-PluginInfo-EnabledByDefault=true ++Name=GrammarLink ++Name[bs]=GrammarLink ++Name[ca]=GrammarLink ++Name[ca@valencia]=GrammarLink ++Name[da]=GrammarLink ++Name[de]=Grammatik-Verknüpfung ++Name[el]=GrammarLink ++Name[es]=GrammarLink ++Name[fi]=GrammarLink ++Name[fr]=GrammarLink ++Name[gl]=GrammarLink ++Name[hu]=GrammarLink ++Name[ia]=GrammarLink (Ligamine de grammatica) ++Name[it]=GrammarLink ++Name[kk]=GrammarLink ++Name[ko]=GrammarLink ++Name[lt]=GramatikosNuoroda ++Name[nb]=GrammarLink ++Name[nds]=GrammatikLink ++Name[nl]=GrammaticaKoppeling ++Name[pl]=GrammarLink ++Name[pt]=GrammarLink ++Name[pt_BR]=GrammarLink ++Name[ru]=GrammarLink ++Name[sk]=Gramatický odkaz ++Name[sr]=Повезна граматика ++Name[sr@ijekavian]=Повезна граматика ++Name[sr@ijekavianlatin]=Povezna gramatika ++Name[sr@latin]=Povezna gramatika ++Name[sv]=Grammatiklänk ++Name[tr]=Dilbilgisi Bağlantısı ++Name[uk]=GrammarLink ++Name[wa]=GrammarLink ++Name[x-test]=xxGrammarLinkxx ++Name[zh_TW]=GrammarLink +diff --git a/grammar/plugins/linkgrammar/grammarlinkclient.cpp b/grammar/plugins/linkgrammar/grammarlinkclient.cpp +new file mode 100644 +index 0000000..dec91f4 +--- /dev/null ++++ b/grammar/plugins/linkgrammar/grammarlinkclient.cpp +@@ -0,0 +1,68 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarlinkclient.h" ++#include "grammarlinkplugin.h" ++ ++#include ++#include ++#include ++ ++K_PLUGIN_FACTORY( GrammarLinkClientFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN( GrammarLinkClientFactory( "grammar_link" ) ) ++ ++GrammarLinkClient::GrammarLinkClient(QObject *parent, const QVariantList& /* args */) ++ : Grammar::GrammarClient(parent) ++{ ++} ++ ++GrammarLinkClient::~GrammarLinkClient() ++{ ++ ++} ++ ++int GrammarLinkClient::reliability() const ++{ ++ return 20; ++} ++ ++Grammar::GrammarPlugin *GrammarLinkClient::createGrammarChecker(const QString &language) ++{ ++ GrammarLinkPlugin *plugin = new GrammarLinkPlugin(language); ++ return plugin; ++} ++ ++QStringList GrammarLinkClient::searchLanguages() const ++{ ++ //TODO ++ return QStringList(); ++} ++ ++QStringList GrammarLinkClient::languages() const ++{ ++ //return searchLanguages(); ++ //TODO improve search ++ return QStringList() < ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARLINKCLIENT_H ++#define GRAMMARLINKCLIENT_H ++ ++#include "grammar/grammarclient_p.h" ++#include "grammar/grammarplugin_p.h" ++#include ++ ++class GrammarLinkClient : public Grammar::GrammarClient ++{ ++ Q_OBJECT ++public: ++ GrammarLinkClient(QObject *parent, const QVariantList &); ++ ~GrammarLinkClient(); ++ ++ int reliability() const; ++ Grammar::GrammarPlugin *createGrammarChecker(const QString &language); ++ ++ QStringList languages() const; ++ ++ QString name() const; ++ ++private: ++ QStringList searchLanguages() const; ++}; ++ ++#endif // GRAMMARLINKCLIENT_H +diff --git a/grammar/plugins/linkgrammar/grammarlinkplugin.cpp b/grammar/plugins/linkgrammar/grammarlinkplugin.cpp +new file mode 100644 +index 0000000..6595bca +--- /dev/null ++++ b/grammar/plugins/linkgrammar/grammarlinkplugin.cpp +@@ -0,0 +1,40 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarlinkplugin.h" ++ ++#include ++#include ++ ++GrammarLinkPlugin::GrammarLinkPlugin(const QString &language) ++ : Grammar::GrammarPlugin(language) ++{ ++ setlocale(LC_ALL, ""); ++ mOpts = parse_options_create(); ++ mDict = dictionary_create_lang(language.toLatin1()); ++ if (!mDict) { ++ qDebug()<<" dictionary for language "< ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammar/grammarplugin_p.h" ++extern "C" { ++#include ++} ++#ifndef GRAMMARLINKPLUGIN_H ++#define GRAMMARLINKPLUGIN_H ++ ++class GrammarLinkPlugin : public Grammar::GrammarPlugin ++{ ++public: ++ GrammarLinkPlugin(const QString &language); ++ ~GrammarLinkPlugin(); ++private: ++ Dictionary mDict; ++ Parse_Options mOpts; ++}; ++ ++#endif // GRAMMARLINKPLUGIN_H +diff --git a/grammar/tests/CMakeLists.txt b/grammar/tests/CMakeLists.txt +new file mode 100644 +index 0000000..17ce55b +--- /dev/null ++++ b/grammar/tests/CMakeLists.txt +@@ -0,0 +1,10 @@ ++project( grammareditor ) ++ ++set( grammareditor_SRCS ++ mainwindow.cpp ++ main.cpp ++) ++ ++kde4_add_executable(grammareditor TEST ${grammareditor_SRCS} ) ++TARGET_LINK_LIBRARIES(grammareditor ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} grammar ) ++ +diff --git a/grammar/tests/main.cpp b/grammar/tests/main.cpp +new file mode 100644 +index 0000000..afae65c +--- /dev/null ++++ b/grammar/tests/main.cpp +@@ -0,0 +1,38 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 ++#include ++#include ++ ++#include "mainwindow.h" ++ ++int main( int argc, char **argv ) ++{ ++ const QByteArray& ba = QByteArray( "grammareditor" ); ++ const KLocalizedString name = ki18n( "Grammar Editor" ); ++ KAboutData aboutData( ba, ba, name, ba, name ); ++ KCmdLineArgs::init( argc, argv, &aboutData ); ++ KApplication app; ++ MainWindow* mw = new MainWindow(); ++ mw->show(); ++ return app.exec(); ++} +diff --git a/grammar/tests/mainwindow.cpp b/grammar/tests/mainwindow.cpp +new file mode 100644 +index 0000000..1385907 +--- /dev/null ++++ b/grammar/tests/mainwindow.cpp +@@ -0,0 +1,39 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "mainwindow.h" ++ ++#include "grammar/widgets/grammarcomboboxlanguage.h" ++#include "grammar/grammarhighlighter.h" ++ ++#include ++#include ++ ++MainWindow::MainWindow() ++ : QMainWindow() ++{ ++ QWidget *w = new QWidget; ++ QVBoxLayout *layout = new QVBoxLayout; ++ w->setLayout(layout); ++ Grammar::GrammarComboBoxLanguage *comboxbox = new Grammar::GrammarComboBoxLanguage; ++ layout->addWidget(comboxbox); ++ mEdit = new QTextEdit; ++ new Grammar::GrammarHighlighter(mEdit); ++ layout->addWidget(mEdit); ++ setCentralWidget(w); ++} ++ +diff --git a/grammar/tests/mainwindow.h b/grammar/tests/mainwindow.h +new file mode 100644 +index 0000000..90c8ae2 +--- /dev/null ++++ b/grammar/tests/mainwindow.h +@@ -0,0 +1,34 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 MAINWINDOW_H ++#define MAINWINDOW_H ++ ++#include ++ ++class QTextEdit; ++ ++class MainWindow : public QMainWindow ++{ ++ Q_OBJECT ++public: ++ MainWindow(); ++private: ++ QTextEdit *mEdit; ++}; ++ ++#endif // MAINWINDOW_H +diff --git a/grammar/widgets/grammarcomboboxlanguage.cpp b/grammar/widgets/grammarcomboboxlanguage.cpp +new file mode 100644 +index 0000000..ab467d4 +--- /dev/null ++++ b/grammar/widgets/grammarcomboboxlanguage.cpp +@@ -0,0 +1,91 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarcomboboxlanguage.h" ++#include "grammarchecker.h" ++#include ++ ++namespace Grammar { ++class GrammarComboBoxLanguagePrivate ++{ ++public: ++ GrammarComboBoxLanguagePrivate(GrammarComboBoxLanguage *qq) ++ : q(qq) ++ { ++ ++ } ++ ++ void slotLanguageChanged(int index) ++ { ++ Q_EMIT q->languageChanged( q->itemData( index ).toString() ); ++ } ++ ++ GrammarComboBoxLanguage *q; ++}; ++ ++ ++GrammarComboBoxLanguage::GrammarComboBoxLanguage(QWidget *parent) ++ : KComboBox(parent), d(new GrammarComboBoxLanguagePrivate(this)) ++{ ++ reloadList(); ++ connect( this, SIGNAL(activated(int)), this, SLOT(slotLanguageChanged(int)) ); ++} ++ ++GrammarComboBoxLanguage::~GrammarComboBoxLanguage() ++{ ++ delete d; ++} ++ ++void GrammarComboBoxLanguage::reloadList() ++{ ++ clear(); ++ ++ Grammar::GrammarChecker* checker = new Grammar::GrammarChecker(); ++ QMap lang = checker->availableLanguage(); ++ QMapIterator i( lang ); ++ while ( i.hasNext() ) { ++ i.next(); ++ kDebug() << "Populate combo:" << i.key() << ":" << i.value(); ++ addItem( i.key(), i.value() ); ++ } ++ delete checker; ++} ++ ++void GrammarComboBoxLanguage::setCurrentLanguage(const QString &lang) ++{ ++ if ( lang.isEmpty() || lang == itemData( currentIndex() ).toString() ) ++ return; ++ ++ const int idx = findData( lang ); ++ if ( idx == -1 ) { ++ kDebug() << "lang not found" << lang; ++ return; ++ } ++ ++ setCurrentIndex( idx ); ++ d->slotLanguageChanged( idx ); ++} ++ ++QString GrammarComboBoxLanguage::currentLanguage() const ++{ ++ return itemData( currentIndex() ).toString(); ++} ++ ++} ++ ++#include "moc_grammarcomboboxlanguage.cpp" +diff --git a/grammar/widgets/grammarcomboboxlanguage.h b/grammar/widgets/grammarcomboboxlanguage.h +new file mode 100644 +index 0000000..4b67b3c +--- /dev/null ++++ b/grammar/widgets/grammarcomboboxlanguage.h +@@ -0,0 +1,49 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARCOMBOBOXLANGUAGE_H ++#define GRAMMARCOMBOBOXLANGUAGE_H ++ ++#include "grammar_export.h" ++ ++#include ++ ++namespace Grammar ++{ ++class GrammarComboBoxLanguagePrivate; ++class GRAMMAR_EXPORT GrammarComboBoxLanguage : public KComboBox ++{ ++ Q_OBJECT ++public: ++ explicit GrammarComboBoxLanguage(QWidget *parent = 0); ++ ~GrammarComboBoxLanguage(); ++ ++ void setCurrentLanguage(const QString &lang); ++ QString currentLanguage() const; ++ ++Q_SIGNALS: ++ void languageChanged(const QString &language); ++ ++private: ++ void reloadList(); ++ friend class GrammarComboBoxLanguagePrivate; ++ GrammarComboBoxLanguagePrivate * const d; ++ Q_PRIVATE_SLOT(d, void slotLanguageChanged(int) ) ++}; ++} ++ ++#endif // GRAMMARCOMBOBOXLANGUAGE_H +diff --git a/grammar/widgets/grammarconfigurewidget.cpp b/grammar/widgets/grammarconfigurewidget.cpp +new file mode 100644 +index 0000000..d4395c5 +--- /dev/null ++++ b/grammar/widgets/grammarconfigurewidget.cpp +@@ -0,0 +1,105 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "grammarconfigurewidget.h" ++#include "grammarcomboboxlanguage.h" ++#include "grammarloader.h" ++#include "grammarsettings.h" ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++namespace Grammar { ++ ++class GrammarConfigureWidgetPrivate { ++public: ++ GrammarConfigureWidgetPrivate(KConfig *_config, GrammarConfigureWidget *qq) ++ : q(qq), ++ config(_config) ++ { ++ init(); ++ } ++ ++ void init() ++ { ++ loader = GrammarLoader::openGrammarLoader(); ++ KConfigGroup group = config->group(QLatin1String("General")); ++ loader->settings()->readSettings(group); ++ QHBoxLayout *lay = new QHBoxLayout; ++ QLabel *lab = new QLabel(i18n("Default language:")); ++ lay->addWidget(lab); ++ ++ language = new GrammarComboBoxLanguage; ++ lay->addWidget(language); ++ ++ q->setLayout(lay); ++ } ++ ++ void setDefault() ++ { ++ //TODO ++ } ++ ++ void save() ++ { ++ KConfigGroup group = config->group(QLatin1String("General")); ++ loader->settings()->setDefaultLanguage(language->currentLanguage()); ++ loader->settings()->saveSettings(group); ++ } ++ ++ void setLanguage(const QString &lang) ++ { ++ language->setCurrentLanguage(lang); ++ } ++ ++ GrammarLoader *loader; ++ GrammarComboBoxLanguage *language; ++ GrammarConfigureWidget *q; ++ KConfig *config; ++}; ++ ++GrammarConfigureWidget::GrammarConfigureWidget(KConfig *config, QWidget *parent) ++ : QWidget(parent), d(new GrammarConfigureWidgetPrivate(config, this)) ++{ ++} ++ ++GrammarConfigureWidget::~GrammarConfigureWidget() ++{ ++ delete d; ++} ++ ++void GrammarConfigureWidget::setDefault() ++{ ++ d->setDefault(); ++} ++ ++void GrammarConfigureWidget::setLanguage(const QString &lang) ++{ ++ d->setLanguage(lang); ++} ++ ++void GrammarConfigureWidget::save() ++{ ++ d->save(); ++} ++ ++} ++ +diff --git a/grammar/widgets/grammarconfigurewidget.h b/grammar/widgets/grammarconfigurewidget.h +new file mode 100644 +index 0000000..d7177e7 +--- /dev/null ++++ b/grammar/widgets/grammarconfigurewidget.h +@@ -0,0 +1,45 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 GRAMMARCONFIGUREWIDGET_H ++#define GRAMMARCONFIGUREWIDGET_H ++ ++#include "grammar_export.h" ++#include ++class KConfig; ++namespace Grammar ++{ ++class GrammarConfigureWidgetPrivate; ++class GRAMMAR_EXPORT GrammarConfigureWidget : public QWidget ++{ ++ Q_OBJECT ++public: ++ explicit GrammarConfigureWidget(KConfig *config, QWidget *parent=0); ++ ~GrammarConfigureWidget(); ++ ++ void setDefault(); ++ void setLanguage(const QString &lang); ++ void save(); ++ ++private: ++ friend class GrammarConfigureWidgetPrivate; ++ GrammarConfigureWidgetPrivate * const d; ++}; ++} ++ ++#endif // GRAMMARCONFIGUREWIDGET_H diff -Nru kdepim-4.13.0/debian/patches/kubuntu_revert_e6ebd9b593dfd366b8c57932cc3167a8a3ec5b3b.diff kdepim-4.13.3/debian/patches/kubuntu_revert_e6ebd9b593dfd366b8c57932cc3167a8a3ec5b3b.diff --- kdepim-4.13.0/debian/patches/kubuntu_revert_e6ebd9b593dfd366b8c57932cc3167a8a3ec5b3b.diff 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/debian/patches/kubuntu_revert_e6ebd9b593dfd366b8c57932cc3167a8a3ec5b3b.diff 2014-05-11 01:06:11.000000000 +0000 @@ -0,0 +1,4321 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 29c866f..5b42d0e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -280,6 +280,7 @@ else() + add_definitions(-DKMAIL_SUPPORTED) + endif() + ++ macro_optional_add_subdirectory(pimactivity) + macro_optional_add_subdirectory(korganizer) + macro_optional_add_subdirectory(korgac) + macro_optional_add_subdirectory(sieveeditor) +diff --git a/MAINTAINERS b/MAINTAINERS +index c8f91cd..9e9eb76 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -43,6 +43,7 @@ mailcommon Laurent Montel + mboximporter Laurent Montel + notesagent Laurent Montel + pimsettingexporter Laurent Montel ++pimactivity Laurent Montel + messagecomposer Laurent Montel + messagecore Laurent Montel + messagelist Laurent Montel +diff --git a/pimactivity/CMakeLists.txt b/pimactivity/CMakeLists.txt +new file mode 100644 +index 0000000..d687806 +--- /dev/null ++++ b/pimactivity/CMakeLists.txt +@@ -0,0 +1,52 @@ ++PROJECT( pimactivity ) ++ ++find_package(KActivities 6.2.0 QUIET CONFIG) ++set_package_properties(KActivities PROPERTIES DESCRIPTION "KActivities" URL "https://projects.kde.org/projects/kde/kdelibs/kactivities" TYPE RECOMMENDED PURPOSE "Required for Activities integration in kdepim." ) ++ ++ ++if(KActivities_FOUND) ++ ++include_directories(${KACTIVITIES_INCLUDE_DIRS} .) ++ ++add_definitions( -DQT_NO_CAST_FROM_ASCII ) ++add_definitions( -DQT_NO_CAST_TO_ASCII ) ++ ++ ++set(libpimactivity_SRCS ++ widgets/comboboxactivity.cpp ++ widgets/configureidentity.cpp ++ activitymanager.cpp ++ configureactivitywidget.cpp ++ pimwidgets/mailtransport/transportcomboboxactivity.cpp ++ pimwidgets/identity/identitycomboboxactivity.cpp ++ pimwidgets/identity/identitymanageractivity.cpp ++ widgets/configurecollections.cpp ++ widgets/configuremailtransport.cpp ++ widgets/activitywarning.cpp ++ widgets/abstractconfigurewidget.cpp ++) ++ ++qt4_add_dbus_adaptor(libpimactivity_SRCS pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml pimwidgets/identity/identitymanageractivity.h PimActivity::IdentityManagerActivity ) ++ ++kde4_add_library(pimactivity ${LIBRARY_TYPE} ${libpimactivity_SRCS}) ++ ++set_target_properties(pimactivity PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION}) ++ ++target_link_libraries(pimactivity ++ ${KDE4_KDEUI_LIBS} ++ ${KDE4_KIO_LIBS} ++ ${KACTIVITIES_LIBRARY} ++ ${KDEPIMLIBS_KPIMIDENTITIES_LIBS} ++ ${KDEPIMLIBS_MAILTRANSPORT_LIBS} ++ ${KDEPIMLIBS_KMIME_LIBS} ++ ${KDEPIMLIBS_AKONADI_LIBS} ++ ${KDEPIMLIBS_KPIMUTILS_LIBS} ++ akonadi_next ++) ++ ++ ++install(TARGETS pimactivity ${INSTALL_TARGETS_DEFAULT_ARGS}) ++ ++add_subdirectory(kcm) ++add_subdirectory(tests) ++endif() +diff --git a/pimactivity/Messages.sh b/pimactivity/Messages.sh +new file mode 100644 +index 0000000..a03e491 +--- /dev/null ++++ b/pimactivity/Messages.sh +@@ -0,0 +1,3 @@ ++#! /bin/sh ++$XGETTEXT `find . -name '*.h' -o -name '*.cpp' | grep -v '/tests/' |grep -v '/kcm/'` -o $podir/libpimactivity.pot ++rm -f rc.cpp +diff --git a/pimactivity/activitymanager.cpp b/pimactivity/activitymanager.cpp +new file mode 100644 +index 0000000..37f3177 +--- /dev/null ++++ b/pimactivity/activitymanager.cpp +@@ -0,0 +1,168 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "activitymanager.h" ++ ++#include ++#include ++ ++#include ++ ++namespace PimActivity { ++ ++class ActivityManagerPrivate ++{ ++public: ++ ActivityManagerPrivate(ActivityManager *qq) ++ : isEnabled(false), ++ q(qq), ++ selectComponents(ActivityManager::None) ++ { ++ consumer = new KActivities::Consumer; ++ const QStringList activities = consumer->listActivities(); ++ Q_FOREACH (const QString &id, activities) { ++ insertActivity(id); ++ } ++ ++ q->connect(consumer,SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)),q,SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus))); ++ q->connect(consumer,SIGNAL(activityAdded(QString)),q,SLOT(slotActivityAdded(QString))); ++ q->connect(consumer,SIGNAL(activityRemoved(QString)),q,SLOT(slotActivityRemoved(QString))); ++ q->connect(consumer,SIGNAL(currentActivityChanged(QString)),q,SIGNAL(currentActivityChanged(QString))); ++ } ++ ~ActivityManagerPrivate() ++ { ++ delete consumer; ++ } ++ ++ void insertActivity(const QString &id) ++ { ++ KActivities::Info *activity = new KActivities::Info(id, q); ++ activities[id] = activity; ++ } ++ ++ void slotActivityRemoved(const QString &id) ++ { ++ KActivities::Info *activity = activities.take(id); ++ delete activity; ++ emit q->activityRemoved(id); ++ } ++ ++ void slotActivityAdded(const QString &id) ++ { ++ insertActivity(id); ++ emit q->activityAdded(id); ++ } ++ ++ QHash listActivitiesWithRealName() const ++ { ++ QHash result; ++ QHashIterator i(activities); ++ while (i.hasNext()) { ++ i.next(); ++ result.insert(i.key(), i.value()->name()); ++ } ++ return result; ++ } ++ ++ bool isEnabled; ++ QHash activities; ++ ActivityManager *q; ++ KActivities::Consumer *consumer; ++ ActivityManager::SelectComponents selectComponents; ++}; ++ ++ActivityManager::ActivityManager(QObject *parent) ++ : QObject(parent), d(new ActivityManagerPrivate(this)) ++{ ++ if (KActivities::Consumer::serviceStatus() == KActivities::Consumer::NotRunning) { ++ qDebug()<<" kactivities is not running"; ++ } else { ++ const QString currentActivity = this->currentActivity(); ++ if (!currentActivity.isEmpty()) { ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(currentActivity); ++ KConfigGroup grp = conf->group(QLatin1String("Global")); ++ d->isEnabled =grp.readEntry(QLatin1String("Enabled"), false); ++ } ++ } ++} ++ ++ActivityManager::~ActivityManager() ++{ ++ delete d; ++} ++ ++void ActivityManager::setEnabledActivity(bool enabled) ++{ ++ d->isEnabled = enabled; ++ Q_EMIT enabledActivityChanged(enabled); ++} ++ ++bool ActivityManager::isEnabledActivity() const ++{ ++ return d->isEnabled; ++} ++ ++bool ActivityManager::isActive() const ++{ ++ return (KActivities::Consumer::serviceStatus() == KActivities::Consumer::Running); ++} ++ ++QHash ActivityManager::listActivitiesWithRealName() const ++{ ++ return d->listActivitiesWithRealName(); ++} ++ ++QStringList ActivityManager::listActivities() const ++{ ++ if (isActive()) { ++ return d->consumer->listActivities(); ++ } ++ return QStringList(); ++} ++ ++QString ActivityManager::currentActivity() const ++{ ++ if (isActive()) { ++ return d->consumer->currentActivity(); ++ } ++ return QString(); ++} ++ ++KSharedConfigPtr ActivityManager::configFromActivity(const QString &id) ++{ ++ const QString configLocal = KStandardDirs::locateLocal( "data", QString::fromLatin1("activitymanager/activities/%1/config/pimactivityrc").arg(id) ); ++ return KSharedConfig::openConfig( configLocal ); ++} ++ ++void ActivityManager::setSelectComponents(ActivityManager::SelectComponents selection) ++{ ++ d->selectComponents = selection; ++} ++ ++ActivityManager::SelectComponents ActivityManager::selectComponents() const ++{ ++ return d->selectComponents; ++} ++ ++ ++ ++} ++ ++#include "moc_activitymanager.cpp" +diff --git a/pimactivity/activitymanager.h b/pimactivity/activitymanager.h +new file mode 100644 +index 0000000..b918fd8 +--- /dev/null ++++ b/pimactivity/activitymanager.h +@@ -0,0 +1,77 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 ACTIVITYMANAGER_H ++#define ACTIVITYMANAGER_H ++ ++#include "pimactivity_export.h" ++#include ++ ++#include ++ ++#include ++ ++namespace PimActivity { ++class ActivityManagerPrivate; ++class PIMACTIVITY_EXPORT ActivityManager : public QObject ++{ ++ Q_OBJECT ++public: ++ explicit ActivityManager(QObject *parent = 0); ++ ~ActivityManager(); ++ ++ enum SelectComponent { ++ None = 0, ++ Identity = 1, ++ MailTransport = 2, ++ Collection = 4 ++ }; ++ Q_DECLARE_FLAGS( SelectComponents, SelectComponent ) ++ ++ void setSelectComponents(ActivityManager::SelectComponents selection); ++ ActivityManager::SelectComponents selectComponents() const; ++ ++ bool isActive() const; ++ ++ QStringList listActivities() const; ++ QHash listActivitiesWithRealName() const; ++ QString currentActivity() const; ++ ++ void setEnabledActivity(bool enabled); ++ bool isEnabledActivity() const; ++ ++ static KSharedConfigPtr configFromActivity(const QString &id); ++ ++Q_SIGNALS: ++ void serviceStatusChanged(KActivities::Consumer::ServiceStatus); ++ void activityAdded(const QString &); ++ void activityRemoved(const QString &); ++ void currentActivityChanged(const QString &); ++ void enabledActivityChanged(bool enabled); ++ ++private: ++ friend class ActivityManagerPrivate; ++ ActivityManagerPrivate * const d; ++ Q_PRIVATE_SLOT( d, void slotActivityAdded(const QString &)) ++ Q_PRIVATE_SLOT( d, void slotActivityRemoved(const QString &)) ++}; ++} ++ ++#endif // ACTIVITYMANAGER_H +diff --git a/pimactivity/configureactivitywidget.cpp b/pimactivity/configureactivitywidget.cpp +new file mode 100644 +index 0000000..0a32217 +--- /dev/null ++++ b/pimactivity/configureactivitywidget.cpp +@@ -0,0 +1,185 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "configureactivitywidget.h" ++#include "activitymanager.h" ++#include "widgets/configureidentity.h" ++#include "widgets/comboboxactivity.h" ++#include "widgets/configuremailtransport.h" ++#include "widgets/configurecollections.h" ++#include "widgets/activitywarning.h" ++ ++#include ++#include ++ ++#include ++#include ++#include ++ ++namespace PimActivity { ++ ++class ConfigureActivityWidgetPrivate { ++public: ++ ConfigureActivityWidgetPrivate(ActivityManager *activityManager, ConfigureActivityWidget *qq) ++ : q(qq), ++ activateActivity( 0 ), ++ tabWidget( 0 ), ++ manager( activityManager ), ++ identity( 0 ), ++ mailTransport( 0 ) ++ { ++ QVBoxLayout * lay = new QVBoxLayout; ++ activateActivity = new QCheckBox(i18n("Enable Support Activity")); ++ activateActivity->setChecked(true); ++ lay->addWidget(activateActivity); ++ ++ lay->addWidget(new ActivityWarning(manager)); ++ ++ QHBoxLayout *verticalLayout = new QHBoxLayout; ++ QLabel *lab = new QLabel(i18n("Activities:")); ++ verticalLayout->addWidget(lab); ++ ++ activities = new ComboBoxActivity(manager, q); ++ ++ verticalLayout->addWidget(activities); ++ ++ ++ lay->addLayout(verticalLayout); ++ tabWidget = new KTabWidget; ++ ++ lay->addWidget(tabWidget); ++ q->setLayout(lay); ++ q->connect(activateActivity, SIGNAL(toggled(bool)), activities, SLOT(setEnabled(bool))); ++ q->connect(activateActivity, SIGNAL(toggled(bool)), tabWidget, SLOT(setEnabled(bool))); ++ q->connect(activateActivity, SIGNAL(toggled(bool)), q, SLOT(slotModified())); ++ ++ addPages(); ++ q->connect(activities, SIGNAL(activityChanged(QString)), q, SLOT(slotActivityChanged(QString))); ++ } ++ ~ConfigureActivityWidgetPrivate() ++ { ++ } ++ ++ void slotActivityChanged(const QString &id) ++ { ++ identity->setActivity(id); ++ mailTransport->setActivity(id); ++ collections->setActivity(id); ++ } ++ ++ void slotModified() ++ { ++ emit q->changed(true); ++ } ++ ++ void readConfig() ++ { ++ const QString currentActivity = manager->currentActivity(); ++ if (!currentActivity.isEmpty()) { ++ ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(currentActivity); ++ KConfigGroup grp = conf->group(QLatin1String("Global")); ++ activateActivity->setChecked(grp.readEntry(QLatin1String("Enabled"), false)); ++ ++ identity->setCurrentActivity(currentActivity); ++ mailTransport->setCurrentActivity(currentActivity); ++ collections->setCurrentActivity(currentActivity); ++ } ++ } ++ ++ void writeConfig() ++ { ++ const QString currentActivity = manager->currentActivity(); ++ bool activityEnabled = false; ++ if (!currentActivity.isEmpty()) { ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(currentActivity); ++ KConfigGroup grp = conf->group(QLatin1String("Global")); ++ activityEnabled = activateActivity->isChecked(); ++ grp.writeEntry(QLatin1String("Enabled"), activityEnabled); ++ ++ identity->writeConfig(currentActivity); ++ mailTransport->writeConfig(currentActivity); ++ collections->writeConfig(currentActivity); ++ } ++ manager->setEnabledActivity(activityEnabled); ++ } ++ ++ void setDefault() ++ { ++ activateActivity->setChecked(false); ++ identity->setDefault(); ++ mailTransport->setDefault(); ++ collections->setDefault(); ++ } ++ ++ void addPages() ++ { ++ identity = new ConfigureIdentity(q); ++ tabWidget->addTab(identity, i18n("Identity")); ++ q->connect(identity, SIGNAL(changed(bool)), q, SIGNAL(changed(bool))); ++ ++ mailTransport = new ConfigureMailtransport; ++ tabWidget->addTab(mailTransport, i18n("Transport")); ++ q->connect(mailTransport, SIGNAL(changed(bool)), q, SIGNAL(changed(bool))); ++ ++ collections = new ConfigureCollections; ++ tabWidget->addTab(collections, i18n("Collections")); ++ q->connect(collections, SIGNAL(changed(bool)), q, SIGNAL(changed(bool))); ++ } ++ ++ ConfigureActivityWidget *q; ++ QCheckBox *activateActivity; ++ KTabWidget *tabWidget; ++ ActivityManager *manager; ++ ConfigureIdentity *identity; ++ ComboBoxActivity *activities; ++ ConfigureMailtransport *mailTransport; ++ ConfigureCollections *collections; ++}; ++ ++ConfigureActivityWidget::ConfigureActivityWidget(ActivityManager *manager, QWidget *parent) ++ : QWidget(parent), d(new ConfigureActivityWidgetPrivate(manager, this)) ++{ ++} ++ ++ConfigureActivityWidget::~ConfigureActivityWidget() ++{ ++ delete d; ++} ++ ++void ConfigureActivityWidget::readConfig() ++{ ++ d->readConfig(); ++} ++ ++void ConfigureActivityWidget::writeConfig() ++{ ++ d->writeConfig(); ++} ++ ++void ConfigureActivityWidget::defaults() ++{ ++ d->setDefault(); ++} ++ ++} ++ ++ ++#include "moc_configureactivitywidget.cpp" +diff --git a/pimactivity/configureactivitywidget.h b/pimactivity/configureactivitywidget.h +new file mode 100644 +index 0000000..d19d7fc +--- /dev/null ++++ b/pimactivity/configureactivitywidget.h +@@ -0,0 +1,59 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 CONFIGUREACTIVITYWIDGET_H ++#define CONFIGUREACTIVITYWIDGET_H ++ ++#include "pimactivity_export.h" ++ ++#include ++ ++class KTabWidget; ++ ++namespace PimActivity { ++class ConfigureActivityWidgetPrivate; ++class ActivityManager; ++class PIMACTIVITY_EXPORT ConfigureActivityWidget : public QWidget ++{ ++ Q_OBJECT ++public: ++ explicit ConfigureActivityWidget(PimActivity::ActivityManager *manager, QWidget *parent = 0); ++ ~ConfigureActivityWidget(); ++ ++ enum ConfigureType { ++ Identity, ++ MailTransport, ++ Collection ++ }; ++ void readConfig(); ++ void writeConfig(); ++ void defaults(); ++ ++Q_SIGNALS: ++ void changed(bool); ++ ++private: ++ friend class ConfigureActivityWidgetPrivate; ++ ConfigureActivityWidgetPrivate * const d; ++ Q_PRIVATE_SLOT( d, void slotActivityChanged(const QString &)) ++ Q_PRIVATE_SLOT( d, void slotModified()) ++}; ++} ++ ++#endif // CONFIGUREACTIVITYWIDGET_H +diff --git a/pimactivity/kcm/CMakeLists.txt b/pimactivity/kcm/CMakeLists.txt +new file mode 100644 +index 0000000..d9d70f2 +--- /dev/null ++++ b/pimactivity/kcm/CMakeLists.txt +@@ -0,0 +1,10 @@ ++set( kcm_activity_SRCS ++ kcmpimactivity.cpp ++) ++ ++kde4_add_plugin(kcm_pimactivity ${kcm_activity_SRCS}) ++ ++target_link_libraries(kcm_pimactivity ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} pimactivity) ++ ++install(TARGETS kcm_pimactivity DESTINATION ${PLUGIN_INSTALL_DIR}) ++install(FILES kcmpimactivity.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +diff --git a/pimactivity/kcm/Messages.sh b/pimactivity/kcm/Messages.sh +new file mode 100644 +index 0000000..dc8dfc8 +--- /dev/null ++++ b/pimactivity/kcm/Messages.sh +@@ -0,0 +1,2 @@ ++#! /bin/sh ++$XGETTEXT `find . -name '*.h' -o -name '*.cpp' ` -o $podir/kcm_pimactivity.pot +diff --git a/pimactivity/kcm/kcmpimactivity.cpp b/pimactivity/kcm/kcmpimactivity.cpp +new file mode 100644 +index 0000000..16c5a88 +--- /dev/null ++++ b/pimactivity/kcm/kcmpimactivity.cpp +@@ -0,0 +1,77 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "kcmpimactivity.h" ++#include "pimactivity/activitymanager.h" ++#include "pimactivity/configureactivitywidget.h" ++ ++#include ++#include ++#include ++ ++#include ++ ++K_PLUGIN_FACTORY( KCMPimActivityFactory, registerPlugin(); ) ++K_EXPORT_PLUGIN( KCMPimActivityFactory( "kcmpimactivity" ) ) ++ ++ ++KCMPimActivity::KCMPimActivity(QWidget *parent, const QVariantList &args) ++ : KCModule( KCMPimActivityFactory::componentData(), parent ) ++{ ++ KAboutData *about = new KAboutData( I18N_NOOP( "kcmpimactivity" ), 0, ++ ki18n( "PIM Activity Settings" ), ++ 0, KLocalizedString(), KAboutData::License_LGPL, ++ ki18n( "(c) 2013 Laurent Montel" ) ); ++ ++ about->addAuthor( ki18n( "Laurent Montel" ), KLocalizedString(), "montel@kde.org" ); ++ KGlobal::locale()->insertCatalog(QLatin1String("libpimactivity")); ++ setAboutData( about ); ++ ++ initGUI(); ++} ++ ++KCMPimActivity::~KCMPimActivity() ++{ ++} ++ ++void KCMPimActivity::initGUI() ++{ ++ QVBoxLayout *layout = new QVBoxLayout; ++ layout->setSpacing( KDialog::spacingHint() ); ++ layout->setMargin( 0 ); ++ setLayout(layout); ++ mManager = new PimActivity::ActivityManager(this); ++ mConfigure = new PimActivity::ConfigureActivityWidget(mManager); ++ connect(mConfigure, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); ++ layout->addWidget(mConfigure); ++} ++ ++void KCMPimActivity::load() ++{ ++ mConfigure->readConfig(); ++} ++ ++void KCMPimActivity::save() ++{ ++ mConfigure->writeConfig(); ++} ++ ++void KCMPimActivity::defaults() ++{ ++ mConfigure->defaults(); ++} ++ +diff --git a/pimactivity/kcm/kcmpimactivity.desktop b/pimactivity/kcm/kcmpimactivity.desktop +new file mode 100644 +index 0000000..58bfd7d +--- /dev/null ++++ b/pimactivity/kcm/kcmpimactivity.desktop +@@ -0,0 +1,115 @@ ++[Desktop Entry] ++Type=Service ++X-KDE-ServiceTypes=KCModule ++ ++X-KDE-Library=kcm_pimactivity ++X-KDE-Weight=200 ++ ++Name=PIM Activity Settings ++Name[bs]=Postavke PIM aktivnosti ++Name[ca]=Arranjament de l'activitat PIM ++Name[ca@valencia]=Arranjament de l'activitat PIM ++Name[cs]=Nastavení činnosti PIM ++Name[da]=Indstilling af PIM-aktivitet ++Name[de]=Einstellungen für PIM-Aktivitäten ++Name[el]=Ρυθμίσεις δραστηριότητας PIM ++Name[es]=Preferencias de actividad de PIM ++Name[fi]=PIM-aktiviteettiasetukset ++Name[fr]=Configuration de l'activité PIM ++Name[gl]=Configuración da actividade de PIM ++Name[hu]=PIM tevékenység beállítások ++Name[ia]=Preferentias de activitate de PIM ++Name[it]=Impostazioni delle attività di PIM ++Name[kk]=PIM белсендігін баптау ++Name[ko]=PIM 활동 설정 ++Name[lt]=Stiliaus nustatymai ++Name[mr]=पीआयएम कार्यपध्दती संयोजना ++Name[nb]=PIM aktivitetsinnstillinger ++Name[nds]=PIM-Aktiviteetinstellen ++Name[nl]=Activiteitsinstellingen van PIM ++Name[pl]=Ustawienia działań ZIO ++Name[pt]=Configuração da Actividade PIM ++Name[pt_BR]=Configurações da atividade de PIM ++Name[ru]=Настройка комнат для приложений PIM ++Name[sk]=Nastavenia aktivít PIM ++Name[sr]=Поставке ПИМ активности ++Name[sr@ijekavian]=Поставке ПИМ активности ++Name[sr@ijekavianlatin]=Postavke PIM aktivnosti ++Name[sr@latin]=Postavke PIM aktivnosti ++Name[sv]=Aktivitetsinställningar för personlig informationshantering ++Name[tr]=PIM Etkinlik Ayarları ++Name[uk]=Параметри простору дій керування особистими даними ++Name[wa]=Apontiaedjes des activités PIM ++Name[x-test]=xxPIM Activity Settingsxx ++Name[zh_TW]=PIM 活動設定 ++Comment=Configure the activity for pim application ++Comment[bs]=Konfiguriši aktivnost za Pim aplikaciju ++Comment[ca]=Configura l'activitat per a l'aplicació PIM ++Comment[ca@valencia]=Configura l'activitat per a l'aplicació PIM ++Comment[da]=Indstil aktiviteten til PIM-program ++Comment[de]=Einrichtung der Aktivitäten für PIM-Anwendungen ++Comment[el]=Διαμόρφωση της δραστηριότητας για εφαρμογές pim ++Comment[es]=Configurar la actividad para una aplicación pim ++Comment[fi]=Määrittää PIM-sovelluksen toiminnot. ++Comment[fr]=Configurer l'activité pour l'application pim ++Comment[gl]=Configurar a actividade de programas PIM. ++Comment[hu]=Tevékenység beállítása a PIM alkalmazásokhoz ++Comment[ia]=Configura le activitate pro application de pim ++Comment[it]=Configura l'attività per l'applicazione di PIM ++Comment[kk]=PIM қолданбаның белсендігін баптау ++Comment[ko]=PIM 프로그램의 활동 설정 ++Comment[lt]=Konfigūruoti pim programos veiklą ++Comment[mr]=पीआयएम अनुप्रयोगाकरिता कार्यपध्दती संयोजीत करा ++Comment[nb]=Sett opp aktiviteten for pim-program ++Comment[nds]=De Aktiviteet för't PIM-Programm instellen ++Comment[nl]=De activiteit voor de pim-toepassing instellen ++Comment[pl]=Konfiguruj działania dla programu zio ++Comment[pt]=Configura a actividade para uma aplicação PIM ++Comment[pt_BR]=Configura a atividade para aplicativos de PIM ++Comment[ru]=Настройте комнату для PIM-приложения ++Comment[sk]=Nastaviť aktivitu pre aplikáciu pim ++Comment[sr]=Подесите активност за ПИМ програме ++Comment[sr@ijekavian]=Подесите активност за ПИМ програме ++Comment[sr@ijekavianlatin]=Podesite aktivnost za PIM programe ++Comment[sr@latin]=Podesite aktivnost za PIM programe ++Comment[sv]=Anpassa aktiviteten för personlig informationshanteringsprogram ++Comment[tr]=PIM uygulaması için etkinliği yapılandır ++Comment[uk]=Налаштувати простір дій для програми керування особистими даними ++Comment[wa]=Apontyîz l' activité pol programe pim ++Comment[x-test]=xxConfigure the activity for pim applicationxx ++Comment[zh_TW]=設定 PIM 應用程式的活動 ++X-KDE-Keywords=configure, settings, activity ++X-KDE-Keywords[bs]=konfigurisanje, postavkem, aktivnost ++X-KDE-Keywords[ca]=configura, arranjament, activitat ++X-KDE-Keywords[ca@valencia]=configura, arranjament, activitat ++X-KDE-Keywords[da]=indstil, konfigurér, aktivitet ++X-KDE-Keywords[de]=einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,Aktivität ++X-KDE-Keywords[el]=διαμόρφωση, ρυθμίσεις, δραστηριότητα ++X-KDE-Keywords[es]=configurar, preferencias, actividad ++X-KDE-Keywords[fi]=configure, settings, activity, asetukset, aktiviteetti ++X-KDE-Keywords[fr]=configurer, paramétrage, activité ++X-KDE-Keywords[gl]=configurar, configuración, actividade ++X-KDE-Keywords[hu]=beállítás, beállítások, tevékenység ++X-KDE-Keywords[ia]=configura, preferentia, activitate ++X-KDE-Keywords[it]=configurazione, impostazioni, attività ++X-KDE-Keywords[kk]=configure, settings, activity ++X-KDE-Keywords[lt]=akregator, konfigūruoti, nustatymai, išsamiau ++X-KDE-Keywords[mr]=संयोजना, संयोजना, कार्यपध्दती ++X-KDE-Keywords[nb]=sett opp, innstillinger, aktivitet ++X-KDE-Keywords[nds]=instellen,inrichten,Aktiviteet ++X-KDE-Keywords[nl]=configureren. instellingen, activiteit ++X-KDE-Keywords[pl]=konfiguruj, ustawienia, działanie ++X-KDE-Keywords[pt]=configurar, configuração, actividade ++X-KDE-Keywords[pt_BR]=configurar, configurações, atividade ++X-KDE-Keywords[ru]=configure,settings,activity,настроить,настройки,параметры,комната ++X-KDE-Keywords[sk]=nastaviť, nastavenia, aktivita ++X-KDE-Keywords[sr]=configure,settings,activity,подешавање,поставке,активност ++X-KDE-Keywords[sr@ijekavian]=configure,settings,activity,подешавање,поставке,активност ++X-KDE-Keywords[sr@ijekavianlatin]=configure,settings,activity,podešavanje,postavke,aktivnost ++X-KDE-Keywords[sr@latin]=configure,settings,activity,podešavanje,postavke,aktivnost ++X-KDE-Keywords[sv]=anpassa, inställningar, aktivitet ++X-KDE-Keywords[tr]=yapılandır, ayarlar, etkinlik ++X-KDE-Keywords[uk]=configure,settings,activity,налаштувати,налаштування,параметри,простір,дії,простір дій ++X-KDE-Keywords[wa]=apontyî, tchuzes, apontiaedje, activité ++X-KDE-Keywords[x-test]=xxconfigure, settings, activityxx ++X-KDE-Keywords[zh_TW]=configure, settings, activity +diff --git a/pimactivity/kcm/kcmpimactivity.h b/pimactivity/kcm/kcmpimactivity.h +new file mode 100644 +index 0000000..6132972 +--- /dev/null ++++ b/pimactivity/kcm/kcmpimactivity.h +@@ -0,0 +1,43 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 KCMPIMACTIVITY_H ++#define KCMPIMACTIVITY_H ++ ++#include ++ ++namespace PimActivity { ++class ActivityManager; ++class ConfigureActivityWidget; ++} ++ ++class KCMPimActivity : public KCModule ++{ ++public: ++ explicit KCMPimActivity(QWidget *parent, const QVariantList &args ); ++ ~KCMPimActivity(); ++ ++ void load(); ++ void save(); ++ void defaults(); ++private: ++ void initGUI(); ++ PimActivity::ActivityManager *mManager; ++ PimActivity::ConfigureActivityWidget *mConfigure; ++}; ++ ++#endif // KCMPIMACTIVITY_H +diff --git a/pimactivity/pimactivity_export.h b/pimactivity/pimactivity_export.h +new file mode 100644 +index 0000000..ae179f1 +--- /dev/null ++++ b/pimactivity/pimactivity_export.h +@@ -0,0 +1,43 @@ ++/* This file is part of the KDE project ++ Copyright (C) 2007 David Faure ++ ++ 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 PIMACTIVITY_EXPORT_H ++#define PIMACTIVITY_EXPORT_H ++ ++/* needed for KDE_EXPORT and KDE_IMPORT macros */ ++#include ++ ++#ifndef PIMACTIVITY_EXPORT ++# if defined(KDEPIM_STATIC_LIBS) ++ /* No export/import for static libraries */ ++# define PIMACTIVITY_EXPORT ++# elif defined(MAKE_PIMACTIVITY_LIB) ++ /* We are building this library */ ++# define PIMACTIVITY_EXPORT KDE_EXPORT ++# else ++ /* We are using this library */ ++# define PIMACTIVITY_EXPORT KDE_IMPORT ++# endif ++#endif ++ ++# ifndef PIMACTIVITY_EXPORT_DEPRECATED ++# define PIMACTIVITY_EXPORT_DEPRECATED KDE_DEPRECATED PIMACTIVITY_EXPORT ++# endif ++ ++#endif +diff --git a/pimactivity/pimwidgets/identity/TODO b/pimactivity/pimwidgets/identity/TODO +new file mode 100644 +index 0000000..eb152e3 +--- /dev/null ++++ b/pimactivity/pimwidgets/identity/TODO +@@ -0,0 +1,2 @@ ++Add support for default identity for each activity ++ +diff --git a/pimactivity/pimwidgets/identity/identitycomboboxactivity.cpp b/pimactivity/pimwidgets/identity/identitycomboboxactivity.cpp +new file mode 100644 +index 0000000..f80b533 +--- /dev/null ++++ b/pimactivity/pimwidgets/identity/identitycomboboxactivity.cpp +@@ -0,0 +1,103 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "identitycomboboxactivity.h" ++#include "activitymanager.h" ++#include "identitymanageractivity.h" ++ ++#include ++ ++namespace PimActivity { ++class IdentityComboboxActivityPrivate ++{ ++public: ++ IdentityComboboxActivityPrivate(IdentityManagerActivity *manager, IdentityComboboxActivity *qq) ++ : identityManagerActivity(manager), ++ q(qq) ++ { ++ } ++ ++ void connectSignals() ++ { ++ if (identityManagerActivity->activityManager()) { ++ q->connect(identityManagerActivity->activityManager(), SIGNAL(currentActivityChanged(QString)), q, SLOT(slotCurrentActivityChanged(QString))); ++ initializeActivity(); ++ } ++ } ++ ++ void initializeActivity() ++ { ++ slotCurrentActivityChanged(identityManagerActivity->activityManager()->currentActivity()); ++ } ++ ++ void slotCurrentActivityChanged(const QString &id) ++ { ++ //TODO ++ q->updateComboboxList(id); ++ } ++ ++ QList uoidList; ++ IdentityManagerActivity *identityManagerActivity; ++ IdentityComboboxActivity *q; ++}; ++ ++ ++IdentityComboboxActivity::IdentityComboboxActivity(IdentityManagerActivity *manager, QWidget *parent) ++ : KComboBox(parent), d(new IdentityComboboxActivityPrivate(manager, this)) ++{ ++ d->connectSignals(); ++} ++ ++IdentityComboboxActivity::~IdentityComboboxActivity() ++{ ++ delete d; ++} ++ ++void IdentityComboboxActivity::updateComboboxList(const QString &id) ++{ ++ clear(); ++ if (id.isEmpty()) { ++ //not activity => show all identity ++ } else { ++ //Show current identity from id. ++ } ++ //TODO ++} ++ ++uint IdentityComboboxActivity::currentIdentity() const ++{ ++ return d->uoidList[ currentIndex()]; ++} ++ ++void IdentityComboboxActivity::setCurrentIdentity( const QString &identityName ) ++{ ++ ++} ++ ++void IdentityComboboxActivity::setCurrentIdentity( const KPIMIdentities::Identity &identity ) ++{ ++ setCurrentIdentity( identity.uoid() ); ++} ++ ++void IdentityComboboxActivity::setCurrentIdentity( uint uoid ) ++{ ++ ++} ++ ++} ++ ++#include "moc_identitycomboboxactivity.cpp" +diff --git a/pimactivity/pimwidgets/identity/identitycomboboxactivity.h b/pimactivity/pimwidgets/identity/identitycomboboxactivity.h +new file mode 100644 +index 0000000..a5148f2 +--- /dev/null ++++ b/pimactivity/pimwidgets/identity/identitycomboboxactivity.h +@@ -0,0 +1,54 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 IDENTITYCOMBOBOXACTIVITY_H ++#define IDENTITYCOMBOBOXACTIVITY_H ++ ++#include "pimactivity_export.h" ++#include ++ ++namespace KPIMIdentities { ++class Identity; ++} ++ ++namespace PimActivity { ++class IdentityComboboxActivityPrivate; ++class IdentityManagerActivity; ++class PIMACTIVITY_EXPORT IdentityComboboxActivity : public KComboBox ++{ ++ Q_OBJECT ++public: ++ explicit IdentityComboboxActivity(IdentityManagerActivity *manager, QWidget *parent = 0); ++ ~IdentityComboboxActivity(); ++ QString currentIdentityName() const; ++ ++ uint currentIdentity() const; ++ void setCurrentIdentity( const QString &identityName ); ++ void setCurrentIdentity( const KPIMIdentities::Identity &identity ); ++ void setCurrentIdentity( uint uoid ); ++ ++protected Q_SLOTS: ++ void updateComboboxList(const QString &id); ++ ++private: ++ friend class IdentityComboboxActivityPrivate; ++ IdentityComboboxActivityPrivate * const d; ++ Q_PRIVATE_SLOT( d, void slotCurrentActivityChanged(const QString&)) ++}; ++} ++ ++#endif // IDENTITYCOMBOBOXACTIVITY_H +diff --git a/pimactivity/pimwidgets/identity/identitymanageractivity.cpp b/pimactivity/pimwidgets/identity/identitymanageractivity.cpp +new file mode 100644 +index 0000000..b51ce6b +--- /dev/null ++++ b/pimactivity/pimwidgets/identity/identitymanageractivity.cpp +@@ -0,0 +1,658 @@ ++/* ++ Copyright (c) 2002 Marc Mutz ++ ++ 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. ++*/ ++ ++// config keys: ++static const char configKeyDefaultIdentity[] = "Default Identity"; ++ ++#include "identitymanageractivity.h" ++#include // for IdentityList::{export,import}Data ++ ++#include // for static helper functions ++ ++#include // for IdentityEntry::fromControlCenter() ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++#include "identitymanageractivityadaptor.h" ++ ++namespace PimActivity { ++ ++class IdentityManagerActivityPrivate ++{ ++public: ++ IdentityManagerActivityPrivate(ActivityManager *manager, IdentityManagerActivity *qq) ++ : readOnly(false), ++ activityManager(manager), ++ q(qq) ++ { ++ config = new KConfig( QLatin1String("emailidentities") ); ++ } ++ ~IdentityManagerActivityPrivate() ++ { ++ delete config; ++ } ++ ++ QStringList groupList( KConfig *conf ) const ++ { ++ return conf->groupList().filter( QRegExp( QLatin1String("^Identity #\\d+$") ) ); ++ } ++ ++ void writeConfig() const ++ { ++ const QStringList identitiesList = groupList( config ); ++ QStringList::const_iterator groupEnd = identitiesList.constEnd(); ++ for ( QStringList::const_iterator group = identitiesList.constBegin(); ++ group != groupEnd; ++group ) { ++ config->deleteGroup( *group ); ++ } ++ int i = 0; ++ IdentityManagerActivity::ConstIterator end = identities.constEnd(); ++ for ( IdentityManagerActivity::ConstIterator it = identities.constBegin(); ++ it != end; ++it, ++i ) { ++ KConfigGroup cg( config, QString::fromLatin1( "Identity #%1" ).arg( i ) ); ++ ( *it ).writeConfig( cg ); ++ if ( ( *it ).isDefault() ) { ++ // remember which one is default: ++ KConfigGroup general( config, "General" ); ++ general.writeEntry( configKeyDefaultIdentity, ( *it ).uoid() ); ++ ++ // Also write the default identity to emailsettings ++ KEMailSettings es; ++ es.setSetting( KEMailSettings::RealName, ( *it ).fullName() ); ++ es.setSetting( KEMailSettings::EmailAddress, ( *it ).primaryEmailAddress() ); ++ es.setSetting( KEMailSettings::Organization, ( *it ).organization() ); ++ es.setSetting( KEMailSettings::ReplyToAddress, ( *it ).replyToAddr() ); ++ } ++ } ++ config->sync(); ++ } ++ ++ void readConfig( KConfig *conf ) ++ { ++ identities.clear(); ++ ++ const QStringList identitiesList = groupList( conf ); ++ if ( identitiesList.isEmpty() ) { ++ return; // nothing to be done... ++ } ++ ++ KConfigGroup general( conf, "General" ); ++ uint defaultIdentity = general.readEntry( configKeyDefaultIdentity, 0 ); ++ bool haveDefault = false; ++ QStringList::const_iterator groupEnd = identitiesList.constEnd(); ++ for ( QStringList::const_iterator group = identitiesList.constBegin(); ++ group != groupEnd; ++group ) { ++ KConfigGroup configGroup( conf, *group ); ++ identities << KPIMIdentities::Identity(); ++ identities.last().readConfig( configGroup ); ++ if ( !haveDefault && identities.last().uoid() == defaultIdentity ) { ++ haveDefault = true; ++ identities.last().setIsDefault( true ); ++ } ++ } ++ ++ if ( !haveDefault ) { ++ kWarning( 5325 ) << "IdentityManagerActivity: There was no default identity." ++ << "Marking first one as default."; ++ identities.first().setIsDefault( true ); ++ } ++ qSort( identities ); ++ ++ shadowIdentities = identities; ++ } ++ ++ ++ void createDefaultIdentity() ++ { ++ QString fullName, emailAddress; ++ bool done = false; ++ ++ // Check if the application has any settings ++ q->createDefaultIdentity( fullName, emailAddress ); ++ ++ // If not, then use the kcontrol settings ++ if ( fullName.isEmpty() && emailAddress.isEmpty() ) { ++ KEMailSettings emailSettings; ++ fullName = emailSettings.getSetting( KEMailSettings::RealName ); ++ emailAddress = emailSettings.getSetting( KEMailSettings::EmailAddress ); ++ ++ if ( !fullName.isEmpty() && !emailAddress.isEmpty() ) { ++ q->newFromControlCenter( i18nc( "use default address from control center", ++ "Default" ) ); ++ done = true; ++ } else { ++ // If KEmailSettings doesn't have name and address, generate something from KUser ++ KUser user; ++ if ( fullName.isEmpty() ) { ++ fullName = user.property( KUser::FullName ).toString(); ++ } ++ if ( emailAddress.isEmpty() ) { ++ emailAddress = user.loginName(); ++ if ( !emailAddress.isEmpty() ) { ++ KConfigGroup general( config, "General" ); ++ QString defaultdomain = general.readEntry( "Default domain" ); ++ if ( !defaultdomain.isEmpty() ) { ++ emailAddress += QLatin1Char('@') + defaultdomain; ++ } else { ++ emailAddress.clear(); ++ } ++ } ++ } ++ } ++ } ++ ++ if ( !done ) { ++ // Default identity name ++ QString name( i18nc( "Default name for new email accounts/identities.", "Unnamed" ) ); ++ ++ if ( !emailAddress.isEmpty() ) { ++ // If we have an email address, create a default identity name from it ++ QString idName = emailAddress; ++ int pos = idName.indexOf( QLatin1Char('@') ); ++ if ( pos != -1 ) { ++ name = idName.mid( pos + 1, -1 ); ++ } ++ ++ // Make the name a bit more human friendly ++ name.replace( QLatin1Char('.'), QLatin1Char(' ') ); ++ pos = name.indexOf( QLatin1Char(' ') ); ++ if ( pos != 0 ) { ++ name[pos + 1] = name[pos + 1].toUpper(); ++ } ++ name[0] = name[0].toUpper(); ++ } else if ( !fullName.isEmpty() ) { ++ // If we have a full name, create a default identity name from it ++ name = fullName; ++ } ++ shadowIdentities << KPIMIdentities::Identity( name, fullName, emailAddress ); ++ } ++ ++ shadowIdentities.last().setIsDefault( true ); ++ shadowIdentities.last().setUoid( newUoid() ); ++ if ( readOnly ) { // commit won't do it in readonly mode ++ identities = shadowIdentities; ++ } ++ } ++ ++ int newUoid() ++ { ++ int uoid; ++ ++ // determine the UOIDs of all saved identities ++ QList usedUOIDs; ++ QList::ConstIterator end( identities.constEnd() ); ++ for ( QList::ConstIterator it = identities.constBegin(); ++ it != end; ++it ) { ++ usedUOIDs << ( *it ).uoid(); ++ } ++ ++ if ( q->hasPendingChanges() ) { ++ // add UOIDs of all shadow identities. Yes, we will add a lot of duplicate ++ // UOIDs, but avoiding duplicate UOIDs isn't worth the effort. ++ QList::ConstIterator endShadow( shadowIdentities.constEnd() ); ++ for ( QList::ConstIterator it = shadowIdentities.constBegin(); ++ it != endShadow; ++it ) { ++ usedUOIDs << ( *it ).uoid(); ++ } ++ } ++ ++ usedUOIDs << 0; // no UOID must be 0 because this value always refers to the ++ // default identity ++ ++ do { ++ uoid = KRandom::random(); ++ } while ( usedUOIDs.indexOf( uoid ) != -1 ); ++ ++ return uoid; ++ } ++ ++ /** The list that will be seen by everyoe */ ++ QList identities; ++ /** The list that will be seen by the config dialog */ ++ QList shadowIdentities; ++ ++ KConfig *config; ++ bool readOnly; ++ ActivityManager *activityManager; ++ IdentityManagerActivity *q; ++}; ++ ++ ++static QString newDBusObjectName() ++{ ++ static int s_count = 0; ++ QString name = QLatin1String( "/KPIMIDENTITIES_IdentityManagerActivity" ); ++ if ( s_count++ ) { ++ name += QLatin1Char('_'); ++ name += QString::number( s_count ); ++ } ++ return name; ++} ++ ++IdentityManagerActivity::IdentityManagerActivity(ActivityManager *manager, bool readonly, QObject *parent, ++ const char *name ) ++ : QObject( parent ), ++ d(new IdentityManagerActivityPrivate(manager, this)) ++{ ++ setObjectName( QLatin1String(name) ); ++ KGlobal::locale()->insertCatalog( QLatin1String("libkpimidentities") ); ++ new IdentityManagerActivityAdaptor( this ); ++ QDBusConnection dbus = QDBusConnection::sessionBus(); ++ const QString dbusPath = newDBusObjectName(); ++ setProperty( "uniqueDBusPath", dbusPath ); ++ const QString dbusInterface = QLatin1String("org.kde.pim.IdentityManagerActivity"); ++ dbus.registerObject( dbusPath, this ); ++ dbus.connect( QString(), QString(), dbusInterface, QLatin1String("identitiesChanged"), this, ++ SLOT(slotIdentitiesChanged(QString)) ); ++ ++ d->readOnly = readonly; ++ ++ d->readConfig( d->config ); ++ if ( d->identities.isEmpty() ) { ++ kDebug( 5325 ) << "emailidentities is empty -> convert from kmailrc"; ++ // No emailidentities file, or an empty one due to broken conversion ++ // (kconf_update bug in kdelibs <= 3.2.2) ++ // => convert it, i.e. read settings from kmailrc ++ KConfig kmailConf( QLatin1String("kmailrc") ); ++ d->readConfig( &kmailConf ); ++ } ++ // we need at least a default identity: ++ if ( d->identities.isEmpty() ) { ++ kDebug( 5325 ) << "IdentityManagerActivity: No identity found. Creating default."; ++ d->createDefaultIdentity(); ++ commit(); ++ } ++ // Migration: people without settings in kemailsettings should get some ++ if ( KEMailSettings().getSetting( KEMailSettings::EmailAddress ).isEmpty() ) { ++ d->writeConfig(); ++ } ++} ++ ++IdentityManagerActivity::~IdentityManagerActivity() ++{ ++ kWarning( hasPendingChanges(), 5325 ) ++ << "IdentityManagerActivity: There were uncommitted changes!"; ++ delete d; ++} ++ ++PimActivity::ActivityManager *IdentityManagerActivity::activityManager() const ++{ ++ return d->activityManager; ++} ++ ++ ++QString IdentityManagerActivity::makeUnique( const QString &name ) const ++{ ++ int suffix = 1; ++ QString result = name; ++ while ( identities().contains( result ) ) { ++ result = i18nc( "%1: name; %2: number appended to it to make it unique " ++ "among a list of names", "%1 #%2", ++ name, suffix ); ++ suffix++; ++ } ++ return result; ++} ++ ++bool IdentityManagerActivity::isUnique( const QString &name ) const ++{ ++ return !identities().contains( name ); ++} ++ ++void IdentityManagerActivity::commit() ++{ ++ // early out: ++ if ( !hasPendingChanges() || d->readOnly ) { ++ return; ++ } ++ ++ QList seenUOIDs; ++ QList::ConstIterator end = d->identities.constEnd(); ++ for ( QList::ConstIterator it = d->identities.constBegin(); ++ it != end; ++it ) { ++ seenUOIDs << ( *it ).uoid(); ++ } ++ ++ QList changedUOIDs; ++ // find added and changed identities: ++ for ( QList::ConstIterator it = d->shadowIdentities.constBegin(); ++ it != d->shadowIdentities.constEnd(); ++it ) { ++ int index = seenUOIDs.indexOf( ( *it ).uoid() ); ++ if ( index != -1 ) { ++ uint uoid = seenUOIDs.at( index ); ++ const KPIMIdentities::Identity &orig = identityForUoid( uoid ); // look up in identities ++ if ( *it != orig ) { ++ // changed identity ++ kDebug( 5325 ) << "emitting changed() for identity" << uoid; ++ emit changed( *it ); ++ changedUOIDs << uoid; ++ } ++ seenUOIDs.removeAll( uoid ); ++ } else { ++ // new identity ++ kDebug( 5325 ) << "emitting added() for identity" << ( *it ).uoid(); ++ emit added( *it ); ++ } ++ } ++ ++ // what's left are deleted identities: ++ for ( QList::ConstIterator it = seenUOIDs.constBegin(); ++ it != seenUOIDs.constEnd(); ++it ) { ++ kDebug( 5325 ) << "emitting deleted() for identity" << ( *it ); ++ emit deleted( *it ); ++ } ++ ++ d->identities = d->shadowIdentities; ++ d->writeConfig(); ++ ++ // now that identities has all the new info, we can emit the added/changed ++ // signals that ship a uoid. This is because the slots might use ++ // identityForUoid(uoid)... ++ QList::ConstIterator changedEnd( changedUOIDs.constEnd() ); ++ for ( QList::ConstIterator it = changedUOIDs.constBegin(); ++ it != changedEnd; ++it ) { ++ emit changed( *it ); ++ } ++ ++ emit changed(); // normal signal ++ ++ // DBus signal for other IdentityManagerActivity instances ++ const QString ourIdentifier = QString::fromLatin1( "%1/%2" ). ++ arg( QDBusConnection::sessionBus().baseService() ). ++ arg( property( "uniqueDBusPath" ).toString() ); ++ emit identitiesChanged( ourIdentifier ); ++} ++ ++void IdentityManagerActivity::rollback() ++{ ++ d->shadowIdentities = d->identities; ++} ++ ++bool IdentityManagerActivity::hasPendingChanges() const ++{ ++ return d->identities != d->shadowIdentities; ++} ++ ++QStringList IdentityManagerActivity::identities() const ++{ ++ QStringList result; ++ ConstIterator end = d->identities.constEnd(); ++ for ( ConstIterator it = d->identities.constBegin(); ++ it != end; ++it ) { ++ result << ( *it ).identityName(); ++ } ++ return result; ++} ++ ++QStringList IdentityManagerActivity::shadowIdentities() const ++{ ++ QStringList result; ++ ConstIterator end = d->shadowIdentities.constEnd(); ++ for ( ConstIterator it = d->shadowIdentities.constBegin(); ++ it != end; ++it ) { ++ result << ( *it ).identityName(); ++ } ++ return result; ++} ++ ++void IdentityManagerActivity::sort() ++{ ++ qSort( d->shadowIdentities ); ++} ++ ++QList::ConstIterator IdentityManagerActivity::begin() const ++{ ++ return d->identities.constBegin(); ++} ++ ++QList::ConstIterator IdentityManagerActivity::end() const ++{ ++ return d->identities.constEnd(); ++} ++ ++IdentityManagerActivity::Iterator IdentityManagerActivity::modifyBegin() ++{ ++ return d->shadowIdentities.begin(); ++} ++ ++IdentityManagerActivity::Iterator IdentityManagerActivity::modifyEnd() ++{ ++ return d->shadowIdentities.end(); ++} ++ ++const KPIMIdentities::Identity &IdentityManagerActivity::identityForUoid( uint uoid ) const ++{ ++ for ( ConstIterator it = begin(); it != end(); ++it ) { ++ if ( ( *it ).uoid() == uoid ) { ++ return ( *it ); ++ } ++ } ++ return KPIMIdentities::Identity::null(); ++} ++ ++const KPIMIdentities::Identity &IdentityManagerActivity::identityForUoidOrDefault( uint uoid ) const ++{ ++ const KPIMIdentities::Identity &ident = identityForUoid( uoid ); ++ if ( ident.isNull() ) { ++ return defaultIdentity(); ++ } else { ++ return ident; ++ } ++} ++ ++const KPIMIdentities::Identity &IdentityManagerActivity::identityForAddress( const QString &addresses ) const ++{ ++ const QStringList addressList = KPIMUtils::splitAddressList( addresses ); ++ foreach ( const QString &fullAddress, addressList ) { ++ const QString addrSpec = KPIMUtils::extractEmailAddress( fullAddress ).toLower(); ++ for ( ConstIterator it = begin(); it != end(); ++it ) { ++ const KPIMIdentities::Identity &identity = *it; ++ if ( identity.matchesEmailAddress( addrSpec ) ) { ++ return identity; ++ } ++ } ++ } ++ return KPIMIdentities::Identity::null(); ++} ++ ++bool IdentityManagerActivity::thatIsMe( const QString &addressList ) const ++{ ++ return !identityForAddress( addressList ).isNull(); ++} ++ ++KPIMIdentities::Identity &IdentityManagerActivity::modifyIdentityForName( const QString &name ) ++{ ++ for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { ++ if ( ( *it ).identityName() == name ) { ++ return ( *it ); ++ } ++ } ++ ++ kWarning( 5325 ) << "IdentityManagerActivity::modifyIdentityForName() used as" ++ << "newFromScratch() replacement!" ++ << endl << " name == \"" << name << "\""; ++ return newFromScratch( name ); ++} ++ ++KPIMIdentities::Identity &IdentityManagerActivity::modifyIdentityForUoid( uint uoid ) ++{ ++ for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { ++ if ( ( *it ).uoid() == uoid ) { ++ return ( *it ); ++ } ++ } ++ ++ kWarning( 5325 ) << "IdentityManagerActivity::identityForUoid() used as" ++ << "newFromScratch() replacement!" ++ << endl << " uoid == \"" << uoid << "\""; ++ return newFromScratch( i18n( "Unnamed" ) ); ++} ++ ++const KPIMIdentities::Identity &IdentityManagerActivity::defaultIdentity() const ++{ ++ for ( ConstIterator it = begin(); it != end(); ++it ) { ++ if ( ( *it ).isDefault() ) { ++ return ( *it ); ++ } ++ } ++ ++ if ( d->identities.isEmpty() ) { ++ kFatal( 5325 ) << "IdentityManagerActivity: No default identity found!"; ++ } else { ++ kWarning( 5325 ) << "IdentityManagerActivity: No default identity found!"; ++ } ++ return *begin(); ++} ++ ++bool IdentityManagerActivity::setAsDefault( uint uoid ) ++{ ++ // First, check if the identity actually exists: ++ bool found = false; ++ for ( ConstIterator it = d->shadowIdentities.constBegin(); ++ it != d->shadowIdentities.constEnd(); ++it ) { ++ if ( ( *it ).uoid() == uoid ) { ++ found = true; ++ break; ++ } ++ } ++ ++ if ( !found ) { ++ return false; ++ } ++ ++ // Then, change the default as requested: ++ for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { ++ ( *it ).setIsDefault( ( *it ).uoid() == uoid ); ++ } ++ ++ // and re-sort: ++ sort(); ++ return true; ++} ++ ++bool IdentityManagerActivity::removeIdentity( const QString &name ) ++{ ++ if ( d->shadowIdentities.size() <= 1 ) { ++ return false; ++ } ++ ++ for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { ++ if ( ( *it ).identityName() == name ) { ++ bool removedWasDefault = ( *it ).isDefault(); ++ d->shadowIdentities.erase( it ); ++ if ( removedWasDefault && !d->shadowIdentities.isEmpty() ) { ++ d->shadowIdentities.first().setIsDefault( true ); ++ } ++ return true; ++ } ++ } ++ return false; ++} ++ ++bool IdentityManagerActivity::removeIdentityForced( const QString &name ) ++{ ++ for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { ++ if ( ( *it ).identityName() == name ) { ++ bool removedWasDefault = ( *it ).isDefault(); ++ d->shadowIdentities.erase( it ); ++ if ( removedWasDefault && !d->shadowIdentities.isEmpty() ) { ++ d->shadowIdentities.first().setIsDefault( true ); ++ } ++ return true; ++ } ++ } ++ return false; ++} ++ ++KPIMIdentities::Identity &IdentityManagerActivity::newFromScratch( const QString &name ) ++{ ++ return newFromExisting( KPIMIdentities::Identity( name ) ); ++} ++ ++KPIMIdentities::Identity &IdentityManagerActivity::newFromControlCenter( const QString &name ) ++{ ++ KEMailSettings es; ++ es.setProfile( es.defaultProfileName() ); ++ ++ return ++ newFromExisting( KPIMIdentities::Identity( name, ++ es.getSetting( KEMailSettings::RealName ), ++ es.getSetting( KEMailSettings::EmailAddress ), ++ es.getSetting( KEMailSettings::Organization ), ++ es.getSetting( KEMailSettings::ReplyToAddress ) ) ); ++} ++ ++KPIMIdentities::Identity &IdentityManagerActivity::newFromExisting( const KPIMIdentities::Identity &other, const QString &name ) ++{ ++ d->shadowIdentities << other; ++ KPIMIdentities::Identity &result = d->shadowIdentities.last(); ++ result.setIsDefault( false ); // we don't want two default identities! ++ result.setUoid( d->newUoid() ); // we don't want two identies w/ same UOID ++ if ( !name.isNull() ) { ++ result.setIdentityName( name ); ++ } ++ return result; ++} ++ ++ ++QStringList IdentityManagerActivity::allEmails() const ++{ ++ QStringList lst; ++ for ( ConstIterator it = begin(); it != end(); ++it ) { ++ lst << ( *it ).primaryEmailAddress(); ++ if ( !( *it ).emailAliases().isEmpty() ) { ++ lst << ( *it ).emailAliases(); ++ } ++ } ++ return lst; ++} ++ ++void IdentityManagerActivity::slotRollback() ++{ ++ rollback(); ++} ++ ++void IdentityManagerActivity::slotIdentitiesChanged( const QString &id ) ++{ ++ kDebug( 5325 ) << " KPIMIdentities::IdentityManagerActivity::slotIdentitiesChanged :" << id; ++ const QString ourIdentifier = QString::fromLatin1( "%1/%2" ). ++ arg( QDBusConnection::sessionBus().baseService() ). ++ arg( property( "uniqueDBusPath" ).toString() ); ++ if ( id != ourIdentifier ) { ++ d->config->reparseConfiguration(); ++ Q_ASSERT( !hasPendingChanges() ); ++ d->readConfig( d->config ); ++ emit changed(); ++ } ++} ++ ++} ++ +diff --git a/pimactivity/pimwidgets/identity/identitymanageractivity.h b/pimactivity/pimwidgets/identity/identitymanageractivity.h +new file mode 100644 +index 0000000..d5296e3 +--- /dev/null ++++ b/pimactivity/pimwidgets/identity/identitymanageractivity.h +@@ -0,0 +1,238 @@ ++/* ++ Copyright (c) 2013 Laurent Montel ++ Copyright (c) 2002 Marc Mutz ++ ++ 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 IDENTITYMANAGERACTIVITY_H ++#define IDENTITYMANAGERACTIVITY_H ++ ++#include "pimactivity_export.h" ++ ++#include ++ ++class QStringList; ++ ++namespace KPIMIdentities { ++class Identity; ++} ++ ++namespace PimActivity ++{ ++/** ++ * @short Manages the list of identities. ++ * @author Marc Mutz ++ **/ ++class ActivityManager; ++class IdentityManagerActivityPrivate; ++class PIMACTIVITY_EXPORT IdentityManagerActivity : public QObject ++{ ++ Q_OBJECT ++public: ++ /** ++ * Create an identity manager, which loads the emailidentities file ++ * to create identities. ++ * @param readonly if true, no changes can be made to the identity manager ++ * This means in particular that if there is no identity configured, ++ * the default identity created here will not be saved. ++ * It is assumed that a minimum of one identity is always present. ++ */ ++ explicit IdentityManagerActivity( ActivityManager *manager, bool readonly = false, QObject *parent=0, const char *name=0 ); ++ virtual ~IdentityManagerActivity(); ++ ++ PimActivity::ActivityManager *activityManager() const; ++ ++ typedef QList::Iterator Iterator; ++ typedef QList::ConstIterator ConstIterator; ++ ++ /** ++ * Typedef for STL style iterator ++ */ ++ typedef Iterator iterator; ++ ++ /** ++ * Typedef for STL style iterator ++ */ ++ typedef ConstIterator const_iterator; ++ ++ /** @return a unique name for a new identity based on @p name ++ * @param name the name of the base identity ++ */ ++ QString makeUnique( const QString &name ) const; ++ ++ /** @return whether the @p name is unique ++ * @param name the name to be examined ++ */ ++ bool isUnique( const QString &name ) const; ++ ++ /** Commit changes to disk and emit changed() if necessary. */ ++ void commit(); ++ ++ /** Re-read the config from disk and forget changes. */ ++ void rollback(); ++ ++ /** Check whether there are any unsaved changes. */ ++ bool hasPendingChanges() const; ++ ++ /** @return the list of identities */ ++ QStringList identities() const; ++ ++ /** Convenience method. ++ ++ @return the list of (shadow) identities, ie. the ones currently ++ under configuration. ++ */ ++ QStringList shadowIdentities() const; ++ ++ /** Sort the identities by name (the default is always first). This ++ operates on the @em shadow list, so you need to @ref commit for ++ the changes to take effect. ++ **/ ++ void sort(); ++ ++ /** @return an identity whose address matches any in @p addresses ++ or @ref Identity::null if no such identity exists. ++ @param addresses the string of addresses to scan for matches ++ **/ ++ const KPIMIdentities::Identity &identityForAddress( const QString &addresses ) const; ++ ++ /** @return true if @p addressList contains any of our addresses, ++ false otherwise. ++ @param addressList the addressList to examine ++ @see #identityForAddress ++ **/ ++ bool thatIsMe( const QString &addressList ) const; ++ ++ /** @return the identity with Unique Object Identifier (UOID) @p ++ uoid or @ref Identity::null if not found. ++ @param uoid the Unique Object Identifier to find identity with ++ **/ ++ const KPIMIdentities::Identity &identityForUoid( uint uoid ) const; ++ ++ /** Convenience menthod. ++ ++ @return the identity with Unique Object Identifier (UOID) @p ++ uoid or the default identity if not found. ++ @param uoid the Unique Object Identifier to find identity with ++ **/ ++ const KPIMIdentities::Identity &identityForUoidOrDefault( uint uoid ) const; ++ ++ /** @return the default identity */ ++ const KPIMIdentities::Identity &defaultIdentity() const; ++ ++ /** Sets the identity with Unique Object Identifier (UOID) @p uoid ++ to be new the default identity. As usual, use @ref commit to ++ make this permanent. ++ ++ @param uoid the default identity to set ++ @return false if an identity with UOID @p uoid was not found ++ **/ ++ bool setAsDefault( uint uoid ); ++ ++ /** @return the identity named @p identityName. This method returns a ++ reference to the identity that can be modified. To let others ++ see this change, use @ref commit. ++ @param identityName the identity name to return modifiable reference ++ **/ ++ KPIMIdentities::Identity &modifyIdentityForName( const QString &identityName ); ++ ++ /** @return the identity with Unique Object Identifier (UOID) @p uoid. ++ This method returns a reference to the identity that can ++ be modified. To let others see this change, use @ref commit. ++ **/ ++ KPIMIdentities::Identity &modifyIdentityForUoid( uint uoid ); ++ ++ /** Removes the identity with name @p identityName ++ Will return false if the identity is not found, ++ or when one tries to remove the last identity. ++ @param identityName the identity to remove ++ **/ ++ bool removeIdentity( const QString &identityName ); ++ ++ /** ++ * Removes the identity with name @p identityName ++ * Will return @c false if the identity is not found, @c true otherwise. ++ * ++ * @note In opposite to removeIdentity, this method allows to remove the ++ * last remaining identity. ++ * ++ * @since 4.6 ++ */ ++ bool removeIdentityForced( const QString &identityName ); ++ ++ QList::ConstIterator begin() const; ++ QList::ConstIterator end() const; ++ /// Iterator used by the configuration dialog, which works on a separate list ++ /// of identities, for modification. Changes are made effective by commit(). ++ Iterator modifyBegin(); ++ Iterator modifyEnd(); ++ ++ KPIMIdentities::Identity &newFromScratch( const QString &name ); ++ KPIMIdentities::Identity &newFromControlCenter( const QString &name ); ++ KPIMIdentities::Identity &newFromExisting( const KPIMIdentities::Identity &other, ++ const QString &name=QString() ); ++ ++ /** Returns the list of all email addresses (only name@host) from all ++ identities */ ++ QStringList allEmails() const; ++ ++Q_SIGNALS: ++ /** Emitted whenever a commit changes any configure option */ ++ void changed(); ++ /** Emitted whenever the identity with Unique Object Identifier ++ (UOID) @p uoid changed. Useful for more fine-grained change ++ notifications than what is possible with the standard @ref ++ changed() signal. */ ++ void changed( uint uoid ); ++ /** Emitted whenever the identity @p ident changed. Useful for more ++ fine-grained change notifications than what is possible with the ++ standard @ref changed() signal. */ ++ void changed( const KPIMIdentities::Identity &ident ); ++ /** Emitted on @ref commit() for each deleted identity. At the time ++ this signal is emitted, the identity does still exist and can be ++ retrieved by @ref identityForUoid() if needed */ ++ void deleted( uint uoid ); ++ /** Emitted on @ref commit() for each new identity */ ++ void added( const KPIMIdentities::Identity &ident ); ++ ++ void identitiesChanged( const QString &id ); ++ ++protected: ++ /** ++ * This is called when no identity has been defined, so we need to ++ * create a default one. The parameters are filled with some default ++ * values from KUser, but reimplementations of this method can give ++ * them another value. ++ */ ++ virtual void createDefaultIdentity( QString&/*fullName*/, ++ QString&/*emailAddress*/ ) {} ++ ++protected Q_SLOTS: ++ void slotRollback(); ++ ++private Q_SLOTS: ++ // Connected to the DBus signal ++ void slotIdentitiesChanged( const QString &id ); ++ ++private: ++ friend class IdentityManagerActivityPrivate; ++ IdentityManagerActivityPrivate * const d; ++}; ++ ++} // namespace ++ ++#endif // _KMAIL_IDENTITYMANAGER_H_ +diff --git a/pimactivity/pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml b/pimactivity/pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml +new file mode 100644 +index 0000000..fcd7fb5 +--- /dev/null ++++ b/pimactivity/pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml +@@ -0,0 +1,8 @@ ++ ++ ++ ++ ++ ++ ++ ++ +diff --git a/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.cpp b/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.cpp +new file mode 100644 +index 0000000..9fa3ec4 +--- /dev/null ++++ b/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.cpp +@@ -0,0 +1,82 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "transportcomboboxactivity.h" ++#include "activitymanager.h" ++ ++namespace PimActivity { ++ ++class TransportComboboxActivityPrivate ++{ ++public: ++ TransportComboboxActivityPrivate(ActivityManager *manager, TransportComboboxActivity *qq) ++ : q(qq), ++ activityManager(manager) ++ { ++ } ++ ++ void connectSignals() ++ { ++ if (activityManager) { ++ q->connect(activityManager, SIGNAL(currentActivityChanged(QString)), q, SLOT(slotCurrentActivityChanged(QString))); ++ //Initialize it. ++ slotCurrentActivityChanged(activityManager->currentActivity()); ++ } ++ } ++ ++ void slotCurrentActivityChanged(const QString &id) ++ { ++ q->updateComboboxList(); ++ } ++ ++ TransportComboboxActivity *q; ++ ActivityManager *activityManager; ++}; ++ ++TransportComboboxActivity::TransportComboboxActivity(QWidget *parent) ++ : MailTransport::TransportComboBox(parent), d(new TransportComboboxActivityPrivate(0, this)) ++{ ++} ++ ++TransportComboboxActivity::TransportComboboxActivity(ActivityManager *manager, QWidget *parent) ++ : MailTransport::TransportComboBox(parent), d(new TransportComboboxActivityPrivate(manager, this)) ++{ ++ d->connectSignals(); ++} ++ ++TransportComboboxActivity::~TransportComboboxActivity() ++{ ++ delete d; ++} ++ ++void TransportComboboxActivity::setActivityManager(ActivityManager *manager) ++{ ++ d->activityManager = manager; ++ d->connectSignals(); ++} ++ ++void TransportComboboxActivity::updateComboboxList() ++{ ++ //TODO ++} ++ ++} ++ ++#include "moc_transportcomboboxactivity.cpp" +diff --git a/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h b/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h +new file mode 100644 +index 0000000..4637f82 +--- /dev/null ++++ b/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h +@@ -0,0 +1,51 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 TRANSPORTCOMBOBOXACTIVITY_H ++#define TRANSPORTCOMBOBOXACTIVITY_H ++ ++#include "pimactivity_export.h" ++ ++#include ++ ++namespace PimActivity { ++class ActivityManager; ++class TransportComboboxActivityPrivate; ++class PIMACTIVITY_EXPORT TransportComboboxActivity : public MailTransport::TransportComboBox ++{ ++ Q_OBJECT ++public: ++ explicit TransportComboboxActivity(QWidget *parent = 0); ++ explicit TransportComboboxActivity(ActivityManager *manager, QWidget *parent = 0); ++ ~TransportComboboxActivity(); ++ ++ void setActivityManager(ActivityManager *manager); ++ ++protected Q_SLOTS: ++ void updateComboboxList(); ++ ++private: ++ friend class TransportComboboxActivityPrivate; ++ TransportComboboxActivityPrivate * const d; ++ Q_PRIVATE_SLOT( d, void slotCurrentActivityChanged(const QString&)) ++}; ++} ++ ++#endif // TRANSPORTCOMBOBOXACTIVITY_H +diff --git a/pimactivity/pimwidgets/mailtransport/transportmanager.cpp b/pimactivity/pimwidgets/mailtransport/transportmanager.cpp +new file mode 100644 +index 0000000..daa18a2 +--- /dev/null ++++ b/pimactivity/pimwidgets/mailtransport/transportmanager.cpp +@@ -0,0 +1,776 @@ ++/* ++ Copyright (c) 2006 - 2007 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 "transportmanager.h" ++#include "resourcesendjob_p.h" ++#include "mailtransport_defs.h" ++#include "sendmailjob.h" ++#include "smtpjob.h" ++#include "transport.h" ++#include "transport_p.h" ++#include "transportjob.h" ++#include "transporttype.h" ++#include "transporttype_p.h" ++#include "addtransportdialog.h" ++#include "transportconfigdialog.h" ++#include "transportconfigwidget.h" ++#include "sendmailconfigwidget.h" ++#include "smtpconfigwidget.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++using namespace MailTransport; ++using namespace KWallet; ++ ++namespace MailTransport { ++/** ++ * Private class that helps to provide binary compatibility between releases. ++ * @internal ++ */ ++class TransportManagerPrivate ++{ ++ public: ++ TransportManagerPrivate( TransportManager *parent ) ++ : q( parent ) ++ { ++ } ++ ++ ~TransportManagerPrivate() { ++ delete config; ++ qDeleteAll( transports ); ++ } ++ ++ KConfig *config; ++ QList transports; ++ TransportType::List types; ++ bool myOwnChange; ++ bool appliedChange; ++ KWallet::Wallet *wallet; ++ bool walletOpenFailed; ++ bool walletAsyncOpen; ++ int defaultTransportId; ++ bool isMainInstance; ++ QList walletQueue; ++ TransportManager *q; ++ ++ void readConfig(); ++ void writeConfig(); ++ void fillTypes(); ++ int createId() const; ++ void prepareWallet(); ++ void validateDefault(); ++ void migrateToWallet(); ++ ++ // Slots ++ void slotTransportsChanged(); ++ void slotWalletOpened( bool success ); ++ void dbusServiceUnregistered(); ++ void agentTypeAdded( const Akonadi::AgentType &atype ); ++ void agentTypeRemoved( const Akonadi::AgentType &atype ); ++ void jobResult( KJob *job ); ++}; ++ ++} ++ ++class StaticTransportManager : public TransportManager ++{ ++ public: ++ StaticTransportManager() : TransportManager() {} ++}; ++ ++StaticTransportManager *sSelf = 0; ++ ++static void destroyStaticTransportManager() { ++ delete sSelf; ++} ++ ++TransportManager::TransportManager() ++ : QObject(), d( new TransportManagerPrivate( this ) ) ++{ ++ KGlobal::locale()->insertCatalog( QLatin1String( "libmailtransport" ) ); ++ KGlobal::locale()->insertCatalog( QLatin1String( "libakonadi-kmime" ) ); ++ qAddPostRoutine( destroyStaticTransportManager ); ++ d->myOwnChange = false; ++ d->appliedChange = false; ++ d->wallet = 0; ++ d->walletOpenFailed = false; ++ d->walletAsyncOpen = false; ++ d->defaultTransportId = -1; ++ d->config = new KConfig( QLatin1String( "mailtransports" ) ); ++ ++ QDBusConnection::sessionBus().registerObject( DBUS_OBJECT_PATH, this, ++ QDBusConnection::ExportScriptableSlots | ++ QDBusConnection::ExportScriptableSignals ); ++ ++ QDBusServiceWatcher *watcher = ++ new QDBusServiceWatcher( DBUS_SERVICE_NAME, QDBusConnection::sessionBus(), ++ QDBusServiceWatcher::WatchForUnregistration, this ); ++ connect( watcher, SIGNAL(serviceUnregistered(QString)), ++ SLOT(dbusServiceUnregistered()) ); ++ ++ QDBusConnection::sessionBus().connect( QString(), QString(), ++ DBUS_INTERFACE_NAME, DBUS_CHANGE_SIGNAL, ++ this, SLOT(slotTransportsChanged()) ); ++ ++ d->isMainInstance = QDBusConnection::sessionBus().registerService( DBUS_SERVICE_NAME ); ++ ++ d->fillTypes(); ++} ++ ++TransportManager::~TransportManager() ++{ ++ qRemovePostRoutine( destroyStaticTransportManager ); ++ delete d; ++} ++ ++TransportManager *TransportManager::self() ++{ ++ if ( !sSelf ) { ++ sSelf = new StaticTransportManager; ++ sSelf->d->readConfig(); ++ } ++ return sSelf; ++} ++ ++Transport *TransportManager::transportById( int id, bool def ) const ++{ ++ foreach ( Transport *t, d->transports ) { ++ if ( t->id() == id ) { ++ return t; ++ } ++ } ++ ++ if ( def || ( id == 0 && d->defaultTransportId != id ) ) { ++ return transportById( d->defaultTransportId, false ); ++ } ++ return 0; ++} ++ ++Transport *TransportManager::transportByName( const QString &name, bool def ) const ++{ ++ foreach ( Transport *t, d->transports ) { ++ if ( t->name() == name ) { ++ return t; ++ } ++ } ++ if ( def ) { ++ return transportById( 0, false ); ++ } ++ return 0; ++} ++ ++QList< Transport * > TransportManager::transports() const ++{ ++ return d->transports; ++} ++ ++TransportType::List TransportManager::types() const ++{ ++ return d->types; ++} ++ ++Transport *TransportManager::createTransport() const ++{ ++ int id = d->createId(); ++ Transport *t = new Transport( QString::number( id ) ); ++ t->setId( id ); ++ return t; ++} ++ ++void TransportManager::addTransport( Transport *transport ) ++{ ++ if ( d->transports.contains( transport ) ) { ++ kDebug() << "Already have this transport."; ++ return; ++ } ++ ++ kDebug() << "Added transport" << transport; ++ d->transports.append( transport ); ++ d->validateDefault(); ++ emitChangesCommitted(); ++} ++ ++void TransportManager::schedule( TransportJob *job ) ++{ ++ connect( job, SIGNAL(result(KJob*)), SLOT(jobResult(KJob*)) ); ++ ++ // check if the job is waiting for the wallet ++ if ( !job->transport()->isComplete() ) { ++ kDebug() << "job waits for wallet:" << job; ++ d->walletQueue << job; ++ loadPasswordsAsync(); ++ return; ++ } ++ ++ job->start(); ++} ++ ++void TransportManager::createDefaultTransport() ++{ ++ KEMailSettings kes; ++ Transport *t = createTransport(); ++ t->setName( i18n( "Default Transport" ) ); ++ t->setHost( kes.getSetting( KEMailSettings::OutServer ) ); ++ if ( t->isValid() ) { ++ t->writeConfig(); ++ addTransport( t ); ++ } else { ++ kWarning() << "KEMailSettings does not contain a valid transport."; ++ } ++} ++ ++bool TransportManager::showTransportCreationDialog( QWidget *parent, ++ ShowCondition showCondition ) ++{ ++ if ( showCondition == IfNoTransportExists ) { ++ if ( !isEmpty() ) { ++ return true; ++ } ++ ++ const int response = KMessageBox::messageBox( parent, ++ KMessageBox::WarningContinueCancel, ++ i18n( "You must create an outgoing account before sending." ), ++ i18n( "Create Account Now?" ), ++ KGuiItem( i18n( "Create Account Now" ) ) ); ++ if ( response != KMessageBox::Continue ) { ++ return false; ++ } ++ } ++ ++ QPointer dialog = new AddTransportDialog( parent ); ++ const bool accepted = ( dialog->exec() == QDialog::Accepted ); ++ delete dialog; ++ return accepted; ++} ++ ++bool TransportManager::configureTransport( Transport *transport, QWidget *parent ) ++{ ++ if ( transport->type() == Transport::EnumType::Akonadi ) { ++ using namespace Akonadi; ++ AgentInstance instance = AgentManager::self()->instance( transport->host() ); ++ if ( !instance.isValid() ) { ++ kWarning() << "Invalid resource instance" << transport->host(); ++ } ++ instance.configure( parent ); // Async... ++ transport->writeConfig(); ++ return true; // No way to know here if the user cancelled or not. ++ } ++ ++ QPointer transportConfigDialog = ++ new TransportConfigDialog( transport, parent ); ++ transportConfigDialog->setCaption( i18n( "Configure account" ) ); ++ bool okClicked = ( transportConfigDialog->exec() == QDialog::Accepted ); ++ delete transportConfigDialog; ++ return okClicked; ++} ++ ++TransportJob *TransportManager::createTransportJob( int transportId ) ++{ ++ Transport *t = transportById( transportId, false ); ++ if ( !t ) { ++ return 0; ++ } ++ t = t->clone(); // Jobs delete their transports. ++ t->updatePasswordState(); ++ switch ( t->type() ) { ++ case Transport::EnumType::SMTP: ++ return new SmtpJob( t, this ); ++ case Transport::EnumType::Sendmail: ++ return new SendmailJob( t, this ); ++ case Transport::EnumType::Akonadi: ++ return new ResourceSendJob( t, this ); ++ } ++ Q_ASSERT( false ); ++ return 0; ++} ++ ++TransportJob *TransportManager::createTransportJob( const QString &transport ) ++{ ++ bool ok = false; ++ Transport *t = 0; ++ ++ int transportId = transport.toInt( &ok ); ++ if ( ok ) { ++ t = transportById( transportId ); ++ } ++ ++ if ( !t ) { ++ t = transportByName( transport, false ); ++ } ++ ++ if ( t ) { ++ return createTransportJob( t->id() ); ++ } ++ ++ return 0; ++} ++ ++bool TransportManager::isEmpty() const ++{ ++ return d->transports.isEmpty(); ++} ++ ++QList TransportManager::transportIds() const ++{ ++ QList rv; ++ foreach ( Transport *t, d->transports ) { ++ rv << t->id(); ++ } ++ return rv; ++} ++ ++QStringList TransportManager::transportNames() const ++{ ++ QStringList rv; ++ foreach ( Transport *t, d->transports ) { ++ rv << t->name(); ++ } ++ return rv; ++} ++ ++QString TransportManager::defaultTransportName() const ++{ ++ Transport *t = transportById( d->defaultTransportId, false ); ++ if ( t ) { ++ return t->name(); ++ } ++ return QString(); ++} ++ ++int TransportManager::defaultTransportId() const ++{ ++ return d->defaultTransportId; ++} ++ ++void TransportManager::setDefaultTransport( int id ) ++{ ++ if ( id == d->defaultTransportId || !transportById( id, false ) ) { ++ return; ++ } ++ d->defaultTransportId = id; ++ d->writeConfig(); ++} ++ ++void TransportManager::removeTransport( int id ) ++{ ++ Transport *t = transportById( id, false ); ++ if ( !t ) { ++ return; ++ } ++ emit transportRemoved( t->id(), t->name() ); ++ ++ // Kill the resource, if Akonadi-type transport. ++ if ( t->type() == Transport::EnumType::Akonadi ) { ++ using namespace Akonadi; ++ const AgentInstance instance = AgentManager::self()->instance( t->host() ); ++ if ( !instance.isValid() ) { ++ kWarning() << "Could not find resource instance."; ++ } ++ AgentManager::self()->removeInstance( instance ); ++ } ++ ++ d->transports.removeAll( t ); ++ d->validateDefault(); ++ QString group = t->currentGroup(); ++ delete t; ++ d->config->deleteGroup( group ); ++ d->writeConfig(); ++ ++} ++ ++void TransportManagerPrivate::readConfig() ++{ ++ QList oldTransports = transports; ++ transports.clear(); ++ ++ QRegExp re( QLatin1String( "^Transport (.+)$" ) ); ++ QStringList groups = config->groupList().filter( re ); ++ foreach ( const QString &s, groups ) { ++ re.indexIn( s ); ++ Transport *t = 0; ++ ++ // see if we happen to have that one already ++ foreach ( Transport *old, oldTransports ) { ++ if ( old->currentGroup() == QLatin1String( "Transport " ) + re.cap( 1 ) ) { ++ kDebug() << "reloading existing transport:" << s; ++ t = old; ++ t->d->passwordNeedsUpdateFromWallet = true; ++ t->readConfig(); ++ oldTransports.removeAll( old ); ++ break; ++ } ++ } ++ ++ if ( !t ) { ++ t = new Transport( re.cap( 1 ) ); ++ } ++ if ( t->id() <= 0 ) { ++ t->setId( createId() ); ++ t->writeConfig(); ++ } ++ transports.append( t ); ++ } ++ ++ qDeleteAll( oldTransports ); ++ oldTransports.clear(); ++ ++ // read default transport ++ KConfigGroup group( config, "General" ); ++ defaultTransportId = group.readEntry( "default-transport", 0 ); ++ if ( defaultTransportId == 0 ) { ++ // migrated default transport contains the name instead ++ QString name = group.readEntry( "default-transport", QString() ); ++ if ( !name.isEmpty() ) { ++ Transport *t = q->transportByName( name, false ); ++ if ( t ) { ++ defaultTransportId = t->id(); ++ writeConfig(); ++ } ++ } ++ } ++ validateDefault(); ++ migrateToWallet(); ++ q->loadPasswordsAsync(); ++} ++ ++void TransportManagerPrivate::writeConfig() ++{ ++ KConfigGroup group( config, "General" ); ++ group.writeEntry( "default-transport", defaultTransportId ); ++ config->sync(); ++ q->emitChangesCommitted(); ++} ++ ++void TransportManagerPrivate::fillTypes() ++{ ++ Q_ASSERT( types.isEmpty() ); ++ ++ // SMTP. ++ { ++ TransportType type; ++ type.d->mType = Transport::EnumType::SMTP; ++ type.d->mName = i18nc( "@option SMTP transport", "SMTP" ); ++ type.d->mDescription = i18n( "An SMTP server on the Internet" ); ++ types << type; ++ } ++ ++ // Sendmail. ++ { ++ TransportType type; ++ type.d->mType = Transport::EnumType::Sendmail; ++ type.d->mName = i18nc( "@option sendmail transport", "Sendmail" ); ++ type.d->mDescription = i18n( "A local sendmail installation" ); ++ types << type; ++ } ++ ++ // All Akonadi resources with MailTransport capability. ++ { ++ using namespace Akonadi; ++ foreach ( const AgentType &atype, AgentManager::self()->types() ) { ++ // TODO probably the string "MailTransport" should be #defined somewhere ++ // and used like that in the resources (?) ++ if ( atype.capabilities().contains( QLatin1String( "MailTransport" ) ) ) { ++ TransportType type; ++ type.d->mType = Transport::EnumType::Akonadi; ++ type.d->mAgentType = atype; ++ type.d->mName = atype.name(); ++ type.d->mDescription = atype.description(); ++ types << type; ++ kDebug() << "Found Akonadi type" << atype.name(); ++ } ++ } ++ ++ // Watch for appearing and disappearing types. ++ QObject::connect( AgentManager::self(), SIGNAL(typeAdded(Akonadi::AgentType)), ++ q, SLOT(agentTypeAdded(Akonadi::AgentType)) ); ++ QObject::connect( AgentManager::self(), SIGNAL(typeRemoved(Akonadi::AgentType)), ++ q, SLOT(agentTypeRemoved(Akonadi::AgentType)) ); ++ } ++ ++ kDebug() << "Have SMTP, Sendmail, and" << types.count() - 2 << "Akonadi types."; ++} ++ ++void TransportManager::emitChangesCommitted() ++{ ++ d->myOwnChange = true; // prevent us from reading our changes again ++ d->appliedChange = false; // but we have to read them at least once ++ emit transportsChanged(); ++ emit changesCommitted(); ++} ++ ++void TransportManagerPrivate::slotTransportsChanged() ++{ ++ if ( myOwnChange && appliedChange ) { ++ myOwnChange = false; ++ appliedChange = false; ++ return; ++ } ++ ++ kDebug(); ++ config->reparseConfiguration(); ++ // FIXME: this deletes existing transport objects! ++ readConfig(); ++ appliedChange = true; // to prevent recursion ++ emit q->transportsChanged(); ++} ++ ++int TransportManagerPrivate::createId() const ++{ ++ QList usedIds; ++ foreach ( Transport *t, transports ) { ++ usedIds << t->id(); ++ } ++ usedIds << 0; // 0 is default for unknown ++ int newId; ++ do { ++ newId = KRandom::random(); ++ } while ( usedIds.contains( newId ) ); ++ return newId; ++} ++ ++KWallet::Wallet * TransportManager::wallet() ++{ ++ if ( d->wallet && d->wallet->isOpen() ) { ++ return d->wallet; ++ } ++ ++ if ( !Wallet::isEnabled() || d->walletOpenFailed ) { ++ return 0; ++ } ++ ++ WId window = 0; ++ if ( qApp->activeWindow() ) { ++ window = qApp->activeWindow()->winId(); ++ } else if ( !QApplication::topLevelWidgets().isEmpty() ) { ++ window = qApp->topLevelWidgets().first()->winId(); ++ } ++ ++ delete d->wallet; ++ d->wallet = Wallet::openWallet( Wallet::NetworkWallet(), window ); ++ ++ if ( !d->wallet ) { ++ d->walletOpenFailed = true; ++ return 0; ++ } ++ ++ d->prepareWallet(); ++ return d->wallet; ++} ++ ++void TransportManagerPrivate::prepareWallet() ++{ ++ if ( !wallet ) { ++ return; ++ } ++ if ( !wallet->hasFolder( WALLET_FOLDER ) ) { ++ wallet->createFolder( WALLET_FOLDER ); ++ } ++ wallet->setFolder( WALLET_FOLDER ); ++} ++ ++void TransportManager::loadPasswords() ++{ ++ foreach ( Transport *t, d->transports ) { ++ t->readPassword(); ++ } ++ ++ // flush the wallet queue ++ const QList copy = d->walletQueue; ++ d->walletQueue.clear(); ++ foreach ( TransportJob *job, copy ) { ++ job->start(); ++ } ++ ++ emit passwordsChanged(); ++} ++ ++void TransportManager::loadPasswordsAsync() ++{ ++ kDebug(); ++ ++ // check if there is anything to do at all ++ bool found = false; ++ foreach ( Transport *t, d->transports ) { ++ if ( !t->isComplete() ) { ++ found = true; ++ break; ++ } ++ } ++ if ( !found ) { ++ return; ++ } ++ ++ // async wallet opening ++ if ( !d->wallet && !d->walletOpenFailed ) { ++ WId window = 0; ++ if ( qApp->activeWindow() ) { ++ window = qApp->activeWindow()->winId(); ++ } else if ( !QApplication::topLevelWidgets().isEmpty() ) { ++ window = qApp->topLevelWidgets().first()->winId(); ++ } ++ ++ d->wallet = Wallet::openWallet( Wallet::NetworkWallet(), window, ++ Wallet::Asynchronous ); ++ if ( d->wallet ) { ++ connect( d->wallet, SIGNAL(walletOpened(bool)), SLOT(slotWalletOpened(bool)) ); ++ d->walletAsyncOpen = true; ++ } else { ++ d->walletOpenFailed = true; ++ loadPasswords(); ++ } ++ return; ++ } ++ if ( d->wallet && !d->walletAsyncOpen ) { ++ loadPasswords(); ++ } ++} ++ ++void TransportManagerPrivate::slotWalletOpened( bool success ) ++{ ++ kDebug(); ++ walletAsyncOpen = false; ++ if ( !success ) { ++ walletOpenFailed = true; ++ delete wallet; ++ wallet = 0; ++ } else { ++ prepareWallet(); ++ } ++ q->loadPasswords(); ++} ++ ++void TransportManagerPrivate::validateDefault() ++{ ++ if ( !q->transportById( defaultTransportId, false ) ) { ++ if ( q->isEmpty() ) { ++ defaultTransportId = -1; ++ } else { ++ defaultTransportId = transports.first()->id(); ++ writeConfig(); ++ } ++ } ++} ++ ++void TransportManagerPrivate::migrateToWallet() ++{ ++ // check if we tried this already ++ static bool firstRun = true; ++ if ( !firstRun ) { ++ return; ++ } ++ firstRun = false; ++ ++ // check if we are the main instance ++ if ( !isMainInstance ) { ++ return; ++ } ++ ++ // check if migration is needed ++ QStringList names; ++ foreach ( Transport *t, transports ) { ++ if ( t->needsWalletMigration() ) { ++ names << t->name(); ++ } ++ } ++ if ( names.isEmpty() ) { ++ return; ++ } ++ ++ // ask user if he wants to migrate ++ int result = KMessageBox::questionYesNoList( ++ 0, ++ i18n( "The following mail transports store their passwords in an " ++ "unencrypted configuration file.\nFor security reasons, " ++ "please consider migrating these passwords to KWallet, the " ++ "KDE Wallet management tool,\nwhich stores sensitive data " ++ "for you in a strongly encrypted file.\n" ++ "Do you want to migrate your passwords to KWallet?" ), ++ names, i18n( "Question" ), ++ KGuiItem( i18n( "Migrate" ) ), KGuiItem( i18n( "Keep" ) ), ++ QString::fromLatin1( "WalletMigrate" ) ); ++ if ( result != KMessageBox::Yes ) { ++ return; ++ } ++ ++ // perform migration ++ foreach ( Transport *t, transports ) { ++ if ( t->needsWalletMigration() ) { ++ t->migrateToWallet(); ++ } ++ } ++} ++ ++void TransportManagerPrivate::dbusServiceUnregistered() ++{ ++ QDBusConnection::sessionBus().registerService( DBUS_SERVICE_NAME ); ++} ++ ++void TransportManagerPrivate::agentTypeAdded( const Akonadi::AgentType &atype ) ++{ ++ using namespace Akonadi; ++ if ( atype.capabilities().contains( QLatin1String( "MailTransport" ) ) ) { ++ TransportType type; ++ type.d->mType = Transport::EnumType::Akonadi; ++ type.d->mAgentType = atype; ++ type.d->mName = atype.name(); ++ type.d->mDescription = atype.description(); ++ types << type; ++ kDebug() << "Added new Akonadi type" << atype.name(); ++ } ++} ++ ++void TransportManagerPrivate::agentTypeRemoved( const Akonadi::AgentType &atype ) ++{ ++ using namespace Akonadi; ++ foreach ( const TransportType &type, types ) { ++ if ( type.type() == Transport::EnumType::Akonadi && ++ type.agentType() == atype ) { ++ types.removeAll( type ); ++ kDebug() << "Removed Akonadi type" << atype.name(); ++ } ++ } ++} ++ ++void TransportManagerPrivate::jobResult( KJob *job ) ++{ ++ walletQueue.removeAll( static_cast( job ) ); ++} ++ ++#include "moc_transportmanager.cpp" +diff --git a/pimactivity/pimwidgets/mailtransport/transportmanager.h b/pimactivity/pimwidgets/mailtransport/transportmanager.h +new file mode 100644 +index 0000000..ed391c7 +--- /dev/null ++++ b/pimactivity/pimwidgets/mailtransport/transportmanager.h +@@ -0,0 +1,304 @@ ++/* ++ Copyright (c) 2006 - 2007 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 MAILTRANSPORT_TRANSPORTMANAGER_H ++#define MAILTRANSPORT_TRANSPORTMANAGER_H ++ ++#include ++#include ++ ++#include ++#include ++ ++#include ++ ++class KJob; ++ ++namespace KWallet { ++ class Wallet; ++} ++ ++namespace MailTransport { ++ ++class Transport; ++class TransportConfigWidget; ++class TransportJob; ++class TransportManagerPrivate; ++ ++/** ++ @short Central transport management interface. ++ ++ This class manages the creation, configuration, and removal of mail ++ transports, as well as the loading and storing of mail transport settings. ++ ++ It also handles the creation of transport jobs, although that behaviour is ++ deprecated and you are encouraged to use MessageQueueJob. ++ ++ @see MessageQueueJob. ++*/ ++class MAILTRANSPORT_EXPORT TransportManager : public QObject ++{ ++ Q_OBJECT ++ Q_CLASSINFO( "D-Bus Interface", "org.kde.pim.TransportManager" ) ++ ++ friend class Transport; ++ friend class TransportManagerPrivate; ++ ++ public: ++ ++ /** ++ Destructor. ++ */ ++ virtual ~TransportManager(); ++ ++ /** ++ Returns the TransportManager instance. ++ */ ++ static TransportManager *self(); ++ ++ /** ++ Tries to load passwords asynchronously from KWallet if needed. ++ The passwordsChanged() signal is emitted once the passwords have been loaded. ++ Nothing happens if the passwords were already available. ++ */ ++ void loadPasswordsAsync(); ++ ++ /** ++ Returns the Transport object with the given id. ++ @param id The identifier of the Transport. ++ @param def if set to true, the default transport will be returned if the ++ specified Transport object could not be found, 0 otherwise. ++ @returns A Transport object for immediate use. It might become invalid as ++ soon as the event loop is entered again due to remote changes. If you need ++ to store a Transport object, store the transport identifier instead. ++ */ ++ Transport *transportById( int id, bool def = true ) const; ++ ++ /** ++ Returns the transport object with the given name. ++ @param name The transport name. ++ @param def if set to true, the default transport will be returned if the ++ specified Transport object could not be found, 0 otherwise. ++ @returns A Transport object for immediate use, see transportById() for ++ limitations. ++ */ ++ Transport *transportByName( const QString &name, bool def = true ) const; ++ ++ /** ++ Returns a list of all available transports. ++ Note: The Transport objects become invalid as soon as a change occur, so ++ they are only suitable for immediate use. ++ */ ++ QListtransports() const; ++ ++ /** ++ Returns a list of all available transport types. ++ */ ++ TransportType::List types() const; ++ ++ /** ++ Creates a new, empty Transport object. The object is owned by the caller. ++ If you want to add the Transport permanently (eg. after configuring it) ++ call addTransport(). ++ */ ++ Transport *createTransport() const; ++ ++ /** ++ Adds the given transport. The object ownership is transferred to ++ TransportMananger, ie. you must not delete @p transport. ++ @param transport The Transport object to add. ++ */ ++ void addTransport( Transport *transport ); ++ ++ /** ++ Creates a mail transport job for the given transport identifier. ++ Returns 0 if the specified transport is invalid. ++ @param transportId The transport identifier. ++ ++ @deprecated use MessageQueueJob to queue messages ++ and rely on the Dispatcher Agent to send them. ++ */ ++ MAILTRANSPORT_DEPRECATED TransportJob *createTransportJob( int transportId ); ++ ++ /** ++ Creates a mail transport job for the given transport identifer, ++ or transport name. ++ Returns 0 if the specified transport is invalid. ++ @param transport A string defining a mail transport. ++ ++ @deprecated use MessageQueueJob to queue messages ++ and rely on the Dispatcher Agent to send them. ++ */ ++ MAILTRANSPORT_DEPRECATED TransportJob *createTransportJob( const QString &transport ); ++ ++ /** ++ Executes the given transport job. This is the preferred way to start ++ transport jobs. It takes care of asynchronously loading passwords from ++ KWallet if necessary. ++ @param job The completely configured transport job to execute. ++ ++ @deprecated use MessageQueueJob to queue messages ++ and rely on the Dispatcher Agent to send them. ++ */ ++ MAILTRANSPORT_DEPRECATED void schedule( TransportJob *job ); ++ ++ /** ++ Tries to create a transport based on KEMailSettings. ++ If the data in KEMailSettings is incomplete, no transport is created. ++ */ ++ void createDefaultTransport(); ++ ++ /// Describes when to show the transport creation dialog ++ enum ShowCondition { ++ Always, ///< Show the transport creation dialog unconditionally ++ IfNoTransportExists ///< Only show the transport creation dialog if no transport currently ++ /// exists. Ask the user if he wants to add a transport in ++ /// the other case. ++ }; ++ ++ /** ++ Shows a dialog for creating and configuring a new transport. ++ @param parent Parent widget of the dialog. ++ @param showCondition the condition under which the dialog is shown at all ++ @return True if a new transport has been created and configured. ++ @since 4.4 ++ */ ++ bool showTransportCreationDialog( QWidget *parent, ShowCondition showCondition = Always ); ++ ++ /** ++ Open a configuration dialog for an existing transport. ++ @param transport The transport to configure. It can be a new transport, ++ or one already managed by TransportManager. ++ @param parent The parent widget for the dialog. ++ @return True if the user clicked Ok, false if the user cancelled. ++ @since 4.4 ++ */ ++ bool configureTransport( Transport *transport, QWidget *parent ); ++ ++ public Q_SLOTS: ++ /** ++ Returns true if there are no mail transports at all. ++ */ ++ Q_SCRIPTABLE bool isEmpty() const; ++ ++ /** ++ Returns a list of transport identifiers. ++ */ ++ Q_SCRIPTABLE QList transportIds() const; ++ ++ /** ++ Returns a list of transport names. ++ */ ++ Q_SCRIPTABLE QStringList transportNames() const; ++ ++ /** ++ Returns the default transport name. ++ */ ++ Q_SCRIPTABLE QString defaultTransportName() const; ++ ++ /** ++ Returns the default transport identifier. ++ Invalid if there are no transports at all. ++ */ ++ Q_SCRIPTABLE int defaultTransportId() const; ++ ++ /** ++ Sets the default transport. The change will be in effect immediately. ++ @param id The identifier of the new default transport. ++ */ ++ Q_SCRIPTABLE void setDefaultTransport( int id ); ++ ++ /** ++ Deletes the specified transport. ++ @param id The identifier of the mail transport to remove. ++ */ ++ Q_SCRIPTABLE void removeTransport( int id ); ++ ++ Q_SIGNALS: ++ /** ++ Emitted when transport settings have changed (by this or any other ++ TransportManager instance). ++ */ ++ Q_SCRIPTABLE void transportsChanged(); ++ ++ /** ++ Internal signal to synchronize all TransportManager instances. ++ This signal is emitted by the instance writing the changes. ++ You probably want to use transportsChanged() instead. ++ */ ++ Q_SCRIPTABLE void changesCommitted(); ++ ++ /** ++ Emitted when passwords have been loaded from the wallet. ++ If you made a deep copy of a transport, you should call updatePasswordState() ++ for the cloned transport to ensure its password is updated as well. ++ */ ++ void passwordsChanged(); ++ ++ /** ++ Emitted when a transport is deleted. ++ @param id The identifier of the deleted transport. ++ @param name The name of the deleted transport. ++ */ ++ void transportRemoved( int id, const QString &name ); ++ ++ /** ++ Emitted when a transport has been renamed. ++ @param id The identifier of the renamed transport. ++ @param oldName The old name. ++ @param newName The new name. ++ */ ++ void transportRenamed( int id, const QString &oldName, const QString &newName ); ++ ++ protected: ++ /** ++ Returns a pointer to an open wallet if available, 0 otherwise. ++ The wallet is opened synchronously if necessary. ++ */ ++ KWallet::Wallet *wallet(); ++ ++ /** ++ Loads all passwords synchronously. ++ */ ++ void loadPasswords(); ++ ++ /** ++ Singleton class, the only instance resides in the static object sSelf. ++ */ ++ TransportManager(); ++ ++ private: ++ ++ // These are used by our friend, Transport ++ void emitChangesCommitted(); ++ ++ private: ++ TransportManagerPrivate *const d; ++ ++ Q_PRIVATE_SLOT( d, void slotTransportsChanged() ) ++ Q_PRIVATE_SLOT( d, void slotWalletOpened( bool success ) ) ++ Q_PRIVATE_SLOT( d, void dbusServiceUnregistered() ) ++ Q_PRIVATE_SLOT( d, void agentTypeAdded( const Akonadi::AgentType &atype ) ) ++ Q_PRIVATE_SLOT( d, void agentTypeRemoved( const Akonadi::AgentType &atype ) ) ++ Q_PRIVATE_SLOT( d, void jobResult( KJob *job ) ) ++}; ++ ++} // namespace MailTransport ++ ++#endif // MAILTRANSPORT_TRANSPORTMANAGER_H +diff --git a/pimactivity/tests/CMakeLists.txt b/pimactivity/tests/CMakeLists.txt +new file mode 100644 +index 0000000..90443f8 +--- /dev/null ++++ b/pimactivity/tests/CMakeLists.txt +@@ -0,0 +1,10 @@ ++project( pimactivitytest ) ++ ++set( pimactivitytest_SRCS ++ main.cpp ++ mainwindow.cpp ++) ++ ++kde4_add_executable(pimactivitytest TEST ${pimactivitytest_SRCS} ) ++TARGET_LINK_LIBRARIES(pimactivitytest ${KDE4_KDEUI_LIBS} pimactivity ) ++ +diff --git a/pimactivity/tests/main.cpp b/pimactivity/tests/main.cpp +new file mode 100644 +index 0000000..f7a3de4 +--- /dev/null ++++ b/pimactivity/tests/main.cpp +@@ -0,0 +1,38 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 ++#include ++#include ++ ++#include "mainwindow.h" ++ ++int main( int argc, char **argv ) ++{ ++ const QByteArray& ba = QByteArray( "pimactivitytest_gui" ); ++ const KLocalizedString name = ki18n( "PimActivitytest_gui" ); ++ KAboutData aboutData( ba, ba, name, ba, name ); ++ KCmdLineArgs::init( argc, argv, &aboutData ); ++ KApplication app; ++ MainWindow* mw = new MainWindow; ++ mw->show(); ++ app.exec(); ++} +diff --git a/pimactivity/tests/mainwindow.cpp b/pimactivity/tests/mainwindow.cpp +new file mode 100644 +index 0000000..5c7c09b +--- /dev/null ++++ b/pimactivity/tests/mainwindow.cpp +@@ -0,0 +1,43 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 "mainwindow.h" ++#include "pimactivity/pimwidgets/identity/identitymanageractivity.h" ++#include "pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h" ++#include "pimactivity/pimwidgets/identity/identitycomboboxactivity.h" ++#include "pimactivity/activitymanager.h" ++ ++#include ++ ++MainWindow::MainWindow() ++ : QMainWindow() ++{ ++ QWidget *w = new QWidget; ++ QVBoxLayout *lay = new QVBoxLayout; ++ PimActivity::TransportComboboxActivity *combobox = new PimActivity::TransportComboboxActivity; ++ lay->addWidget(combobox); ++ ++ PimActivity::ActivityManager *manager = new PimActivity::ActivityManager(this); ++ ++ PimActivity::IdentityManagerActivity *identityManager = new PimActivity::IdentityManagerActivity(manager,false, this, "identitymanager"); ++ PimActivity::IdentityComboboxActivity *identityCombobox = new PimActivity::IdentityComboboxActivity(identityManager); ++ lay->addWidget(identityCombobox); ++ ++ w->setLayout(lay); ++ setCentralWidget(w); ++} ++ +diff --git a/pimactivity/tests/mainwindow.h b/pimactivity/tests/mainwindow.h +new file mode 100644 +index 0000000..03fb74a +--- /dev/null ++++ b/pimactivity/tests/mainwindow.h +@@ -0,0 +1,30 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ This program is free software; you can redistribute it and/or modify it ++ under the terms of the GNU General Public License, version 2, as ++ published by the Free Software Foundation. ++ ++ 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 MAINWINDOW_H ++#define MAINWINDOW_H ++ ++#include ++ ++class MainWindow : public QMainWindow ++{ ++ Q_OBJECT ++public: ++ MainWindow(); ++}; ++ ++#endif // MAINWINDOW_H +diff --git a/pimactivity/widgets/abstractconfigurewidget.cpp b/pimactivity/widgets/abstractconfigurewidget.cpp +new file mode 100644 +index 0000000..9c4c4e0 +--- /dev/null ++++ b/pimactivity/widgets/abstractconfigurewidget.cpp +@@ -0,0 +1,58 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "abstractconfigurewidget.h" ++ ++#include ++#include ++ ++using namespace PimActivity; ++ ++AbstractConfigureWidget::AbstractConfigureWidget() ++{ ++} ++ ++AbstractConfigureWidget::~AbstractConfigureWidget() ++{ ++} ++ ++void AbstractConfigureWidget::setCurrentActivity(const QString &id) ++{ ++ if (mActivityId != id) { ++ mActivityId = id; ++ readConfig(id); ++ } ++} ++ ++void AbstractConfigureWidget::setActivity(const QString &id) ++{ ++ if (mActivityId != id) { ++ //Save previous activity ++ writeConfig(mActivityId); ++ mActivityId = id; ++ //read new activity ++ readConfig(id); ++ } ++} ++ ++QString AbstractConfigureWidget::activity() const ++{ ++ return mActivityId; ++} +diff --git a/pimactivity/widgets/abstractconfigurewidget.h b/pimactivity/widgets/abstractconfigurewidget.h +new file mode 100644 +index 0000000..f027d39 +--- /dev/null ++++ b/pimactivity/widgets/abstractconfigurewidget.h +@@ -0,0 +1,46 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 ABSTRACTCONFIGUREWIDGET_H ++#define ABSTRACTCONFIGUREWIDGET_H ++ ++#include ++ ++namespace PimActivity { ++class AbstractConfigureWidget ++{ ++public: ++ AbstractConfigureWidget(); ++ virtual ~AbstractConfigureWidget(); ++ ++ void setActivity(const QString &id); ++ QString activity() const; ++ ++ void setCurrentActivity(const QString &id); ++ ++ virtual void readConfig(const QString &id) = 0; ++ virtual void writeConfig(const QString &id) = 0; ++ ++private: ++ QString mActivityId; ++}; ++} ++ ++#endif // ABSTRACTCONFIGUREWIDGET_H +diff --git a/pimactivity/widgets/activitywarning.cpp b/pimactivity/widgets/activitywarning.cpp +new file mode 100644 +index 0000000..11d1508 +--- /dev/null ++++ b/pimactivity/widgets/activitywarning.cpp +@@ -0,0 +1,49 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "activitywarning.h" ++#include "activitymanager.h" ++ ++#include ++ ++namespace PimActivity { ++ActivityWarning::ActivityWarning(ActivityManager *activityManager, QWidget *parent) ++ : KMessageWidget(parent) ++{ ++ setMessageType( Warning ); ++ setCloseButtonVisible( true ); ++ setWordWrap( true ); ++ setText( i18n( "Activities is not active on this computer." ) ); ++ connect(activityManager, SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)), this, SLOT(setServiceStatusChanged(KActivities::Consumer::ServiceStatus))); ++ setVisible(!activityManager->isActive()); ++} ++ ++ActivityWarning::~ActivityWarning() ++{ ++ ++} ++ ++void ActivityWarning::setServiceStatusChanged(KActivities::Consumer::ServiceStatus status) ++{ ++ setVisible(status == KActivities::Consumer::NotRunning); ++} ++ ++} ++ +diff --git a/pimactivity/widgets/activitywarning.h b/pimactivity/widgets/activitywarning.h +new file mode 100644 +index 0000000..c6da7ad +--- /dev/null ++++ b/pimactivity/widgets/activitywarning.h +@@ -0,0 +1,40 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 ACTIVITYWARNING_H ++#define ACTIVITYWARNING_H ++ ++#include ++#include ++ ++namespace PimActivity { ++class ActivityManager; ++class ActivityWarning : public KMessageWidget ++{ ++ Q_OBJECT ++public: ++ explicit ActivityWarning(PimActivity::ActivityManager *activityManager, QWidget *parent = 0); ++ ~ActivityWarning(); ++ ++private Q_SLOTS: ++ void setServiceStatusChanged(KActivities::Consumer::ServiceStatus status); ++}; ++} ++ ++#endif // ACTIVITYWARNING_H +diff --git a/pimactivity/widgets/comboboxactivity.cpp b/pimactivity/widgets/comboboxactivity.cpp +new file mode 100644 +index 0000000..2e2464a +--- /dev/null ++++ b/pimactivity/widgets/comboboxactivity.cpp +@@ -0,0 +1,83 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "comboboxactivity.h" ++#include "activitymanager.h" ++#include ++ ++namespace PimActivity { ++ ++class ComboBoxActivityPrivate ++{ ++public: ++ ComboBoxActivityPrivate(ComboBoxActivity *qq, ActivityManager *manager) ++ : q(qq), ++ activityManager(manager) ++ { ++ const QHash list = activityManager->listActivitiesWithRealName(); ++ QHashIterator i(list); ++ while (i.hasNext()) { ++ i.next(); ++ q->addItem(i.value(), i.key()); ++ } ++ q->connect(manager, SIGNAL(activityAdded(QString)), q, SLOT(slotActivityAdded(QString))); ++ q->connect(manager, SIGNAL(activityRemoved(QString)), q, SLOT(slotActivityRemoved(QString))); ++ q->connect(manager, SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)), q, SLOT(slotActivityStatusChanged(KActivities::Consumer::ServiceStatus))); ++ q->connect(q, SIGNAL(activated(int)), q, SLOT(slotActivityChanged(int))); ++ q->setEnabled(activityManager->isActive()); ++ } ++ ++ void slotActivityAdded(const QString &name) ++ { ++ q->addItem(name); ++ } ++ ++ void slotActivityRemoved(const QString &name) ++ { ++ q->removeItem(q->findText(name)); ++ } ++ ++ void slotActivityStatusChanged(KActivities::Consumer::ServiceStatus status) ++ { ++ q->setEnabled(status == KActivities::Consumer::Running); ++ } ++ ++ void slotActivityChanged(int index) ++ { ++ Q_EMIT q->activityChanged(q->itemData(index).toString()); ++ } ++ ++ ComboBoxActivity *q; ++ ActivityManager *activityManager; ++}; ++ ++ComboBoxActivity::ComboBoxActivity(ActivityManager *activityManager, QWidget *parent) ++ : KComboBox(parent), d(new ComboBoxActivityPrivate(this, activityManager)) ++{ ++} ++ ++ComboBoxActivity::~ComboBoxActivity() ++{ ++ delete d; ++} ++ ++} ++ ++#include "moc_comboboxactivity.cpp" +diff --git a/pimactivity/widgets/comboboxactivity.h b/pimactivity/widgets/comboboxactivity.h +new file mode 100644 +index 0000000..fc4afc8 +--- /dev/null ++++ b/pimactivity/widgets/comboboxactivity.h +@@ -0,0 +1,49 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 COMBOBOXACTIVITY_H ++#define COMBOBOXACTIVITY_H ++ ++#include ++ ++namespace PimActivity { ++class ActivityManager; ++class ComboBoxActivityPrivate; ++class ComboBoxActivity : public KComboBox ++{ ++ Q_OBJECT ++public: ++ explicit ComboBoxActivity(ActivityManager *activityManager, QWidget *parent = 0); ++ ~ComboBoxActivity(); ++ ++Q_SIGNALS: ++ //Emit activity identity ++ void activityChanged(const QString &id); ++private: ++ friend class ComboBoxActivityPrivate; ++ ComboBoxActivityPrivate * const d; ++ Q_PRIVATE_SLOT( d, void slotActivityAdded(const QString&) ) ++ Q_PRIVATE_SLOT( d, void slotActivityRemoved(const QString&) ) ++ Q_PRIVATE_SLOT( d, void slotActivityStatusChanged(KActivities::Consumer::ServiceStatus) ) ++ Q_PRIVATE_SLOT( d, void slotActivityChanged(int) ) ++}; ++} ++ ++#endif // COMBOBOXACTIVITY_H +diff --git a/pimactivity/widgets/configurecollections.cpp b/pimactivity/widgets/configurecollections.cpp +new file mode 100644 +index 0000000..d3331a0 +--- /dev/null ++++ b/pimactivity/widgets/configurecollections.cpp +@@ -0,0 +1,113 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "configurecollections.h" ++#include "activitymanager.h" ++ ++#include ++#include ++#include ++ ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++ ++ ++namespace PimActivity { ++ ++ConfigureCollections::ConfigureCollections(QWidget *parent) ++ : QWidget(parent), mModelState(0) ++{ ++ QVBoxLayout *layout = new QVBoxLayout; ++ layout->setSpacing( KDialog::spacingHint() ); ++ layout->setMargin( 0 ); ++ ++ mFolderView = new QTreeView( this ); ++ mFolderView->setEditTriggers( QAbstractItemView::NoEditTriggers ); ++ layout->addWidget( mFolderView ); ++ setLayout(layout); ++ initCollections(); ++} ++ ++ConfigureCollections::~ConfigureCollections() ++{ ++ ++} ++ ++void ConfigureCollections::initCollections() ++{ ++ // Create a new change recorder. ++ mChangeRecorder = new Akonadi::ChangeRecorder( this ); ++ mChangeRecorder->setMimeTypeMonitored( KMime::Message::mimeType() ); ++ ++ mModel = new Akonadi::EntityTreeModel( mChangeRecorder, this ); ++ ++ // Set the model to show only collections, not items. ++ mModel->setItemPopulationStrategy( Akonadi::EntityTreeModel::NoItemPopulation ); ++ ++ // Create the Check proxy model. ++ mSelectionModel = new QItemSelectionModel( mModel ); ++ mCheckProxy = new KCheckableProxyModel( this ); ++ mCheckProxy->setSelectionModel( mSelectionModel ); ++ mCheckProxy->setSourceModel( mModel ); ++ ++ connect(mCheckProxy, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(slotDataChanged())); ++ mFolderView->setModel( mCheckProxy ); ++} ++ ++void ConfigureCollections::slotDataChanged() ++{ ++ Q_EMIT(changed(true)); ++} ++ ++void ConfigureCollections::readConfig(const QString &id) ++{ ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(id); ++ if (!mModelState) { ++ mModelState = new KViewStateMaintainer( conf->group( "collections" ), this ); ++ mModelState->setSelectionModel( mSelectionModel ); ++ } ++ mModelState->restoreState(); ++} ++ ++void ConfigureCollections::writeConfig(const QString &id) ++{ ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(id); ++ KConfigGroup grp = conf->group(QLatin1String("collections")); ++ if (mModelState) { ++ delete mModelState; ++ mModelState = new KViewStateMaintainer( grp, this ); ++ mModelState->saveState(); ++ } ++ Q_EMIT(changed(false)); ++} ++ ++void ConfigureCollections::setDefault() ++{ ++ //TODO ++} ++ ++} ++ +diff --git a/pimactivity/widgets/configurecollections.h b/pimactivity/widgets/configurecollections.h +new file mode 100644 +index 0000000..2590403 +--- /dev/null ++++ b/pimactivity/widgets/configurecollections.h +@@ -0,0 +1,71 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 CONFIGURECOLLECTIONS_H ++#define CONFIGURECOLLECTIONS_H ++ ++#include "abstractconfigurewidget.h" ++ ++#include ++ ++#include ++ ++namespace Akonadi { ++ class EntityTreeModel; ++ class ChangeRecorder; ++ class ETMViewStateSaver; ++} ++ ++class KCheckableProxyModel; ++class QTreeView; ++ ++namespace PimActivity { ++ ++class ConfigureCollections : public QWidget, public AbstractConfigureWidget ++{ ++ Q_OBJECT ++public: ++ explicit ConfigureCollections(QWidget *parent = 0); ++ ~ConfigureCollections(); ++ ++ void setDefault(); ++ void writeConfig(const QString &id); ++ ++private: ++ void readConfig(const QString &id); ++ ++private Q_SLOTS: ++ void slotDataChanged(); ++ ++Q_SIGNALS: ++ void changed(bool b = true); ++ ++private: ++ void initCollections(); ++ QTreeView *mFolderView; ++ QItemSelectionModel *mSelectionModel; ++ Akonadi::EntityTreeModel *mModel; ++ Akonadi::ChangeRecorder *mChangeRecorder; ++ KCheckableProxyModel *mCheckProxy; ++ KViewStateMaintainer *mModelState; ++}; ++} ++ ++#endif // CONFIGURECOLLECTIONS_H +diff --git a/pimactivity/widgets/configureidentity.cpp b/pimactivity/widgets/configureidentity.cpp +new file mode 100644 +index 0000000..574da22 +--- /dev/null ++++ b/pimactivity/widgets/configureidentity.cpp +@@ -0,0 +1,107 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "configureidentity.h" ++#include "activitymanager.h" ++ ++#include ++#include ++ ++ ++#include ++#include ++#include ++ ++namespace PimActivity { ++ ++ConfigureIdentity::ConfigureIdentity(QWidget *parent) ++ : QWidget(parent) ++{ ++ QVBoxLayout *lay = new QVBoxLayout; ++ mListIdentity = new QListWidget; ++ lay->addWidget(mListIdentity); ++ init(); ++ setLayout(lay); ++ connect(mListIdentity, SIGNAL(itemChanged(QListWidgetItem*)), SIGNAL(changed())); ++} ++ ++ConfigureIdentity::~ConfigureIdentity() ++{ ++ delete mManager; ++} ++ ++void ConfigureIdentity::init() ++{ ++ mManager = new KPIMIdentities::IdentityManager( false, this, "mIdentityManager" ); ++ KPIMIdentities::IdentityManager::Iterator end( mManager->modifyEnd() ); ++ ++ for ( KPIMIdentities::IdentityManager::Iterator it = mManager->modifyBegin(); it != end; ++it ) { ++ QListWidgetItem *item = new QListWidgetItem(mListIdentity); ++ item->setCheckState(Qt::Checked); ++ item->setData(IdentityID, (*it).uoid()); ++ item->setText((*it).identityName()); ++ } ++} ++ ++void ConfigureIdentity::readConfig(const QString &id) ++{ ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(id); ++ if (conf->hasGroup(QLatin1String("identity"))) { ++ KConfigGroup grp = conf->group(QLatin1String("identity")); ++ const QStringList list = grp.readEntry(QLatin1String("NoActiveIdentity"), QStringList()); ++ const int numberOfItems(mListIdentity->count()); ++ for (int i = 0; i < numberOfItems; ++i) { ++ QListWidgetItem *item = mListIdentity->item(i); ++ if (list.contains(item->data(IdentityID).toString())) { ++ item->setCheckState(Qt::Unchecked); ++ } else { ++ item->setCheckState(Qt::Checked); ++ } ++ } ++ } ++ emit changed(false); ++} ++ ++void ConfigureIdentity::writeConfig(const QString &id) ++{ ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(id); ++ KConfigGroup grp = conf->group(QLatin1String("identity")); ++ const int numberOfItems(mListIdentity->count()); ++ QStringList lst; ++ for (int i = 0; i < numberOfItems; ++i) { ++ QListWidgetItem *item = mListIdentity->item(i); ++ if (item->checkState() == Qt::Unchecked) { ++ lst << item->data(IdentityID).toString(); ++ } ++ } ++ grp.writeEntry(QLatin1String("NoActiveIdentity"), lst); ++} ++ ++void ConfigureIdentity::setDefault() ++{ ++ const int numberOfItems(mListIdentity->count()); ++ for (int i = 0; i < numberOfItems; ++i) { ++ QListWidgetItem *item = mListIdentity->item(i); ++ item->setCheckState(Qt::Checked); ++ } ++} ++ ++} ++ +diff --git a/pimactivity/widgets/configureidentity.h b/pimactivity/widgets/configureidentity.h +new file mode 100644 +index 0000000..6c9b30f +--- /dev/null ++++ b/pimactivity/widgets/configureidentity.h +@@ -0,0 +1,64 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 CONFIGUREIDENTITY_H ++#define CONFIGUREIDENTITY_H ++ ++#include "abstractconfigurewidget.h" ++#include ++ ++class QListWidget; ++namespace KPIMIdentities { ++class IdentityManager; ++} ++ ++namespace PimActivity { ++ ++class ConfigureIdentity : public QWidget, public AbstractConfigureWidget ++{ ++ Q_OBJECT ++public: ++ explicit ConfigureIdentity(QWidget *parent); ++ ~ConfigureIdentity(); ++ ++ void writeConfig(const QString &id); ++ ++ void setDefault(); ++ ++private: ++ void readConfig(const QString &id); ++ ++ ++Q_SIGNALS: ++ void changed(bool b = true); ++ ++private: ++ enum identityId { ++ IdentityID = Qt::UserRole +1 ++ }; ++ ++ void init(); ++ QListWidget *mListIdentity; ++ KPIMIdentities::IdentityManager *mManager; ++}; ++ ++} ++ ++#endif // CONFIGUREIDENTITY_H +diff --git a/pimactivity/widgets/configuremailtransport.cpp b/pimactivity/widgets/configuremailtransport.cpp +new file mode 100644 +index 0000000..28b00b2 +--- /dev/null ++++ b/pimactivity/widgets/configuremailtransport.cpp +@@ -0,0 +1,103 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 "configuremailtransport.h" ++#include "activitymanager.h" ++ ++#include "mailtransport/transportmanager.h" ++ ++#include ++#include ++#include ++ ++namespace PimActivity { ++ConfigureMailtransport::ConfigureMailtransport(QWidget *parent) ++ : QWidget(parent) ++{ ++ QVBoxLayout *lay = new QVBoxLayout; ++ mListTransport = new QListWidget; ++ lay->addWidget(mListTransport); ++ init(); ++ setLayout(lay); ++ connect(mListTransport, SIGNAL(itemChanged(QListWidgetItem*)), SIGNAL(changed())); ++} ++ ++ConfigureMailtransport::~ConfigureMailtransport() ++{ ++} ++ ++void ConfigureMailtransport::init() ++{ ++ QStringList listNames = MailTransport::TransportManager::self()->transportNames(); ++ QList listIds = MailTransport::TransportManager::self()->transportIds(); ++ int i = 0; ++ Q_FOREACH (const QString &name, listNames) { ++ QListWidgetItem *item = new QListWidgetItem(mListTransport); ++ item->setCheckState(Qt::Checked); ++ item->setText(name); ++ item->setData(TransportID, listIds.at(i)); ++ ++i; ++ } ++} ++ ++void ConfigureMailtransport::readConfig(const QString &id) ++{ ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(id); ++ if (conf->hasGroup(QLatin1String("mailtransport"))) { ++ KConfigGroup grp = conf->group(QLatin1String("mailtransport")); ++ const QStringList list = grp.readEntry(QLatin1String("NoActiveMailTransport"), QStringList()); ++ const int numberOfItems(mListTransport->count()); ++ for (int i = 0; i < numberOfItems; ++i) { ++ QListWidgetItem *item = mListTransport->item(i); ++ if (list.contains(item->data(TransportID).toString())) { ++ item->setCheckState(Qt::Unchecked); ++ } else { ++ item->setCheckState(Qt::Checked); ++ } ++ } ++ } ++} ++ ++void ConfigureMailtransport::writeConfig(const QString &id) ++{ ++ KSharedConfigPtr conf = ActivityManager::configFromActivity(id); ++ KConfigGroup grp = conf->group(QLatin1String("mailtransport")); ++ const int numberOfItems(mListTransport->count()); ++ QStringList lst; ++ for (int i = 0; i < numberOfItems; ++i) { ++ QListWidgetItem *item = mListTransport->item(i); ++ if (item->checkState() == Qt::Unchecked) { ++ lst << item->data(TransportID).toString(); ++ } ++ } ++ grp.writeEntry(QLatin1String("NoActiveMailTransport"), lst); ++} ++ ++void ConfigureMailtransport::setDefault() ++{ ++ const int numberOfItems(mListTransport->count()); ++ for (int i = 0; i < numberOfItems; ++i) { ++ QListWidgetItem *item = mListTransport->item(i); ++ item->setCheckState(Qt::Checked); ++ } ++} ++ ++ ++} ++ +diff --git a/pimactivity/widgets/configuremailtransport.h b/pimactivity/widgets/configuremailtransport.h +new file mode 100644 +index 0000000..0908d98 +--- /dev/null ++++ b/pimactivity/widgets/configuremailtransport.h +@@ -0,0 +1,55 @@ ++/* ++ Copyright (c) 2013, 2014 Montel Laurent ++ ++ 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 CONFIGUREMAILTRANSPORT_H ++#define CONFIGUREMAILTRANSPORT_H ++ ++#include "abstractconfigurewidget.h" ++#include ++class QListWidget; ++ ++namespace PimActivity { ++class ConfigureMailtransport : public QWidget, public AbstractConfigureWidget ++{ ++ Q_OBJECT ++public: ++ explicit ConfigureMailtransport(QWidget *parent = 0); ++ ~ConfigureMailtransport(); ++ ++ void writeConfig(const QString &id); ++ void setDefault(); ++ ++private: ++ void readConfig(const QString &id); ++ ++Q_SIGNALS: ++ void changed(bool b = true); ++ ++private: ++ enum transportId { ++ TransportID = Qt::UserRole +1 ++ }; ++ ++ void init(); ++ QListWidget *mListTransport; ++}; ++} ++ ++#endif // CONFIGUREMAILTRANSPORT_H diff -Nru kdepim-4.13.0/debian/patches/series kdepim-4.13.3/debian/patches/series --- kdepim-4.13.0/debian/patches/series 2014-04-10 20:52:58.000000000 +0000 +++ kdepim-4.13.3/debian/patches/series 2018-03-25 15:16:52.000000000 +0000 @@ -1,3 +1,6 @@ #debianize_akregator_default.diff kubuntu_debianize_akregator_default.diff kubuntu_install_headers.diff +kubuntu_revert_e6ebd9b593dfd366b8c57932cc3167a8a3ec5b3b.diff +kubuntu_revert_9fed45112711cf203a03ba3b3ed5ca0ee796c836.diff +fix-CVE-2017-9604.patch diff -Nru kdepim-4.13.0/examples/coisceim/coisceimpart.desktop kdepim-4.13.3/examples/coisceim/coisceimpart.desktop --- kdepim-4.13.0/examples/coisceim/coisceimpart.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/examples/coisceim/coisceimpart.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,6 +6,7 @@ Name[da]=CoisceimPart Name[de]=CoisceimPart Name[el]=CoisceimPart +Name[en_GB]=CoisceimPart Name[es]=CoisceimPart Name[et]=CoisceimPart Name[fi]=Coisceim-osa diff -Nru kdepim-4.13.0/examples/coisceim/kontact-plugin/coisceim_plugin.desktop kdepim-4.13.3/examples/coisceim/kontact-plugin/coisceim_plugin.desktop --- kdepim-4.13.0/examples/coisceim/kontact-plugin/coisceim_plugin.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/examples/coisceim/kontact-plugin/coisceim_plugin.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -23,6 +23,7 @@ Comment[da]=Coisceim-plugin Comment[de]=Coisceim-Modul Comment[el]=Πρόσθετο Coisceim +Comment[en_GB]=Coisceim Plugin Comment[es]=Complemento de Coisceim Comment[et]=Coisceimi plugin Comment[fi]=Coisceim-liitännäinen @@ -66,6 +67,7 @@ Name[da]=Trips Name[de]=Trips Name[el]=Ταξίδια +Name[en_GB]=Trips Name[es]=Viajes Name[et]=Trips Name[fi]=Trips diff -Nru kdepim-4.13.0/examples/mailreader/kmail-plasma/plasma-applet-kpapplet.desktop kdepim-4.13.3/examples/mailreader/kmail-plasma/plasma-applet-kpapplet.desktop --- kdepim-4.13.0/examples/mailreader/kmail-plasma/plasma-applet-kpapplet.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/examples/mailreader/kmail-plasma/plasma-applet-kpapplet.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -83,6 +83,7 @@ Comment[da]=Dine e-mails Comment[de]=Ihre E-Mails Comment[el]=Οι διευθύνσεις αλληλογραφίας σας +Comment[en_GB]=Your emails Comment[es]=Sus direcciones de correo Comment[et]=Sinu e-kirjad Comment[fi]=Sähköpostiosoitteesi diff -Nru kdepim-4.13.0/grammar/backgroundgrammarchecker.cpp kdepim-4.13.3/grammar/backgroundgrammarchecker.cpp --- kdepim-4.13.0/grammar/backgroundgrammarchecker.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/backgroundgrammarchecker.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "backgroundgrammarchecker.h" - -namespace Grammar { - -class BackgroundGrammarCheckerPrivate -{ -public: - BackgroundGrammarCheckerPrivate(BackgroundGrammarChecker *qq) - : q(qq) - { - - } - BackgroundGrammarChecker *q; -}; - -BackgroundGrammarChecker::BackgroundGrammarChecker(QObject *parent) - : QObject(parent), d(new BackgroundGrammarCheckerPrivate(this)) -{ -} - -BackgroundGrammarChecker::~BackgroundGrammarChecker() -{ - delete d; -} -} - diff -Nru kdepim-4.13.0/grammar/backgroundgrammarchecker.h kdepim-4.13.3/grammar/backgroundgrammarchecker.h --- kdepim-4.13.0/grammar/backgroundgrammarchecker.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/backgroundgrammarchecker.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 BACKGROUNDGRAMMARCHECKER_H -#define BACKGROUNDGRAMMARCHECKER_H - -#include - -namespace Grammar { -class BackgroundGrammarCheckerPrivate; -class BackgroundGrammarChecker : QObject -{ - Q_OBJECT -public: - explicit BackgroundGrammarChecker(QObject *parent = 0); - ~BackgroundGrammarChecker(); - -private: - friend class BackgroundGrammarCheckerPrivate; - BackgroundGrammarCheckerPrivate * const d; -}; -} - -#endif // BACKGROUNDGRAMMARCHECKER_H diff -Nru kdepim-4.13.0/grammar/CMakeLists.txt kdepim-4.13.3/grammar/CMakeLists.txt --- kdepim-4.13.0/grammar/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -project(grammar) -add_definitions( -DQT_NO_CAST_FROM_ASCII ) -add_definitions( -DQT_NO_CAST_TO_ASCII ) - -include_directories( .) - -set(libgrammar_SRCS - grammarhighlighter.cpp - grammarclient.cpp - backgroundgrammarchecker.cpp - grammarsettings.cpp - grammarplugin.cpp - grammarloader.cpp - grammarchecker.cpp - widgets/grammarcomboboxlanguage.cpp - widgets/grammarconfigurewidget.cpp -) - -kde4_add_library(grammar ${LIBRARY_TYPE} ${libgrammar_SRCS}) - -target_link_libraries(grammar ${KDE4_KDEUI_LIBS}) - - -set_target_properties( grammar PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} ) -install(TARGETS grammar ${INSTALL_TARGETS_DEFAULT_ARGS} ) - -add_subdirectory(plugins) - -add_subdirectory(tests) - diff -Nru kdepim-4.13.0/grammar/grammarchecker.cpp kdepim-4.13.3/grammar/grammarchecker.cpp --- kdepim-4.13.0/grammar/grammarchecker.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarchecker.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarchecker.h" -#include "grammarloader.h" - -#include -#include - -#include - -namespace Grammar { - -class GrammarCheckerPrivate -{ -public: - GrammarCheckerPrivate(GrammarChecker *qq) - : q(qq) - { - - } - GrammarChecker *q; -}; - - -GrammarChecker::GrammarChecker(const QString &lang) - : d(new GrammarCheckerPrivate(this)) -{ -} - -GrammarChecker::~GrammarChecker() -{ - delete d; -} - -QMap GrammarChecker::availableLanguage() const -{ - GrammarLoader *l = GrammarLoader::openGrammarLoader(); - const QStringList lst = l->languages(); - QMap langs; - foreach(const QString &tag, lst) { - const QString description= QString::fromLatin1("%1 (%2)") - .arg(KGlobal::locale()->languageCodeToName(tag)) - .arg(KGlobal::locale()->countryCodeToName(tag)); - langs.insert(description, tag); - } - - return langs; -} - -} diff -Nru kdepim-4.13.0/grammar/grammarchecker.h kdepim-4.13.3/grammar/grammarchecker.h --- kdepim-4.13.0/grammar/grammarchecker.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarchecker.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARCHECKER_H -#define GRAMMARCHECKER_H - -#include -#include - -namespace Grammar { -class GrammarCheckerPrivate; -class GrammarChecker -{ -public: - GrammarChecker(const QString &lang = QString()); - ~GrammarChecker(); - - QMap availableLanguage() const; - -private: - friend class GrammarCheckerPrivate; - GrammarCheckerPrivate * const d; -}; -} - -#endif // GRAMMARCHECKER_H diff -Nru kdepim-4.13.0/grammar/grammarclient.cpp kdepim-4.13.3/grammar/grammarclient.cpp --- kdepim-4.13.0/grammar/grammarclient.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarclient.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarclient_p.h" - -namespace Grammar { - -GrammarClient::GrammarClient(QObject *parent) - : QObject(parent) -{ -} - -} -#include "moc_grammarclient_p.cpp" diff -Nru kdepim-4.13.0/grammar/grammarclient_p.h kdepim-4.13.3/grammar/grammarclient_p.h --- kdepim-4.13.0/grammar/grammarclient_p.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarclient_p.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARCLIENT_H -#define GRAMMARCLIENT_H - -#include "grammar_export.h" - -#include -#include -#include - - -namespace Grammar { -class GrammarPlugin; -class GRAMMAR_EXPORT GrammarClient : public QObject -{ - Q_OBJECT -public: - explicit GrammarClient(QObject *parent = 0); - - virtual int reliability() const = 0; - - virtual QStringList languages() const = 0; - - virtual QString name() const = 0; - - virtual Grammar::GrammarPlugin *createGrammarChecker(const QString &language) = 0; -}; - -} - -#endif // GRAMMARCLIENT_H diff -Nru kdepim-4.13.0/grammar/grammar_export.h kdepim-4.13.3/grammar/grammar_export.h --- kdepim-4.13.0/grammar/grammar_export.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammar_export.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure - - 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 GRAMMAR_EXPORT_H -#define GRAMMAR_EXPORT_H - -/* needed for KDE_EXPORT and KDE_IMPORT macros */ -#include - -#ifndef GRAMMAR_EXPORT -# if defined(KDEPIM_STATIC_LIBS) - /* No export/import for static libraries */ -# define GRAMMAR_EXPORT -# elif defined(MAKE_GRAMMAR_LIB) - /* We are building this library */ -# define GRAMMAR_EXPORT KDE_EXPORT -# else - /* We are using this library */ -# define GRAMMAR_EXPORT KDE_IMPORT -# endif -#endif - -# ifndef GRAMMAR_EXPORT_DEPRECATED -# define GRAMMAR_EXPORT_DEPRECATED KDE_DEPRECATED GRAMMAR_EXPORT -# endif - -#endif diff -Nru kdepim-4.13.0/grammar/grammarhighlighter.cpp kdepim-4.13.3/grammar/grammarhighlighter.cpp --- kdepim-4.13.0/grammar/grammarhighlighter.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarhighlighter.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarhighlighter.h" - -namespace Grammar { - -class GrammarPrivate { -public: - GrammarPrivate(GrammarHighlighter *qq) - : active(true), - q(qq) - { - - } - QString currentLanguage; - QColor grammarErrorColor; - bool active; - GrammarHighlighter *q; -}; - -GrammarHighlighter::GrammarHighlighter(QTextEdit *textEdit) - : QSyntaxHighlighter(textEdit), d(new GrammarPrivate(this)) -{ -} - -GrammarHighlighter::~GrammarHighlighter() -{ - delete d; -} - -QString GrammarHighlighter::currentLanguage() const -{ - return d->currentLanguage; -} - -void GrammarHighlighter::setCurrentLanguage(const QString &lang) -{ - d->currentLanguage = lang; -} - -void GrammarHighlighter::highlightBlock(const QString &text) -{ - if (text.isEmpty() || !d->active) - return; - - //TODO - setCurrentBlockState(0); -} - -void GrammarHighlighter::setActive(bool active) -{ - d->active = active; -} - -bool GrammarHighlighter::isActive() const -{ - return d->active; -} - -void GrammarHighlighter::setGrammarColor(const QColor &color) -{ - d->grammarErrorColor = color; -} - -QColor GrammarHighlighter::grammarColor() const -{ - return d->grammarErrorColor; -} - - -} diff -Nru kdepim-4.13.0/grammar/grammarhighlighter.h kdepim-4.13.3/grammar/grammarhighlighter.h --- kdepim-4.13.0/grammar/grammarhighlighter.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarhighlighter.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARHIGHLIGHTER_H -#define GRAMMARHIGHLIGHTER_H - -#include - -#include "grammar_export.h" - -namespace Grammar -{ -class GrammarPrivate; -class GRAMMAR_EXPORT GrammarHighlighter : public QSyntaxHighlighter -{ - Q_OBJECT -public: - explicit GrammarHighlighter(QTextEdit *textEdit); - ~GrammarHighlighter(); - - QString currentLanguage() const; - void setCurrentLanguage(const QString &lang); - - void setActive(bool active); - bool isActive() const; - - void setGrammarColor(const QColor &color); - QColor grammarColor() const; - -protected: - void highlightBlock(const QString &text); - -private: - friend class GrammarPrivate; - GrammarPrivate * const d; -}; -} - -#endif // GRAMMARHIGHLIGHTER_H diff -Nru kdepim-4.13.0/grammar/grammarloader.cpp kdepim-4.13.3/grammar/grammarloader.cpp --- kdepim-4.13.0/grammar/grammarloader.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarloader.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,123 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarloader.h" -#include "grammarclient_p.h" -#include "grammarsettings.h" - -#include -#include -#include - -namespace Grammar { -class GrammarLoaderPrivate -{ -public: - GrammarLoaderPrivate(GrammarLoader *qq) - : settings(0), - q(qq) - { - } - - ~GrammarLoaderPrivate() - { - plugins.clear(); - } - - void loadPlugins() - { - plugins = KServiceTypeTrader::self()->query(QString::fromLatin1("Grammar/GrammarClient")); - - KService::List::const_iterator end(plugins.constEnd()); - for (KService::List::const_iterator itr = plugins.constBegin(); itr != end; ++itr ) { - loadPlugin((*itr)); - } - } - - void loadPlugin(const KSharedPtr &service) - { - QString error; - - Grammar::GrammarClient *client = service->createInstance(q, QVariantList(), &error); - if (client) { - const QStringList languages = client->languages(); - clients.append(client->name()); - QStringList::const_iterator itrEnd(languages.end()); - for (QStringList::const_iterator itr = languages.begin(); itr != itrEnd; ++itr) { - if (!languageClients[*itr].isEmpty() && (client->reliability() < languageClients[*itr].first()->reliability())) - languageClients[*itr].append(client); - else - languageClients[*itr].prepend(client); - } - //kDebug() << "Successfully loaded plugin:" << service->entryPath(); - } else { - kDebug() << error; - } - } - - - KService::List plugins; - QStringList clients; - // - QMap > languageClients; - GrammarSettings *settings; - GrammarLoader *q; -}; - -K_GLOBAL_STATIC(GrammarLoader, s_loader) - -GrammarLoader *GrammarLoader::openGrammarLoader() -{ - if (s_loader.isDestroyed()) { - return 0; - } - - return s_loader; -} - -GrammarLoader::GrammarLoader() - : d(new GrammarLoaderPrivate(this)) -{ - d->settings = new GrammarSettings;// - d->loadPlugins(); - KConfig config(QString::fromLatin1("grammarrc")); - KConfigGroup grp = config.group(QLatin1String("General")); - d->settings->readSettings(grp); -} - -GrammarLoader::~GrammarLoader() -{ - delete d; -} - -QStringList GrammarLoader::clients() const -{ - return d->clients; -} - -QStringList GrammarLoader::languages() const -{ - return d->languageClients.keys(); -} - -GrammarSettings *GrammarLoader::settings() const -{ - return d->settings; -} - -} - diff -Nru kdepim-4.13.0/grammar/grammarloader.h kdepim-4.13.3/grammar/grammarloader.h --- kdepim-4.13.0/grammar/grammarloader.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarloader.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARLOADER_H -#define GRAMMARLOADER_H -#include - -#include "grammar_export.h" - -namespace Grammar { -class GrammarLoaderPrivate; -class GrammarSettings; -class GRAMMAR_EXPORT GrammarLoader : public QObject -{ - Q_OBJECT -public: - static GrammarLoader *openGrammarLoader(); - - GrammarLoader(); - ~GrammarLoader(); - - QStringList clients() const; - - QStringList languages() const; - - GrammarSettings *settings() const; - -Q_SIGNALS: - void configurationChanged(); - - -private: - friend class GrammarLoaderPrivate; - GrammarLoaderPrivate * const d; -}; -} - -#endif // GRAMMARLOADER_H diff -Nru kdepim-4.13.0/grammar/grammarplugin.cpp kdepim-4.13.3/grammar/grammarplugin.cpp --- kdepim-4.13.0/grammar/grammarplugin.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarplugin.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarplugin_p.h" - -namespace Grammar { - -class GrammarPluginPrivate -{ -public: - GrammarPluginPrivate() - { - - } - QString lang; -}; - -GrammarPlugin::GrammarPlugin(const QString &lang) - : d(new GrammarPluginPrivate) -{ - d->lang = lang; -} - -GrammarPlugin::~GrammarPlugin() -{ - delete d; -} - -QString GrammarPlugin::language() const -{ - return d->lang; -} - -} diff -Nru kdepim-4.13.0/grammar/grammarplugin_p.h kdepim-4.13.3/grammar/grammarplugin_p.h --- kdepim-4.13.0/grammar/grammarplugin_p.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarplugin_p.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARPLUGIN_H -#define GRAMMARPLUGIN_H - -#include "grammar_export.h" - -#include - -namespace Grammar { -class GrammarPluginPrivate; -class GRAMMAR_EXPORT GrammarPlugin -{ -public: - ~GrammarPlugin(); - - QString language() const; -protected: - GrammarPlugin(const QString &lang); -private: - friend class GrammarPluginPrivate; - GrammarPluginPrivate * const d; -}; -} - -#endif // GRAMMARPLUGIN_H diff -Nru kdepim-4.13.0/grammar/grammarsettings.cpp kdepim-4.13.3/grammar/grammarsettings.cpp --- kdepim-4.13.0/grammar/grammarsettings.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarsettings.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarsettings.h" - -#include -#include - -namespace Grammar { - -class GrammarSettingsPrivate -{ -public: - GrammarSettingsPrivate() - { - } - QString defaultLanguage; -}; - -GrammarSettings::GrammarSettings() - : d(new GrammarSettingsPrivate) -{ -} - -GrammarSettings::~GrammarSettings() -{ - delete d; -} - -void GrammarSettings::setDefaultLanguage(const QString &lang) -{ - d->defaultLanguage = lang; -} - -QString GrammarSettings::defaultLanguage() const -{ - return d->defaultLanguage; -} - -void GrammarSettings::saveSettings(KConfigGroup &group) -{ - group.writeEntry("DefaultLanguage", d->defaultLanguage); -} - -void GrammarSettings::readSettings(const KConfigGroup &group) -{ - d->defaultLanguage = group.readEntry("DefaultLanguage"); -} - -} diff -Nru kdepim-4.13.0/grammar/grammarsettings.h kdepim-4.13.3/grammar/grammarsettings.h --- kdepim-4.13.0/grammar/grammarsettings.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/grammarsettings.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARSETTINGS_H -#define GRAMMARSETTINGS_H - -#include -class KConfigGroup; - -namespace Grammar { -class GrammarSettingsPrivate; -class GrammarSettings -{ -public: - GrammarSettings(); - ~GrammarSettings(); - - void setDefaultLanguage(const QString &lang); - QString defaultLanguage() const; - - void saveSettings(KConfigGroup &group); - void readSettings(const KConfigGroup &group); - -private: - friend class GrammarSettingsPrivate; - GrammarSettingsPrivate * const d; -}; -} - -#endif // GRAMMARSETTINGS_H diff -Nru kdepim-4.13.0/grammar/plugins/CMakeLists.txt kdepim-4.13.3/grammar/plugins/CMakeLists.txt --- kdepim-4.13.0/grammar/plugins/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/plugins/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -project(plugins) -find_package(LinkGrammar) -set_package_properties(LinkGrammar PROPERTIES DESCRIPTION "Grammar checking Library" - URL "http://www.abisource.com/projects/link-grammar/" - TYPE OPTIONAL - PURPOSE "Required by Grammar-Check plugin" - ) - -if(LINKGRAMMAR_FOUND) - add_subdirectory(linkgrammar) -endif() - diff -Nru kdepim-4.13.0/grammar/plugins/linkgrammar/CMakeLists.txt kdepim-4.13.3/grammar/plugins/linkgrammar/CMakeLists.txt --- kdepim-4.13.0/grammar/plugins/linkgrammar/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/plugins/linkgrammar/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -project(linkgrammarchecker) - -include_directories(${LinkGrammar_INCLUDE_DIR}) -set( linkgrammarchecker_SRCS grammarlinkclient.cpp grammarlinkplugin.cpp) - -kde4_add_plugin(grammar_link ${linkgrammarchecker_SRCS}) - -target_link_libraries(grammar_link ${KDE4_KDECORE_LIBS} ${LinkGrammar_LIBRARIES} grammar) - -install(TARGETS grammar_link DESTINATION ${PLUGIN_INSTALL_DIR} ) - - -########### install files ############### - -install( FILES grammar_link.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) - - diff -Nru kdepim-4.13.0/grammar/plugins/linkgrammar/grammarlinkclient.cpp kdepim-4.13.3/grammar/plugins/linkgrammar/grammarlinkclient.cpp --- kdepim-4.13.0/grammar/plugins/linkgrammar/grammarlinkclient.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/plugins/linkgrammar/grammarlinkclient.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarlinkclient.h" -#include "grammarlinkplugin.h" - -#include -#include -#include - -K_PLUGIN_FACTORY( GrammarLinkClientFactory, registerPlugin(); ) -K_EXPORT_PLUGIN( GrammarLinkClientFactory( "grammar_link" ) ) - -GrammarLinkClient::GrammarLinkClient(QObject *parent, const QVariantList& /* args */) - : Grammar::GrammarClient(parent) -{ -} - -GrammarLinkClient::~GrammarLinkClient() -{ - -} - -int GrammarLinkClient::reliability() const -{ - return 20; -} - -Grammar::GrammarPlugin *GrammarLinkClient::createGrammarChecker(const QString &language) -{ - GrammarLinkPlugin *plugin = new GrammarLinkPlugin(language); - return plugin; -} - -QStringList GrammarLinkClient::searchLanguages() const -{ - //TODO - return QStringList(); -} - -QStringList GrammarLinkClient::languages() const -{ - //return searchLanguages(); - //TODO improve search - return QStringList() < - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARLINKCLIENT_H -#define GRAMMARLINKCLIENT_H - -#include "grammar/grammarclient_p.h" -#include "grammar/grammarplugin_p.h" -#include - -class GrammarLinkClient : public Grammar::GrammarClient -{ - Q_OBJECT -public: - GrammarLinkClient(QObject *parent, const QVariantList &); - ~GrammarLinkClient(); - - int reliability() const; - Grammar::GrammarPlugin *createGrammarChecker(const QString &language); - - QStringList languages() const; - - QString name() const; - -private: - QStringList searchLanguages() const; -}; - -#endif // GRAMMARLINKCLIENT_H diff -Nru kdepim-4.13.0/grammar/plugins/linkgrammar/grammar_link.desktop kdepim-4.13.3/grammar/plugins/linkgrammar/grammar_link.desktop --- kdepim-4.13.0/grammar/plugins/linkgrammar/grammar_link.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/plugins/linkgrammar/grammar_link.desktop 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=Grammar/GrammarClient -X-KDE-Library=grammar_link -X-KDE-PluginInfo-Author=Laurent Montel -X-KDE-PluginInfo-Email=montel@kde.org -X-KDE-PluginInfo-Name=grammar_link -X-KDE-PluginInfo-Version=0.0.1 -X-KDE-PluginInfo-Website=http://www.kde.org -X-KDE-PluginInfo-Category=Clients -X-KDE-PluginInfo-Depends= -X-KDE-PluginInfo-License=LGPL -X-KDE-PluginInfo-EnabledByDefault=true -Name=GrammarLink -Name[bs]=GrammarLink -Name[ca]=GrammarLink -Name[ca@valencia]=GrammarLink -Name[da]=GrammarLink -Name[de]=Grammatik-Verknüpfung -Name[el]=GrammarLink -Name[es]=GrammarLink -Name[fi]=GrammarLink -Name[fr]=GrammarLink -Name[gl]=GrammarLink -Name[hu]=GrammarLink -Name[ia]=GrammarLink (Ligamine de grammatica) -Name[it]=GrammarLink -Name[kk]=GrammarLink -Name[ko]=GrammarLink -Name[lt]=GramatikosNuoroda -Name[nb]=GrammarLink -Name[nds]=GrammatikLink -Name[nl]=GrammaticaKoppeling -Name[pl]=GrammarLink -Name[pt]=GrammarLink -Name[pt_BR]=GrammarLink -Name[ru]=GrammarLink -Name[sk]=Gramatický odkaz -Name[sr]=Повезна граматика -Name[sr@ijekavian]=Повезна граматика -Name[sr@ijekavianlatin]=Povezna gramatika -Name[sr@latin]=Povezna gramatika -Name[sv]=Grammatiklänk -Name[tr]=Dilbilgisi Bağlantısı -Name[uk]=GrammarLink -Name[wa]=GrammarLink -Name[x-test]=xxGrammarLinkxx -Name[zh_TW]=GrammarLink diff -Nru kdepim-4.13.0/grammar/plugins/linkgrammar/grammarlinkplugin.cpp kdepim-4.13.3/grammar/plugins/linkgrammar/grammarlinkplugin.cpp --- kdepim-4.13.0/grammar/plugins/linkgrammar/grammarlinkplugin.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/plugins/linkgrammar/grammarlinkplugin.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarlinkplugin.h" - -#include -#include - -GrammarLinkPlugin::GrammarLinkPlugin(const QString &language) - : Grammar::GrammarPlugin(language) -{ - setlocale(LC_ALL, ""); - mOpts = parse_options_create(); - mDict = dictionary_create_lang(language.toLatin1()); - if (!mDict) { - qDebug()<<" dictionary for language "< - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammar/grammarplugin_p.h" -extern "C" { -#include -} -#ifndef GRAMMARLINKPLUGIN_H -#define GRAMMARLINKPLUGIN_H - -class GrammarLinkPlugin : public Grammar::GrammarPlugin -{ -public: - GrammarLinkPlugin(const QString &language); - ~GrammarLinkPlugin(); -private: - Dictionary mDict; - Parse_Options mOpts; -}; - -#endif // GRAMMARLINKPLUGIN_H diff -Nru kdepim-4.13.0/grammar/tests/CMakeLists.txt kdepim-4.13.3/grammar/tests/CMakeLists.txt --- kdepim-4.13.0/grammar/tests/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/tests/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -project( grammareditor ) - -set( grammareditor_SRCS - mainwindow.cpp - main.cpp -) - -kde4_add_executable(grammareditor TEST ${grammareditor_SRCS} ) -TARGET_LINK_LIBRARIES(grammareditor ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} grammar ) - diff -Nru kdepim-4.13.0/grammar/tests/main.cpp kdepim-4.13.3/grammar/tests/main.cpp --- kdepim-4.13.0/grammar/tests/main.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/tests/main.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 -#include -#include - -#include "mainwindow.h" - -int main( int argc, char **argv ) -{ - const QByteArray& ba = QByteArray( "grammareditor" ); - const KLocalizedString name = ki18n( "Grammar Editor" ); - KAboutData aboutData( ba, ba, name, ba, name ); - KCmdLineArgs::init( argc, argv, &aboutData ); - KApplication app; - MainWindow* mw = new MainWindow(); - mw->show(); - return app.exec(); -} diff -Nru kdepim-4.13.0/grammar/tests/mainwindow.cpp kdepim-4.13.3/grammar/tests/mainwindow.cpp --- kdepim-4.13.0/grammar/tests/mainwindow.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/tests/mainwindow.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "mainwindow.h" - -#include "grammar/widgets/grammarcomboboxlanguage.h" -#include "grammar/grammarhighlighter.h" - -#include -#include - -MainWindow::MainWindow() - : QMainWindow() -{ - QWidget *w = new QWidget; - QVBoxLayout *layout = new QVBoxLayout; - w->setLayout(layout); - Grammar::GrammarComboBoxLanguage *comboxbox = new Grammar::GrammarComboBoxLanguage; - layout->addWidget(comboxbox); - mEdit = new QTextEdit; - new Grammar::GrammarHighlighter(mEdit); - layout->addWidget(mEdit); - setCentralWidget(w); -} - diff -Nru kdepim-4.13.0/grammar/tests/mainwindow.h kdepim-4.13.3/grammar/tests/mainwindow.h --- kdepim-4.13.0/grammar/tests/mainwindow.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/tests/mainwindow.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include - -class QTextEdit; - -class MainWindow : public QMainWindow -{ - Q_OBJECT -public: - MainWindow(); -private: - QTextEdit *mEdit; -}; - -#endif // MAINWINDOW_H diff -Nru kdepim-4.13.0/grammar/TODO kdepim-4.13.3/grammar/TODO --- kdepim-4.13.0/grammar/TODO 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/TODO 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -Add more grammer plugins here diff -Nru kdepim-4.13.0/grammar/widgets/grammarcomboboxlanguage.cpp kdepim-4.13.3/grammar/widgets/grammarcomboboxlanguage.cpp --- kdepim-4.13.0/grammar/widgets/grammarcomboboxlanguage.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/widgets/grammarcomboboxlanguage.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarcomboboxlanguage.h" -#include "grammarchecker.h" -#include - -namespace Grammar { -class GrammarComboBoxLanguagePrivate -{ -public: - GrammarComboBoxLanguagePrivate(GrammarComboBoxLanguage *qq) - : q(qq) - { - - } - - void slotLanguageChanged(int index) - { - Q_EMIT q->languageChanged( q->itemData( index ).toString() ); - } - - GrammarComboBoxLanguage *q; -}; - - -GrammarComboBoxLanguage::GrammarComboBoxLanguage(QWidget *parent) - : KComboBox(parent), d(new GrammarComboBoxLanguagePrivate(this)) -{ - reloadList(); - connect( this, SIGNAL(activated(int)), this, SLOT(slotLanguageChanged(int)) ); -} - -GrammarComboBoxLanguage::~GrammarComboBoxLanguage() -{ - delete d; -} - -void GrammarComboBoxLanguage::reloadList() -{ - clear(); - - Grammar::GrammarChecker* checker = new Grammar::GrammarChecker(); - QMap lang = checker->availableLanguage(); - QMapIterator i( lang ); - while ( i.hasNext() ) { - i.next(); - kDebug() << "Populate combo:" << i.key() << ":" << i.value(); - addItem( i.key(), i.value() ); - } - delete checker; -} - -void GrammarComboBoxLanguage::setCurrentLanguage(const QString &lang) -{ - if ( lang.isEmpty() || lang == itemData( currentIndex() ).toString() ) - return; - - const int idx = findData( lang ); - if ( idx == -1 ) { - kDebug() << "lang not found" << lang; - return; - } - - setCurrentIndex( idx ); - d->slotLanguageChanged( idx ); -} - -QString GrammarComboBoxLanguage::currentLanguage() const -{ - return itemData( currentIndex() ).toString(); -} - -} - -#include "moc_grammarcomboboxlanguage.cpp" diff -Nru kdepim-4.13.0/grammar/widgets/grammarcomboboxlanguage.h kdepim-4.13.3/grammar/widgets/grammarcomboboxlanguage.h --- kdepim-4.13.0/grammar/widgets/grammarcomboboxlanguage.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/widgets/grammarcomboboxlanguage.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARCOMBOBOXLANGUAGE_H -#define GRAMMARCOMBOBOXLANGUAGE_H - -#include "grammar_export.h" - -#include - -namespace Grammar -{ -class GrammarComboBoxLanguagePrivate; -class GRAMMAR_EXPORT GrammarComboBoxLanguage : public KComboBox -{ - Q_OBJECT -public: - explicit GrammarComboBoxLanguage(QWidget *parent = 0); - ~GrammarComboBoxLanguage(); - - void setCurrentLanguage(const QString &lang); - QString currentLanguage() const; - -Q_SIGNALS: - void languageChanged(const QString &language); - -private: - void reloadList(); - friend class GrammarComboBoxLanguagePrivate; - GrammarComboBoxLanguagePrivate * const d; - Q_PRIVATE_SLOT(d, void slotLanguageChanged(int) ) -}; -} - -#endif // GRAMMARCOMBOBOXLANGUAGE_H diff -Nru kdepim-4.13.0/grammar/widgets/grammarconfigurewidget.cpp kdepim-4.13.3/grammar/widgets/grammarconfigurewidget.cpp --- kdepim-4.13.0/grammar/widgets/grammarconfigurewidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/widgets/grammarconfigurewidget.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "grammarconfigurewidget.h" -#include "grammarcomboboxlanguage.h" -#include "grammarloader.h" -#include "grammarsettings.h" - -#include -#include -#include - -#include -#include - -namespace Grammar { - -class GrammarConfigureWidgetPrivate { -public: - GrammarConfigureWidgetPrivate(KConfig *_config, GrammarConfigureWidget *qq) - : q(qq), - config(_config) - { - init(); - } - - void init() - { - loader = GrammarLoader::openGrammarLoader(); - KConfigGroup group = config->group(QLatin1String("General")); - loader->settings()->readSettings(group); - QHBoxLayout *lay = new QHBoxLayout; - QLabel *lab = new QLabel(i18n("Default language:")); - lay->addWidget(lab); - - language = new GrammarComboBoxLanguage; - lay->addWidget(language); - - q->setLayout(lay); - } - - void setDefault() - { - //TODO - } - - void save() - { - KConfigGroup group = config->group(QLatin1String("General")); - loader->settings()->setDefaultLanguage(language->currentLanguage()); - loader->settings()->saveSettings(group); - } - - void setLanguage(const QString &lang) - { - language->setCurrentLanguage(lang); - } - - GrammarLoader *loader; - GrammarComboBoxLanguage *language; - GrammarConfigureWidget *q; - KConfig *config; -}; - -GrammarConfigureWidget::GrammarConfigureWidget(KConfig *config, QWidget *parent) - : QWidget(parent), d(new GrammarConfigureWidgetPrivate(config, this)) -{ -} - -GrammarConfigureWidget::~GrammarConfigureWidget() -{ - delete d; -} - -void GrammarConfigureWidget::setDefault() -{ - d->setDefault(); -} - -void GrammarConfigureWidget::setLanguage(const QString &lang) -{ - d->setLanguage(lang); -} - -void GrammarConfigureWidget::save() -{ - d->save(); -} - -} - diff -Nru kdepim-4.13.0/grammar/widgets/grammarconfigurewidget.h kdepim-4.13.3/grammar/widgets/grammarconfigurewidget.h --- kdepim-4.13.0/grammar/widgets/grammarconfigurewidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grammar/widgets/grammarconfigurewidget.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 GRAMMARCONFIGUREWIDGET_H -#define GRAMMARCONFIGUREWIDGET_H - -#include "grammar_export.h" -#include -class KConfig; -namespace Grammar -{ -class GrammarConfigureWidgetPrivate; -class GRAMMAR_EXPORT GrammarConfigureWidget : public QWidget -{ - Q_OBJECT -public: - explicit GrammarConfigureWidget(KConfig *config, QWidget *parent=0); - ~GrammarConfigureWidget(); - - void setDefault(); - void setLanguage(const QString &lang); - void save(); - -private: - friend class GrammarConfigureWidgetPrivate; - GrammarConfigureWidgetPrivate * const d; -}; -} - -#endif // GRAMMARCONFIGUREWIDGET_H diff -Nru kdepim-4.13.0/grantleetheme/grantleetheme.kcfg kdepim-4.13.3/grantleetheme/grantleetheme.kcfg --- kdepim-4.13.0/grantleetheme/grantleetheme.kcfg 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grantleetheme/grantleetheme.kcfg 2014-07-09 12:18:50.000000000 +0000 @@ -3,8 +3,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd"> - - + + + + + + diff -Nru kdepim-4.13.0/grantleetheme/grantleethememanager.cpp kdepim-4.13.3/grantleetheme/grantleethememanager.cpp --- kdepim-4.13.0/grantleetheme/grantleethememanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grantleetheme/grantleethememanager.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -41,8 +41,9 @@ class GrantleeThemeManager::Private { public: - Private(const QString &desktopFileName, KActionCollection *ac, const QString &relativePath, GrantleeThemeManager *qq) - : defaultDesktopFileName(desktopFileName), + Private(GrantleeTheme::GrantleeThemeManager::Application type, const QString &desktopFileName, KActionCollection *ac, const QString &relativePath, GrantleeThemeManager *qq) + : applicationType(type), + defaultDesktopFileName(desktopFileName), actionGroup(0), menu(0), actionCollection(ac), @@ -59,7 +60,7 @@ q->connect(downloadThemesAction, SIGNAL(triggered(bool)), q, SLOT(slotDownloadHeaderThemes()) ); q->connect( watch, SIGNAL(dirty(QString)), SLOT(directoryChanged()) ); - setThemesPath(); + updateThemesPath(); } ~Private() @@ -87,14 +88,14 @@ void directoryChanged() { + updateThemesPath(); updateActionList(); Q_EMIT q->updateThemes(); } - void setThemesPath() + void updateThemesPath() { if ( !themesDirectories.isEmpty() ) { - watch->stopScan(); Q_FOREACH (const QString &directory, themesDirectories) { watch->removeDir( directory ); } @@ -142,8 +143,9 @@ return; QString themeActivated; Q_FOREACH ( KToggleAction *action, themesActionList ) { - if (action->isChecked()) + if (action->isChecked()) { themeActivated = action->data().toString(); + } actionGroup->removeAction(action); if (actionCollection) actionCollection->removeAction( action ); @@ -155,6 +157,7 @@ themesActionList.clear(); + bool themeActivatedFound = false; QMapIterator i(themes); while (i.hasNext()) { i.next(); @@ -162,32 +165,62 @@ KToggleAction *act = new KToggleAction(theme.name(),q); act->setToolTip(theme.description()); act->setData(theme.dirName()); - if (theme.dirName() == themeActivated) + if (theme.dirName() == themeActivated) { act->setChecked(true); + themeActivatedFound = true; + } themesActionList.append(act); actionGroup->addAction(act); menu->addAction(act); q->connect(act, SIGNAL(triggered(bool)), q, SLOT(slotThemeSelected())); } + if (!themeActivatedFound) { + if (!themesActionList.isEmpty()) { + //Activate first item if we removed theme. + KToggleAction *act = themesActionList.at(0); + act->setChecked(true); + selectTheme(act); + } + } menu->addAction(separatorAction); menu->addAction(downloadThemesAction); } + void selectTheme(KToggleAction *act) + { + if (act) { + switch(applicationType) { + case GrantleeThemeManager::Mail: + GrantleeSettings::self()->setGrantleeMailThemeName( act->data().toString() ); + break; + case GrantleeThemeManager::Addressbook: + GrantleeSettings::self()->setGrantleeAddressBookThemeName( act->data().toString() ); + break; + } + GrantleeSettings::self()->writeConfig(); + } + } + void slotThemeSelected() { if (q->sender() ) { KToggleAction *act = dynamic_cast(q->sender()); - if (act) { - GrantleeSettings::self()->setGrantleeThemeName( act->data().toString() ); - GrantleeSettings::self()->writeConfig(); - } + selectTheme(act); Q_EMIT q->grantleeThemeSelected(); } } KToggleAction *actionForTheme() { - const QString themeName = GrantleeSettings::self()->grantleeThemeName(); + QString themeName; + switch(applicationType) { + case GrantleeThemeManager::Mail: + themeName = GrantleeSettings::self()->grantleeMailThemeName(); + break; + case GrantleeThemeManager::Addressbook: + themeName = GrantleeSettings::self()->grantleeAddressBookThemeName(); + break; + } if (themeName.isEmpty()) return 0; Q_FOREACH(KToggleAction *act, themesActionList) { @@ -211,7 +244,7 @@ } } } - + GrantleeThemeManager::Application applicationType; QString defaultDesktopFileName; QString downloadConfigFileName; QStringList themesDirectories; @@ -228,8 +261,8 @@ GrantleeThemeManager *q; }; -GrantleeThemeManager::GrantleeThemeManager(const QString &defaultDesktopFileName, KActionCollection *actionCollection, const QString &path, QObject *parent) - : QObject(parent), d(new Private(defaultDesktopFileName, actionCollection, path,this)) +GrantleeThemeManager::GrantleeThemeManager(GrantleeTheme::GrantleeThemeManager::Application applicationType, const QString &defaultDesktopFileName, KActionCollection *actionCollection, const QString &path, QObject *parent) + : QObject(parent), d(new Private(applicationType, defaultDesktopFileName, actionCollection, path,this)) { } diff -Nru kdepim-4.13.0/grantleetheme/grantleethememanager.h kdepim-4.13.3/grantleetheme/grantleethememanager.h --- kdepim-4.13.0/grantleetheme/grantleethememanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grantleetheme/grantleethememanager.h 2014-07-09 12:18:50.000000000 +0000 @@ -32,7 +32,12 @@ { Q_OBJECT public: - explicit GrantleeThemeManager(const QString &defaultDesktopFileName, KActionCollection *actionCollection, const QString &path, QObject *parent = 0); + enum Application { + Mail = 0, + Addressbook + }; + + explicit GrantleeThemeManager(GrantleeTheme::GrantleeThemeManager::Application applicationType, const QString &defaultDesktopFileName, KActionCollection *actionCollection, const QString &path, QObject *parent = 0); ~GrantleeThemeManager(); QMap themes() const; diff -Nru kdepim-4.13.0/grantleethemeeditor/themesession.cpp kdepim-4.13.3/grantleethemeeditor/themesession.cpp --- kdepim-4.13.0/grantleethemeeditor/themesession.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/grantleethemeeditor/themesession.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -30,7 +30,7 @@ ThemeSession::ThemeSession(const QString &projectDirectory, const QString &themeTypeName) : mProjectDirectory(projectDirectory), mThemeTypeName(themeTypeName), - mVersion(1.0) + mVersion(1) { } @@ -68,7 +68,7 @@ KConfig config(session); if (config.hasGroup(QLatin1String("Global"))) { KConfigGroup global = config.group(QLatin1String("Global")); - const int version = global.readEntry(QLatin1String("version"), 0.0); + const int version = global.readEntry(QLatin1String("version"), 0); if (version >= mVersion) { if (global.readEntry(QLatin1String("themeTypeName")) != mThemeTypeName) { KMessageBox::error(0, i18n("Error during theme loading"), i18n("You are trying to load a theme which cannot be read by this application")); diff -Nru kdepim-4.13.0/headerthemeeditor/headerthemeeditor.desktop kdepim-4.13.3/headerthemeeditor/headerthemeeditor.desktop --- kdepim-4.13.0/headerthemeeditor/headerthemeeditor.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/headerthemeeditor/headerthemeeditor.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=KMail editor til headertema Name[de]=KMail-Designeditor für Vorspann Name[el]=Επεξεργαστής θεμάτων επικεφαλίδας του KMail +Name[en_GB]=KMail Header Theme Editor Name[es]=Editor de temas de encabezados de KMail +Name[et]=KMaili päiseteema redaktor Name[fi]=KMail-otsaketeemamuokkain Name[fr]=Éditeur de thème d'en-tête KMail Name[gl]=Editor de temas da cabeceira de KMail @@ -45,7 +47,9 @@ GenericName[da]=Editor til mail-headertema GenericName[de]=Designeditor für E-Mail-Vorspann GenericName[el]=Επεξεργαστής θεμάτων επικεφαλίδας μηνυμάτων +GenericName[en_GB]=Mail Header Theme Editor GenericName[es]=Editor de temas de encabezados de correo +GenericName[et]=Kirja päiseteema redaktor GenericName[fi]=Postin otsaketeemamuokkain GenericName[fr]=Éditeur de thème d'en-tête de messagerie GenericName[gl]=Editor de temas da cabeceira de correos diff -Nru kdepim-4.13.0/headerthemeeditor/themeeditormainwindow.cpp kdepim-4.13.3/headerthemeeditor/themeeditormainwindow.cpp --- kdepim-4.13.0/headerthemeeditor/themeeditormainwindow.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/headerthemeeditor/themeeditormainwindow.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -217,19 +217,19 @@ return; } closeThemeEditor(); - loadTheme(directory); - mRecentFileAction->addUrl(KUrl(directory)); + if (loadTheme(directory)) + mRecentFileAction->addUrl(KUrl(directory)); mSaveAction->setEnabled(false); } -void ThemeEditorMainWindow::loadTheme(const QString &directory) +bool ThemeEditorMainWindow::loadTheme(const QString &directory) { if (!directory.isEmpty()) { const QString filename = directory + QDir::separator() + QLatin1String("theme.themerc"); QFile file(filename); if (!file.exists()) { KMessageBox::error(this, i18n("Directory does not contain a theme file. We cannot load theme.")); - return; + return false; } mThemeEditor = new ThemeEditorPage(QString(), QString()); @@ -239,6 +239,7 @@ setCentralWidget(mThemeEditor); updateActions(); } + return true; } void ThemeEditorMainWindow::slotAddExtraPage() diff -Nru kdepim-4.13.0/headerthemeeditor/themeeditormainwindow.h kdepim-4.13.3/headerthemeeditor/themeeditormainwindow.h --- kdepim-4.13.0/headerthemeeditor/themeeditormainwindow.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/headerthemeeditor/themeeditormainwindow.h 2014-07-09 12:18:50.000000000 +0000 @@ -62,7 +62,7 @@ SaveAndCreateNewTheme }; - void loadTheme(const QString &directory); + bool loadTheme(const QString &directory); void readConfig(); void updateActions(); bool saveCurrentProject(ActionSaveTheme act); diff -Nru kdepim-4.13.0/importwizard/importwizard.desktop kdepim-4.13.3/importwizard/importwizard.desktop --- kdepim-4.13.0/importwizard/importwizard.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/importwizard/importwizard.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,7 +7,9 @@ Name[da]=Importguide til KMail Name[de]=KMail-Import-Assistent Name[el]=Οδηγός εισαγωγής KMail +Name[en_GB]=KMail Import Wizard Name[es]=Asistente de importación de KMail +Name[et]=KMaili impordinõustaja Name[fi]=KMailin opastettu tuonti Name[fr]=Assistant d'import KMail Name[gl]=Asistente de importación de KMail @@ -20,7 +22,7 @@ Name[nb]=Importveiviser for KMail Name[nds]=KMail-Importhölper Name[nl]=Assistent van KMail voor importeren -Name[pl]=Asystent importu KMail +Name[pl]=Pomocnik importu KMail Name[pt]=Assistente de Importação do KMail Name[pt_BR]=Assistente de importação do KMail Name[ru]=Мастер импорта KMail @@ -46,6 +48,7 @@ Comment[da]=Kør importguiden for at migrere data fra e-mail-programmer såsom Thunderbird, Evolution osv. Comment[de]=Starten Sie den Import-Assistenten für den Import aus E-Mail-Programmen wie Thunderbird, Evolution usw. Comment[el]=Εκτελέστε τον οδηγό εισαγωγής για να μεταφέρετε δεδομένα από πελάτες αλληλογραφίας όπως το thunderbird, evolution κλπ. +Comment[en_GB]=Launch the import wizard to migrate data from mailer as thunderbird/evolution etc. Comment[es]=Lanza el asistente de importación para migrar datos desde un gestor de correo como thunderbird/evolution, etc. Comment[et]=Impordinõustaja abil saab üle tuua andmeid teistest kirjade rakendustest, näiteks Thunderbird, Evolution jne. Comment[fi]=Käynnistää opastetun toiminnon postin tuomiseksi Thunderbirdistä, Evolutionista tms. diff -Nru kdepim-4.13.0/incidenceeditor-ng/dialogdesktop.ui kdepim-4.13.3/incidenceeditor-ng/dialogdesktop.ui --- kdepim-4.13.0/incidenceeditor-ng/dialogdesktop.ui 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/incidenceeditor-ng/dialogdesktop.ui 2014-07-09 12:18:50.000000000 +0000 @@ -13,7 +13,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -41,7 +50,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -195,7 +213,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -782,7 +809,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -805,7 +841,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -1070,14 +1115,32 @@ - + + 0 + + + 0 + + + 0 + + 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -1097,7 +1160,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -1130,7 +1202,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -1222,14 +1303,32 @@ - + + 0 + + + 0 + + + 0 + + 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -1262,10 +1361,19 @@ - + 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -1491,26 +1599,6 @@ - KPIM::KCheckComboBox - KComboBox -
libkdepim/widgets/kcheckcombobox.h
-
- - KRichTextEdit - KTextEdit -
krichtextedit.h
-
- - KTimeComboBox - KComboBox -
ktimecombobox.h
-
- - KDateComboBox - KComboBox -
kdatecombobox.h
-
- KComboBox QComboBox
kcombobox.h
@@ -1524,6 +1612,7 @@ KSeparator QFrame
kseparator.h
+ 1
KTextEdit @@ -1531,22 +1620,12 @@
ktextedit.h
- KRichTextWidget - KRichTextEdit -
krichtextwidget.h
-
- KTabWidget QTabWidget
ktabwidget.h
1
- KPIM::KWeekdayCheckCombo - KPIM::KCheckComboBox -
libkdepim/widgets/kweekdaycheckcombo.h
-
- IncidenceEditorNG::KTimeZoneComboBox KComboBox
ktimezonecombobox.h
@@ -1562,7 +1641,85 @@
libkdepim/widgets/tagwidgets.h
1
+ + KPIM::KCheckComboBox + KComboBox +
libkdepim/widgets/kcheckcombobox.h
+
+ + KRichTextEdit + KTextEdit +
krichtextedit.h
+
+ + KTimeComboBox + KComboBox +
ktimecombobox.h
+
+ + KDateComboBox + KComboBox +
kdatecombobox.h
+
+ + KRichTextWidget + KRichTextEdit +
krichtextwidget.h
+
+ + KPIM::KWeekdayCheckCombo + KPIM::KCheckComboBox +
libkdepim/widgets/kweekdaycheckcombo.h
+
+ + mCalSelectorPlaceHolder + mAcceptInvitationButton + mDeclineInvitationButton + mSummaryEdit + mLocationEdit + mCompletionSlider + mPriorityCombo + mWholeDayCheck + mFreeBusyCheck + mStartCheck + mStartDateEdit + mStartTimeEdit + mTimeZoneComboStart + mEndCheck + mEndDateEdit + mEndTimeEdit + mTimeZoneComboEnd + mTabWidget + mDescriptionEdit + mTagWidget + mSecrecyCombo + mSolveButton + mSelectButton + mOrganizerCombo + mAlarmPresetCombo + mAlarmAddPresetButton + mAlarmList + mAlarmNewButton + mAlarmConfigureButton + mAlarmToggleButton + mAlarmRemoveButton + mRecurrenceTypeCombo + mFrequencyEdit + mThisAndFutureCheck + mWeekDayCombo + mMonthlyCombo + mYearlyCombo + mRecurrenceEndCombo + mRecurrenceEndDate + mEndDurationEdit + mExceptionDateEdit + mExceptionAddButton + mExceptionList + mExceptionRemoveButton + mAddButton + mRemoveButton + diff -Nru kdepim-4.13.0/kaddressbook/aboutdata.cpp kdepim-4.13.3/kaddressbook/aboutdata.cpp --- kdepim-4.13.0/kaddressbook/aboutdata.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/aboutdata.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -25,10 +25,10 @@ #include AboutData::AboutData() - : KAboutData( "kaddressbook", 0, ki18n( "KAddressBook" ), - KDEPIM_VERSION, ki18n( "The KDE Address Book Application" ), - KAboutData::License_GPL_V2, - ki18n( "Copyright © 2007–2014 KAddressBook authors" ) ) + : KAboutData( "kaddressbook", 0, ki18n( "KAddressBook" ), + KDEPIM_VERSION, ki18n( "The KDE Address Book Application" ), + KAboutData::License_GPL_V2, + ki18n( "Copyright © 2007–2014 KAddressBook authors" ) ) { addAuthor( ki18n( "Laurent Montel" ), ki18n( "Current maintainer" ), "montel@kde.org" ); addAuthor( ki18n( "Tobias Koenig" ), ki18n( "Previous maintainer" ), "tokoe@kde.org" ); diff -Nru kdepim-4.13.0/kaddressbook/aboutdata.h kdepim-4.13.3/kaddressbook/aboutdata.h --- kdepim-4.13.0/kaddressbook/aboutdata.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/aboutdata.h 2014-07-09 12:18:50.000000000 +0000 @@ -27,7 +27,7 @@ class KADDRESSBOOK_EXPORT AboutData : public KAboutData { - public: +public: /** * Creates a new about data object. */ diff -Nru kdepim-4.13.0/kaddressbook/contactfields.cpp kdepim-4.13.3/kaddressbook/contactfields.cpp --- kdepim-4.13.0/kaddressbook/contactfields.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactfields.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -24,684 +24,684 @@ QString ContactFields::label( Field field ) { - switch ( field ) { - case Undefined: - return i18nc( "@item Undefined import field type", "Undefined" ); - break; - case FormattedName: - return KABC::Addressee::formattedNameLabel(); - break; - case Prefix: - return KABC::Addressee::prefixLabel(); - break; - case GivenName: - return KABC::Addressee::givenNameLabel(); - break; - case AdditionalName: - return KABC::Addressee::additionalNameLabel(); - break; - case FamilyName: - return KABC::Addressee::familyNameLabel(); - break; - case Suffix: - return KABC::Addressee::suffixLabel(); - break; - case NickName: - return KABC::Addressee::nickNameLabel(); - break; - case Birthday: - return KABC::Addressee::birthdayLabel(); - break; - case Anniversary: - return i18nc( "The wedding anniversary of a contact", "Anniversary" ); - break; - case HomeAddressStreet: - return KABC::Addressee::homeAddressStreetLabel(); - break; - case HomeAddressPostOfficeBox: - return KABC::Addressee::homeAddressPostOfficeBoxLabel(); - break; - case HomeAddressLocality: - return KABC::Addressee::homeAddressLocalityLabel(); - break; - case HomeAddressRegion: - return KABC::Addressee::homeAddressRegionLabel(); - break; - case HomeAddressPostalCode: - return KABC::Addressee::homeAddressPostalCodeLabel(); - break; - case HomeAddressCountry: - return KABC::Addressee::homeAddressCountryLabel(); - break; - case HomeAddressLabel: - return KABC::Addressee::homeAddressLabelLabel(); - break; - case BusinessAddressStreet: - return KABC::Addressee::businessAddressStreetLabel(); - break; - case BusinessAddressPostOfficeBox: - return KABC::Addressee::businessAddressPostOfficeBoxLabel(); - break; - case BusinessAddressLocality: - return KABC::Addressee::businessAddressLocalityLabel(); - break; - case BusinessAddressRegion: - return KABC::Addressee::businessAddressRegionLabel(); - break; - case BusinessAddressPostalCode: - return KABC::Addressee::businessAddressPostalCodeLabel(); - break; - case BusinessAddressCountry: - return KABC::Addressee::businessAddressCountryLabel(); - break; - case BusinessAddressLabel: - return KABC::Addressee::businessAddressLabelLabel(); - break; - case HomePhone: - return KABC::Addressee::homePhoneLabel(); - break; - case BusinessPhone: - return KABC::Addressee::businessPhoneLabel(); - break; - case MobilePhone: - return KABC::Addressee::mobilePhoneLabel(); - break; - case HomeFax: - return KABC::Addressee::homeFaxLabel(); - break; - case BusinessFax: - return KABC::Addressee::businessFaxLabel(); - break; - case CarPhone: - return KABC::Addressee::carPhoneLabel(); - break; - case Isdn: - return KABC::Addressee::isdnLabel(); - break; - case Pager: - return KABC::Addressee::pagerLabel(); - break; - case PreferredEmail: - return i18nc( "Preferred email address", "EMail (preferred)" ); - break; - case Email2: - return i18nc( "Second email address", "EMail (2)" ); - break; - case Email3: - return i18nc( "Third email address", "EMail (3)" ); - break; - case Email4: - return i18nc( "Fourth email address", "EMail (4)" ); - break; - case Mailer: - return KABC::Addressee::mailerLabel(); - break; - case Title: - return KABC::Addressee::titleLabel(); - break; - case Role: - return KABC::Addressee::roleLabel(); - break; - case Organization: - return KABC::Addressee::organizationLabel(); - break; - case Note: - return KABC::Addressee::noteLabel(); - break; - case Homepage: - return KABC::Addressee::urlLabel(); - break; - case BlogFeed: - return i18n( "Blog Feed" ); - break; - case Profession: - return i18n( "Profession" ); - break; - case Office: - return i18n( "Office" ); - break; - case Manager: - return i18n( "Manager" ); - break; - case Assistant: - return i18n( "Assistant" ); - break; - case Spouse: - return i18n( "Spouse" ); - break; - } + switch ( field ) { + case Undefined: + return i18nc( "@item Undefined import field type", "Undefined" ); + break; + case FormattedName: + return KABC::Addressee::formattedNameLabel(); + break; + case Prefix: + return KABC::Addressee::prefixLabel(); + break; + case GivenName: + return KABC::Addressee::givenNameLabel(); + break; + case AdditionalName: + return KABC::Addressee::additionalNameLabel(); + break; + case FamilyName: + return KABC::Addressee::familyNameLabel(); + break; + case Suffix: + return KABC::Addressee::suffixLabel(); + break; + case NickName: + return KABC::Addressee::nickNameLabel(); + break; + case Birthday: + return KABC::Addressee::birthdayLabel(); + break; + case Anniversary: + return i18nc( "The wedding anniversary of a contact", "Anniversary" ); + break; + case HomeAddressStreet: + return KABC::Addressee::homeAddressStreetLabel(); + break; + case HomeAddressPostOfficeBox: + return KABC::Addressee::homeAddressPostOfficeBoxLabel(); + break; + case HomeAddressLocality: + return KABC::Addressee::homeAddressLocalityLabel(); + break; + case HomeAddressRegion: + return KABC::Addressee::homeAddressRegionLabel(); + break; + case HomeAddressPostalCode: + return KABC::Addressee::homeAddressPostalCodeLabel(); + break; + case HomeAddressCountry: + return KABC::Addressee::homeAddressCountryLabel(); + break; + case HomeAddressLabel: + return KABC::Addressee::homeAddressLabelLabel(); + break; + case BusinessAddressStreet: + return KABC::Addressee::businessAddressStreetLabel(); + break; + case BusinessAddressPostOfficeBox: + return KABC::Addressee::businessAddressPostOfficeBoxLabel(); + break; + case BusinessAddressLocality: + return KABC::Addressee::businessAddressLocalityLabel(); + break; + case BusinessAddressRegion: + return KABC::Addressee::businessAddressRegionLabel(); + break; + case BusinessAddressPostalCode: + return KABC::Addressee::businessAddressPostalCodeLabel(); + break; + case BusinessAddressCountry: + return KABC::Addressee::businessAddressCountryLabel(); + break; + case BusinessAddressLabel: + return KABC::Addressee::businessAddressLabelLabel(); + break; + case HomePhone: + return KABC::Addressee::homePhoneLabel(); + break; + case BusinessPhone: + return KABC::Addressee::businessPhoneLabel(); + break; + case MobilePhone: + return KABC::Addressee::mobilePhoneLabel(); + break; + case HomeFax: + return KABC::Addressee::homeFaxLabel(); + break; + case BusinessFax: + return KABC::Addressee::businessFaxLabel(); + break; + case CarPhone: + return KABC::Addressee::carPhoneLabel(); + break; + case Isdn: + return KABC::Addressee::isdnLabel(); + break; + case Pager: + return KABC::Addressee::pagerLabel(); + break; + case PreferredEmail: + return i18nc( "Preferred email address", "EMail (preferred)" ); + break; + case Email2: + return i18nc( "Second email address", "EMail (2)" ); + break; + case Email3: + return i18nc( "Third email address", "EMail (3)" ); + break; + case Email4: + return i18nc( "Fourth email address", "EMail (4)" ); + break; + case Mailer: + return KABC::Addressee::mailerLabel(); + break; + case Title: + return KABC::Addressee::titleLabel(); + break; + case Role: + return KABC::Addressee::roleLabel(); + break; + case Organization: + return KABC::Addressee::organizationLabel(); + break; + case Note: + return KABC::Addressee::noteLabel(); + break; + case Homepage: + return KABC::Addressee::urlLabel(); + break; + case BlogFeed: + return i18n( "Blog Feed" ); + break; + case Profession: + return i18n( "Profession" ); + break; + case Office: + return i18n( "Office" ); + break; + case Manager: + return i18n( "Manager" ); + break; + case Assistant: + return i18n( "Assistant" ); + break; + case Spouse: + return i18n( "Spouse" ); + break; + } - return QString(); + return QString(); } ContactFields::Fields ContactFields::allFields() { - Fields fields; + Fields fields; - fields << Undefined - << FormattedName - << Prefix - << GivenName - << AdditionalName - << FamilyName - << Suffix - << NickName - << Birthday - << Anniversary - << PreferredEmail - << Email2 - << Email3 - << Email4 - << HomeAddressStreet - << HomeAddressPostOfficeBox - << HomeAddressLocality - << HomeAddressRegion - << HomeAddressPostalCode - << HomeAddressCountry - << HomeAddressLabel - << BusinessAddressStreet - << BusinessAddressPostOfficeBox - << BusinessAddressLocality - << BusinessAddressRegion - << BusinessAddressPostalCode - << BusinessAddressCountry - << BusinessAddressLabel - << HomePhone - << BusinessPhone - << MobilePhone - << HomeFax - << BusinessFax - << CarPhone - << Isdn - << Pager - << Mailer - << Title - << Role - << Organization - << Note - << Homepage - << BlogFeed - << Profession - << Office - << Manager - << Assistant - << Spouse; + fields << Undefined + << FormattedName + << Prefix + << GivenName + << AdditionalName + << FamilyName + << Suffix + << NickName + << Birthday + << Anniversary + << PreferredEmail + << Email2 + << Email3 + << Email4 + << HomeAddressStreet + << HomeAddressPostOfficeBox + << HomeAddressLocality + << HomeAddressRegion + << HomeAddressPostalCode + << HomeAddressCountry + << HomeAddressLabel + << BusinessAddressStreet + << BusinessAddressPostOfficeBox + << BusinessAddressLocality + << BusinessAddressRegion + << BusinessAddressPostalCode + << BusinessAddressCountry + << BusinessAddressLabel + << HomePhone + << BusinessPhone + << MobilePhone + << HomeFax + << BusinessFax + << CarPhone + << Isdn + << Pager + << Mailer + << Title + << Role + << Organization + << Note + << Homepage + << BlogFeed + << Profession + << Office + << Manager + << Assistant + << Spouse; - return fields; + return fields; } void ContactFields::setValue( Field field, const QString &value, KABC::Addressee &contact ) { - switch ( field ) { - case ContactFields::Undefined: - break; - case ContactFields::FormattedName: - contact.setFormattedName( value ); - break; - case ContactFields::GivenName: - contact.setGivenName( value ); - break; - case ContactFields::FamilyName: - contact.setFamilyName( value ); - break; - case ContactFields::AdditionalName: - contact.setAdditionalName( value ); - break; - case ContactFields::Prefix: - contact.setPrefix( value ); - break; - case ContactFields::Suffix: - contact.setSuffix( value ); - break; - case ContactFields::NickName: - contact.setNickName( value ); - break; - case ContactFields::Birthday: - contact.setBirthday( QDateTime::fromString( value, Qt::ISODate ) ); - break; - case ContactFields::Anniversary: - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), - QLatin1String( "X-Anniversary" ), value ); - break; - case ContactFields::PreferredEmail: - contact.insertEmail( value, true ); - break; - case ContactFields::Email2: - contact.insertEmail( value, false ); - break; - case ContactFields::Email3: - contact.insertEmail( value, false ); - break; - case ContactFields::Email4: - contact.insertEmail( value, false ); - break; - case ContactFields::Role: - contact.setRole( value ); - break; - case ContactFields::Title: - contact.setTitle( value ); - break; - case ContactFields::Mailer: - contact.setMailer( value ); - break; - case ContactFields::Homepage: - contact.setUrl( KUrl( value ) ); - break; - case ContactFields::Organization: - contact.setOrganization( value ); - break; - case ContactFields::Note: - contact.setNote( value ); - break; - case ContactFields::HomePhone: - { - KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Home ); - number.setNumber( value ); - contact.insertPhoneNumber( number ); - } - break; - case ContactFields::BusinessPhone: - { - KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Work ); - number.setNumber( value ); - contact.insertPhoneNumber( number ); - } - break; - case ContactFields::MobilePhone: - { - KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Cell ); - number.setNumber( value ); - contact.insertPhoneNumber( number ); - } - break; - case ContactFields::HomeFax: - { - KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Home | - KABC::PhoneNumber::Fax ); - number.setNumber( value ); - contact.insertPhoneNumber( number ); - } - break; - case ContactFields::BusinessFax: - { - KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Work | - KABC::PhoneNumber::Fax ); - number.setNumber( value ); - contact.insertPhoneNumber( number ); - } - break; - case ContactFields::CarPhone: - { - KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Car ); - number.setNumber( value ); - contact.insertPhoneNumber( number ); - } - break; - case ContactFields::Isdn: - { - KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Isdn ); - number.setNumber( value ); - contact.insertPhoneNumber( number ); - } - break; - case ContactFields::Pager: - { - KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Pager ); - number.setNumber( value ); - contact.insertPhoneNumber( number ); - } - break; + switch ( field ) { + case ContactFields::Undefined: + break; + case ContactFields::FormattedName: + contact.setFormattedName( value ); + break; + case ContactFields::GivenName: + contact.setGivenName( value ); + break; + case ContactFields::FamilyName: + contact.setFamilyName( value ); + break; + case ContactFields::AdditionalName: + contact.setAdditionalName( value ); + break; + case ContactFields::Prefix: + contact.setPrefix( value ); + break; + case ContactFields::Suffix: + contact.setSuffix( value ); + break; + case ContactFields::NickName: + contact.setNickName( value ); + break; + case ContactFields::Birthday: + contact.setBirthday( QDateTime::fromString( value, Qt::ISODate ) ); + break; + case ContactFields::Anniversary: + contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), + QLatin1String( "X-Anniversary" ), value ); + break; + case ContactFields::PreferredEmail: + contact.insertEmail( value, true ); + break; + case ContactFields::Email2: + contact.insertEmail( value, false ); + break; + case ContactFields::Email3: + contact.insertEmail( value, false ); + break; + case ContactFields::Email4: + contact.insertEmail( value, false ); + break; + case ContactFields::Role: + contact.setRole( value ); + break; + case ContactFields::Title: + contact.setTitle( value ); + break; + case ContactFields::Mailer: + contact.setMailer( value ); + break; + case ContactFields::Homepage: + contact.setUrl( KUrl( value ) ); + break; + case ContactFields::Organization: + contact.setOrganization( value ); + break; + case ContactFields::Note: + contact.setNote( value ); + break; + case ContactFields::HomePhone: + { + KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Home ); + number.setNumber( value ); + contact.insertPhoneNumber( number ); + } + break; + case ContactFields::BusinessPhone: + { + KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Work ); + number.setNumber( value ); + contact.insertPhoneNumber( number ); + } + break; + case ContactFields::MobilePhone: + { + KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Cell ); + number.setNumber( value ); + contact.insertPhoneNumber( number ); + } + break; + case ContactFields::HomeFax: + { + KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Home | + KABC::PhoneNumber::Fax ); + number.setNumber( value ); + contact.insertPhoneNumber( number ); + } + break; + case ContactFields::BusinessFax: + { + KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Work | + KABC::PhoneNumber::Fax ); + number.setNumber( value ); + contact.insertPhoneNumber( number ); + } + break; + case ContactFields::CarPhone: + { + KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Car ); + number.setNumber( value ); + contact.insertPhoneNumber( number ); + } + break; + case ContactFields::Isdn: + { + KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Isdn ); + number.setNumber( value ); + contact.insertPhoneNumber( number ); + } + break; + case ContactFields::Pager: + { + KABC::PhoneNumber number = contact.phoneNumber( KABC::PhoneNumber::Pager ); + number.setNumber( value ); + contact.insertPhoneNumber( number ); + } + break; - case ContactFields::HomeAddressStreet: - { - KABC::Address address = contact.address( KABC::Address::Home ); - address.setStreet( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::HomeAddressPostOfficeBox: - { - KABC::Address address = contact.address( KABC::Address::Home ); - address.setPostOfficeBox( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::HomeAddressLocality: - { - KABC::Address address = contact.address( KABC::Address::Home ); - address.setLocality( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::HomeAddressRegion: - { - KABC::Address address = contact.address( KABC::Address::Home ); - address.setRegion( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::HomeAddressPostalCode: - { - KABC::Address address = contact.address( KABC::Address::Home ); - address.setPostalCode( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::HomeAddressCountry: - { - KABC::Address address = contact.address( KABC::Address::Home ); - address.setCountry( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::HomeAddressLabel: - { - KABC::Address address = contact.address( KABC::Address::Home ); - address.setLabel( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::BusinessAddressStreet: - { - KABC::Address address = contact.address( KABC::Address::Work ); - address.setStreet( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::BusinessAddressPostOfficeBox: - { - KABC::Address address = contact.address( KABC::Address::Work ); - address.setPostOfficeBox( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::BusinessAddressLocality: - { - KABC::Address address = contact.address( KABC::Address::Work ); - address.setLocality( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::BusinessAddressRegion: - { - KABC::Address address = contact.address( KABC::Address::Work ); - address.setRegion( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::BusinessAddressPostalCode: - { - KABC::Address address = contact.address( KABC::Address::Work ); - address.setPostalCode( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::BusinessAddressCountry: - { - KABC::Address address = contact.address( KABC::Address::Work ); - address.setCountry( value ); - contact.insertAddress( address ); - } - break; - case ContactFields::BusinessAddressLabel: - { - KABC::Address address = contact.address( KABC::Address::Work ); - address.setLabel( value ); - contact.insertAddress( address ); - } - break; - case BlogFeed: - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), - QLatin1String( "BlogFeed" ), value ); - break; - case Profession: - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), - QLatin1String( "X-Profession" ), value ); - break; - case Office: - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), - QLatin1String( "X-Office" ), value ); - break; - case Manager: - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), - QLatin1String( "X-ManagersName" ), value ); - break; - case Assistant: - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), - QLatin1String( "X-AssistantsName" ), value ); - break; - case Spouse: - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), - QLatin1String( "X-SpousesName" ), value ); - break; - } + case ContactFields::HomeAddressStreet: + { + KABC::Address address = contact.address( KABC::Address::Home ); + address.setStreet( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::HomeAddressPostOfficeBox: + { + KABC::Address address = contact.address( KABC::Address::Home ); + address.setPostOfficeBox( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::HomeAddressLocality: + { + KABC::Address address = contact.address( KABC::Address::Home ); + address.setLocality( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::HomeAddressRegion: + { + KABC::Address address = contact.address( KABC::Address::Home ); + address.setRegion( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::HomeAddressPostalCode: + { + KABC::Address address = contact.address( KABC::Address::Home ); + address.setPostalCode( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::HomeAddressCountry: + { + KABC::Address address = contact.address( KABC::Address::Home ); + address.setCountry( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::HomeAddressLabel: + { + KABC::Address address = contact.address( KABC::Address::Home ); + address.setLabel( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::BusinessAddressStreet: + { + KABC::Address address = contact.address( KABC::Address::Work ); + address.setStreet( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::BusinessAddressPostOfficeBox: + { + KABC::Address address = contact.address( KABC::Address::Work ); + address.setPostOfficeBox( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::BusinessAddressLocality: + { + KABC::Address address = contact.address( KABC::Address::Work ); + address.setLocality( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::BusinessAddressRegion: + { + KABC::Address address = contact.address( KABC::Address::Work ); + address.setRegion( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::BusinessAddressPostalCode: + { + KABC::Address address = contact.address( KABC::Address::Work ); + address.setPostalCode( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::BusinessAddressCountry: + { + KABC::Address address = contact.address( KABC::Address::Work ); + address.setCountry( value ); + contact.insertAddress( address ); + } + break; + case ContactFields::BusinessAddressLabel: + { + KABC::Address address = contact.address( KABC::Address::Work ); + address.setLabel( value ); + contact.insertAddress( address ); + } + break; + case BlogFeed: + contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), + QLatin1String( "BlogFeed" ), value ); + break; + case Profession: + contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), + QLatin1String( "X-Profession" ), value ); + break; + case Office: + contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), + QLatin1String( "X-Office" ), value ); + break; + case Manager: + contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), + QLatin1String( "X-ManagersName" ), value ); + break; + case Assistant: + contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), + QLatin1String( "X-AssistantsName" ), value ); + break; + case Spouse: + contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), + QLatin1String( "X-SpousesName" ), value ); + break; + } } QString ContactFields::value( Field field, const KABC::Addressee &contact ) { - switch ( field ) { - case Undefined: - return QString(); - break; - case FormattedName: - return contact.formattedName(); - break; - case Prefix: - return contact.prefix(); - break; - case GivenName: - return contact.givenName(); - break; - case AdditionalName: - return contact.additionalName(); - break; - case FamilyName: - return contact.familyName(); - break; - case Suffix: - return contact.suffix(); - break; - case NickName: - return contact.nickName(); - break; - case Birthday: - { - const QDateTime birthday = contact.birthday(); - if ( birthday.date().isValid() ) { - return birthday.date().toString( Qt::ISODate ); - } else { - return QString(); - } - } - break; - case Anniversary: - return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-Anniversary" ) ); - break; - case HomeAddressStreet: - { - const KABC::Address address = contact.address( KABC::Address::Home ); - return address.street(); - } - break; - case HomeAddressPostOfficeBox: - { - const KABC::Address address = contact.address( KABC::Address::Home ); - return address.postOfficeBox(); - } - break; - case HomeAddressLocality: - { - const KABC::Address address = contact.address( KABC::Address::Home ); - return address.locality(); - } - break; - case HomeAddressRegion: - { - const KABC::Address address = contact.address( KABC::Address::Home ); - return address.region(); - } - break; - case HomeAddressPostalCode: - { - const KABC::Address address = contact.address( KABC::Address::Home ); - return address.postalCode(); - } - break; - case HomeAddressCountry: - { - const KABC::Address address = contact.address( KABC::Address::Home ); - return address.country(); - } - break; - case HomeAddressLabel: - { - const KABC::Address address = contact.address( KABC::Address::Home ); - return address.label(); - } - break; - case BusinessAddressStreet: - { - const KABC::Address address = contact.address( KABC::Address::Work ); - return address.street(); - } - break; - case BusinessAddressPostOfficeBox: - { - const KABC::Address address = contact.address( KABC::Address::Work ); - return address.postOfficeBox(); - } - break; - case BusinessAddressLocality: - { - const KABC::Address address = contact.address( KABC::Address::Work ); - return address.locality(); - } - break; - case BusinessAddressRegion: - { - const KABC::Address address = contact.address( KABC::Address::Work ); - return address.region(); - } - break; - case BusinessAddressPostalCode: - { - const KABC::Address address = contact.address( KABC::Address::Work ); - return address.postalCode(); - } - break; - case BusinessAddressCountry: - { - const KABC::Address address = contact.address( KABC::Address::Work ); - return address.country(); - } - break; - case BusinessAddressLabel: - { - const KABC::Address address = contact.address( KABC::Address::Work ); - return address.label(); - } - break; - case HomePhone: - return contact.phoneNumber( KABC::PhoneNumber::Home ).number(); - break; - case BusinessPhone: - return contact.phoneNumber( KABC::PhoneNumber::Work ).number(); - break; - case MobilePhone: - return contact.phoneNumber( KABC::PhoneNumber::Cell ).number(); - break; - case HomeFax: - return contact.phoneNumber( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ).number(); - break; - case BusinessFax: - return contact.phoneNumber( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ).number(); - break; - case CarPhone: - return contact.phoneNumber( KABC::PhoneNumber::Car ).number(); - break; - case Isdn: - return contact.phoneNumber( KABC::PhoneNumber::Isdn ).number(); - break; - case Pager: - return contact.phoneNumber( KABC::PhoneNumber::Pager ).number(); - break; - case PreferredEmail: - { - const QStringList emails = contact.emails(); - if ( emails.count() > 0 ) { - return emails.at( 0 ); - } else { - return QString(); - } - } - break; - case Email2: - { - const QStringList emails = contact.emails(); - if ( emails.count() > 1 ) { - return emails.at( 1 ); - } else { - return QString(); - } - } - break; - case Email3: - { - const QStringList emails = contact.emails(); - if ( emails.count() > 2 ) { - return emails.at( 2 ); - } else { - return QString(); - } - } - break; - case Email4: - { - const QStringList emails = contact.emails(); - if ( emails.count() > 3 ) { - return emails.at( 3 ); - } else { - return QString(); - } - } - break; - case Mailer: - return contact.mailer(); - break; - case Title: - return contact.title(); - break; - case Role: - return contact.role(); - break; - case Organization: - return contact.organization(); - break; - case Note: - return contact.note(); - break; - case Homepage: - return contact.url().url(); - break; - case BlogFeed: - return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "BlogFeed" ) ); - break; - case Profession: - return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-Profession" ) ); - break; - case Office: - return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-Office" ) ); - break; - case Manager: - return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-ManagersName" ) ); - break; - case Assistant: - return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-AssistantsName" ) ); - break; - case Spouse: - return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-SpousesName" ) ); - break; - } + switch ( field ) { + case Undefined: + return QString(); + break; + case FormattedName: + return contact.formattedName(); + break; + case Prefix: + return contact.prefix(); + break; + case GivenName: + return contact.givenName(); + break; + case AdditionalName: + return contact.additionalName(); + break; + case FamilyName: + return contact.familyName(); + break; + case Suffix: + return contact.suffix(); + break; + case NickName: + return contact.nickName(); + break; + case Birthday: + { + const QDateTime birthday = contact.birthday(); + if ( birthday.date().isValid() ) { + return birthday.date().toString( Qt::ISODate ); + } else { + return QString(); + } + } + break; + case Anniversary: + return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-Anniversary" ) ); + break; + case HomeAddressStreet: + { + const KABC::Address address = contact.address( KABC::Address::Home ); + return address.street(); + } + break; + case HomeAddressPostOfficeBox: + { + const KABC::Address address = contact.address( KABC::Address::Home ); + return address.postOfficeBox(); + } + break; + case HomeAddressLocality: + { + const KABC::Address address = contact.address( KABC::Address::Home ); + return address.locality(); + } + break; + case HomeAddressRegion: + { + const KABC::Address address = contact.address( KABC::Address::Home ); + return address.region(); + } + break; + case HomeAddressPostalCode: + { + const KABC::Address address = contact.address( KABC::Address::Home ); + return address.postalCode(); + } + break; + case HomeAddressCountry: + { + const KABC::Address address = contact.address( KABC::Address::Home ); + return address.country(); + } + break; + case HomeAddressLabel: + { + const KABC::Address address = contact.address( KABC::Address::Home ); + return address.label(); + } + break; + case BusinessAddressStreet: + { + const KABC::Address address = contact.address( KABC::Address::Work ); + return address.street(); + } + break; + case BusinessAddressPostOfficeBox: + { + const KABC::Address address = contact.address( KABC::Address::Work ); + return address.postOfficeBox(); + } + break; + case BusinessAddressLocality: + { + const KABC::Address address = contact.address( KABC::Address::Work ); + return address.locality(); + } + break; + case BusinessAddressRegion: + { + const KABC::Address address = contact.address( KABC::Address::Work ); + return address.region(); + } + break; + case BusinessAddressPostalCode: + { + const KABC::Address address = contact.address( KABC::Address::Work ); + return address.postalCode(); + } + break; + case BusinessAddressCountry: + { + const KABC::Address address = contact.address( KABC::Address::Work ); + return address.country(); + } + break; + case BusinessAddressLabel: + { + const KABC::Address address = contact.address( KABC::Address::Work ); + return address.label(); + } + break; + case HomePhone: + return contact.phoneNumber( KABC::PhoneNumber::Home ).number(); + break; + case BusinessPhone: + return contact.phoneNumber( KABC::PhoneNumber::Work ).number(); + break; + case MobilePhone: + return contact.phoneNumber( KABC::PhoneNumber::Cell ).number(); + break; + case HomeFax: + return contact.phoneNumber( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ).number(); + break; + case BusinessFax: + return contact.phoneNumber( KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ).number(); + break; + case CarPhone: + return contact.phoneNumber( KABC::PhoneNumber::Car ).number(); + break; + case Isdn: + return contact.phoneNumber( KABC::PhoneNumber::Isdn ).number(); + break; + case Pager: + return contact.phoneNumber( KABC::PhoneNumber::Pager ).number(); + break; + case PreferredEmail: + { + const QStringList emails = contact.emails(); + if ( emails.count() > 0 ) { + return emails.at( 0 ); + } else { + return QString(); + } + } + break; + case Email2: + { + const QStringList emails = contact.emails(); + if ( emails.count() > 1 ) { + return emails.at( 1 ); + } else { + return QString(); + } + } + break; + case Email3: + { + const QStringList emails = contact.emails(); + if ( emails.count() > 2 ) { + return emails.at( 2 ); + } else { + return QString(); + } + } + break; + case Email4: + { + const QStringList emails = contact.emails(); + if ( emails.count() > 3 ) { + return emails.at( 3 ); + } else { + return QString(); + } + } + break; + case Mailer: + return contact.mailer(); + break; + case Title: + return contact.title(); + break; + case Role: + return contact.role(); + break; + case Organization: + return contact.organization(); + break; + case Note: + return contact.note(); + break; + case Homepage: + return contact.url().url(); + break; + case BlogFeed: + return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "BlogFeed" ) ); + break; + case Profession: + return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-Profession" ) ); + break; + case Office: + return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-Office" ) ); + break; + case Manager: + return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-ManagersName" ) ); + break; + case Assistant: + return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-AssistantsName" ) ); + break; + case Spouse: + return contact.custom( QLatin1String( "KADDRESSBOOK" ), QLatin1String( "X-SpousesName" ) ); + break; + } - return QString(); + return QString(); } diff -Nru kdepim-4.13.0/kaddressbook/contactfields.h kdepim-4.13.3/kaddressbook/contactfields.h --- kdepim-4.13.0/kaddressbook/contactfields.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactfields.h 2014-07-09 12:18:50.000000000 +0000 @@ -25,68 +25,68 @@ class ContactFields { - public: +public: /** * Describes the standard fields that are available for every contact */ enum Field { - Undefined = 0, + Undefined = 0, - FormattedName, - Prefix, - GivenName, - AdditionalName, - FamilyName, - Suffix, - NickName, - - Birthday, - Anniversary, - - HomeAddressStreet, - HomeAddressPostOfficeBox, - HomeAddressLocality, - HomeAddressRegion, - HomeAddressPostalCode, - HomeAddressCountry, - HomeAddressLabel, - - BusinessAddressStreet, - BusinessAddressPostOfficeBox, - BusinessAddressLocality, - BusinessAddressRegion, - BusinessAddressPostalCode, - BusinessAddressCountry, - BusinessAddressLabel, - - HomePhone, - BusinessPhone, - MobilePhone, - HomeFax, - BusinessFax, - CarPhone, - Isdn, - Pager, - - PreferredEmail, - Email2, - Email3, - Email4, - - Mailer, - Title, - Role, - Organization, - Note, - Homepage, - - BlogFeed, - Profession, - Office, - Manager, - Assistant, - Spouse + FormattedName, + Prefix, + GivenName, + AdditionalName, + FamilyName, + Suffix, + NickName, + + Birthday, + Anniversary, + + HomeAddressStreet, + HomeAddressPostOfficeBox, + HomeAddressLocality, + HomeAddressRegion, + HomeAddressPostalCode, + HomeAddressCountry, + HomeAddressLabel, + + BusinessAddressStreet, + BusinessAddressPostOfficeBox, + BusinessAddressLocality, + BusinessAddressRegion, + BusinessAddressPostalCode, + BusinessAddressCountry, + BusinessAddressLabel, + + HomePhone, + BusinessPhone, + MobilePhone, + HomeFax, + BusinessFax, + CarPhone, + Isdn, + Pager, + + PreferredEmail, + Email2, + Email3, + Email4, + + Mailer, + Title, + Role, + Organization, + Note, + Homepage, + + BlogFeed, + Profession, + Office, + Manager, + Assistant, + Spouse }; /** diff -Nru kdepim-4.13.0/kaddressbook/contactselectiondialog.cpp kdepim-4.13.3/kaddressbook/contactselectiondialog.cpp --- kdepim-4.13.0/kaddressbook/contactselectiondialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactselectiondialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -24,29 +24,29 @@ ContactSelectionDialog::ContactSelectionDialog( QItemSelectionModel *selectionModel, QWidget *parent ) - : KDialog( parent ) + : KDialog( parent ) { - setCaption( i18n( "Select Contacts" ) ); - setButtons( Ok | Cancel ); + setCaption( i18n( "Select Contacts" ) ); + setButtons( Ok | Cancel ); - mSelectionWidget = new ContactSelectionWidget( selectionModel, this ); - setMainWidget( mSelectionWidget ); + mSelectionWidget = new ContactSelectionWidget( selectionModel, this ); + setMainWidget( mSelectionWidget ); - setInitialSize( QSize( 450, 220 ) ); + setInitialSize( QSize( 450, 220 ) ); } void ContactSelectionDialog::setMessageText( const QString &message ) { - mSelectionWidget->setMessageText( message ); + mSelectionWidget->setMessageText( message ); } void ContactSelectionDialog::setDefaultAddressBook( const Akonadi::Collection &addressBook ) { - mSelectionWidget->setDefaultAddressBook( addressBook ); + mSelectionWidget->setDefaultAddressBook( addressBook ); } KABC::Addressee::List ContactSelectionDialog::selectedContacts() const { - return mSelectionWidget->selectedContacts(); + return mSelectionWidget->selectedContacts(); } diff -Nru kdepim-4.13.0/kaddressbook/contactselectiondialog.h kdepim-4.13.3/kaddressbook/contactselectiondialog.h --- kdepim-4.13.0/kaddressbook/contactselectiondialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactselectiondialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -29,7 +29,7 @@ namespace Akonadi { - class Collection; +class Collection; } /** @@ -39,9 +39,9 @@ */ class ContactSelectionDialog : public KDialog { - Q_OBJECT + Q_OBJECT - public: +public: /** * Creates a new contact selection dialog. * @@ -65,7 +65,7 @@ */ KABC::Addressee::List selectedContacts() const; - private: +private: ContactSelectionWidget *mSelectionWidget; }; diff -Nru kdepim-4.13.0/kaddressbook/contactselectionwidget.cpp kdepim-4.13.3/kaddressbook/contactselectionwidget.cpp --- kdepim-4.13.0/kaddressbook/contactselectionwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactselectionwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -39,176 +39,176 @@ ContactSelectionWidget::ContactSelectionWidget( QItemSelectionModel *selectionModel, QWidget *parent ) - : QWidget( parent ), mSelectionModel( selectionModel ) + : QWidget( parent ), mSelectionModel( selectionModel ) { - initGui(); + initGui(); - mSelectedContactsButton->setEnabled( mSelectionModel->hasSelection() ); - mAddressBookSelection->setEnabled( false ); - mAddressBookSelectionRecursive->setEnabled( false ); - - connect( mAddressBookContactsButton, SIGNAL(toggled(bool)), - mAddressBookSelection, SLOT(setEnabled(bool)) ); - connect( mAddressBookContactsButton, SIGNAL(toggled(bool)), - mAddressBookSelectionRecursive, SLOT(setEnabled(bool)) ); - - // apply default configuration - if ( mSelectionModel->hasSelection() ) { - mSelectedContactsButton->setChecked( true ); - } else { - mAllContactsButton->setChecked( true ); - } + mSelectedContactsButton->setEnabled( mSelectionModel->hasSelection() ); + mAddressBookSelection->setEnabled( false ); + mAddressBookSelectionRecursive->setEnabled( false ); + + connect( mAddressBookContactsButton, SIGNAL(toggled(bool)), + mAddressBookSelection, SLOT(setEnabled(bool)) ); + connect( mAddressBookContactsButton, SIGNAL(toggled(bool)), + mAddressBookSelectionRecursive, SLOT(setEnabled(bool)) ); + + // apply default configuration + if ( mSelectionModel->hasSelection() ) { + mSelectedContactsButton->setChecked( true ); + } else { + mAllContactsButton->setChecked( true ); + } } void ContactSelectionWidget::setMessageText( const QString &message ) { - mMessageLabel->setText( message ); + mMessageLabel->setText( message ); } void ContactSelectionWidget::setDefaultAddressBook( const Akonadi::Collection &addressBook ) { - mAddressBookSelection->setDefaultCollection( addressBook ); + mAddressBookSelection->setDefaultCollection( addressBook ); } KABC::Addressee::List ContactSelectionWidget::selectedContacts() const { - if ( mAllContactsButton->isChecked() ) { - return collectAllContacts(); - } else if ( mSelectedContactsButton->isChecked() ) { - return collectSelectedContacts(); - } else if ( mAddressBookContactsButton->isChecked() ) { - return collectAddressBookContacts(); - } + if ( mAllContactsButton->isChecked() ) { + return collectAllContacts(); + } else if ( mSelectedContactsButton->isChecked() ) { + return collectSelectedContacts(); + } else if ( mAddressBookContactsButton->isChecked() ) { + return collectAddressBookContacts(); + } - return KABC::Addressee::List(); + return KABC::Addressee::List(); } Akonadi::Item::List ContactSelectionWidget::selectedContactsItem() const { - if ( mAllContactsButton->isChecked() ) { - return collectAllContactsItem(); - } else if ( mSelectedContactsButton->isChecked() ) { - return collectSelectedContactsItem(); - } else if ( mAddressBookContactsButton->isChecked() ) { - return collectAddressBookContactsItem(); - } + if ( mAllContactsButton->isChecked() ) { + return collectAllContactsItem(); + } else if ( mSelectedContactsButton->isChecked() ) { + return collectSelectedContactsItem(); + } else if ( mAddressBookContactsButton->isChecked() ) { + return collectAddressBookContactsItem(); + } - return Akonadi::Item::List(); + return Akonadi::Item::List(); } void ContactSelectionWidget::initGui() { - QVBoxLayout *layout = new QVBoxLayout( this ); + QVBoxLayout *layout = new QVBoxLayout( this ); - mMessageLabel = new QLabel; - layout->addWidget( mMessageLabel ); + mMessageLabel = new QLabel; + layout->addWidget( mMessageLabel ); - QButtonGroup *group = new QButtonGroup( this ); + QButtonGroup *group = new QButtonGroup( this ); - QGroupBox *groupBox = new QGroupBox; + QGroupBox *groupBox = new QGroupBox; - QGridLayout *boxLayout = new QGridLayout; - groupBox->setLayout( boxLayout ); - - mAllContactsButton = new QRadioButton( i18nc( "@option:radio", "All contacts" ) ); - mAllContactsButton->setToolTip( - i18nc( "@info:tooltip", "All contacts from all your address books" ) ); - mAllContactsButton->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option you want to select all your contacts from " - "all your address books." ) ); - - mSelectedContactsButton = new QRadioButton( i18nc( "@option:radio","Selected contacts" ) ); - mSelectedContactsButton->setToolTip( - i18nc( "@info:tooltip", "Only the contacts currently selected" ) ); - mSelectedContactsButton->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option if you want only the contacts you have already " - "selected in the graphical interface." ) ); - - mAddressBookContactsButton = new QRadioButton( i18nc( "@option:radio", "All contacts from:" ) ); - mAddressBookContactsButton->setToolTip( - i18nc( "@info:tooltip", "All contacts from a chosen address book" ) ); - mAddressBookContactsButton->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option if you want to select all the contacts from only one " - "of your address books. Once this option is clicked you will be provided " - "a drop down box listing all those address books and permitted to select " - "the one you want." ) ); - - mAddressBookSelection = new Akonadi::CollectionComboBox; - mAddressBookSelection->setMimeTypeFilter( QStringList() << KABC::Addressee::mimeType() ); - mAddressBookSelection->setAccessRightsFilter( Akonadi::Collection::ReadOnly ); - mAddressBookSelection->setExcludeVirtualCollections( true ); - mAddressBookSelectionRecursive = new QCheckBox( i18nc( "@option:check", "Include Subfolders" ) ); - mAddressBookSelectionRecursive->setToolTip( - i18nc( "@info:tooltip", "Select all subfolders including the top-level folder" ) ); - mAddressBookSelectionRecursive->setWhatsThis( - i18nc( "@info:whatsthis", - "Check this box if you want to select all contacts from this folder, " - "including all subfolders. If you only want the contacts from the " - "top-level folder then leave this box unchecked." ) ); - - group->addButton( mAllContactsButton ); - group->addButton( mSelectedContactsButton ); - group->addButton( mAddressBookContactsButton ); - - boxLayout->addWidget( mAllContactsButton, 0, 0, 1, 2 ); - boxLayout->addWidget( mSelectedContactsButton, 1, 0, 1, 2 ); - boxLayout->addWidget( mAddressBookContactsButton, 2, 0, Qt::AlignTop ); - - QVBoxLayout *addressBookLayout = new QVBoxLayout; - addressBookLayout->setMargin( 0 ); - addressBookLayout->addWidget( mAddressBookSelection ); - addressBookLayout->addWidget( mAddressBookSelectionRecursive ); + QGridLayout *boxLayout = new QGridLayout; + groupBox->setLayout( boxLayout ); + + mAllContactsButton = new QRadioButton( i18nc( "@option:radio", "All contacts" ) ); + mAllContactsButton->setToolTip( + i18nc( "@info:tooltip", "All contacts from all your address books" ) ); + mAllContactsButton->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option you want to select all your contacts from " + "all your address books." ) ); + + mSelectedContactsButton = new QRadioButton( i18nc( "@option:radio","Selected contacts" ) ); + mSelectedContactsButton->setToolTip( + i18nc( "@info:tooltip", "Only the contacts currently selected" ) ); + mSelectedContactsButton->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option if you want only the contacts you have already " + "selected in the graphical interface." ) ); + + mAddressBookContactsButton = new QRadioButton( i18nc( "@option:radio", "All contacts from:" ) ); + mAddressBookContactsButton->setToolTip( + i18nc( "@info:tooltip", "All contacts from a chosen address book" ) ); + mAddressBookContactsButton->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option if you want to select all the contacts from only one " + "of your address books. Once this option is clicked you will be provided " + "a drop down box listing all those address books and permitted to select " + "the one you want." ) ); + + mAddressBookSelection = new Akonadi::CollectionComboBox; + mAddressBookSelection->setMimeTypeFilter( QStringList() << KABC::Addressee::mimeType() ); + mAddressBookSelection->setAccessRightsFilter( Akonadi::Collection::ReadOnly ); + mAddressBookSelection->setExcludeVirtualCollections( true ); + mAddressBookSelectionRecursive = new QCheckBox( i18nc( "@option:check", "Include Subfolders" ) ); + mAddressBookSelectionRecursive->setToolTip( + i18nc( "@info:tooltip", "Select all subfolders including the top-level folder" ) ); + mAddressBookSelectionRecursive->setWhatsThis( + i18nc( "@info:whatsthis", + "Check this box if you want to select all contacts from this folder, " + "including all subfolders. If you only want the contacts from the " + "top-level folder then leave this box unchecked." ) ); + + group->addButton( mAllContactsButton ); + group->addButton( mSelectedContactsButton ); + group->addButton( mAddressBookContactsButton ); + + boxLayout->addWidget( mAllContactsButton, 0, 0, 1, 2 ); + boxLayout->addWidget( mSelectedContactsButton, 1, 0, 1, 2 ); + boxLayout->addWidget( mAddressBookContactsButton, 2, 0, Qt::AlignTop ); + + QVBoxLayout *addressBookLayout = new QVBoxLayout; + addressBookLayout->setMargin( 0 ); + addressBookLayout->addWidget( mAddressBookSelection ); + addressBookLayout->addWidget( mAddressBookSelectionRecursive ); - boxLayout->addLayout( addressBookLayout, 2, 1 ); + boxLayout->addLayout( addressBookLayout, 2, 1 ); - layout->addWidget( groupBox ); - layout->addStretch( 1 ); + layout->addWidget( groupBox ); + layout->addStretch( 1 ); } KABC::Addressee::List ContactSelectionWidget::collectAllContacts() const { - Akonadi::RecursiveItemFetchJob *job = - new Akonadi::RecursiveItemFetchJob( Akonadi::Collection::root(), - QStringList() << KABC::Addressee::mimeType() ); - job->fetchScope().fetchFullPayload(); + Akonadi::RecursiveItemFetchJob *job = + new Akonadi::RecursiveItemFetchJob( Akonadi::Collection::root(), + QStringList() << KABC::Addressee::mimeType() ); + job->fetchScope().fetchFullPayload(); - KABC::Addressee::List contacts; - if ( !job->exec() ) { - return contacts; - } + KABC::Addressee::List contacts; + if ( !job->exec() ) { + return contacts; + } - foreach ( const Akonadi::Item &item, job->items() ) { - if ( item.isValid() && item.hasPayload() ) { - contacts.append( item.payload() ); + foreach ( const Akonadi::Item &item, job->items() ) { + if ( item.isValid() && item.hasPayload() ) { + contacts.append( item.payload() ); + } } - } - return contacts; + return contacts; } Akonadi::Item::List ContactSelectionWidget::collectAllContactsItem() const { - Akonadi::RecursiveItemFetchJob *job = - new Akonadi::RecursiveItemFetchJob( Akonadi::Collection::root(), - QStringList() << KABC::Addressee::mimeType() ); - job->fetchScope().fetchFullPayload(); + Akonadi::RecursiveItemFetchJob *job = + new Akonadi::RecursiveItemFetchJob( Akonadi::Collection::root(), + QStringList() << KABC::Addressee::mimeType() ); + job->fetchScope().fetchFullPayload(); - Akonadi::Item::List lst; - if ( !job->exec() ) { - return lst; - } + Akonadi::Item::List lst; + if ( !job->exec() ) { + return lst; + } - foreach ( const Akonadi::Item &item, job->items() ) { - if ( item.isValid() && item.hasPayload() ) { - lst.append( item ); + foreach ( const Akonadi::Item &item, job->items() ) { + if ( item.isValid() && item.hasPayload() ) { + lst.append( item ); + } } - } - return lst; + return lst; } Akonadi::Item::List ContactSelectionWidget::collectSelectedContactsItem() const @@ -220,104 +220,104 @@ KABC::Addressee::List ContactSelectionWidget::collectSelectedContacts() const { - KABC::Addressee::List contacts; + KABC::Addressee::List contacts; - const QModelIndexList indexes = mSelectionModel->selectedRows( 0 ); - for ( int i = 0; i < indexes.count(); ++i ) { - const QModelIndex index = indexes.at( i ); - if ( index.isValid() ) { - const Akonadi::Item item = - index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - if ( item.isValid() && item.hasPayload() ) { - contacts.append( item.payload() ); - } + const QModelIndexList indexes = mSelectionModel->selectedRows( 0 ); + for ( int i = 0; i < indexes.count(); ++i ) { + const QModelIndex index = indexes.at( i ); + if ( index.isValid() ) { + const Akonadi::Item item = + index.data( Akonadi::EntityTreeModel::ItemRole ).value(); + if ( item.isValid() && item.hasPayload() ) { + contacts.append( item.payload() ); + } + } } - } - return contacts; + return contacts; } KABC::Addressee::List ContactSelectionWidget::collectAddressBookContacts() const { - KABC::Addressee::List contacts; - - const Akonadi::Collection collection = mAddressBookSelection->currentCollection(); - if ( !collection.isValid() ) { - return contacts; - } - - if ( mAddressBookSelectionRecursive->isChecked() ) { - Akonadi::RecursiveItemFetchJob *job = - new Akonadi::RecursiveItemFetchJob( collection, - QStringList() << KABC::Addressee::mimeType() ); - job->fetchScope().fetchFullPayload(); - - if ( !job->exec() ) { - return contacts; - } + KABC::Addressee::List contacts; - foreach ( const Akonadi::Item &item, job->items() ) { - if ( item.hasPayload() ) { - contacts.append( item.payload() ); - } + const Akonadi::Collection collection = mAddressBookSelection->currentCollection(); + if ( !collection.isValid() ) { + return contacts; + } + + if ( mAddressBookSelectionRecursive->isChecked() ) { + Akonadi::RecursiveItemFetchJob *job = + new Akonadi::RecursiveItemFetchJob( collection, + QStringList() << KABC::Addressee::mimeType() ); + job->fetchScope().fetchFullPayload(); + + if ( !job->exec() ) { + return contacts; + } + + foreach ( const Akonadi::Item &item, job->items() ) { + if ( item.hasPayload() ) { + contacts.append( item.payload() ); + } + } + } else { + Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection ); + job->fetchScope().fetchFullPayload(); + + if ( !job->exec() ) { + return contacts; + } + + foreach ( const Akonadi::Item &item, job->items() ) { + if ( item.hasPayload() ) { + contacts.append( item.payload() ); + } + } } - } else { - Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection ); - job->fetchScope().fetchFullPayload(); - if ( !job->exec() ) { - return contacts; - } - - foreach ( const Akonadi::Item &item, job->items() ) { - if ( item.hasPayload() ) { - contacts.append( item.payload() ); - } - } - } - - return contacts; + return contacts; } Akonadi::Item::List ContactSelectionWidget::collectAddressBookContactsItem() const { - Akonadi::Item::List lst; - - const Akonadi::Collection collection = mAddressBookSelection->currentCollection(); - if ( !collection.isValid() ) { - return lst; - } - - if ( mAddressBookSelectionRecursive->isChecked() ) { - Akonadi::RecursiveItemFetchJob *job = - new Akonadi::RecursiveItemFetchJob( collection, - QStringList() << KABC::Addressee::mimeType() ); - job->fetchScope().fetchFullPayload(); + Akonadi::Item::List lst; - if ( !job->exec() ) { - return lst; + const Akonadi::Collection collection = mAddressBookSelection->currentCollection(); + if ( !collection.isValid() ) { + return lst; + } + + if ( mAddressBookSelectionRecursive->isChecked() ) { + Akonadi::RecursiveItemFetchJob *job = + new Akonadi::RecursiveItemFetchJob( collection, + QStringList() << KABC::Addressee::mimeType() ); + job->fetchScope().fetchFullPayload(); + + if ( !job->exec() ) { + return lst; + } + + foreach ( const Akonadi::Item &item, job->items() ) { + if ( item.hasPayload() ) { + lst.append( item ); + } + } + } else { + Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection ); + job->fetchScope().fetchFullPayload(); + + if ( !job->exec() ) { + return lst; + } + + foreach ( const Akonadi::Item &item, job->items() ) { + if ( item.hasPayload() ) { + lst.append( item ); + } + } } - foreach ( const Akonadi::Item &item, job->items() ) { - if ( item.hasPayload() ) { - lst.append( item ); - } - } - } else { - Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection ); - job->fetchScope().fetchFullPayload(); - - if ( !job->exec() ) { - return lst; - } - - foreach ( const Akonadi::Item &item, job->items() ) { - if ( item.hasPayload() ) { - lst.append( item ); - } - } - } - - return lst; + return lst; } diff -Nru kdepim-4.13.0/kaddressbook/contactselectionwidget.h kdepim-4.13.3/kaddressbook/contactselectionwidget.h --- kdepim-4.13.0/kaddressbook/contactselectionwidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactselectionwidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -30,8 +30,8 @@ class QRadioButton; namespace Akonadi { - class Collection; - class CollectionComboBox; +class Collection; +class CollectionComboBox; } /** @@ -41,9 +41,9 @@ */ class ContactSelectionWidget : public QWidget { - Q_OBJECT + Q_OBJECT - public: +public: /** * Creates a new contact selection widget. * diff -Nru kdepim-4.13.0/kaddressbook/contactsorter.cpp kdepim-4.13.3/kaddressbook/contactsorter.cpp --- kdepim-4.13.0/kaddressbook/contactsorter.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactsorter.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -24,65 +24,65 @@ class ContactSortHelper { - public: +public: ContactSortHelper( ContactFields::Field field, Qt::SortOrder sortOrder ) - : mSortField( field ), mSortOrder( sortOrder ) + : mSortField( field ), mSortOrder( sortOrder ) { } inline bool operator()( const KABC::Addressee &contact, const KABC::Addressee &otherContact ) const { - int result = - QString::localeAwareCompare( - ContactFields::value( mSortField, contact ), - ContactFields::value( mSortField, otherContact ) ); - - if ( result == 0 ) { - int givenNameResult = - QString::localeAwareCompare( - ContactFields::value( ContactFields::GivenName, contact ), - ContactFields::value( ContactFields::GivenName, otherContact ) ); - - if ( givenNameResult == 0 ) { - int familyNameResult = - QString::localeAwareCompare( - ContactFields::value( ContactFields::FamilyName, contact ), - ContactFields::value( ContactFields::FamilyName, otherContact ) ); - - if ( familyNameResult == 0 ) { - result = - QString::localeAwareCompare( - ContactFields::value( ContactFields::FormattedName, contact ), - ContactFields::value( ContactFields::FormattedName, otherContact ) ); - } else { - result = familyNameResult; - } - } else { - result = givenNameResult; + int result = + QString::localeAwareCompare( + ContactFields::value( mSortField, contact ), + ContactFields::value( mSortField, otherContact ) ); + + if ( result == 0 ) { + int givenNameResult = + QString::localeAwareCompare( + ContactFields::value( ContactFields::GivenName, contact ), + ContactFields::value( ContactFields::GivenName, otherContact ) ); + + if ( givenNameResult == 0 ) { + int familyNameResult = + QString::localeAwareCompare( + ContactFields::value( ContactFields::FamilyName, contact ), + ContactFields::value( ContactFields::FamilyName, otherContact ) ); + + if ( familyNameResult == 0 ) { + result = + QString::localeAwareCompare( + ContactFields::value( ContactFields::FormattedName, contact ), + ContactFields::value( ContactFields::FormattedName, otherContact ) ); + } else { + result = familyNameResult; + } + } else { + result = givenNameResult; + } } - } - bool lesser = result < 0; + bool lesser = result < 0; - if ( mSortOrder == Qt::DescendingOrder ) { - lesser = !lesser; - } + if ( mSortOrder == Qt::DescendingOrder ) { + lesser = !lesser; + } - return lesser; + return lesser; } - private: +private: const ContactFields::Field mSortField; const Qt::SortOrder mSortOrder; }; ContactSorter::ContactSorter( ContactFields::Field field, Qt::SortOrder sortOrder ) - : mSortField( field ), mSortOrder( sortOrder ) + : mSortField( field ), mSortOrder( sortOrder ) { } void ContactSorter::sort( QList &contacts ) const { - qStableSort( contacts.begin(), contacts.end(), ContactSortHelper( mSortField, mSortOrder ) ); + qStableSort( contacts.begin(), contacts.end(), ContactSortHelper( mSortField, mSortOrder ) ); } diff -Nru kdepim-4.13.0/kaddressbook/contactsorter.h kdepim-4.13.3/kaddressbook/contactsorter.h --- kdepim-4.13.0/kaddressbook/contactsorter.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactsorter.h 2014-07-09 12:18:50.000000000 +0000 @@ -25,13 +25,13 @@ class ContactSorter { - public: +public: explicit ContactSorter( ContactFields::Field field, Qt::SortOrder sortOrder = Qt::AscendingOrder ); void sort( QList &contacts ) const; - private: +private: const ContactFields::Field mSortField; const Qt::SortOrder mSortOrder; }; diff -Nru kdepim-4.13.0/kaddressbook/contactswitcher.cpp kdepim-4.13.3/kaddressbook/contactswitcher.cpp --- kdepim-4.13.0/kaddressbook/contactswitcher.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactswitcher.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -27,106 +27,106 @@ #include ContactSwitcher::ContactSwitcher( QWidget *parent ) - : QWidget( parent ), mView( 0 ) + : QWidget( parent ), mView( 0 ) { - QHBoxLayout *layout = new QHBoxLayout( this ); + QHBoxLayout *layout = new QHBoxLayout( this ); - mPreviousButton = new QPushButton( i18nc( "@action:button Previous contact", "Previous" ) ); - mPreviousButton->setToolTip( - i18nc( "@info:tooltip", "Move to the previous contact in the list" ) ); - mPreviousButton->setWhatsThis( - i18nc( "@info:whatsthis", - "Press this button to move to the previous contact in the list." ) ); - - mNextButton = new QPushButton( i18nc( "@action:button Next contact", "Next" ) ); - mNextButton->setToolTip( - i18nc( "@info:tooltip", "Move to the next contact in the list" ) ); - mNextButton->setWhatsThis( - i18nc( "@info:whatsthis", - "Press this button to move to the next contact in the list." ) ); - - mStatusLabel = new QLabel(); - - layout->addWidget( mPreviousButton ); - layout->addWidget( mNextButton ); - layout->addStretch( 1 ); - layout->addWidget( mStatusLabel ); + mPreviousButton = new QPushButton( i18nc( "@action:button Previous contact", "Previous" ) ); + mPreviousButton->setToolTip( + i18nc( "@info:tooltip", "Move to the previous contact in the list" ) ); + mPreviousButton->setWhatsThis( + i18nc( "@info:whatsthis", + "Press this button to move to the previous contact in the list." ) ); + + mNextButton = new QPushButton( i18nc( "@action:button Next contact", "Next" ) ); + mNextButton->setToolTip( + i18nc( "@info:tooltip", "Move to the next contact in the list" ) ); + mNextButton->setWhatsThis( + i18nc( "@info:whatsthis", + "Press this button to move to the next contact in the list." ) ); + + mStatusLabel = new QLabel(); + + layout->addWidget( mPreviousButton ); + layout->addWidget( mNextButton ); + layout->addStretch( 1 ); + layout->addWidget( mStatusLabel ); - connect( mPreviousButton, SIGNAL(clicked()), SLOT(previousClicked()) ); - connect( mNextButton, SIGNAL(clicked()), SLOT(nextClicked()) ); + connect( mPreviousButton, SIGNAL(clicked()), SLOT(previousClicked()) ); + connect( mNextButton, SIGNAL(clicked()), SLOT(nextClicked()) ); } void ContactSwitcher::setView( QAbstractItemView *view ) { - mView = view; + mView = view; - Q_ASSERT_X( mView->model(), "ContactSwitcher::setView", "The view has no model set!" ); + Q_ASSERT_X( mView->model(), "ContactSwitcher::setView", "The view has no model set!" ); - connect( mView->model(), SIGNAL(layoutChanged()), SLOT(updateStatus()) ); - connect( mView->model(), SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(updateStatus()) ); - connect( mView->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(updateStatus()) ); - connect( mView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(updateStatus())); + connect( mView->model(), SIGNAL(layoutChanged()), SLOT(updateStatus()) ); + connect( mView->model(), SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(updateStatus()) ); + connect( mView->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(updateStatus()) ); + connect( mView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(updateStatus())); - updateStatus(); + updateStatus(); } void ContactSwitcher::nextClicked() { - if ( !mView || !mView->model() ) { - return; - } - - const QModelIndex index = mView->selectionModel()->currentIndex(); - - int row = 0; - if ( index.isValid() ) { - row = index.row() + 1; - } - - mView->selectionModel()->setCurrentIndex( mView->model()->index( row, 0 ), - QItemSelectionModel::Rows | - QItemSelectionModel::ClearAndSelect ); + if ( !mView || !mView->model() ) { + return; + } + + const QModelIndex index = mView->selectionModel()->currentIndex(); + + int row = 0; + if ( index.isValid() ) { + row = index.row() + 1; + } + + mView->selectionModel()->setCurrentIndex( mView->model()->index( row, 0 ), + QItemSelectionModel::Rows | + QItemSelectionModel::ClearAndSelect ); - updateStatus(); + updateStatus(); } void ContactSwitcher::previousClicked() { - if ( !mView || !mView->model() ) { - return; - } - - const QModelIndex index = mView->selectionModel()->currentIndex(); - - int row = 0; - if ( index.isValid() ) { - row = index.row() - 1; - } - - mView->selectionModel()->setCurrentIndex( mView->model()->index( row, 0 ), - QItemSelectionModel::Rows | - QItemSelectionModel::ClearAndSelect ); + if ( !mView || !mView->model() ) { + return; + } + + const QModelIndex index = mView->selectionModel()->currentIndex(); + + int row = 0; + if ( index.isValid() ) { + row = index.row() - 1; + } + + mView->selectionModel()->setCurrentIndex( mView->model()->index( row, 0 ), + QItemSelectionModel::Rows | + QItemSelectionModel::ClearAndSelect ); - updateStatus(); + updateStatus(); } void ContactSwitcher::updateStatus() { - if ( !mView || !mView->model() ) { - return; - } - - const QModelIndex index = mView->selectionModel()->currentIndex(); - - int row = 0; - if ( index.isValid() ) { - row = index.row(); - } + if ( !mView || !mView->model() ) { + return; + } + + const QModelIndex index = mView->selectionModel()->currentIndex(); + + int row = 0; + if ( index.isValid() ) { + row = index.row(); + } - mPreviousButton->setEnabled( row != 0 ); - mNextButton->setEnabled( row != ( mView->model()->rowCount() - 1 ) ); + mPreviousButton->setEnabled( row != 0 ); + mNextButton->setEnabled( row != ( mView->model()->rowCount() - 1 ) ); - mStatusLabel->setText( i18nc( "@info:status", - "%1 out of %2", row + 1, mView->model()->rowCount() ) ); + mStatusLabel->setText( i18nc( "@info:status", + "%1 out of %2", row + 1, mView->model()->rowCount() ) ); } diff -Nru kdepim-4.13.0/kaddressbook/contactswitcher.h kdepim-4.13.3/kaddressbook/contactswitcher.h --- kdepim-4.13.0/kaddressbook/contactswitcher.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/contactswitcher.h 2014-07-09 12:18:50.000000000 +0000 @@ -36,9 +36,9 @@ */ class ContactSwitcher : public QWidget { - Q_OBJECT + Q_OBJECT - public: +public: /** * Creates a new contact switcher. * @@ -51,7 +51,7 @@ */ void setView( QAbstractItemView *view ); - private Q_SLOTS: +private Q_SLOTS: /** * This slot is called when the 'Next' button is clicked. */ @@ -68,7 +68,7 @@ */ void updateStatus(); - private: +private: QAbstractItemView *mView; QPushButton *mNextButton; QPushButton *mPreviousButton; diff -Nru kdepim-4.13.0/kaddressbook/globalcontactmodel.cpp kdepim-4.13.3/kaddressbook/globalcontactmodel.cpp --- kdepim-4.13.0/kaddressbook/globalcontactmodel.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/globalcontactmodel.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -34,39 +34,39 @@ GlobalContactModel::GlobalContactModel() { - mSession = new Akonadi::Session( "KAddressBook::GlobalContactSession" ); + mSession = new Akonadi::Session( "KAddressBook::GlobalContactSession" ); - Akonadi::ItemFetchScope scope; - scope.fetchFullPayload( true ); - scope.fetchAttribute(); - - mMonitor = new Akonadi::ChangeRecorder; - mMonitor->setSession(mSession); - mMonitor->fetchCollection( true ); - mMonitor->setItemFetchScope( scope ); - mMonitor->setCollectionMonitored( Akonadi::Collection::root() ); - mMonitor->setMimeTypeMonitored( KABC::Addressee::mimeType(), true ); - mMonitor->setMimeTypeMonitored( KABC::ContactGroup::mimeType(), true ); + Akonadi::ItemFetchScope scope; + scope.fetchFullPayload( true ); + scope.fetchAttribute(); + + mMonitor = new Akonadi::ChangeRecorder; + mMonitor->setSession(mSession); + mMonitor->fetchCollection( true ); + mMonitor->setItemFetchScope( scope ); + mMonitor->setCollectionMonitored( Akonadi::Collection::root() ); + mMonitor->setMimeTypeMonitored( KABC::Addressee::mimeType(), true ); + mMonitor->setMimeTypeMonitored( KABC::ContactGroup::mimeType(), true ); - mModel = new Akonadi::ContactsTreeModel( mMonitor ); + mModel = new Akonadi::ContactsTreeModel( mMonitor ); } GlobalContactModel::~GlobalContactModel() { - delete mModel; - delete mMonitor; - delete mSession; + delete mModel; + delete mMonitor; + delete mSession; } GlobalContactModel *GlobalContactModel::instance() { - if ( !mInstance ) { - mInstance = new GlobalContactModel(); - } - return mInstance; + if ( !mInstance ) { + mInstance = new GlobalContactModel(); + } + return mInstance; } Akonadi::ContactsTreeModel *GlobalContactModel::model() const { - return mModel; + return mModel; } diff -Nru kdepim-4.13.0/kaddressbook/globalcontactmodel.h kdepim-4.13.3/kaddressbook/globalcontactmodel.h --- kdepim-4.13.0/kaddressbook/globalcontactmodel.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/globalcontactmodel.h 2014-07-09 12:18:50.000000000 +0000 @@ -22,10 +22,10 @@ #define GLOBALCONTACTMODEL_H namespace Akonadi { - class ChangeRecorder; - class ContactsTreeModel; - class Monitor; - class Session; +class ChangeRecorder; +class ContactsTreeModel; +class Monitor; +class Session; } /** @@ -36,7 +36,7 @@ */ class GlobalContactModel { - public: +public: /** * Destroys the global contact model. */ @@ -52,7 +52,7 @@ */ Akonadi::ContactsTreeModel *model() const; - private: +private: GlobalContactModel(); static GlobalContactModel *mInstance; diff -Nru kdepim-4.13.0/kaddressbook/kaddressbook.desktop kdepim-4.13.3/kaddressbook/kaddressbook.desktop --- kdepim-4.13.0/kaddressbook/kaddressbook.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/kaddressbook.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -98,7 +98,7 @@ GenericName[nl]=Contactpersoonbeheerder GenericName[nn]=Kontakthandsamar GenericName[pa]=ਸੰਪਰਕ ਮੈਨੇਜਰ -GenericName[pl]=Menadżer kontaktów +GenericName[pl]=Zarządzanie kontaktami GenericName[pt]=Gestor de Contactos GenericName[pt_BR]=Gerenciador de contatos GenericName[ro]=Gestionar de contacte diff -Nru kdepim-4.13.0/kaddressbook/kaddressbook-importer.desktop kdepim-4.13.3/kaddressbook/kaddressbook-importer.desktop --- kdepim-4.13.0/kaddressbook/kaddressbook-importer.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/kaddressbook-importer.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,7 +7,9 @@ Name[da]=KAddressbook importfil Name[de]=Adressbuch-Importdatei Name[el]=Αρχείο εισαγωγής του KAddressBook +Name[en_GB]=KAddressbook import file Name[es]=Importar archivo de KAddressbook +Name[et]=KDE aadressiraamatu impordifail Name[fi]=Tiedoston tuonti KAddressbookiin Name[fr]=Importation d'un fichier KAddressbook Name[gl]=Importar un ficheiro do KAddressbook diff -Nru kdepim-4.13.0/kaddressbook/kaddressbookpart.cpp kdepim-4.13.3/kaddressbook/kaddressbookpart.cpp --- kdepim-4.13.0/kaddressbook/kaddressbookpart.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/kaddressbookpart.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -38,48 +38,48 @@ KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent, const QVariantList & ) - : KParts::ReadOnlyPart( parent ) + : KParts::ReadOnlyPart( parent ) { - setComponentData( KAddressBookFactory::componentData() ); + setComponentData( KAddressBookFactory::componentData() ); - KAddressBook::insertLibraryCatalogues(); + KAddressBook::insertLibraryCatalogues(); - KIconLoader::global()->addAppDir( QLatin1String("kaddressbook") ); - // create a canvas to insert our widget - QWidget *canvas = new QWidget( parentWidget ); - canvas->setFocusPolicy( Qt::ClickFocus ); - setWidget( canvas ); - QVBoxLayout *topLayout = new QVBoxLayout( canvas ); + KIconLoader::global()->addAppDir( QLatin1String("kaddressbook") ); + // create a canvas to insert our widget + QWidget *canvas = new QWidget( parentWidget ); + canvas->setFocusPolicy( Qt::ClickFocus ); + setWidget( canvas ); + QVBoxLayout *topLayout = new QVBoxLayout( canvas ); - mMainWidget = new MainWidget( this, canvas ); - initAction(); + mMainWidget = new MainWidget( this, canvas ); + initAction(); - topLayout->addWidget( mMainWidget ); - topLayout->setMargin(0); - setXMLFile( QLatin1String("kaddressbookui.rc") ); + topLayout->addWidget( mMainWidget ); + topLayout->setMargin(0); + setXMLFile( QLatin1String("kaddressbookui.rc") ); } void KAddressBookPart::updateQuickSearchText() { - mMainWidget->updateQuickSearchText(); + mMainWidget->updateQuickSearchText(); } void KAddressBookPart::initAction() { - KAction *action = new KAction( KIcon( QLatin1String("configure") ), i18n( "&Configure KAddressBook..." ), this ); - actionCollection()->addAction( QLatin1String("kaddressbook_configure"), action ); - connect( action, SIGNAL(triggered(bool)), mMainWidget, - SLOT(configure()) ); + KAction *action = new KAction( KIcon( QLatin1String("configure") ), i18n( "&Configure KAddressBook..." ), this ); + actionCollection()->addAction( QLatin1String("kaddressbook_configure"), action ); + connect( action, SIGNAL(triggered(bool)), mMainWidget, + SLOT(configure()) ); } void KAddressBookPart::newContact() { - mMainWidget->newContact(); + mMainWidget->newContact(); } void KAddressBookPart::newGroup() { - mMainWidget->newGroup(); + mMainWidget->newGroup(); } KAddressBookPart::~KAddressBookPart() @@ -88,12 +88,12 @@ bool KAddressBookPart::openFile() { - return false; + return false; } void KAddressBookPart::guiActivateEvent( KParts::GUIActivateEvent *e ) { - kDebug(); - KParts::ReadOnlyPart::guiActivateEvent( e ); + kDebug(); + KParts::ReadOnlyPart::guiActivateEvent( e ); } diff -Nru kdepim-4.13.0/kaddressbook/kaddressbookpart.h kdepim-4.13.3/kaddressbook/kaddressbookpart.h --- kdepim-4.13.0/kaddressbook/kaddressbookpart.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/kaddressbookpart.h 2014-07-09 12:18:50.000000000 +0000 @@ -28,9 +28,9 @@ class KAddressBookPart: public KParts::ReadOnlyPart { - Q_OBJECT + Q_OBJECT - public: +public: KAddressBookPart( QWidget *parentWidget, QObject *parent, const QVariantList & ); virtual ~KAddressBookPart(); @@ -39,11 +39,11 @@ void newGroup(); void updateQuickSearchText(); - protected: +protected: virtual bool openFile(); virtual void guiActivateEvent( KParts::GUIActivateEvent * ); void initAction(); - private: +private: MainWidget *mMainWidget; }; diff -Nru kdepim-4.13.0/kaddressbook/main.cpp kdepim-4.13.3/kaddressbook/main.cpp --- kdepim-4.13.0/kaddressbook/main.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/main.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -57,18 +57,18 @@ int main( int argc, char **argv ) { - AboutData about; + AboutData about; - KCmdLineArgs::init( argc, argv, &about ); + KCmdLineArgs::init( argc, argv, &about ); - KCmdLineArgs::addCmdLineOptions( kaddressbook_options() ); // Add KAddressBook options - KUniqueApplication::addCmdLineOptions(); - if ( !KAddressBookApplication::start() ) { - return 0; - } + KCmdLineArgs::addCmdLineOptions( kaddressbook_options() ); // Add KAddressBook options + KUniqueApplication::addCmdLineOptions(); + if ( !KAddressBookApplication::start() ) { + return 0; + } - KAddressBookApplication app; - KAddressBook::insertLibraryCatalogues(); + KAddressBookApplication app; + KAddressBook::insertLibraryCatalogues(); - return app.exec(); + return app.exec(); } diff -Nru kdepim-4.13.0/kaddressbook/mainwidget.cpp kdepim-4.13.3/kaddressbook/mainwidget.cpp --- kdepim-4.13.0/kaddressbook/mainwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/mainwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -93,40 +93,40 @@ namespace { static bool isStructuralCollection( const Akonadi::Collection &collection ) { - QStringList mimeTypes; - mimeTypes << KABC::Addressee::mimeType() << KABC::ContactGroup::mimeType(); - const QStringList collectionMimeTypes = collection.contentMimeTypes(); - foreach ( const QString &mimeType, mimeTypes ) { - if ( collectionMimeTypes.contains( mimeType ) ) { - return false; + QStringList mimeTypes; + mimeTypes << KABC::Addressee::mimeType() << KABC::ContactGroup::mimeType(); + const QStringList collectionMimeTypes = collection.contentMimeTypes(); + foreach ( const QString &mimeType, mimeTypes ) { + if ( collectionMimeTypes.contains( mimeType ) ) { + return false; + } } - } - return true; + return true; } class StructuralCollectionsNotCheckableProxy : public KCheckableProxyModel { - public: +public: StructuralCollectionsNotCheckableProxy( QObject *parent ) - : KCheckableProxyModel( parent ) + : KCheckableProxyModel( parent ) { } /* reimp */QVariant data( const QModelIndex &index, int role ) const { - if ( !index.isValid() ) { - return QVariant(); - } + if ( !index.isValid() ) { + return QVariant(); + } - if ( role == Qt::CheckStateRole ) { - // Don't show the checkbox if the collection can't contain incidences - const Akonadi::Collection collection = - index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() && isStructuralCollection( collection ) ) { - return QVariant(); + if ( role == Qt::CheckStateRole ) { + // Don't show the checkbox if the collection can't contain incidences + const Akonadi::Collection collection = + index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); + if ( collection.isValid() && isStructuralCollection( collection ) ) { + return QVariant(); + } } - } - return KCheckableProxyModel::data( index, role ); + return KCheckableProxyModel::data( index, role ); } }; @@ -136,17 +136,17 @@ : QWidget( parent ), mAllContactsModel( 0 ), mXmlGuiClient( guiClient ), mGrantleeThemeManager(0), mQuickSearchAction(0) { - (void) new KaddressbookAdaptor( this ); - QDBusConnection::sessionBus().registerObject(QLatin1String("/KAddressBook"), this); + (void) new KaddressbookAdaptor( this ); + QDBusConnection::sessionBus().registerObject(QLatin1String("/KAddressBook"), this); - mXXPortManager = new XXPortManager( this ); - Akonadi::AttributeFactory::registerAttribute(); + mXXPortManager = new XXPortManager( this ); + Akonadi::AttributeFactory::registerAttribute(); - setupGui(); - setupActions( guiClient->actionCollection() ); + setupGui(); + setupActions( guiClient->actionCollection() ); - /* + /* * The item models, proxies and views have the following structure: * * mItemView @@ -535,7 +535,7 @@ void MainWidget::setupActions( KActionCollection *collection ) { - mGrantleeThemeManager = new GrantleeTheme::GrantleeThemeManager(QString::fromLatin1( "theme.desktop" ), collection, QLatin1String("kaddressbook/viewertemplates/")); + mGrantleeThemeManager = new GrantleeTheme::GrantleeThemeManager(GrantleeTheme::GrantleeThemeManager::Addressbook, QString::fromLatin1( "theme.desktop" ), collection, QLatin1String("kaddressbook/viewertemplates/")); mGrantleeThemeManager->setDownloadNewStuffConfigFile(QLatin1String("kaddressbook_themes.knsrc")); connect(mGrantleeThemeManager, SIGNAL(grantleeThemeSelected()), this, SLOT(slotGrantleeThemeSelected())); connect(mGrantleeThemeManager, SIGNAL(updateThemes()), this, SLOT(slotGrantleeThemesUpdated())); @@ -682,43 +682,46 @@ wizard.setDefaultAddressBook( currentAddressBook() ); const int result = wizard.exec(); - if (result) + if (result) { + Settings::self()->setDefaultFileName( printer.outputFileName() ); + Settings::self()->setPrintingStyle( wizard.printingStyle() ); + Settings::self()->setSortOrder( wizard.sortOrder() ); previewdlg.exec(); + } } void MainWidget::print() { - QPrinter printer; - printer.setDocName( i18n( "Address Book" ) ); - printer.setOutputFileName( Settings::self()->defaultFileName() ); - printer.setOutputFormat( QPrinter::PdfFormat ); - printer.setCollateCopies( true ); - - QPrintDialog printDialog(KdePrint::createPrintDialog(&printer)); - - printDialog.setWindowTitle( i18n( "Print Contacts" ) ); - if ( !printDialog.exec() ) { //krazy:exclude=crashy - return; - } + QPrinter printer; + printer.setDocName( i18n( "Address Book" ) ); + printer.setOutputFileName( Settings::self()->defaultFileName() ); + printer.setCollateCopies( true ); + + QPointer printDialog = KdePrint::createPrintDialog(&printer, this); - KABPrinting::PrintingWizard wizard( &printer, mItemView->selectionModel(), this ); - wizard.setDefaultAddressBook( currentAddressBook() ); + printDialog->setWindowTitle( i18n( "Print Contacts" ) ); + if ( !printDialog->exec() || !printDialog ) { + delete printDialog; + return; + } + KABPrinting::PrintingWizard wizard( &printer, mItemView->selectionModel(), this ); + wizard.setDefaultAddressBook( currentAddressBook() ); - wizard.exec(); //krazy:exclude=crashy + wizard.exec(); //krazy:exclude=crashy - Settings::self()->setDefaultFileName( printer.outputFileName() ); - Settings::self()->setPrintingStyle( wizard.printingStyle() ); - Settings::self()->setSortOrder( wizard.sortOrder() ); + Settings::self()->setDefaultFileName( printer.outputFileName() ); + Settings::self()->setPrintingStyle( wizard.printingStyle() ); + Settings::self()->setSortOrder( wizard.sortOrder() ); } void MainWidget::newContact() { - mActionManager->action( Akonadi::StandardContactActionManager::CreateContact )->trigger(); + mActionManager->action( Akonadi::StandardContactActionManager::CreateContact )->trigger(); } void MainWidget::newGroup() { - mActionManager->action( Akonadi::StandardContactActionManager::CreateContactGroup )->trigger(); + mActionManager->action( Akonadi::StandardContactActionManager::CreateContactGroup )->trigger(); } /** @@ -728,13 +731,13 @@ */ void MainWidget::itemSelected( const Akonadi::Item &item ) { - if ( Akonadi::MimeTypeChecker::isWantedItem( item, KABC::Addressee::mimeType() ) ) { - mDetailsViewStack->setCurrentWidget( mContactDetails ); - mContactDetails->setContact( item ); - } else if ( Akonadi::MimeTypeChecker::isWantedItem( item, KABC::ContactGroup::mimeType() ) ) { - mDetailsViewStack->setCurrentWidget( mContactGroupDetails ); - mContactGroupDetails->setContactGroup( item ); - } + if ( Akonadi::MimeTypeChecker::isWantedItem( item, KABC::Addressee::mimeType() ) ) { + mDetailsViewStack->setCurrentWidget( mContactDetails ); + mContactDetails->setContact( item ); + } else if ( Akonadi::MimeTypeChecker::isWantedItem( item, KABC::ContactGroup::mimeType() ) ) { + mDetailsViewStack->setCurrentWidget( mContactGroupDetails ); + mContactGroupDetails->setContactGroup( item ); + } } /** @@ -743,43 +746,43 @@ */ void MainWidget::itemSelectionChanged( const QModelIndex ¤t, const QModelIndex & ) { - if ( !current.isValid() ) { - mDetailsViewStack->setCurrentWidget( mEmptyDetails ); - } + if ( !current.isValid() ) { + mDetailsViewStack->setCurrentWidget( mEmptyDetails ); + } } void MainWidget::selectFirstItem() { - // Whenever the quick search has changed, we select the first item - // in the item view, so that the detailsview is updated - if ( mItemView && mItemView->selectionModel() ) { - mItemView->selectionModel()->setCurrentIndex( mItemView->model()->index( 0, 0 ), - QItemSelectionModel::Rows | - QItemSelectionModel::ClearAndSelect ); - } + // Whenever the quick search has changed, we select the first item + // in the item view, so that the detailsview is updated + if ( mItemView && mItemView->selectionModel() ) { + mItemView->selectionModel()->setCurrentIndex( mItemView->model()->index( 0, 0 ), + QItemSelectionModel::Rows | + QItemSelectionModel::ClearAndSelect ); + } } bool MainWidget::showQRCodes() { #if defined(HAVE_PRISON) - KConfig config( QLatin1String( "akonadi_contactrc" ) ); - KConfigGroup group( &config, QLatin1String( "View" ) ); - return group.readEntry( "QRCodes", true ); + KConfig config( QLatin1String( "akonadi_contactrc" ) ); + KConfigGroup group( &config, QLatin1String( "View" ) ); + return group.readEntry( "QRCodes", true ); #else - return true; + return true; #endif } void MainWidget::setQRCodeShow( bool on ) { #if defined(HAVE_PRISON) - // must write the configuration setting first before updating the view. - KConfig config( QLatin1String( "akonadi_contactrc" ) ); - KConfigGroup group( &config, QLatin1String( "View" ) ); - group.writeEntry( "QRCodes", on ); - if ( mItemView->model() ) { - mItemView->setCurrentIndex( mItemView->model()->index( 0, 0 ) ); - } + // must write the configuration setting first before updating the view. + KConfig config( QLatin1String( "akonadi_contactrc" ) ); + KConfigGroup group( &config, QLatin1String( "View" ) ); + group.writeEntry( "QRCodes", on ); + if ( mItemView->model() ) { + mItemView->setCurrentIndex( mItemView->model()->index( 0, 0 ) ); + } #else Q_UNUSED( on ); #endif @@ -787,107 +790,107 @@ Akonadi::Collection MainWidget::currentAddressBook() const { - if ( mCollectionView->selectionModel() && mCollectionView->selectionModel()->hasSelection() ) { - const QModelIndex index = mCollectionView->selectionModel()->selectedIndexes().first(); - const Akonadi::Collection collection = - index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); + if ( mCollectionView->selectionModel() && mCollectionView->selectionModel()->hasSelection() ) { + const QModelIndex index = mCollectionView->selectionModel()->selectedIndexes().first(); + const Akonadi::Collection collection = + index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - return collection; - } + return collection; + } - return Akonadi::Collection(); + return Akonadi::Collection(); } QAbstractItemModel *MainWidget::allContactsModel() { - if ( !mAllContactsModel ) { - KDescendantsProxyModel *descendantsModel = new KDescendantsProxyModel( this ); - descendantsModel->setSourceModel( GlobalContactModel::instance()->model() ); - - mAllContactsModel = new Akonadi::EntityMimeTypeFilterModel( this ); - mAllContactsModel->setSourceModel( descendantsModel ); - mAllContactsModel->addMimeTypeExclusionFilter( Akonadi::Collection::mimeType() ); - mAllContactsModel->setHeaderGroup( Akonadi::EntityTreeModel::ItemListHeaders ); - } + if ( !mAllContactsModel ) { + KDescendantsProxyModel *descendantsModel = new KDescendantsProxyModel( this ); + descendantsModel->setSourceModel( GlobalContactModel::instance()->model() ); + + mAllContactsModel = new Akonadi::EntityMimeTypeFilterModel( this ); + mAllContactsModel->setSourceModel( descendantsModel ); + mAllContactsModel->addMimeTypeExclusionFilter( Akonadi::Collection::mimeType() ); + mAllContactsModel->setHeaderGroup( Akonadi::EntityTreeModel::ItemListHeaders ); + } - return mAllContactsModel; + return mAllContactsModel; } void MainWidget::setViewMode( QAction *action ) { - setViewMode( action->data().toInt() ); + setViewMode( action->data().toInt() ); } void MainWidget::setViewMode( int mode ) { - int currentMode = Settings::self()->viewMode(); - //kDebug() << "cur" << currentMode << "new" << mode; - if ( mode == currentMode ) return; // nothing to do - - if ( mode == 0 ) { - mode = currentMode;// initialisation, no save - } else { - saveSplitterStates(); // for 2- or 3-column mode - } - if ( mode == 1 ) { // simple mode - mMainWidgetSplitter2->setVisible( false ); - mDetailsPane->setVisible( true ); - mContactSwitcher->setVisible( true ); - } - else { - mMainWidgetSplitter2->setVisible( true ); - mContactSwitcher->setVisible( false ); - - if ( mode == 2 ) { // 2 columns - mMainWidgetSplitter2->setOrientation( Qt::Vertical ); + int currentMode = Settings::self()->viewMode(); + //kDebug() << "cur" << currentMode << "new" << mode; + if ( mode == currentMode ) return; // nothing to do + + if ( mode == 0 ) { + mode = currentMode;// initialisation, no save + } else { + saveSplitterStates(); // for 2- or 3-column mode } - else if ( mode == 3 ) { // 3 columns - mMainWidgetSplitter2->setOrientation( Qt::Horizontal ); + if ( mode == 1 ) { // simple mode + mMainWidgetSplitter2->setVisible( false ); + mDetailsPane->setVisible( true ); + mContactSwitcher->setVisible( true ); + } + else { + mMainWidgetSplitter2->setVisible( true ); + mContactSwitcher->setVisible( false ); + + if ( mode == 2 ) { // 2 columns + mMainWidgetSplitter2->setOrientation( Qt::Vertical ); + } + else if ( mode == 3 ) { // 3 columns + mMainWidgetSplitter2->setOrientation( Qt::Horizontal ); + } } - } - Settings::self()->setViewMode( mode ); // save new mode in settings - restoreSplitterStates(); // restore state for new mode - mViewModeGroup->actions().at( mode-1 )->setChecked( true ); + Settings::self()->setViewMode( mode ); // save new mode in settings + restoreSplitterStates(); // restore state for new mode + mViewModeGroup->actions().at( mode-1 )->setChecked( true ); - if ( mItemView->model() ) { - mItemView->setCurrentIndex( mItemView->model()->index( 0, 0 ) ); - } + if ( mItemView->model() ) { + mItemView->setCurrentIndex( mItemView->model()->index( 0, 0 ) ); + } } void MainWidget::saveSplitterStates() const { - // The splitter states are saved separately for each column view mode, - // but only if not in simple mode (1 column). - int currentMode = Settings::self()->viewMode(); - if ( currentMode == 1 ) - return; - - QString groupName = QString::fromLatin1( "UiState_MainWidgetSplitter_%1" ).arg( currentMode ); - //kDebug() << "saving to group" << groupName; - KConfigGroup group( Settings::self()->config(), groupName ); - KPIM::UiStateSaver::saveState( mMainWidgetSplitter1, group ); - KPIM::UiStateSaver::saveState( mMainWidgetSplitter2, group ); + // The splitter states are saved separately for each column view mode, + // but only if not in simple mode (1 column). + int currentMode = Settings::self()->viewMode(); + if ( currentMode == 1 ) + return; + + QString groupName = QString::fromLatin1( "UiState_MainWidgetSplitter_%1" ).arg( currentMode ); + //kDebug() << "saving to group" << groupName; + KConfigGroup group( Settings::self()->config(), groupName ); + KPIM::UiStateSaver::saveState( mMainWidgetSplitter1, group ); + KPIM::UiStateSaver::saveState( mMainWidgetSplitter2, group ); } void MainWidget::restoreSplitterStates() { - // The splitter states are restored as appropriate for the current - // column view mode, but not for simple mode (1 column). - int currentMode = Settings::self()->viewMode(); - if ( currentMode == 1 ) - return; - - QString groupName = QString::fromLatin1( "UiState_MainWidgetSplitter_%1" ).arg( currentMode ); - //kDebug() << "restoring from group" << groupName; - KConfigGroup group( Settings::self()->config(), groupName ); - KPIM::UiStateSaver::restoreState( mMainWidgetSplitter1, group ); - KPIM::UiStateSaver::restoreState( mMainWidgetSplitter2, group ); + // The splitter states are restored as appropriate for the current + // column view mode, but not for simple mode (1 column). + int currentMode = Settings::self()->viewMode(); + if ( currentMode == 1 ) + return; + + QString groupName = QString::fromLatin1( "UiState_MainWidgetSplitter_%1" ).arg( currentMode ); + //kDebug() << "restoring from group" << groupName; + KConfigGroup group( Settings::self()->config(), groupName ); + KPIM::UiStateSaver::restoreState( mMainWidgetSplitter1, group ); + KPIM::UiStateSaver::restoreState( mMainWidgetSplitter2, group ); } void MainWidget::initGrantleeThemeName() { - QString themeName = GrantleeTheme::GrantleeSettings::self()->grantleeThemeName(); + QString themeName = GrantleeTheme::GrantleeSettings::self()->grantleeAddressBookThemeName(); if (themeName.isEmpty()) { themeName = QLatin1String("default"); } @@ -899,14 +902,14 @@ { initGrantleeThemeName(); if ( mItemView->model() ) { - mItemView->setCurrentIndex( mItemView->model()->index( 0, 0 ) ); + mItemView->setCurrentIndex( mItemView->model()->index( 0, 0 ) ); } } void MainWidget::slotGrantleeThemesUpdated() { if ( mItemView->model() ) { - mItemView->setCurrentIndex( mItemView->model()->index( 0, 0 ) ); + mItemView->setCurrentIndex( mItemView->model()->index( 0, 0 ) ); } } diff -Nru kdepim-4.13.0/kaddressbook/mainwidget.h kdepim-4.13.3/kaddressbook/mainwidget.h --- kdepim-4.13.0/kaddressbook/mainwidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/mainwidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -30,16 +30,16 @@ } class KAction; namespace Akonadi { - class Collection; - class ContactGroupViewer; - class ContactViewer; - class ContactsFilterProxyModel; - class EntityMimeTypeFilterModel; - class EntityTreeView; - class Item; - class ItemView; - class StandardContactActionManager; - class EntityTreeModel; +class Collection; +class ContactGroupViewer; +class ContactViewer; +class ContactsFilterProxyModel; +class EntityMimeTypeFilterModel; +class EntityTreeView; +class Item; +class ItemView; +class StandardContactActionManager; +class EntityTreeModel; } namespace KAddressBookGrantlee { @@ -62,16 +62,16 @@ class KADDRESSBOOK_EXPORT MainWidget : public QWidget { - Q_OBJECT + Q_OBJECT - public: +public: explicit MainWidget( KXMLGUIClient *guiClient, QWidget *parent = 0 ); ~MainWidget(); XXPortManager *importManager() const; void updateQuickSearchText(); - public Q_SLOTS: +public Q_SLOTS: void newContact(); void newGroup(); void print(); @@ -82,7 +82,7 @@ bool handleCommandLine(); - private Q_SLOTS: +private Q_SLOTS: void delayedInit(); void itemSelected( const Akonadi::Item &item ); diff -Nru kdepim-4.13.0/kaddressbook/mainwindow.cpp kdepim-4.13.3/kaddressbook/mainwindow.cpp --- kdepim-4.13.0/kaddressbook/mainwindow.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/mainwindow.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -31,21 +31,21 @@ #include MainWindow::MainWindow() - : KXmlGuiWindow( 0 ) + : KXmlGuiWindow( 0 ) { - mMainWidget = new MainWidget( this, this ); + mMainWidget = new MainWidget( this, this ); - setCentralWidget( mMainWidget ); + setCentralWidget( mMainWidget ); - initActions(); + initActions(); - setStandardToolBarMenuEnabled( true ); + setStandardToolBarMenuEnabled( true ); - toolBar()->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); + toolBar()->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); - setupGUI( Save | Create, QLatin1String("kaddressbookui.rc") ); + setupGUI( Save | Create, QLatin1String("kaddressbookui.rc") ); - setAutoSaveSettings(); + setAutoSaveSettings(); } MainWindow::~MainWindow() @@ -59,43 +59,43 @@ void MainWindow::initActions() { - KStandardAction::quit( this, SLOT(close()), actionCollection() ); + KStandardAction::quit( this, SLOT(close()), actionCollection() ); - KAction *action = - KStandardAction::keyBindings( this, SLOT(configureKeyBindings()), actionCollection() ); - action->setWhatsThis( - i18nc( "@info:whatsthis", - "You will be presented with a dialog where you can configure " - "the application-wide shortcuts." ) ); - KStandardAction::configureToolbars( this, SLOT(configureToolbars()), actionCollection() ); - KStandardAction::preferences( this, SLOT(configure()), actionCollection() ); + KAction *action = + KStandardAction::keyBindings( this, SLOT(configureKeyBindings()), actionCollection() ); + action->setWhatsThis( + i18nc( "@info:whatsthis", + "You will be presented with a dialog where you can configure " + "the application-wide shortcuts." ) ); + KStandardAction::configureToolbars( this, SLOT(configureToolbars()), actionCollection() ); + KStandardAction::preferences( this, SLOT(configure()), actionCollection() ); } void MainWindow::configure() { - mMainWidget->configure(); + mMainWidget->configure(); } void MainWindow::configureKeyBindings() { - if (KShortcutsDialog::configure( actionCollection(), KShortcutsEditor::LetterShortcutsAllowed, this )) { - mMainWidget->updateQuickSearchText(); - } + if (KShortcutsDialog::configure( actionCollection(), KShortcutsEditor::LetterShortcutsAllowed, this )) { + mMainWidget->updateQuickSearchText(); + } } void MainWindow::configureToolbars() { - saveMainWindowSettings( KGlobal::config()->group( "MainWindow" ) ); + saveMainWindowSettings( KGlobal::config()->group( "MainWindow" ) ); - KEditToolBar dlg( factory() ); - connect( &dlg, SIGNAL(newToolBarConfig()), this, SLOT(newToolbarConfig()) ); - dlg.exec(); + KEditToolBar dlg( factory() ); + connect( &dlg, SIGNAL(newToolBarConfig()), this, SLOT(newToolbarConfig()) ); + dlg.exec(); } void MainWindow::newToolbarConfig() { - createGUI( QLatin1String("kaddressbookui.rc") ); + createGUI( QLatin1String("kaddressbookui.rc") ); - applyMainWindowSettings( KGlobal::config()->group( "MainWindow" ) ); + applyMainWindowSettings( KGlobal::config()->group( "MainWindow" ) ); } diff -Nru kdepim-4.13.0/kaddressbook/mainwindow.h kdepim-4.13.3/kaddressbook/mainwindow.h --- kdepim-4.13.0/kaddressbook/mainwindow.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/mainwindow.h 2014-07-09 12:18:50.000000000 +0000 @@ -26,19 +26,19 @@ class MainWidget; class MainWindow : public KXmlGuiWindow { - Q_OBJECT + Q_OBJECT - public: +public: MainWindow(); ~MainWindow(); MainWidget *mainWidget() const; - private Q_SLOTS: +private Q_SLOTS: void configure(); void configureKeyBindings(); void configureToolbars(); void newToolbarConfig(); - private: +private: void initActions(); MainWidget *mMainWidget; diff -Nru kdepim-4.13.0/kaddressbook/modelcolumnmanager.cpp kdepim-4.13.3/kaddressbook/modelcolumnmanager.cpp --- kdepim-4.13.0/kaddressbook/modelcolumnmanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/modelcolumnmanager.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -33,177 +33,177 @@ #include ModelColumnManager::ModelColumnManager( Akonadi::ContactsTreeModel *model, QObject *parent ) - : QObject( parent ), mModel( model ), mWidget( 0 ) + : QObject( parent ), mModel( model ), mWidget( 0 ) { } void ModelColumnManager::load() { - const QList settingsColumns = Settings::contactModelColumns(); - Akonadi::ContactsTreeModel::Columns columns; + const QList settingsColumns = Settings::contactModelColumns(); + Akonadi::ContactsTreeModel::Columns columns; - foreach ( int column, settingsColumns ) { - columns.append( ( Akonadi::ContactsTreeModel::Column )column ); - } + foreach ( int column, settingsColumns ) { + columns.append( ( Akonadi::ContactsTreeModel::Column )column ); + } - mModel->setColumns( columns ); + mModel->setColumns( columns ); } void ModelColumnManager::store() { - const Akonadi::ContactsTreeModel::Columns columns = mModel->columns(); - QList settingsColumns; + const Akonadi::ContactsTreeModel::Columns columns = mModel->columns(); + QList settingsColumns; - foreach ( int column, columns ) { - settingsColumns.append( (int)column ); - } + foreach ( int column, columns ) { + settingsColumns.append( (int)column ); + } - Settings::setContactModelColumns( settingsColumns ); + Settings::setContactModelColumns( settingsColumns ); } void ModelColumnManager::setWidget( QWidget *widget ) { - mWidget = widget; - mWidget->installEventFilter( this ); + mWidget = widget; + mWidget->installEventFilter( this ); } bool ModelColumnManager::eventFilter( QObject *watched, QEvent *event ) { - if ( watched == mWidget ) { - if ( event->type() == QEvent::ContextMenu ) { - QMenu menu; - - Akonadi::ContactsTreeModel::Columns columns = mModel->columns(); - - QAction *fullNameAction = menu.addAction( i18n( "Full Name" ) ); - fullNameAction->setCheckable( true ); - fullNameAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::FullName ) ); - fullNameAction->setEnabled( false ); - - QAction *familyNameAction = menu.addAction( i18n( "Family Name" ) ); - familyNameAction->setCheckable( true ); - familyNameAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::FamilyName ) ); - - QAction *givenNameAction = menu.addAction( i18n( "Given Name" ) ); - givenNameAction->setCheckable( true ); - givenNameAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::GivenName ) ); - - QAction *birthdayAction = menu.addAction( KABC::Addressee::birthdayLabel() ); - birthdayAction->setCheckable( true ); - birthdayAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::Birthday ) ); - - QAction *homeAddressAction = menu.addAction( i18n( "Home Address" ) ); - homeAddressAction->setCheckable( true ); - homeAddressAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::HomeAddress ) ); - - QAction *businessAddressAction = menu.addAction( i18n( "Business Address" ) ); - businessAddressAction->setCheckable( true ); - businessAddressAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::BusinessAddress ) ); - - QAction *phoneNumbersAction = menu.addAction( i18n( "Phone Numbers" ) ); - phoneNumbersAction->setCheckable( true ); - phoneNumbersAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::PhoneNumbers ) ); - - QAction *preferredEmailAction = menu.addAction( i18n( "Preferred EMail" ) ); - preferredEmailAction->setCheckable( true ); - preferredEmailAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::PreferredEmail ) ); - - QAction *allEmailsAction = menu.addAction( i18n( "All EMails" ) ); - allEmailsAction->setCheckable( true ); - allEmailsAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::AllEmails ) ); - - QAction *organizationAction = menu.addAction( KABC::Addressee::organizationLabel() ); - organizationAction->setCheckable( true ); - organizationAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::Organization ) ); - - QAction *roleAction = menu.addAction( KABC::Addressee::roleLabel() ); - roleAction->setCheckable( true ); - roleAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::Role ) ); - - QAction *homepageAction = menu.addAction( KABC::Addressee::urlLabel() ); - homepageAction->setCheckable( true ); - homepageAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::Homepage ) ); - - QAction *noteAction = menu.addAction( KABC::Addressee::noteLabel() ); - noteAction->setCheckable( true ); - noteAction->setChecked( - columns.contains( Akonadi::ContactsTreeModel::Note ) ); - - if ( menu.exec( ( ( QContextMenuEvent * )event )->globalPos() ) ) { - Akonadi::ContactsTreeModel::Columns columns; - - if ( fullNameAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::FullName; - } - if ( familyNameAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::FamilyName; - } - if ( givenNameAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::GivenName; - } - if ( birthdayAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::Birthday; - } - if ( homeAddressAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::HomeAddress; - } - if ( businessAddressAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::BusinessAddress; + if ( watched == mWidget ) { + if ( event->type() == QEvent::ContextMenu ) { + QMenu menu; + + Akonadi::ContactsTreeModel::Columns columns = mModel->columns(); + + QAction *fullNameAction = menu.addAction( i18n( "Full Name" ) ); + fullNameAction->setCheckable( true ); + fullNameAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::FullName ) ); + fullNameAction->setEnabled( false ); + + QAction *familyNameAction = menu.addAction( i18n( "Family Name" ) ); + familyNameAction->setCheckable( true ); + familyNameAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::FamilyName ) ); + + QAction *givenNameAction = menu.addAction( i18n( "Given Name" ) ); + givenNameAction->setCheckable( true ); + givenNameAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::GivenName ) ); + + QAction *birthdayAction = menu.addAction( KABC::Addressee::birthdayLabel() ); + birthdayAction->setCheckable( true ); + birthdayAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::Birthday ) ); + + QAction *homeAddressAction = menu.addAction( i18n( "Home Address" ) ); + homeAddressAction->setCheckable( true ); + homeAddressAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::HomeAddress ) ); + + QAction *businessAddressAction = menu.addAction( i18n( "Business Address" ) ); + businessAddressAction->setCheckable( true ); + businessAddressAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::BusinessAddress ) ); + + QAction *phoneNumbersAction = menu.addAction( i18n( "Phone Numbers" ) ); + phoneNumbersAction->setCheckable( true ); + phoneNumbersAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::PhoneNumbers ) ); + + QAction *preferredEmailAction = menu.addAction( i18n( "Preferred EMail" ) ); + preferredEmailAction->setCheckable( true ); + preferredEmailAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::PreferredEmail ) ); + + QAction *allEmailsAction = menu.addAction( i18n( "All EMails" ) ); + allEmailsAction->setCheckable( true ); + allEmailsAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::AllEmails ) ); + + QAction *organizationAction = menu.addAction( KABC::Addressee::organizationLabel() ); + organizationAction->setCheckable( true ); + organizationAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::Organization ) ); + + QAction *roleAction = menu.addAction( KABC::Addressee::roleLabel() ); + roleAction->setCheckable( true ); + roleAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::Role ) ); + + QAction *homepageAction = menu.addAction( KABC::Addressee::urlLabel() ); + homepageAction->setCheckable( true ); + homepageAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::Homepage ) ); + + QAction *noteAction = menu.addAction( KABC::Addressee::noteLabel() ); + noteAction->setCheckable( true ); + noteAction->setChecked( + columns.contains( Akonadi::ContactsTreeModel::Note ) ); + + if ( menu.exec( ( ( QContextMenuEvent * )event )->globalPos() ) ) { + Akonadi::ContactsTreeModel::Columns columns; + + if ( fullNameAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::FullName; + } + if ( familyNameAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::FamilyName; + } + if ( givenNameAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::GivenName; + } + if ( birthdayAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::Birthday; + } + if ( homeAddressAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::HomeAddress; + } + if ( businessAddressAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::BusinessAddress; + } + if ( phoneNumbersAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::PhoneNumbers; + } + if ( preferredEmailAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::PreferredEmail; + } + if ( allEmailsAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::AllEmails; + } + if ( organizationAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::Organization; + } + if ( roleAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::Role; + } + if ( homepageAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::Homepage; + } + if ( noteAction->isChecked() ) { + columns << Akonadi::ContactsTreeModel::Note; + } + + mModel->setColumns( columns ); + QTimer::singleShot( 0, this, SLOT(adaptHeaderView()) ); + } + + return true; + } else { + return false; } - if ( phoneNumbersAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::PhoneNumbers; - } - if ( preferredEmailAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::PreferredEmail; - } - if ( allEmailsAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::AllEmails; - } - if ( organizationAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::Organization; - } - if ( roleAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::Role; - } - if ( homepageAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::Homepage; - } - if ( noteAction->isChecked() ) { - columns << Akonadi::ContactsTreeModel::Note; - } - - mModel->setColumns( columns ); - QTimer::singleShot( 0, this, SLOT(adaptHeaderView()) ); - } - - return true; - } else { - return false; } - } - return false; + return false; } void ModelColumnManager::adaptHeaderView() { - QHeaderView *view = qobject_cast( mWidget ); - if ( view ) { - view->resizeSections( QHeaderView::Stretch ); + QHeaderView *view = qobject_cast( mWidget ); + if ( view ) { + view->resizeSections( QHeaderView::Stretch ); - view->setDefaultAlignment( mModel->columns().count() == 1 ? Qt::AlignCenter : Qt::AlignLeft ); - } + view->setDefaultAlignment( mModel->columns().count() == 1 ? Qt::AlignCenter : Qt::AlignLeft ); + } } diff -Nru kdepim-4.13.0/kaddressbook/modelcolumnmanager.h kdepim-4.13.3/kaddressbook/modelcolumnmanager.h --- kdepim-4.13.0/kaddressbook/modelcolumnmanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/modelcolumnmanager.h 2014-07-09 12:18:50.000000000 +0000 @@ -38,8 +38,8 @@ */ class ModelColumnManager : public QObject { - Q_OBJECT - public: + Q_OBJECT +public: /** * Creates a new model column manager. * @@ -64,13 +64,13 @@ */ void setWidget( QWidget *view ); - protected: +protected: virtual bool eventFilter( QObject *watched, QEvent *event ); - private Q_SLOTS: +private Q_SLOTS: void adaptHeaderView(); - private: +private: Akonadi::ContactsTreeModel *mModel; Akonadi::ContactsTreeModel::Columns mColumns; QWidget *mWidget; diff -Nru kdepim-4.13.0/kaddressbook/printing/compact/compactstyle.cpp kdepim-4.13.3/kaddressbook/printing/compact/compactstyle.cpp --- kdepim-4.13.0/kaddressbook/printing/compact/compactstyle.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/compact/compactstyle.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -51,12 +51,12 @@ class CompactStyleForm : public QWidget, public Ui::CompactStyleForm_Base { - public: +public: explicit CompactStyleForm( QWidget *parent ) - : QWidget( parent ) + : QWidget( parent ) { - setObjectName( QLatin1String("AppearancePage") ); - setupUi( this ); + setObjectName( QLatin1String("AppearancePage") ); + setupUi( this ); } }; @@ -64,98 +64,98 @@ QString CompactStyle::contactsToHtml( const KABC::Addressee::List &contacts ) const { - // collect the fields are need to print - ContactFields::Fields fields; - fields << ContactFields::FormattedName; - if (this->withHomeAddress) { - fields << ContactFields::HomeAddressStreet - << ContactFields::HomeAddressPostalCode - << ContactFields::HomeAddressLocality - << ContactFields::HomePhone - << ContactFields::MobilePhone; - } - if (this->withBusinessAddress) { - fields << ContactFields::BusinessAddressStreet - << ContactFields::BusinessAddressPostalCode - << ContactFields::BusinessAddressLocality - << ContactFields::BusinessPhone; - } - if (this->withEMail) { - fields << ContactFields::PreferredEmail - << ContactFields::Email2; - } - if (this->withBirthday) { - fields << ContactFields::Birthday; - } - - QString content; - - content += QLatin1String("\n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - - bool odd = false; - foreach ( const KABC::Addressee &contact, contacts ) { - // get the values - QStringList values; - foreach ( const ContactFields::Field &field, fields ) { - // we need only values with content - QString value = ContactFields::value( field, contact ).trimmed(); - if ( value.size() > 0 ) { - values << value; - } - } - - content += QLatin1String(" \n"); - QString style = QLatin1String("background-color:"); - if ( this->withAlternating ) { - style += ( odd ) ? this->firstColor.name() : this->secondColor.name(); - } else { - style += QLatin1String("#ffffff"); - } - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - odd = !odd; - } - - content += QLatin1String("
") + values.join(QLatin1String("; ")) + QLatin1String("
\n"); - content += QLatin1String(" \n"); - content += QLatin1String("\n"); + // collect the fields are need to print + ContactFields::Fields fields; + fields << ContactFields::FormattedName; + if (this->withHomeAddress) { + fields << ContactFields::HomeAddressStreet + << ContactFields::HomeAddressPostalCode + << ContactFields::HomeAddressLocality + << ContactFields::HomePhone + << ContactFields::MobilePhone; + } + if (this->withBusinessAddress) { + fields << ContactFields::BusinessAddressStreet + << ContactFields::BusinessAddressPostalCode + << ContactFields::BusinessAddressLocality + << ContactFields::BusinessPhone; + } + if (this->withEMail) { + fields << ContactFields::PreferredEmail + << ContactFields::Email2; + } + if (this->withBirthday) { + fields << ContactFields::Birthday; + } + + QString content; + + content += QLatin1String("\n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + + bool odd = false; + foreach ( const KABC::Addressee &contact, contacts ) { + // get the values + QStringList values; + foreach ( const ContactFields::Field &field, fields ) { + // we need only values with content + QString value = ContactFields::value( field, contact ).trimmed(); + if ( value.size() > 0 ) { + values << value; + } + } + + content += QLatin1String(" \n"); + QString style = QLatin1String("background-color:"); + if ( this->withAlternating ) { + style += ( odd ) ? this->firstColor.name() : this->secondColor.name(); + } else { + style += QLatin1String("#ffffff"); + } + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + odd = !odd; + } + + content += QLatin1String("
") + values.join(QLatin1String("; ")) + QLatin1String("
\n"); + content += QLatin1String(" \n"); + content += QLatin1String("\n"); - return content; + return content; } CompactStyle::CompactStyle( PrintingWizard *parent ) - : PrintStyle( parent ), - mPageSettings( new CompactStyleForm( parent ) ) + : PrintStyle( parent ), + mPageSettings( new CompactStyleForm( parent ) ) { - setPreview( QLatin1String("compact-style.png") ); - setPreferredSortOptions( ContactFields::FormattedName, Qt::AscendingOrder ); + setPreview( QLatin1String("compact-style.png") ); + setPreferredSortOptions( ContactFields::FormattedName, Qt::AscendingOrder ); - addPage( mPageSettings, i18n( "Compact Style" ) ); + addPage( mPageSettings, i18n( "Compact Style" ) ); - connect( mPageSettings->cbAlternating, SIGNAL(clicked()), - this, SLOT(setAlternatingColors()) ); - - // set the controls, with the values in config - KConfigGroup config( KGlobal::config(), CompactStyleConfigSectionName ); - - withAlternating = config.readEntry( WithAlternating, true ); - withHomeAddress = config.readEntry( WithHomeAddress, true ); - withBusinessAddress = config.readEntry( WithBusinessAddress, false ); - withBirthday = config.readEntry( WithBirthday, true ); - withEMail = config.readEntry( WithEMail, true ); - - mPageSettings->cbFirst->setColor( config.readEntry( FirstColor, QColor( 220, 220, 220 ) ) ); - mPageSettings->cbSecond->setColor( config.readEntry( SecondColor, QColor( 255, 255, 255 ) ) ); - mPageSettings->cbAlternating->setChecked( withAlternating ); - mPageSettings->cbWithHomeAddress->setChecked( withHomeAddress ); - mPageSettings->cbWithBusinessAddress->setChecked( withBusinessAddress ); - mPageSettings->cbWithBirthday->setChecked( withBirthday ); - mPageSettings->cbWithEMail->setChecked( withEMail ); + connect( mPageSettings->cbAlternating, SIGNAL(clicked()), + this, SLOT(setAlternatingColors()) ); + + // set the controls, with the values in config + KConfigGroup config( KGlobal::config(), CompactStyleConfigSectionName ); + + withAlternating = config.readEntry( WithAlternating, true ); + withHomeAddress = config.readEntry( WithHomeAddress, true ); + withBusinessAddress = config.readEntry( WithBusinessAddress, false ); + withBirthday = config.readEntry( WithBirthday, true ); + withEMail = config.readEntry( WithEMail, true ); + + mPageSettings->cbFirst->setColor( config.readEntry( FirstColor, QColor( 220, 220, 220 ) ) ); + mPageSettings->cbSecond->setColor( config.readEntry( SecondColor, QColor( 255, 255, 255 ) ) ); + mPageSettings->cbAlternating->setChecked( withAlternating ); + mPageSettings->cbWithHomeAddress->setChecked( withHomeAddress ); + mPageSettings->cbWithBusinessAddress->setChecked( withBusinessAddress ); + mPageSettings->cbWithBirthday->setChecked( withBirthday ); + mPageSettings->cbWithEMail->setChecked( withEMail ); - // set up the color boxes - setAlternatingColors(); + // set up the color boxes + setAlternatingColors(); } CompactStyle::~CompactStyle() @@ -164,65 +164,65 @@ void CompactStyle::print( const KABC::Addressee::List &contacts, PrintProgress *progress ) { - // from UI to members - withAlternating = mPageSettings->cbAlternating->isChecked(); - firstColor = mPageSettings->cbFirst->color(); - secondColor = mPageSettings->cbSecond->color(); - withHomeAddress = mPageSettings->cbWithHomeAddress->isChecked(); - withBusinessAddress = mPageSettings->cbWithBusinessAddress->isChecked(); - withBirthday = mPageSettings->cbWithBirthday->isChecked(); - withEMail = mPageSettings->cbWithEMail->isChecked(); - - // to config - KConfigGroup config( KGlobal::config(), CompactStyleConfigSectionName ); - - config.writeEntry( WithAlternating, withAlternating ); - config.writeEntry( FirstColor, firstColor ); - config.writeEntry( SecondColor, secondColor ); - config.writeEntry( WithHomeAddress, withHomeAddress ); - config.writeEntry( WithBusinessAddress, withBusinessAddress ); - config.writeEntry( WithBirthday, withBirthday ); - config.writeEntry( WithEMail, withEMail ); - config.sync(); - - // print - QPrinter *printer = wizard()->printer(); - printer->setPageMargins( 20, 20, 20, 20, QPrinter::DevicePixel ); - - progress->addMessage( i18n( "Setting up document" ) ); - - const QString html = contactsToHtml( contacts ); + // from UI to members + withAlternating = mPageSettings->cbAlternating->isChecked(); + firstColor = mPageSettings->cbFirst->color(); + secondColor = mPageSettings->cbSecond->color(); + withHomeAddress = mPageSettings->cbWithHomeAddress->isChecked(); + withBusinessAddress = mPageSettings->cbWithBusinessAddress->isChecked(); + withBirthday = mPageSettings->cbWithBirthday->isChecked(); + withEMail = mPageSettings->cbWithEMail->isChecked(); + + // to config + KConfigGroup config( KGlobal::config(), CompactStyleConfigSectionName ); + + config.writeEntry( WithAlternating, withAlternating ); + config.writeEntry( FirstColor, firstColor ); + config.writeEntry( SecondColor, secondColor ); + config.writeEntry( WithHomeAddress, withHomeAddress ); + config.writeEntry( WithBusinessAddress, withBusinessAddress ); + config.writeEntry( WithBirthday, withBirthday ); + config.writeEntry( WithEMail, withEMail ); + config.sync(); + + // print + QPrinter *printer = wizard()->printer(); + printer->setPageMargins( 20, 20, 20, 20, QPrinter::DevicePixel ); + + progress->addMessage( i18n( "Setting up document" ) ); + + const QString html = contactsToHtml( contacts ); - QTextDocument document; - document.setHtml( html ); + QTextDocument document; + document.setHtml( html ); - progress->addMessage( i18n( "Printing" ) ); + progress->addMessage( i18n( "Printing" ) ); - document.print( printer ); + document.print( printer ); - progress->addMessage( i18nc( "Finished printing", "Done" ) ); + progress->addMessage( i18nc( "Finished printing", "Done" ) ); } void CompactStyle::setAlternatingColors() { - mPageSettings->cbFirst->setEnabled( mPageSettings->cbAlternating->isChecked() ); - mPageSettings->lbCbFirst->setEnabled( mPageSettings->cbAlternating->isChecked() ); - mPageSettings->cbSecond->setEnabled( mPageSettings->cbAlternating->isChecked() ); - mPageSettings->lbCbSecond->setEnabled( mPageSettings->cbAlternating->isChecked() ); + mPageSettings->cbFirst->setEnabled( mPageSettings->cbAlternating->isChecked() ); + mPageSettings->lbCbFirst->setEnabled( mPageSettings->cbAlternating->isChecked() ); + mPageSettings->cbSecond->setEnabled( mPageSettings->cbAlternating->isChecked() ); + mPageSettings->lbCbSecond->setEnabled( mPageSettings->cbAlternating->isChecked() ); } CompactStyleFactory::CompactStyleFactory( PrintingWizard *parent ) - : PrintStyleFactory( parent ) + : PrintStyleFactory( parent ) { } PrintStyle *CompactStyleFactory::create() const { - return new CompactStyle( mParent ); + return new CompactStyle( mParent ); } QString CompactStyleFactory::description() const { - return i18n( "Compact Printing Style" ); + return i18n( "Compact Printing Style" ); } diff -Nru kdepim-4.13.0/kaddressbook/printing/compact/compactstyle.h kdepim-4.13.3/kaddressbook/printing/compact/compactstyle.h --- kdepim-4.13.0/kaddressbook/printing/compact/compactstyle.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/compact/compactstyle.h 2014-07-09 12:18:50.000000000 +0000 @@ -32,9 +32,9 @@ class CompactStyle : public PrintStyle { - Q_OBJECT + Q_OBJECT - public: +public: explicit CompactStyle( PrintingWizard *parent ); ~CompactStyle(); @@ -43,7 +43,7 @@ */ void print( const KABC::Addressee::List &, PrintProgress * ); - private: +private: QString contactsToHtml( const KABC::Addressee::List &contacts ) const; CompactStyleForm *mPageSettings; @@ -59,7 +59,7 @@ QColor firstColor; QColor secondColor; - private Q_SLOTS: +private Q_SLOTS: /** * Enable or disable the controls for color selection. The colors * are needed for alternating background color of the rows. @@ -69,7 +69,7 @@ class CompactStyleFactory : public PrintStyleFactory { - public: +public: explicit CompactStyleFactory( PrintingWizard *parent ); PrintStyle *create() const; diff -Nru kdepim-4.13.0/kaddressbook/printing/detailled/detailledstyle.cpp kdepim-4.13.3/kaddressbook/printing/detailled/detailledstyle.cpp --- kdepim-4.13.0/kaddressbook/printing/detailled/detailledstyle.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/detailled/detailledstyle.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -55,221 +55,221 @@ struct ColorSettings { - QString headerTextColor; - QString headerBackgroundColor; + QString headerTextColor; + QString headerBackgroundColor; }; QString contactsToHtml( const KABC::Addressee::List &contacts, const ColorSettings &settings ) { - QString content; + QString content; - content += QLatin1String("\n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - foreach ( const KABC::Addressee &contact, contacts ) { - QString name = contact.realName(); - if ( !contact.title().isEmpty() || !contact.role().isEmpty() ) { - QStringList content; - if ( !contact.title().isEmpty() ) { - content << contact.title(); - } - if ( !contact.role().isEmpty() ) { - content << contact.role(); - } - name += QString::fromLatin1( " (%1)" ).arg( content.join( QLatin1String( ", " ) ) ); - } - - const QString birthday = KGlobal::locale()->formatDate( contact.birthday().date(), - KLocale::ShortDate ); - - ContactBlock::List blocks; - - if ( !contact.organization().isEmpty() ) { - ContactBlock block; - block.header = i18n( "Organization:" ); - block.entries.append( contact.organization() ); + content += QLatin1String("\n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + foreach ( const KABC::Addressee &contact, contacts ) { + QString name = contact.realName(); + if ( !contact.title().isEmpty() || !contact.role().isEmpty() ) { + QStringList content; + if ( !contact.title().isEmpty() ) { + content << contact.title(); + } + if ( !contact.role().isEmpty() ) { + content << contact.role(); + } + name += QString::fromLatin1( " (%1)" ).arg( content.join( QLatin1String( ", " ) ) ); + } - blocks.append( block ); - } + const QString birthday = KGlobal::locale()->formatDate( contact.birthday().date(), + KLocale::ShortDate ); - if ( !contact.emails().isEmpty() ) { - ContactBlock block; - block.header = ( contact.emails().count() == 1 ? - i18n( "Email address:" ) : - i18n( "Email addresses:" ) ); - block.entries = contact.emails(); + ContactBlock::List blocks; - blocks.append( block ); - } + if ( !contact.organization().isEmpty() ) { + ContactBlock block; + block.header = i18n( "Organization:" ); + block.entries.append( contact.organization() ); - if ( !contact.phoneNumbers().isEmpty() ) { - const KABC::PhoneNumber::List numbers = contact.phoneNumbers(); + blocks.append( block ); + } - ContactBlock block; - block.header = ( numbers.count() == 1 ? - i18n( "Telephone:" ) : - i18n( "Telephones:" ) ); - - foreach ( const KABC::PhoneNumber &number, numbers ) { - const QString line = number.typeLabel() + QLatin1String(": ") + number.number(); - block.entries.append( line ); - } + if ( !contact.emails().isEmpty() ) { + ContactBlock block; + block.header = ( contact.emails().count() == 1 ? + i18n( "Email address:" ) : + i18n( "Email addresses:" ) ); + block.entries = contact.emails(); - blocks.append( block ); - } + blocks.append( block ); + } - if ( contact.url().isValid() ) { - ContactBlock block; - block.header = i18n( "Web page:" ); - block.entries.append( contact.url().prettyUrl() ); + if ( !contact.phoneNumbers().isEmpty() ) { + const KABC::PhoneNumber::List numbers = contact.phoneNumbers(); - blocks.append( block ); - } + ContactBlock block; + block.header = ( numbers.count() == 1 ? + i18n( "Telephone:" ) : + i18n( "Telephones:" ) ); + + foreach ( const KABC::PhoneNumber &number, numbers ) { + const QString line = number.typeLabel() + QLatin1String(": ") + number.number(); + block.entries.append( line ); + } - if ( !contact.addresses().isEmpty() ) { - const KABC::Address::List addresses = contact.addresses(); + blocks.append( block ); + } - foreach ( const KABC::Address &address, addresses ) { - ContactBlock block; + if ( contact.url().isValid() ) { + ContactBlock block; + block.header = i18n( "Web page:" ); + block.entries.append( contact.url().prettyUrl() ); - switch ( address.type() ) { - case KABC::Address::Dom: - block.header = i18n( "Domestic Address" ); - break; - case KABC::Address::Intl: - block.header = i18n( "International Address" ); - break; - case KABC::Address::Postal: - block.header = i18n( "Postal Address" ); - break; - case KABC::Address::Parcel: - block.header = i18n( "Parcel Address" ); - break; - case KABC::Address::Home: - block.header = i18n( "Home Address" ); - break; - case KABC::Address::Work: - block.header = i18n( "Work Address" ); - break; - case KABC::Address::Pref: - default: - block.header = i18n( "Preferred Address" ); + blocks.append( block ); } - block.header += QLatin1Char(':'); - block.entries = address.formattedAddress().split( QLatin1Char('\n'), QString::KeepEmptyParts ); - blocks.append( block ); - } - } + if ( !contact.addresses().isEmpty() ) { + const KABC::Address::List addresses = contact.addresses(); - if ( !contact.note().isEmpty() ) { - ContactBlock block; - block.header = i18n( "Notes:" ); - block.entries = contact.note().split( QLatin1Char('\n'), QString::KeepEmptyParts ); + foreach ( const KABC::Address &address, addresses ) { + ContactBlock block; - blocks.append( block ); - } + switch ( address.type() ) { + case KABC::Address::Dom: + block.header = i18n( "Domestic Address" ); + break; + case KABC::Address::Intl: + block.header = i18n( "International Address" ); + break; + case KABC::Address::Postal: + block.header = i18n( "Postal Address" ); + break; + case KABC::Address::Parcel: + block.header = i18n( "Parcel Address" ); + break; + case KABC::Address::Home: + block.header = i18n( "Home Address" ); + break; + case KABC::Address::Work: + block.header = i18n( "Work Address" ); + break; + case KABC::Address::Pref: + default: + block.header = i18n( "Preferred Address" ); + } + block.header += QLatin1Char(':'); + + block.entries = address.formattedAddress().split( QLatin1Char('\n'), QString::KeepEmptyParts ); + blocks.append( block ); + } + } - // add header - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - - for ( int i = 0; i < blocks.count(); i += 2 ) { - // add empty line for spacing - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - - // add real block data - const ContactBlock leftBlock = blocks.at( i ); - const ContactBlock rightBlock = ( ( i + 1 < blocks.count() ) ? - blocks.at( i + 1 ) : - ContactBlock() ); - - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - - const int maxLines = qMax( leftBlock.entries.count(), rightBlock.entries.count() ); - for ( int j = 0; j < maxLines; ++j ) { - QString leftLine, rightLine; + if ( !contact.note().isEmpty() ) { + ContactBlock block; + block.header = i18n( "Notes:" ); + block.entries = contact.note().split( QLatin1Char('\n'), QString::KeepEmptyParts ); - if ( j < leftBlock.entries.count() ) { - leftLine = leftBlock.entries.at( j ); + blocks.append( block ); } - if ( j < rightBlock.entries.count() ) { - rightLine = rightBlock.entries.at( j ); + // add header + content += QLatin1String("
") + - name + QLatin1String("") + - birthday + QLatin1String("
  
") + leftBlock.header + QLatin1String("") + rightBlock.header + QLatin1String("
\n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + + for ( int i = 0; i < blocks.count(); i += 2 ) { + // add empty line for spacing + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + + // add real block data + const ContactBlock leftBlock = blocks.at( i ); + const ContactBlock rightBlock = ( ( i + 1 < blocks.count() ) ? + blocks.at( i + 1 ) : + ContactBlock() ); + + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + + const int maxLines = qMax( leftBlock.entries.count(), rightBlock.entries.count() ); + for ( int j = 0; j < maxLines; ++j ) { + QString leftLine, rightLine; + + if ( j < leftBlock.entries.count() ) { + leftLine = leftBlock.entries.at( j ); + } + + if ( j < rightBlock.entries.count() ) { + rightLine = rightBlock.entries.at( j ); + } + + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + } } + // add empty line for spacing content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); content += QLatin1String(" \n"); - } + content += QLatin1String("
") + + name + QLatin1String("") + + birthday + QLatin1String("
  
") + leftBlock.header + QLatin1String("") + rightBlock.header + QLatin1String("
") + leftLine + QLatin1String("") + rightLine + QLatin1String("
") + leftLine + QLatin1String("") + rightLine + QLatin1String("  
\n"); } + content += QLatin1String(" \n"); + content += QLatin1String("\n"); - // add empty line for spacing - content += QLatin1String(" \n"); - content += QLatin1String("  \n"); - content += QLatin1String("  \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - } - content += QLatin1String(" \n"); - content += QLatin1String("\n"); - - return content; + return content; } class KABPrinting::AppearancePage : public QWidget, public Ui::AppearancePage_Base { - public: +public: AppearancePage( QWidget *parent ) - : QWidget( parent ) - { - setupUi( this ); - setObjectName( QLatin1String("AppearancePage") ); - } + : QWidget( parent ) + { + setupUi( this ); + setObjectName( QLatin1String("AppearancePage") ); + } }; DetailledPrintStyle::DetailledPrintStyle( PrintingWizard *parent ) - : PrintStyle( parent ), mPageAppearance( new AppearancePage( parent ) ) + : PrintStyle( parent ), mPageAppearance( new AppearancePage( parent ) ) { - setPreview( QLatin1String("detailed-style.png") ); - setPreferredSortOptions( ContactFields::FormattedName, Qt::AscendingOrder ); + setPreview( QLatin1String("detailed-style.png") ); + setPreferredSortOptions( ContactFields::FormattedName, Qt::AscendingOrder ); - addPage( mPageAppearance, i18n( "Detailed Print Style - Appearance" ) ); + addPage( mPageAppearance, i18n( "Detailed Print Style - Appearance" ) ); - KConfigGroup config( KGlobal::config(), ConfigSectionName ); + KConfigGroup config( KGlobal::config(), ConfigSectionName ); - mPageAppearance->kcbHeaderBGColor-> - setColor( config.readEntry( ContactHeaderBGColor, QColor( Qt::black ) ) ); + mPageAppearance->kcbHeaderBGColor-> + setColor( config.readEntry( ContactHeaderBGColor, QColor( Qt::black ) ) ); - mPageAppearance->kcbHeaderTextColor-> - setColor( config.readEntry( ContactHeaderForeColor, QColor( Qt::white ) ) ); + mPageAppearance->kcbHeaderTextColor-> + setColor( config.readEntry( ContactHeaderForeColor, QColor( Qt::white ) ) ); - mPageAppearance->layout()->setMargin( KDialog::marginHint() ); - mPageAppearance->layout()->setSpacing( KDialog::spacingHint() ); + mPageAppearance->layout()->setMargin( KDialog::marginHint() ); + mPageAppearance->layout()->setSpacing( KDialog::spacingHint() ); } DetailledPrintStyle::~DetailledPrintStyle() @@ -278,49 +278,49 @@ void DetailledPrintStyle::print( const KABC::Addressee::List &contacts, PrintProgress *progress ) { - progress->addMessage( i18n( "Setting up colors" ) ); - progress->setProgress( 0 ); + progress->addMessage( i18n( "Setting up colors" ) ); + progress->setProgress( 0 ); - const QColor headerBackgroundColor = mPageAppearance->kcbHeaderBGColor->color(); - const QColor headerForegroundColor = mPageAppearance->kcbHeaderTextColor->color(); + const QColor headerBackgroundColor = mPageAppearance->kcbHeaderBGColor->color(); + const QColor headerForegroundColor = mPageAppearance->kcbHeaderTextColor->color(); - KConfigGroup config( KGlobal::config(), ConfigSectionName ); - config.writeEntry( ContactHeaderForeColor, headerForegroundColor ); - config.writeEntry( ContactHeaderBGColor, headerBackgroundColor ); - config.sync(); + KConfigGroup config( KGlobal::config(), ConfigSectionName ); + config.writeEntry( ContactHeaderForeColor, headerForegroundColor ); + config.writeEntry( ContactHeaderBGColor, headerBackgroundColor ); + config.sync(); - ColorSettings settings; - settings.headerBackgroundColor = headerBackgroundColor.name(); - settings.headerTextColor = headerForegroundColor.name(); + ColorSettings settings; + settings.headerBackgroundColor = headerBackgroundColor.name(); + settings.headerTextColor = headerForegroundColor.name(); - QPrinter *printer = wizard()->printer(); + QPrinter *printer = wizard()->printer(); - progress->addMessage( i18n( "Setting up document" ) ); + progress->addMessage( i18n( "Setting up document" ) ); - const QString html = contactsToHtml( contacts, settings ); + const QString html = contactsToHtml( contacts, settings ); - QTextDocument document; - document.setHtml( html ); + QTextDocument document; + document.setHtml( html ); - progress->addMessage( i18n( "Printing" ) ); + progress->addMessage( i18n( "Printing" ) ); - document.print( printer ); + document.print( printer ); - progress->addMessage( i18nc( "Finished printing", "Done" ) ); + progress->addMessage( i18nc( "Finished printing", "Done" ) ); } DetailledPrintStyleFactory::DetailledPrintStyleFactory( PrintingWizard *parent ) - : PrintStyleFactory( parent ) + : PrintStyleFactory( parent ) { } PrintStyle *DetailledPrintStyleFactory::create() const { - return new DetailledPrintStyle( mParent ); + return new DetailledPrintStyle( mParent ); } QString DetailledPrintStyleFactory::description() const { - return i18n( "Detailed Style" ); + return i18n( "Detailed Style" ); } diff -Nru kdepim-4.13.0/kaddressbook/printing/detailled/detailledstyle.h kdepim-4.13.3/kaddressbook/printing/detailled/detailledstyle.h --- kdepim-4.13.0/kaddressbook/printing/detailled/detailledstyle.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/detailled/detailledstyle.h 2014-07-09 12:18:50.000000000 +0000 @@ -34,21 +34,21 @@ class DetailledPrintStyle : public PrintStyle { - Q_OBJECT + Q_OBJECT - public: +public: explicit DetailledPrintStyle( PrintingWizard *parent ); ~DetailledPrintStyle(); void print( const KABC::Addressee::List &contacts, PrintProgress * ); - private: +private: AppearancePage *mPageAppearance; }; class DetailledPrintStyleFactory : public PrintStyleFactory { - public: +public: explicit DetailledPrintStyleFactory( PrintingWizard *parent ); PrintStyle *create() const; diff -Nru kdepim-4.13.0/kaddressbook/printing/grantlee/themes/big-theme-example/theme.desktop kdepim-4.13.3/kaddressbook/printing/grantlee/themes/big-theme-example/theme.desktop --- kdepim-4.13.0/kaddressbook/printing/grantlee/themes/big-theme-example/theme.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/grantlee/themes/big-theme-example/theme.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=Eksempel på stor overskrift Name[de]=Beispiel mit großem Titel Name[el]=Παράδειγμα μεγάλου τίτλου +Name[en_GB]=Example big title Name[es]=Ejemplo de título grande +Name[et]=Suure pealkirja näidis Name[fi]=Esimerkki isosta otsikosta Name[fr]=Exemple avec grand titre Name[gl]=Exemplo de título grande @@ -38,7 +40,9 @@ Description[da]=Eksempel grantlee udskriftstema med stor overskrift Description[de]=Beispiel für Grantlee-Druckstil mit großem Titel Description[el]=Παράδειγμα μεγάλου τίτλου θέματος εκτύπωσης grantlee +Description[en_GB]=Example big title grantlee printing theme Description[es]=Ejemplo de título grande de tema de impresión grantlee +Description[et]=Suure pealkirjaga grantlee trükkimisteema näidis Description[fi]=Esimerkki ison otsikon sisältävästä Grantlee-tulostusteemasta Description[fr]=Thème d'impression Grantlee avec un grand titre Description[gl]=Tema de impresión de grantlee de exemplo de título grande diff -Nru kdepim-4.13.0/kaddressbook/printing/grantlee/themes/default/theme.desktop kdepim-4.13.3/kaddressbook/printing/grantlee/themes/default/theme.desktop --- kdepim-4.13.0/kaddressbook/printing/grantlee/themes/default/theme.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/grantlee/themes/default/theme.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -28,6 +28,7 @@ Name[ia]=Predefinite Name[is]=Sjálfgefið Name[it]=Predefinito +Name[ja]=標準 Name[ka]=ნაგულისხმევი Name[kk]=Әдетті Name[lv]=Noklusētais @@ -73,7 +74,9 @@ Description[da]=Standard grantlee udskriftstema Description[de]=Grantlee-Standarddruckstil Description[el]=Προκαθορισμένο θέμα εκτύπωσης grantlee +Description[en_GB]=Default grantlee printing theme Description[es]=Tema de impresión predeterminado de grantlee +Description[et]=Grantlee vaikimisi trükkimisteema Description[fi]=Grantleen oletustulostusteema Description[fr]=Thème d'impression Grantlee par défaut Description[gl]=Tema de impresión do grantlee por omisión diff -Nru kdepim-4.13.0/kaddressbook/printing/mike/mikesstyle.cpp kdepim-4.13.3/kaddressbook/printing/mike/mikesstyle.cpp --- kdepim-4.13.0/kaddressbook/printing/mike/mikesstyle.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/mike/mikesstyle.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -41,80 +41,80 @@ static QString contactsToHtml( const KABC::Addressee::List &contacts ) { - QString content; + QString content; - ContactFields::Fields leftFields, rightFields; - ContactFields::Fields allFields = ContactFields::allFields(); - allFields.remove( 0 ); // drop 'Undefined' field + ContactFields::Fields leftFields, rightFields; + ContactFields::Fields allFields = ContactFields::allFields(); + allFields.remove( 0 ); // drop 'Undefined' field - const int middle = allFields.count() / 2; + const int middle = allFields.count() / 2; - for ( int i = 0; i < middle; ++i ) { - leftFields.append( allFields.at( i ) ); - } - - for ( int i = middle; i < allFields.count(); ++i ) { - rightFields.append( allFields.at( i ) ); - } - - int counter = 0; - content += QLatin1String("\n"); - content += QLatin1String(" \n"); - foreach ( const KABC::Addressee &contact, contacts ) { - const int max = qMax( leftFields.count(), rightFields.count() ); - - const QString name = contact.realName(); + for ( int i = 0; i < middle; ++i ) { + leftFields.append( allFields.at( i ) ); + } - if ( counter % 2 ) { - content += QLatin1String("

\n"); + for ( int i = middle; i < allFields.count(); ++i ) { + rightFields.append( allFields.at( i ) ); } - // start a new page after every second table - const QString pageBreak = ( ( counter % 2 ) ? QLatin1String("page-break-after: always;" ): QString() ); + int counter = 0; + content += QLatin1String("\n"); + content += QLatin1String(" \n"); + foreach ( const KABC::Addressee &contact, contacts ) { + const int max = qMax( leftFields.count(), rightFields.count() ); + + const QString name = contact.realName(); + + if ( counter % 2 ) { + content += QLatin1String("

\n"); + } + + // start a new page after every second table + const QString pageBreak = ( ( counter % 2 ) ? QLatin1String("page-break-after: always;" ): QString() ); + + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + + for ( int i = 0; i < max; i ++ ) { + QString leftTitle, leftValue, rightTitle, rightValue; + + if ( i < leftFields.count() ) { + leftTitle = ContactFields::label( leftFields.at( i ) ) + QLatin1Char(':'); + leftTitle = leftTitle.replace( QLatin1Char(' '), QLatin1String(" ") ); + leftValue = ContactFields::value( leftFields.at( i ), contact ); + } + + if ( i < rightFields.count() ) { + rightTitle = ContactFields::label( rightFields.at( i ) ) + QLatin1Char(':'); + rightTitle = rightTitle.replace( QLatin1Char(' '), QLatin1String(" ") ); + rightValue = ContactFields::value( rightFields.at( i ), contact ); + } + + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + } + content += QLatin1String("
") + name + QLatin1String("
") + leftTitle + QLatin1String("") + leftValue + QLatin1String("") + rightTitle + QLatin1String("") + rightValue + QLatin1String("
\n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - - for ( int i = 0; i < max; i ++ ) { - QString leftTitle, leftValue, rightTitle, rightValue; - - if ( i < leftFields.count() ) { - leftTitle = ContactFields::label( leftFields.at( i ) ) + QLatin1Char(':'); - leftTitle = leftTitle.replace( QLatin1Char(' '), QLatin1String(" ") ); - leftValue = ContactFields::value( leftFields.at( i ), contact ); - } - - if ( i < rightFields.count() ) { - rightTitle = ContactFields::label( rightFields.at( i ) ) + QLatin1Char(':'); - rightTitle = rightTitle.replace( QLatin1Char(' '), QLatin1String(" ") ); - rightValue = ContactFields::value( rightFields.at( i ), contact ); - } - - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); + counter++; } - content += QLatin1String("
") + name + QLatin1String("
") + leftTitle + QLatin1String("") + leftValue + QLatin1String("") + rightTitle + QLatin1String("") + rightValue + QLatin1String("
\n"); - - counter++; - } - content += QLatin1String(" \n"); - content += QLatin1String("\n"); + content += QLatin1String(" \n"); + content += QLatin1String("\n"); - return content; + return content; } MikesStyle::MikesStyle( PrintingWizard *parent ) - : PrintStyle( parent ) + : PrintStyle( parent ) { - setPreview( QLatin1String("mike-style.png") ); - setPreferredSortOptions( ContactFields::FormattedName, Qt::AscendingOrder ); + setPreview( QLatin1String("mike-style.png") ); + setPreferredSortOptions( ContactFields::FormattedName, Qt::AscendingOrder ); } MikesStyle::~MikesStyle() @@ -123,35 +123,35 @@ void MikesStyle::print( const KABC::Addressee::List &contacts, PrintProgress *progress ) { - QPrinter *printer = wizard()->printer(); - printer->setPageMargins( 20, 20, 20, 20, QPrinter::DevicePixel ); + QPrinter *printer = wizard()->printer(); + printer->setPageMargins( 20, 20, 20, 20, QPrinter::DevicePixel ); - progress->addMessage( i18n( "Setting up document" ) ); + progress->addMessage( i18n( "Setting up document" ) ); - const QString html = contactsToHtml( contacts ); + const QString html = contactsToHtml( contacts ); - QTextDocument document; - document.setHtml( html ); + QTextDocument document; + document.setHtml( html ); - progress->addMessage( i18n( "Printing" ) ); + progress->addMessage( i18n( "Printing" ) ); - document.print( printer ); + document.print( printer ); - progress->addMessage( i18nc( "Finished printing", "Done" ) ); + progress->addMessage( i18nc( "Finished printing", "Done" ) ); } MikesStyleFactory::MikesStyleFactory( PrintingWizard *parent ) - : PrintStyleFactory( parent ) + : PrintStyleFactory( parent ) { } PrintStyle *MikesStyleFactory::create() const { - return new MikesStyle( mParent ); + return new MikesStyle( mParent ); } QString MikesStyleFactory::description() const { - return i18n( "Mike's Printing Style" ); + return i18n( "Mike's Printing Style" ); } diff -Nru kdepim-4.13.0/kaddressbook/printing/mike/mikesstyle.h kdepim-4.13.3/kaddressbook/printing/mike/mikesstyle.h --- kdepim-4.13.0/kaddressbook/printing/mike/mikesstyle.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/mike/mikesstyle.h 2014-07-09 12:18:50.000000000 +0000 @@ -34,9 +34,9 @@ class MikesStyle : public PrintStyle { - Q_OBJECT + Q_OBJECT - public: +public: explicit MikesStyle( PrintingWizard *parent ); ~MikesStyle(); @@ -45,7 +45,7 @@ class MikesStyleFactory : public PrintStyleFactory { - public: +public: explicit MikesStyleFactory( PrintingWizard *parent ); PrintStyle *create() const; diff -Nru kdepim-4.13.0/kaddressbook/printing/printingwizard.cpp kdepim-4.13.3/kaddressbook/printing/printingwizard.cpp --- kdepim-4.13.0/kaddressbook/printing/printingwizard.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/printingwizard.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -54,34 +54,34 @@ PrintingWizard::PrintingWizard( QPrinter *printer, QItemSelectionModel *selectionModel, QWidget *parent ) - : KAssistantDialog( parent ), mPrinter( printer ), mStyle( 0 ) + : KAssistantDialog( parent ), mPrinter( printer ), mStyle( 0 ) { - setCaption( i18n( "Print Contacts" ) ); - showButton( Help, false ); + setCaption( i18n( "Print Contacts" ) ); + showButton( Help, false ); - mSelectionPage = new ContactSelectionWidget( selectionModel, this ); - mSelectionPage->setMessageText( i18n( "Which contacts do you want to print?" ) ); + mSelectionPage = new ContactSelectionWidget( selectionModel, this ); + mSelectionPage->setMessageText( i18n( "Which contacts do you want to print?" ) ); - KPageWidgetItem *mSelectionPageItem = - new KPageWidgetItem( mSelectionPage, i18n( "Choose Contacts to Print" ) ); - addPage( mSelectionPageItem ); - setAppropriate( mSelectionPageItem, true ); - - mStylePage = new StylePage( this ); - connect( mStylePage, SIGNAL(styleChanged(int)), SLOT(slotStyleSelected(int)) ); - addPage( mStylePage, i18n( "Choose Printing Style" ) ); - - registerStyles(); - - if ( mStyleFactories.count() > Settings::self()->printingStyle() ) { - mStylePage->setPrintingStyle( Settings::self()->printingStyle() ); // should emit styleChanged - slotStyleSelected( Settings::self()->printingStyle() ); - } - - mStylePage->setSortOrder( Settings::self()->sortOrder() == 0 ? - Qt::AscendingOrder : - Qt::DescendingOrder ); - readConfig(); + KPageWidgetItem *mSelectionPageItem = + new KPageWidgetItem( mSelectionPage, i18n( "Choose Contacts to Print" ) ); + addPage( mSelectionPageItem ); + setAppropriate( mSelectionPageItem, true ); + + mStylePage = new StylePage( this ); + connect( mStylePage, SIGNAL(styleChanged(int)), SLOT(slotStyleSelected(int)) ); + addPage( mStylePage, i18n( "Choose Printing Style" ) ); + + registerStyles(); + + if ( mStyleFactories.count() > Settings::self()->printingStyle() ) { + mStylePage->setPrintingStyle( Settings::self()->printingStyle() ); // should emit styleChanged + slotStyleSelected( Settings::self()->printingStyle() ); + } + + mStylePage->setSortOrder( Settings::self()->sortOrder() == 0 ? + Qt::AscendingOrder : + Qt::DescendingOrder ); + readConfig(); } PrintingWizard::~PrintingWizard() @@ -107,14 +107,14 @@ void PrintingWizard::setDefaultAddressBook( const Akonadi::Collection &addressBook ) { - mSelectionPage->setDefaultAddressBook( addressBook ); + mSelectionPage->setDefaultAddressBook( addressBook ); } void PrintingWizard::accept() { - print(); - close(); - setResult(QDialog::Accepted); + print(); + close(); + setResult(QDialog::Accepted); } void PrintingWizard::loadGrantleeStyle() @@ -160,79 +160,79 @@ void PrintingWizard::registerStyles() { - mStyleFactories.append( new DetailledPrintStyleFactory( this ) ); - mStyleFactories.append( new MikesStyleFactory( this ) ); - mStyleFactories.append( new RingBinderPrintStyleFactory( this ) ); - mStyleFactories.append( new CompactStyleFactory( this ) ); - - loadGrantleeStyle(); - - mStylePage->clearStyleNames(); - for ( int i = 0; i < mStyleFactories.count(); ++i ) { - mStylePage->addStyleName( mStyleFactories.at( i )->description() ); - } + mStyleFactories.append( new DetailledPrintStyleFactory( this ) ); + mStyleFactories.append( new MikesStyleFactory( this ) ); + mStyleFactories.append( new RingBinderPrintStyleFactory( this ) ); + mStyleFactories.append( new CompactStyleFactory( this ) ); + + loadGrantleeStyle(); + + mStylePage->clearStyleNames(); + for ( int i = 0; i < mStyleFactories.count(); ++i ) { + mStylePage->addStyleName( mStyleFactories.at( i )->description() ); + } } void PrintingWizard::slotStyleSelected( int index ) { - if ( index < 0 || index >= mStyleFactories.count() ) { - return; - } + if ( index < 0 || index >= mStyleFactories.count() ) { + return; + } - if ( mStyle ) { - mStyle->hidePages(); - } + if ( mStyle ) { + mStyle->hidePages(); + } - mStyle = mStyleList.value( index ); - if ( !mStyle ) { - PrintStyleFactory *factory = mStyleFactories.at( index ); - kDebug() << "creating print style" << factory->description(); + mStyle = mStyleList.value( index ); + if ( !mStyle ) { + PrintStyleFactory *factory = mStyleFactories.at( index ); + kDebug() << "creating print style" << factory->description(); - mStyle = factory->create(); - mStyleList.insert( index, mStyle ); - } + mStyle = factory->create(); + mStyleList.insert( index, mStyle ); + } - mStyle->showPages(); + mStyle->showPages(); - mStylePage->setPreview( mStyle->preview() ); + mStylePage->setPreview( mStyle->preview() ); - mStylePage->setSortField( mStyle->preferredSortField() ); - mStylePage->setSortOrder( mStyle->preferredSortOrder() ); + mStylePage->setSortField( mStyle->preferredSortField() ); + mStylePage->setSortOrder( mStyle->preferredSortOrder() ); } QPrinter *PrintingWizard::printer() { - return mPrinter; + return mPrinter; } int PrintingWizard::printingStyle() const { - return mStylePage->printingStyle(); + return mStylePage->printingStyle(); } int PrintingWizard::sortOrder() const { - return mStylePage->sortOrder(); + return mStylePage->sortOrder(); } void PrintingWizard::print() { - // create and show print progress widget: - mProgress = new PrintProgress( this ); - KPageWidgetItem *progressItem = new KPageWidgetItem( mProgress, i18n( "Print Progress" ) ); - addPage( progressItem ); - setCurrentPage( progressItem ); - kapp->processEvents(); - - KABC::Addressee::List contacts = mSelectionPage->selectedContacts(); - - const ContactSorter sorter( mStylePage->sortField(), mStylePage->sortOrder() ); - sorter.sort( contacts ); - - kDebug() <<"printing" << contacts.count() << "contacts."; - // ... print: - enableButton( KDialog::User3, false ); // back button - enableButton( KDialog::Cancel, false ); - mStyle->print( contacts, mProgress ); + // create and show print progress widget: + mProgress = new PrintProgress( this ); + KPageWidgetItem *progressItem = new KPageWidgetItem( mProgress, i18n( "Print Progress" ) ); + addPage( progressItem ); + setCurrentPage( progressItem ); + kapp->processEvents(); + + KABC::Addressee::List contacts = mSelectionPage->selectedContacts(); + + const ContactSorter sorter( mStylePage->sortField(), mStylePage->sortOrder() ); + sorter.sort( contacts ); + + kDebug() <<"printing" << contacts.count() << "contacts."; + // ... print: + enableButton( KDialog::User3, false ); // back button + enableButton( KDialog::Cancel, false ); + mStyle->print( contacts, mProgress ); } diff -Nru kdepim-4.13.0/kaddressbook/printing/printingwizard.h kdepim-4.13.3/kaddressbook/printing/printingwizard.h --- kdepim-4.13.0/kaddressbook/printing/printingwizard.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/printingwizard.h 2014-07-09 12:18:50.000000000 +0000 @@ -39,7 +39,7 @@ class QPrinter; namespace Akonadi { - class Collection; +class Collection; } namespace KABPrinting { @@ -54,9 +54,9 @@ */ class PrintingWizard : public KAssistantDialog { - Q_OBJECT + Q_OBJECT - public: +public: /** * Creates a new printing wizard. * @@ -103,14 +103,14 @@ */ int sortOrder() const; - protected Q_SLOTS: +protected Q_SLOTS: /** * A print style has been selected. The argument is the index * in the cbStyle combo and in styles. */ void slotStyleSelected(int); - protected: +protected: QList mStyleFactories; QList mStyleList; QPrinter *mPrinter; diff -Nru kdepim-4.13.0/kaddressbook/printing/printprogress.cpp kdepim-4.13.3/kaddressbook/printing/printprogress.cpp --- kdepim-4.13.0/kaddressbook/printing/printprogress.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/printprogress.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -35,23 +35,23 @@ using namespace KABPrinting; PrintProgress::PrintProgress( QWidget *parent, const char *name ) - : QWidget( parent ) + : QWidget( parent ) { - setObjectName( QLatin1String(name) ); - setWindowTitle( i18n( "Printing: Progress" ) ); + setObjectName( QLatin1String(name) ); + setWindowTitle( i18n( "Printing: Progress" ) ); - QGridLayout *topLayout = new QGridLayout( this ); - topLayout->setSpacing( KDialog::spacingHint() ); - topLayout->setMargin( KDialog::marginHint() ); + QGridLayout *topLayout = new QGridLayout( this ); + topLayout->setSpacing( KDialog::spacingHint() ); + topLayout->setMargin( KDialog::marginHint() ); - mLogBrowser = new KTextBrowser( this ); - topLayout->addWidget( mLogBrowser, 0, 0 ); + mLogBrowser = new KTextBrowser( this ); + topLayout->addWidget( mLogBrowser, 0, 0 ); - mProgressBar = new QProgressBar( this ); - mProgressBar->setValue( 0 ); - topLayout->addWidget( mProgressBar, 1, 0 ); + mProgressBar = new QProgressBar( this ); + mProgressBar->setValue( 0 ); + topLayout->addWidget( mProgressBar, 1, 0 ); - resize( QSize( 370, 220 ).expandedTo( minimumSizeHint() ) ); + resize( QSize( 370, 220 ).expandedTo( minimumSizeHint() ) ); } PrintProgress::~PrintProgress() @@ -60,27 +60,27 @@ void PrintProgress::addMessage( const QString &msg ) { - mMessages.append( msg ); + mMessages.append( msg ); - QString head = QLatin1String( "" ) + i18n( "Progress" ) + - QLatin1String( ":
    " ); + QString head = QLatin1String( "" ) + i18n( "Progress" ) + + QLatin1String( ":
      " ); - QString foot = QLatin1String( "
    " ); + QString foot = QLatin1String( "
" ); - QString body; - QStringList::ConstIterator it; - QStringList::ConstIterator end(mMessages.constEnd()); - for ( it = mMessages.constBegin(); it != end; ++it ) { - body.append( QLatin1String( "
  • " ) + (*it) + QLatin1String( "
  • " ) ); - } + QString body; + QStringList::ConstIterator it; + QStringList::ConstIterator end(mMessages.constEnd()); + for ( it = mMessages.constBegin(); it != end; ++it ) { + body.append( QLatin1String( "
  • " ) + (*it) + QLatin1String( "
  • " ) ); + } - mLogBrowser->setText( head + body + foot ); - kapp->processEvents(); + mLogBrowser->setText( head + body + foot ); + kapp->processEvents(); } void PrintProgress::setProgress( int step ) { - mProgressBar->setValue( step ); - kapp->processEvents(); + mProgressBar->setValue( step ); + kapp->processEvents(); } diff -Nru kdepim-4.13.0/kaddressbook/printing/printprogress.h kdepim-4.13.3/kaddressbook/printing/printprogress.h --- kdepim-4.13.0/kaddressbook/printing/printprogress.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/printprogress.h 2014-07-09 12:18:50.000000000 +0000 @@ -40,9 +40,9 @@ */ class PrintProgress : public QWidget { - Q_OBJECT + Q_OBJECT - public: +public: explicit PrintProgress( QWidget *parent, const char *name = 0 ); ~PrintProgress(); @@ -56,7 +56,7 @@ */ void setProgress( int ); - private: +private: QStringList mMessages; KTextBrowser *mLogBrowser; diff -Nru kdepim-4.13.0/kaddressbook/printing/printstyle.cpp kdepim-4.13.3/kaddressbook/printing/printstyle.cpp --- kdepim-4.13.0/kaddressbook/printing/printstyle.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/printstyle.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -33,10 +33,10 @@ using namespace KABPrinting; PrintStyle::PrintStyle( PrintingWizard *parent ) - : QObject( parent ), mWizard( parent ) + : QObject( parent ), mWizard( parent ) { - mSortField = ContactFields::GivenName; - mSortOrder = Qt::AscendingOrder; + mSortField = ContactFields::GivenName; + mSortOrder = Qt::AscendingOrder; } PrintStyle::~PrintStyle() @@ -45,88 +45,88 @@ const QPixmap &PrintStyle::preview() const { - return mPreview; + return mPreview; } void PrintStyle::setPreview( const QPixmap &image ) { - mPreview = image; + mPreview = image; } bool PrintStyle::setPreview( const QString &fileName ) { - QPixmap preview; + QPixmap preview; - const QString path = KStandardDirs::locate( "data", QLatin1String("kaddressbook/printing/") + fileName ); - if ( path.isEmpty() ) { - kDebug() << "cannot locate preview image " << fileName << " in appdata"; - return false; - } else { - if ( preview.load( path ) ) { - setPreview( preview ); - return true; + const QString path = KStandardDirs::locate( "data", QLatin1String("kaddressbook/printing/") + fileName ); + if ( path.isEmpty() ) { + kDebug() << "cannot locate preview image " << fileName << " in appdata"; + return false; } else { - kDebug() << "preview at '" << path <<"' cannot be loaded."; - return false; + if ( preview.load( path ) ) { + setPreview( preview ); + return true; + } else { + kDebug() << "preview at '" << path <<"' cannot be loaded."; + return false; + } } - } } PrintingWizard *PrintStyle::wizard() const { - return mWizard; + return mWizard; } void PrintStyle::addPage( QWidget *page, const QString &title ) { - if ( mPageList.indexOf( page ) == -1 ) { // not yet in the list - mPageList.append( page ); - mPageTitles.append( title ); - - KPageWidgetItem *item = new KPageWidgetItem( page, title ); - mPageItems.insert( page, item ); - mWizard->addPage( item ); - mWizard->setAppropriate( item, false ); - } + if ( mPageList.indexOf( page ) == -1 ) { // not yet in the list + mPageList.append( page ); + mPageTitles.append( title ); + + KPageWidgetItem *item = new KPageWidgetItem( page, title ); + mPageItems.insert( page, item ); + mWizard->addPage( item ); + mWizard->setAppropriate( item, false ); + } } void PrintStyle::showPages() { - QWidget *wdg = 0; + QWidget *wdg = 0; - Q_FOREACH ( wdg, mPageList ) { - mWizard->setAppropriate( mPageItems[ wdg ], true ); - } + Q_FOREACH ( wdg, mPageList ) { + mWizard->setAppropriate( mPageItems[ wdg ], true ); + } - mWizard->enableButton( KDialog::User2, wdg ); // next button - mWizard->enableButton( KDialog::User1, !wdg ); // finish button + mWizard->enableButton( KDialog::User2, wdg ); // next button + mWizard->enableButton( KDialog::User1, !wdg ); // finish button } void PrintStyle::hidePages() { - Q_FOREACH ( QWidget *wdg, mPageList ) { - mWizard->setAppropriate( mPageItems[ wdg ], false ); - } + Q_FOREACH ( QWidget *wdg, mPageList ) { + mWizard->setAppropriate( mPageItems[ wdg ], false ); + } } void PrintStyle::setPreferredSortOptions( ContactFields::Field field, Qt::SortOrder sortOrder ) { - mSortField = field; - mSortOrder = sortOrder; + mSortField = field; + mSortOrder = sortOrder; } ContactFields::Field PrintStyle::preferredSortField() const { - return mSortField; + return mSortField; } Qt::SortOrder PrintStyle::preferredSortOrder() const { - return mSortOrder; + return mSortOrder; } PrintStyleFactory::PrintStyleFactory( PrintingWizard *parent ) - : mParent( parent ) + : mParent( parent ) { } diff -Nru kdepim-4.13.0/kaddressbook/printing/printstyle.h kdepim-4.13.3/kaddressbook/printing/printstyle.h --- kdepim-4.13.0/kaddressbook/printing/printstyle.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/printstyle.h 2014-07-09 12:18:50.000000000 +0000 @@ -66,9 +66,9 @@ */ class PrintStyle : public QObject { - Q_OBJECT + Q_OBJECT - public: +public: /** * Creates a new print style. * @@ -118,7 +118,7 @@ */ Qt::SortOrder preferredSortOrder() const; - protected: +protected: /** * Loads the preview image from the kaddressbook data directory. * @@ -153,7 +153,7 @@ */ void addPage( QWidget *page, const QString &title ); - private: +private: PrintingWizard *mWizard; QPixmap mPreview; QList mPageList; @@ -170,7 +170,7 @@ */ class PrintStyleFactory { - public: +public: explicit PrintStyleFactory( PrintingWizard *parent ); virtual ~PrintStyleFactory(); @@ -182,7 +182,7 @@ */ virtual QString description() const = 0; - protected: +protected: PrintingWizard *mParent; }; diff -Nru kdepim-4.13.0/kaddressbook/printing/ringbinder/ringbinderstyle.cpp kdepim-4.13.3/kaddressbook/printing/ringbinder/ringbinderstyle.cpp --- kdepim-4.13.0/kaddressbook/printing/ringbinder/ringbinderstyle.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/ringbinder/ringbinderstyle.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -45,117 +45,117 @@ const char *ShowNote = "ShowNote"; enum PrintField { - PhoneNumbers = 1, - Emails = 2, - Addresses = 4, - Organization = 8, - Birthday = 16, - Note = 32 + PhoneNumbers = 1, + Emails = 2, + Addresses = 4, + Organization = 8, + Birthday = 16, + Note = 32 }; static QString contactsToHtml( const KABC::Addressee::List &contacts, int fields ) { - QString content; + QString content; - content += QLatin1String("\n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - foreach ( const KABC::Addressee &contact, contacts ) { - QString nameString = contact.familyName() + QLatin1String(", ") + contact.givenName(); - - if ( fields & Organization ) { - if ( !contact.organization().isEmpty() ) { - nameString += QLatin1String(" (") + contact.organization() + QLatin1Char(')'); - } - } - - if ( fields & Birthday ) { - if ( contact.birthday().isValid() ) { - nameString += QLatin1String(" *") + KGlobal::locale()->formatDate( contact.birthday().date(), - KLocale::ShortDate ); - } - } - - QStringList leftBlock, rightBlock; - if ( fields & PhoneNumbers ) { - const KABC::PhoneNumber::List numbers = contact.phoneNumbers(); - foreach ( const KABC::PhoneNumber &number, numbers ) { - rightBlock.append( number.typeLabel() + QLatin1String(": ") + number.number() ); - } - } - if ( fields & Emails ) { - const QStringList emails = contact.emails(); - foreach ( const QString &email, emails ) { - rightBlock.append( email ); - } - } - if ( fields & Note ) { - if ( !contact.note().isEmpty() ) { - const QString note = QLatin1String( "Note: " ) + contact.note().replace( QLatin1Char('\n'), QLatin1String("
    ") ); - - rightBlock.append( note ); - } - } - if ( fields & Addresses ) { - const KABC::Address::List addresses = contact.addresses(); - foreach ( const KABC::Address &address, addresses ) { - const QString data = - address.formattedAddress().replace( QLatin1String("\n\n"), QLatin1String("\n") ).replace( QLatin1Char('\n'), QLatin1String("
    ") ); - const QString subBlock= QLatin1String("

    ") + data +QLatin1String( "

    "); - - leftBlock.append( subBlock ); - } - } - - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - content += QLatin1String(" \n"); - } - content += QLatin1String("
    ") + - nameString + leftBlock.join( QString() ) + QLatin1String("") + - rightBlock.join( QLatin1String("
    ") ) + QLatin1String("
    \n"); - content += QLatin1String(" \n"); - content += QLatin1String("\n"); + content += QLatin1String("\n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + foreach ( const KABC::Addressee &contact, contacts ) { + QString nameString = contact.familyName() + QLatin1String(", ") + contact.givenName(); + + if ( fields & Organization ) { + if ( !contact.organization().isEmpty() ) { + nameString += QLatin1String(" (") + contact.organization() + QLatin1Char(')'); + } + } + + if ( fields & Birthday ) { + if ( contact.birthday().isValid() ) { + nameString += QLatin1String(" *") + KGlobal::locale()->formatDate( contact.birthday().date(), + KLocale::ShortDate ); + } + } + + QStringList leftBlock, rightBlock; + if ( fields & PhoneNumbers ) { + const KABC::PhoneNumber::List numbers = contact.phoneNumbers(); + foreach ( const KABC::PhoneNumber &number, numbers ) { + rightBlock.append( number.typeLabel() + QLatin1String(": ") + number.number() ); + } + } + if ( fields & Emails ) { + const QStringList emails = contact.emails(); + foreach ( const QString &email, emails ) { + rightBlock.append( email ); + } + } + if ( fields & Note ) { + if ( !contact.note().isEmpty() ) { + const QString note = QLatin1String( "Note: " ) + contact.note().replace( QLatin1Char('\n'), QLatin1String("
    ") ); + + rightBlock.append( note ); + } + } + if ( fields & Addresses ) { + const KABC::Address::List addresses = contact.addresses(); + foreach ( const KABC::Address &address, addresses ) { + const QString data = + address.formattedAddress().replace( QLatin1String("\n\n"), QLatin1String("\n") ).replace( QLatin1Char('\n'), QLatin1String("
    ") ); + const QString subBlock= QLatin1String("

    ") + data +QLatin1String( "

    "); + + leftBlock.append( subBlock ); + } + } + + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + content += QLatin1String(" \n"); + } + content += QLatin1String("
    ") + + nameString + leftBlock.join( QString() ) + QLatin1String("") + + rightBlock.join( QLatin1String("
    ") ) + QLatin1String("
    \n"); + content += QLatin1String(" \n"); + content += QLatin1String("\n"); - return content; + return content; } namespace KABPrinting { class RingBinderStyleAppearanceForm : public QWidget, public Ui::RingBinderStyleAppearanceForm_Base { - public: +public: explicit RingBinderStyleAppearanceForm( QWidget *parent ) - : QWidget( parent ) + : QWidget( parent ) { - setObjectName( QLatin1String("AppearancePage") ); - setupUi( this ); + setObjectName( QLatin1String("AppearancePage") ); + setupUi( this ); } }; } RingBinderPrintStyle::RingBinderPrintStyle( PrintingWizard *parent ) - : PrintStyle( parent ), - mPageAppearance( new RingBinderStyleAppearanceForm( parent ) ) + : PrintStyle( parent ), + mPageAppearance( new RingBinderStyleAppearanceForm( parent ) ) { - setPreview( QLatin1String("ringbinder-style.png") ); - setPreferredSortOptions( ContactFields::FamilyName, Qt::AscendingOrder ); + setPreview( QLatin1String("ringbinder-style.png") ); + setPreferredSortOptions( ContactFields::FamilyName, Qt::AscendingOrder ); - addPage( mPageAppearance, i18n( "Ring Binder Printing Style - Appearance" ) ); + addPage( mPageAppearance, i18n( "Ring Binder Printing Style - Appearance" ) ); - // applying previous settings - KConfigGroup config( KGlobal::config(), RingBinderConfigSectionName ); - mPageAppearance->cbPhoneNumbers->setChecked( config.readEntry( ShowPhoneNumbers, true ) ); - mPageAppearance->cbEmails->setChecked( config.readEntry( ShowEmailAddresses, true ) ); - mPageAppearance->cbStreetAddresses->setChecked( config.readEntry( ShowStreetAddresses, true ) ); - mPageAppearance->cbOrganization->setChecked( config.readEntry( ShowOrganization, true ) ); - mPageAppearance->cbBirthday->setChecked( config.readEntry( ShowBirthday, false ) ); - mPageAppearance->cbNote->setChecked( config.readEntry( ShowNote, false ) ); + // applying previous settings + KConfigGroup config( KGlobal::config(), RingBinderConfigSectionName ); + mPageAppearance->cbPhoneNumbers->setChecked( config.readEntry( ShowPhoneNumbers, true ) ); + mPageAppearance->cbEmails->setChecked( config.readEntry( ShowEmailAddresses, true ) ); + mPageAppearance->cbStreetAddresses->setChecked( config.readEntry( ShowStreetAddresses, true ) ); + mPageAppearance->cbOrganization->setChecked( config.readEntry( ShowOrganization, true ) ); + mPageAppearance->cbBirthday->setChecked( config.readEntry( ShowBirthday, false ) ); + mPageAppearance->cbNote->setChecked( config.readEntry( ShowNote, false ) ); } RingBinderPrintStyle::~RingBinderPrintStyle() @@ -164,73 +164,73 @@ void RingBinderPrintStyle::print( const KABC::Addressee::List &contacts, PrintProgress *progress ) { - progress->addMessage( i18n( "Setting up fields" ) ); - progress->setProgress( 0 ); + progress->addMessage( i18n( "Setting up fields" ) ); + progress->setProgress( 0 ); - // first write current config settings - KConfigGroup config( KGlobal::config(), RingBinderConfigSectionName ); - config.writeEntry( ShowPhoneNumbers, mPageAppearance->cbPhoneNumbers->isChecked() ); - config.writeEntry( ShowEmailAddresses, mPageAppearance->cbEmails->isChecked() ); - config.writeEntry( ShowStreetAddresses, mPageAppearance->cbStreetAddresses->isChecked() ); - config.writeEntry( ShowOrganization, mPageAppearance->cbOrganization->isChecked() ); - config.writeEntry( ShowBirthday, mPageAppearance->cbBirthday->isChecked() ); - config.writeEntry( ShowNote, mPageAppearance->cbNote->isChecked() ); - config.sync(); + // first write current config settings + KConfigGroup config( KGlobal::config(), RingBinderConfigSectionName ); + config.writeEntry( ShowPhoneNumbers, mPageAppearance->cbPhoneNumbers->isChecked() ); + config.writeEntry( ShowEmailAddresses, mPageAppearance->cbEmails->isChecked() ); + config.writeEntry( ShowStreetAddresses, mPageAppearance->cbStreetAddresses->isChecked() ); + config.writeEntry( ShowOrganization, mPageAppearance->cbOrganization->isChecked() ); + config.writeEntry( ShowBirthday, mPageAppearance->cbBirthday->isChecked() ); + config.writeEntry( ShowNote, mPageAppearance->cbNote->isChecked() ); + config.sync(); - QPrinter *printer = wizard()->printer(); - printer->setPageMargins( 50, 20, 0, 50, QPrinter::DevicePixel ); + QPrinter *printer = wizard()->printer(); + printer->setPageMargins( 50, 20, 0, 50, QPrinter::DevicePixel ); - progress->addMessage( i18n( "Setting up document" ) ); + progress->addMessage( i18n( "Setting up document" ) ); - int fields = 0; + int fields = 0; - if ( mPageAppearance->cbPhoneNumbers->isChecked() ) { - fields |= PhoneNumbers; - } + if ( mPageAppearance->cbPhoneNumbers->isChecked() ) { + fields |= PhoneNumbers; + } - if ( mPageAppearance->cbEmails->isChecked() ) { - fields |= Emails; - } + if ( mPageAppearance->cbEmails->isChecked() ) { + fields |= Emails; + } - if ( mPageAppearance->cbStreetAddresses->isChecked() ) { - fields |= Addresses; - } + if ( mPageAppearance->cbStreetAddresses->isChecked() ) { + fields |= Addresses; + } - if ( mPageAppearance->cbOrganization->isChecked() ) { - fields |= Organization; - } + if ( mPageAppearance->cbOrganization->isChecked() ) { + fields |= Organization; + } - if ( mPageAppearance->cbBirthday->isChecked() ) { - fields |= Birthday; - } + if ( mPageAppearance->cbBirthday->isChecked() ) { + fields |= Birthday; + } - if ( mPageAppearance->cbNote->isChecked() ) { - fields |= Note; - } + if ( mPageAppearance->cbNote->isChecked() ) { + fields |= Note; + } - const QString html = contactsToHtml( contacts, fields ); + const QString html = contactsToHtml( contacts, fields ); - QTextDocument document; - document.setHtml( html ); + QTextDocument document; + document.setHtml( html ); - progress->addMessage( i18n( "Printing" ) ); + progress->addMessage( i18n( "Printing" ) ); - document.print( printer ); + document.print( printer ); - progress->addMessage( i18nc( "Finished printing", "Done" ) ); + progress->addMessage( i18nc( "Finished printing", "Done" ) ); } RingBinderPrintStyleFactory::RingBinderPrintStyleFactory( PrintingWizard *parent ) - : PrintStyleFactory( parent ) + : PrintStyleFactory( parent ) { } PrintStyle *RingBinderPrintStyleFactory::create() const { - return new RingBinderPrintStyle( mParent ); + return new RingBinderPrintStyle( mParent ); } QString RingBinderPrintStyleFactory::description() const { - return i18n( "Printout for Ring Binders" ); + return i18n( "Printout for Ring Binders" ); } diff -Nru kdepim-4.13.0/kaddressbook/printing/ringbinder/ringbinderstyle.h kdepim-4.13.3/kaddressbook/printing/ringbinder/ringbinderstyle.h --- kdepim-4.13.0/kaddressbook/printing/ringbinder/ringbinderstyle.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/ringbinder/ringbinderstyle.h 2014-07-09 12:18:50.000000000 +0000 @@ -34,19 +34,19 @@ class RingBinderPrintStyle : public PrintStyle { - public: +public: explicit RingBinderPrintStyle( PrintingWizard *parent ); ~RingBinderPrintStyle(); void print( const KABC::Addressee::List &contacts, PrintProgress * ); - private: +private: RingBinderStyleAppearanceForm *mPageAppearance; }; class RingBinderPrintStyleFactory : public PrintStyleFactory { - public: +public: explicit RingBinderPrintStyleFactory( PrintingWizard *parent ); PrintStyle *create() const; diff -Nru kdepim-4.13.0/kaddressbook/printing/stylepage.cpp kdepim-4.13.3/kaddressbook/printing/stylepage.cpp --- kdepim-4.13.0/kaddressbook/printing/stylepage.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/stylepage.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -38,22 +38,22 @@ static bool contactFieldsNameLesser( const ContactFields::Field &field, const ContactFields::Field &otherField ) { - return ( QString::localeAwareCompare( ContactFields::label( field ), - ContactFields::label( otherField ) ) < 0 ); + return ( QString::localeAwareCompare( ContactFields::label( field ), + ContactFields::label( otherField ) ) < 0 ); } StylePage::StylePage( QWidget *parent, const char *name ) - : QWidget( parent ) + : QWidget( parent ) { - setObjectName( QLatin1String(name) ); - initGUI(); + setObjectName( QLatin1String(name) ); + initGUI(); - initFieldCombo(); + initFieldCombo(); - mSortTypeCombo->addItem( i18nc( "@item:inlistbox Ascending sort order", "Ascending" ) ); - mSortTypeCombo->addItem( i18nc( "@item:inlistbox Descending sort order", "Descending" ) ); + mSortTypeCombo->addItem( i18nc( "@item:inlistbox Ascending sort order", "Ascending" ) ); + mSortTypeCombo->addItem( i18nc( "@item:inlistbox Descending sort order", "Descending" ) ); - connect( mStyleCombo, SIGNAL(activated(int)), SIGNAL(styleChanged(int)) ); + connect( mStyleCombo, SIGNAL(activated(int)), SIGNAL(styleChanged(int)) ); } StylePage::~StylePage() @@ -62,153 +62,153 @@ void StylePage::setPreview( const QPixmap &pixmap ) { - if ( pixmap.isNull() ) { - mPreview->setText( i18nc( "@label", "(No preview available.)" ) ); - } else { - mPreview->setPixmap( pixmap ); - } + if ( pixmap.isNull() ) { + mPreview->setText( i18nc( "@label", "(No preview available.)" ) ); + } else { + mPreview->setPixmap( pixmap ); + } } void StylePage::addStyleName( const QString &name ) { - mStyleCombo->addItem( name ); + mStyleCombo->addItem( name ); } void StylePage::clearStyleNames() { - mStyleCombo->clear(); + mStyleCombo->clear(); } void StylePage::setSortField( ContactFields::Field field ) { - mFieldCombo->setCurrentIndex( mFields.indexOf( field ) ); + mFieldCombo->setCurrentIndex( mFields.indexOf( field ) ); } void StylePage::setSortOrder( Qt::SortOrder sortOrder ) { - if ( sortOrder == Qt::AscendingOrder ) { - mSortTypeCombo->setCurrentIndex( 0 ); - } else { - mSortTypeCombo->setCurrentIndex( 1 ); - } + if ( sortOrder == Qt::AscendingOrder ) { + mSortTypeCombo->setCurrentIndex( 0 ); + } else { + mSortTypeCombo->setCurrentIndex( 1 ); + } } ContactFields::Field StylePage::sortField() const { - if ( mFieldCombo->currentIndex() == -1 ) { - return ContactFields::GivenName; - } + if ( mFieldCombo->currentIndex() == -1 ) { + return ContactFields::GivenName; + } - return mFields[ mFieldCombo->currentIndex() ]; + return mFields[ mFieldCombo->currentIndex() ]; } Qt::SortOrder StylePage::sortOrder() const { - return ( mSortTypeCombo->currentIndex() == 0 ? Qt::AscendingOrder : Qt::DescendingOrder ); + return ( mSortTypeCombo->currentIndex() == 0 ? Qt::AscendingOrder : Qt::DescendingOrder ); } void StylePage::initFieldCombo() { - mFieldCombo->clear(); + mFieldCombo->clear(); - mFields = ContactFields::allFields(); - mFields.remove( 0 ); // remove ContactFields::Undefined + mFields = ContactFields::allFields(); + mFields.remove( 0 ); // remove ContactFields::Undefined - qSort( mFields.begin(), mFields.end(), contactFieldsNameLesser ); + qSort( mFields.begin(), mFields.end(), contactFieldsNameLesser ); - ContactFields::Fields::ConstIterator it; - ContactFields::Fields::ConstIterator end(mFields.constEnd()); - for ( it = mFields.constBegin(); it != end; ++it ) { - mFieldCombo->addItem( ContactFields::label( *it ) ); - } + ContactFields::Fields::ConstIterator it; + ContactFields::Fields::ConstIterator end(mFields.constEnd()); + for ( it = mFields.constBegin(); it != end; ++it ) { + mFieldCombo->addItem( ContactFields::label( *it ) ); + } } void StylePage::initGUI() { - setWindowTitle( i18nc( "@title:window", "Choose Printing Style" ) ); + setWindowTitle( i18nc( "@title:window", "Choose Printing Style" ) ); - QGridLayout *topLayout = new QGridLayout( this ); - topLayout->setSpacing( KDialog::spacingHint() ); - topLayout->setMargin( KDialog::marginHint() ); - - QLabel *label = - new QLabel( - i18nc( "@label:textbox", - "What should the print look like?\n" - "KAddressBook has several printing styles, designed for different purposes.\n" - "Choose the style that suits your needs below." ), this ); - topLayout->addWidget( label, 0, 0, 1, 2 ); - - QGroupBox *group = new QGroupBox( i18nc( "@title:group", "Sorting" ), this ); - QGridLayout *sortLayout = new QGridLayout(); - group->setLayout( sortLayout ); - sortLayout->setSpacing( KDialog::spacingHint() ); - sortLayout->setMargin( KDialog::marginHint() ); - sortLayout->setAlignment( Qt::AlignTop ); - - label = new QLabel( i18nc( "@label:listbox", "Criterion:" ), group ); - sortLayout->addWidget( label, 0, 0 ); - - mFieldCombo = new KComboBox( false, group ); - mFieldCombo->setToolTip( - i18nc( "@info:tooltip", "Select the primary sort field" ) ); - mFieldCombo->setWhatsThis( - i18nc( "@info:whatsthis", - "From this list you can select the field on which your contacts are sorted " - "in the print output. Use the sorting order option to determine if the " - "sort will be in ascending or descending order." ) ); - sortLayout->addWidget( mFieldCombo, 0, 1 ); - - label = new QLabel( i18nc( "@label:listbox", "Order:" ), group ); - sortLayout->addWidget( label, 1, 0 ); - - mSortTypeCombo = new KComboBox( false, group ); - mSortTypeCombo->setToolTip( - i18nc( "@info:tooltip", "Select the sorting order" ) ); - mSortTypeCombo->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose if you want to sort your contacts in ascending or descending order. " - "Use the sorting criterion option to specify on which contact field the sorting " - "will be performed." ) ); - sortLayout->addWidget( mSortTypeCombo, 1, 1 ); - - topLayout->addWidget( group, 1, 0 ); - - group = new QGroupBox( i18nc( "@title:group", "Print Style" ), this ); - QVBoxLayout *styleLayout = new QVBoxLayout(); - group->setLayout( styleLayout ); - styleLayout->setSpacing( KDialog::spacingHint() ); - styleLayout->setMargin( KDialog::marginHint() ); - - mStyleCombo = new KComboBox( false, group ); - mStyleCombo->setToolTip( - i18nc( "@info:tooltip", "Select the print style" ) ); - mStyleCombo->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose your desired printing style. See the preview image to help you decide." ) ); - - styleLayout->addWidget( mStyleCombo ); - - mPreview = new QLabel( group ); - QFont font( mPreview->font() ); - font.setPointSize( 20 ); - mPreview->setFont( font ); - mPreview->setScaledContents( true ); - mPreview->setAlignment( Qt::AlignCenter ); - mPreview->setWordWrap( true ); - styleLayout->addWidget( mPreview ); + QGridLayout *topLayout = new QGridLayout( this ); + topLayout->setSpacing( KDialog::spacingHint() ); + topLayout->setMargin( KDialog::marginHint() ); + + QLabel *label = + new QLabel( + i18nc( "@label:textbox", + "What should the print look like?\n" + "KAddressBook has several printing styles, designed for different purposes.\n" + "Choose the style that suits your needs below." ), this ); + topLayout->addWidget( label, 0, 0, 1, 2 ); + + QGroupBox *group = new QGroupBox( i18nc( "@title:group", "Sorting" ), this ); + QGridLayout *sortLayout = new QGridLayout(); + group->setLayout( sortLayout ); + sortLayout->setSpacing( KDialog::spacingHint() ); + sortLayout->setMargin( KDialog::marginHint() ); + sortLayout->setAlignment( Qt::AlignTop ); + + label = new QLabel( i18nc( "@label:listbox", "Criterion:" ), group ); + sortLayout->addWidget( label, 0, 0 ); + + mFieldCombo = new KComboBox( false, group ); + mFieldCombo->setToolTip( + i18nc( "@info:tooltip", "Select the primary sort field" ) ); + mFieldCombo->setWhatsThis( + i18nc( "@info:whatsthis", + "From this list you can select the field on which your contacts are sorted " + "in the print output. Use the sorting order option to determine if the " + "sort will be in ascending or descending order." ) ); + sortLayout->addWidget( mFieldCombo, 0, 1 ); + + label = new QLabel( i18nc( "@label:listbox", "Order:" ), group ); + sortLayout->addWidget( label, 1, 0 ); + + mSortTypeCombo = new KComboBox( false, group ); + mSortTypeCombo->setToolTip( + i18nc( "@info:tooltip", "Select the sorting order" ) ); + mSortTypeCombo->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose if you want to sort your contacts in ascending or descending order. " + "Use the sorting criterion option to specify on which contact field the sorting " + "will be performed." ) ); + sortLayout->addWidget( mSortTypeCombo, 1, 1 ); + + topLayout->addWidget( group, 1, 0 ); + + group = new QGroupBox( i18nc( "@title:group", "Print Style" ), this ); + QVBoxLayout *styleLayout = new QVBoxLayout(); + group->setLayout( styleLayout ); + styleLayout->setSpacing( KDialog::spacingHint() ); + styleLayout->setMargin( KDialog::marginHint() ); + + mStyleCombo = new KComboBox( false, group ); + mStyleCombo->setToolTip( + i18nc( "@info:tooltip", "Select the print style" ) ); + mStyleCombo->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose your desired printing style. See the preview image to help you decide." ) ); + + styleLayout->addWidget( mStyleCombo ); + + mPreview = new QLabel( group ); + QFont font( mPreview->font() ); + font.setPointSize( 20 ); + mPreview->setFont( font ); + mPreview->setScaledContents( true ); + mPreview->setAlignment( Qt::AlignCenter ); + mPreview->setWordWrap( true ); + styleLayout->addWidget( mPreview ); - topLayout->addWidget( group, 1, 1 ); - topLayout->setRowStretch( 1, 1 ); + topLayout->addWidget( group, 1, 1 ); + topLayout->setRowStretch( 1, 1 ); } int StylePage::printingStyle() const { - return mStyleCombo->currentIndex(); + return mStyleCombo->currentIndex(); } void StylePage::setPrintingStyle( int index ) { - mStyleCombo->setCurrentIndex( index ); + mStyleCombo->setCurrentIndex( index ); } diff -Nru kdepim-4.13.0/kaddressbook/printing/stylepage.h kdepim-4.13.3/kaddressbook/printing/stylepage.h --- kdepim-4.13.0/kaddressbook/printing/stylepage.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/printing/stylepage.h 2014-07-09 12:18:50.000000000 +0000 @@ -36,9 +36,9 @@ class StylePage : public QWidget { - Q_OBJECT + Q_OBJECT - public: +public: explicit StylePage( QWidget *parent = 0, const char *name = 0 ); ~StylePage(); @@ -88,14 +88,14 @@ */ void setPrintingStyle( int index ); - Q_SIGNALS: +Q_SIGNALS: /** * This signal is emmited when the user selects a new style in the * style combo box. */ void styleChanged( int index ); - private: +private: void initGUI(); void initFieldCombo(); diff -Nru kdepim-4.13.0/kaddressbook/quicksearchwidget.cpp kdepim-4.13.3/kaddressbook/quicksearchwidget.cpp --- kdepim-4.13.0/kaddressbook/quicksearchwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/quicksearchwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -29,29 +29,29 @@ #include QuickSearchWidget::QuickSearchWidget( QWidget *parent ) - : QWidget( parent ) + : QWidget( parent ) { - QVBoxLayout *layout = new QVBoxLayout( this ); - layout->setMargin( 0 ); + QVBoxLayout *layout = new QVBoxLayout( this ); + layout->setMargin( 0 ); - mEdit = new KLineEdit; - //If change shortcut changes it in mainwidget - mEdit->setClearButtonShown( true ); - mEdit->setToolTip( - i18nc( "@info:tooltip", "Search contacts in list" ) ); - mEdit->setWhatsThis( - i18nc( "@info:whatsthis", - "Start typing a search string in this box and the list of contacts " - "matching that string will be displayed. This is a quick way of searching " - "for contacts of interest." ) ); - mEdit->installEventFilter( this ); + mEdit = new KLineEdit; + //If change shortcut changes it in mainwidget + mEdit->setClearButtonShown( true ); + mEdit->setToolTip( + i18nc( "@info:tooltip", "Search contacts in list" ) ); + mEdit->setWhatsThis( + i18nc( "@info:whatsthis", + "Start typing a search string in this box and the list of contacts " + "matching that string will be displayed. This is a quick way of searching " + "for contacts of interest." ) ); + mEdit->installEventFilter( this ); - layout->addWidget( mEdit ); + layout->addWidget( mEdit ); - mTimer = new QTimer( this ); + mTimer = new QTimer( this ); - connect( mEdit, SIGNAL(textChanged(QString)), SLOT(resetTimer()) ); - connect( mTimer, SIGNAL(timeout()), SLOT(delayedTextChanged()) ); + connect( mEdit, SIGNAL(textChanged(QString)), SLOT(resetTimer()) ); + connect( mTimer, SIGNAL(timeout()), SLOT(delayedTextChanged()) ); } QuickSearchWidget::~QuickSearchWidget() @@ -60,8 +60,8 @@ QSize QuickSearchWidget::sizeHint() const { - const QSize size = mEdit->sizeHint(); - return QSize( 200, size.height() ); + const QSize size = mEdit->sizeHint(); + return QSize( 200, size.height() ); } void QuickSearchWidget::slotFocusQuickSearch() @@ -71,26 +71,26 @@ void QuickSearchWidget::resetTimer() { - mTimer->stop(); - mTimer->start( 500 ); + mTimer->stop(); + mTimer->start( 500 ); } void QuickSearchWidget::delayedTextChanged() { - mTimer->stop(); - emit filterStringChanged( mEdit->text() ); + mTimer->stop(); + emit filterStringChanged( mEdit->text() ); } void QuickSearchWidget::keyPressEvent( QKeyEvent *event ) { - if ( event->key() == Qt::Key_Down ) { - event->accept(); - delayedTextChanged(); - emit arrowDownKeyPressed(); - return; - } + if ( event->key() == Qt::Key_Down ) { + event->accept(); + delayedTextChanged(); + emit arrowDownKeyPressed(); + return; + } - QWidget::keyPressEvent( event ); + QWidget::keyPressEvent( event ); } void QuickSearchWidget::updateQuickSearchText( const QString &text ) diff -Nru kdepim-4.13.0/kaddressbook/quicksearchwidget.h kdepim-4.13.3/kaddressbook/quicksearchwidget.h --- kdepim-4.13.0/kaddressbook/quicksearchwidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/quicksearchwidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -38,9 +38,9 @@ */ class QuickSearchWidget : public QWidget { - Q_OBJECT + Q_OBJECT - public: +public: /** * Creates the quick search widget. * @@ -80,14 +80,14 @@ */ void arrowDownKeyPressed(); - private Q_SLOTS: +private Q_SLOTS: void resetTimer(); void delayedTextChanged(); - protected: +protected: void keyPressEvent( QKeyEvent * ); - private: +private: KLineEdit *mEdit; QTimer *mTimer; }; diff -Nru kdepim-4.13.0/kaddressbook/startup.cpp kdepim-4.13.3/kaddressbook/startup.cpp --- kdepim-4.13.0/kaddressbook/startup.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/startup.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -16,7 +16,7 @@ KLocale * l = KGlobal::locale(); for ( unsigned int i = 0 ; i < sizeof catalogs / sizeof *catalogs; ++i ) { - l->insertCatalog( QLatin1String(catalogs[i]) ); + l->insertCatalog( QLatin1String(catalogs[i]) ); } } diff -Nru kdepim-4.13.0/kaddressbook/startup.h kdepim-4.13.3/kaddressbook/startup.h --- kdepim-4.13.0/kaddressbook/startup.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/startup.h 2014-07-09 12:18:50.000000000 +0000 @@ -3,7 +3,7 @@ #include "kaddressbook_export.h" namespace KAddressBook { - KADDRESSBOOK_EXPORT void insertLibraryCatalogues(); +KADDRESSBOOK_EXPORT void insertLibraryCatalogues(); } #endif // STARTUP_H diff -Nru kdepim-4.13.0/kaddressbook/viewertemplates/theme.desktop kdepim-4.13.3/kaddressbook/viewertemplates/theme.desktop --- kdepim-4.13.0/kaddressbook/viewertemplates/theme.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/viewertemplates/theme.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -28,6 +28,7 @@ Name[ia]=Predefinite Name[is]=Sjálfgefið Name[it]=Predefinito +Name[ja]=標準 Name[ka]=ნაგულისხმევი Name[kk]=Әдетті Name[lv]=Noklusētais @@ -73,7 +74,9 @@ Description[da]=Standard kaddressbook-tema. Description[de]=Standarddesign für KAddressBook. Description[el]=Προκαθορισμένο θέμα kaddressbook. +Description[en_GB]=Default kaddressbook theme. Description[es]=Tema predeterminado de kaddressbook. +Description[et]=KDE aadressiraamatu vaikimisi teema Description[fi]=KAddressBookin oletusteema. Description[fr]=Thème par défaut pour kaddressbook. Description[gl]=Tema do kaddressbook por omisión. diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/csvimportdialog.cpp kdepim-4.13.3/kaddressbook/xxport/csv/csvimportdialog.cpp --- kdepim-4.13.0/kaddressbook/xxport/csv/csvimportdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/csvimportdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -51,64 +51,64 @@ #include enum { - Local = 0, - Latin1 = 1, - Uni = 2, - MSBug = 3, - Codec = 4 + Local = 0, + Latin1 = 1, + Uni = 2, + MSBug = 3, + Codec = 4 }; class ContactFieldComboBox : public KComboBox { - public: +public: ContactFieldComboBox( QWidget *parent = 0 ) - : KComboBox( parent ) + : KComboBox( parent ) { - fillFieldMap(); + fillFieldMap(); - addItem( ContactFields::label( ContactFields::Undefined ), ContactFields::Undefined ); + addItem( ContactFields::label( ContactFields::Undefined ), ContactFields::Undefined ); - QMapIterator it( mFieldMap ); - while ( it.hasNext() ) { - it.next(); + QMapIterator it( mFieldMap ); + while ( it.hasNext() ) { + it.next(); - addItem( it.key(), QVariant( it.value() ) ); - } + addItem( it.key(), QVariant( it.value() ) ); + } - int maxLength = 0; - for ( int i = 0; i < count(); ++i ) { - maxLength = qMax( maxLength, itemText( i ).length() ); - } + int maxLength = 0; + for ( int i = 0; i < count(); ++i ) { + maxLength = qMax( maxLength, itemText( i ).length() ); + } - setMinimumContentsLength( maxLength ); - setSizeAdjustPolicy( AdjustToMinimumContentsLength ); - setFixedSize( sizeHint() ); + setMinimumContentsLength( maxLength ); + setSizeAdjustPolicy( AdjustToMinimumContentsLength ); + setFixedSize( sizeHint() ); } void setCurrentField( ContactFields::Field field ) { - setCurrentIndex( findData( (uint)field ) ); + setCurrentIndex( findData( (uint)field ) ); } ContactFields::Field currentField() const { - return ( ContactFields::Field )itemData( currentIndex() ).toUInt(); + return ( ContactFields::Field )itemData( currentIndex() ).toUInt(); } - private: +private: static void fillFieldMap() { - if ( !mFieldMap.isEmpty() ) { - return; - } + if ( !mFieldMap.isEmpty() ) { + return; + } - ContactFields::Fields fields = ContactFields::allFields(); - fields.remove( ContactFields::Undefined ); + ContactFields::Fields fields = ContactFields::allFields(); + fields.remove( ContactFields::Undefined ); - for ( int i = 0; i < fields.count(); ++i ) { - mFieldMap.insert( ContactFields::label( fields.at( i ) ), fields.at( i ) ); - } + for ( int i = 0; i < fields.count(); ++i ) { + mFieldMap.insert( ContactFields::label( fields.at( i ) ), fields.at( i ) ); + } } static QMap mFieldMap; @@ -118,655 +118,655 @@ class ContactFieldDelegate : public QStyledItemDelegate { - public: +public: ContactFieldDelegate( QObject *parent = 0 ) - : QStyledItemDelegate( parent ) + : QStyledItemDelegate( parent ) { } QString displayText( const QVariant &value, const QLocale & ) const { - return ContactFields::label( ( ContactFields::Field )value.toUInt() ); + return ContactFields::label( ( ContactFields::Field )value.toUInt() ); } QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &, const QModelIndex & ) const { - ContactFieldComboBox *editor = new ContactFieldComboBox( parent ); + ContactFieldComboBox *editor = new ContactFieldComboBox( parent ); - return editor; + return editor; } void setEditorData( QWidget *editor, const QModelIndex &index ) const { - const unsigned int value = index.model()->data( index, Qt::EditRole ).toUInt(); + const unsigned int value = index.model()->data( index, Qt::EditRole ).toUInt(); - ContactFieldComboBox *fieldCombo = static_cast( editor ); - fieldCombo->setCurrentField( ( ContactFields::Field )value ); + ContactFieldComboBox *fieldCombo = static_cast( editor ); + fieldCombo->setCurrentField( ( ContactFields::Field )value ); } void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const { - ContactFieldComboBox *fieldCombo = static_cast( editor ); + ContactFieldComboBox *fieldCombo = static_cast( editor ); - model->setData( index, fieldCombo->currentField(), Qt::EditRole ); + model->setData( index, fieldCombo->currentField(), Qt::EditRole ); } void updateEditorGeometry( QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex & ) const { - editor->setGeometry( option.rect ); + editor->setGeometry( option.rect ); } void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const { - if ( index.row() == 0 ) { - QStyleOptionViewItem headerOption( option ); - headerOption.font.setBold( true ); - - QStyledItemDelegate::paint( painter, headerOption, index ); - } else { - QStyledItemDelegate::paint( painter, option, index ); - } + if ( index.row() == 0 ) { + QStyleOptionViewItem headerOption( option ); + headerOption.font.setBold( true ); + + QStyledItemDelegate::paint( painter, headerOption, index ); + } else { + QStyledItemDelegate::paint( painter, option, index ); + } } }; CSVImportDialog::CSVImportDialog( QWidget *parent ) - : KDialog( parent ), mDevice( 0 ) + : KDialog( parent ), mDevice( 0 ) { - setCaption( i18nc( "@title:window", "CSV Import Dialog" ) ); - setButtons( Ok | Cancel | User1 | User2 ); - setDefaultButton( Ok ); - setModal( true ); - showButtonSeparator( true ); - - mModel = new QCsvModel( this ); - - initGUI(); - - reloadCodecs(); - - connect( mUrlRequester, SIGNAL(returnPressed(QString)), - this, SLOT(setFile(QString)) ); - connect( mUrlRequester, SIGNAL(urlSelected(KUrl)), - this, SLOT(setFile(KUrl)) ); - connect( mUrlRequester->lineEdit(), SIGNAL(textChanged(QString)), - this, SLOT(urlChanged(QString)) ); - connect( mDelimiterGroup, SIGNAL(buttonClicked(int)), - this, SLOT(delimiterClicked(int)) ); - connect( mDelimiterEdit, SIGNAL(returnPressed()), - this, SLOT(customDelimiterChanged()) ); - connect( mDelimiterEdit, SIGNAL(textChanged(QString)), - this, SLOT(customDelimiterChanged(QString)) ); - connect( mComboQuote, SIGNAL(activated(QString)), - this, SLOT(textQuoteChanged(QString)) ); - connect( mCodecCombo, SIGNAL(activated(QString)), - this, SLOT(codecChanged()) ); - connect( mSkipFirstRow, SIGNAL(toggled(bool)), - this, SLOT(skipFirstRowChanged(bool)) ); - - connect( mModel, SIGNAL(finishedLoading()), this, SLOT(modelFinishedLoading()) ); - - delimiterClicked( 0 ); - textQuoteChanged( QLatin1String("\"") ); - skipFirstRowChanged( false ); + setCaption( i18nc( "@title:window", "CSV Import Dialog" ) ); + setButtons( Ok | Cancel | User1 | User2 ); + setDefaultButton( Ok ); + setModal( true ); + showButtonSeparator( true ); + + mModel = new QCsvModel( this ); + + initGUI(); + + reloadCodecs(); + + connect( mUrlRequester, SIGNAL(returnPressed(QString)), + this, SLOT(setFile(QString)) ); + connect( mUrlRequester, SIGNAL(urlSelected(KUrl)), + this, SLOT(setFile(KUrl)) ); + connect( mUrlRequester->lineEdit(), SIGNAL(textChanged(QString)), + this, SLOT(urlChanged(QString)) ); + connect( mDelimiterGroup, SIGNAL(buttonClicked(int)), + this, SLOT(delimiterClicked(int)) ); + connect( mDelimiterEdit, SIGNAL(returnPressed()), + this, SLOT(customDelimiterChanged()) ); + connect( mDelimiterEdit, SIGNAL(textChanged(QString)), + this, SLOT(customDelimiterChanged(QString)) ); + connect( mComboQuote, SIGNAL(activated(QString)), + this, SLOT(textQuoteChanged(QString)) ); + connect( mCodecCombo, SIGNAL(activated(QString)), + this, SLOT(codecChanged()) ); + connect( mSkipFirstRow, SIGNAL(toggled(bool)), + this, SLOT(skipFirstRowChanged(bool)) ); + + connect( mModel, SIGNAL(finishedLoading()), this, SLOT(modelFinishedLoading()) ); + + delimiterClicked( 0 ); + textQuoteChanged( QLatin1String("\"") ); + skipFirstRowChanged( false ); } CSVImportDialog::~CSVImportDialog() { - delete mDevice; + delete mDevice; } KABC::AddresseeList CSVImportDialog::contacts() const { - KABC::AddresseeList contacts; - DateParser dateParser( mDatePatternEdit->text() ); + KABC::AddresseeList contacts; + DateParser dateParser( mDatePatternEdit->text() ); - KProgressDialog progressDialog( const_cast( this )->mainWidget() ); - progressDialog.setAutoClose( true ); - progressDialog.progressBar()->setMaximum( mModel->rowCount() ); - progressDialog.setLabelText( i18nc( "@label", "Importing contacts" ) ); - progressDialog.show(); - - kapp->processEvents(); - - for ( int row = 1; row < mModel->rowCount(); ++row ) { - KABC::Addressee contact; - bool emptyRow = true; + KProgressDialog progressDialog( const_cast( this )->mainWidget() ); + progressDialog.setAutoClose( true ); + progressDialog.progressBar()->setMaximum( mModel->rowCount() ); + progressDialog.setLabelText( i18nc( "@label", "Importing contacts" ) ); + progressDialog.show(); - for ( int column = 0; column < mModel->columnCount(); ++column ) { - QString value = mModel->data( mModel->index( row, column ), Qt::DisplayRole ).toString(); + kapp->processEvents(); - if ( !value.isEmpty() ) { - emptyRow = false; + for ( int row = 1; row < mModel->rowCount(); ++row ) { + KABC::Addressee contact; + bool emptyRow = true; - const ContactFields::Field field = - ( ContactFields::Field )mModel->data( mModel->index( 0, column ) ).toUInt(); + for ( int column = 0; column < mModel->columnCount(); ++column ) { + QString value = mModel->data( mModel->index( row, column ), Qt::DisplayRole ).toString(); - // convert the custom date format to ISO format - if ( field == ContactFields::Birthday || field == ContactFields::Anniversary ) { - value = dateParser.parse( value ).toString( Qt::ISODate ); - } + if ( !value.isEmpty() ) { + emptyRow = false; - value.replace( QLatin1String("\\n"), QLatin1String("\n") ); + const ContactFields::Field field = + ( ContactFields::Field )mModel->data( mModel->index( 0, column ) ).toUInt(); - ContactFields::setValue( field, value, contact ); - } - } + // convert the custom date format to ISO format + if ( field == ContactFields::Birthday || field == ContactFields::Anniversary ) { + value = dateParser.parse( value ).toString( Qt::ISODate ); + } - kapp->processEvents(); + value.replace( QLatin1String("\\n"), QLatin1String("\n") ); - if ( progressDialog.wasCancelled() ) { - return KABC::AddresseeList(); - } + ContactFields::setValue( field, value, contact ); + } + } + + kapp->processEvents(); + + if ( progressDialog.wasCancelled() ) { + return KABC::AddresseeList(); + } - progressDialog.progressBar()->setValue( progressDialog.progressBar()->value() + 1 ); + progressDialog.progressBar()->setValue( progressDialog.progressBar()->value() + 1 ); - if ( !emptyRow && !contact.isEmpty() ) { - contacts.append( contact ); + if ( !emptyRow && !contact.isEmpty() ) { + contacts.append( contact ); + } } - } - return contacts; + return contacts; } void CSVImportDialog::initGUI() { - QWidget *page = new QWidget( this ); - setMainWidget( page ); + QWidget *page = new QWidget( this ); + setMainWidget( page ); - QGridLayout *layout = new QGridLayout( page ); - layout->setSpacing( spacingHint() ); - layout->setMargin( 0 ); - - QHBoxLayout *hbox = new QHBoxLayout(); - hbox->setSpacing( spacingHint() ); - - QLabel *label = new QLabel( i18nc( "@label", "File to import:" ), page ); - hbox->addWidget( label ); - - mUrlRequester = new KUrlRequester( page ); - mUrlRequester->setFilter( QLatin1String("*.csv") ); - mUrlRequester->lineEdit()->setTrapReturnKey( true ); - mUrlRequester->setToolTip( - i18nc( "@info:tooltip", "Select a csv file to import" ) ); - mUrlRequester->setWhatsThis( - i18nc( "@info:whatsthis", - "Click this button to start a file chooser that will allow you to " - "select a csv file to import." ) ); - hbox->addWidget( mUrlRequester ); - - layout->addLayout( hbox, 0, 0, 1, 5 ); - - // Delimiter: comma, semicolon, tab, space, other - QGroupBox *group = new QGroupBox( i18nc( "@title:group", "Delimiter" ), page ); - QGridLayout *delimiterLayout = new QGridLayout; - delimiterLayout->setMargin( marginHint() ); - delimiterLayout->setSpacing( spacingHint() ); - group->setLayout( delimiterLayout ); - delimiterLayout->setAlignment( Qt::AlignTop ); - layout->addWidget( group, 1, 0, 4, 1 ); - - mDelimiterGroup = new QButtonGroup( this ); - mDelimiterGroup->setExclusive( true ); - - QRadioButton *button = new QRadioButton( i18nc( "@option:radio Field separator", "Comma" ) ); - button->setToolTip( - i18nc( "@info:tooltip", "Set the field separator to a comma" ) ); - button->setWhatsThis( - i18nc( "@info:whatsthis", - "Select this option if your csv file uses the comma as a field separator." ) ); - button->setChecked( true ); - mDelimiterGroup->addButton( button, 0 ); - delimiterLayout->addWidget( button, 0, 0 ); - - button = new QRadioButton( i18nc( "@option:radio Field separator", "Semicolon" ) ); - button->setToolTip( - i18nc( "@info:tooltip", "Set the field separator to a semicolon" ) ); - button->setWhatsThis( - i18nc( "@info:whatsthis", - "Select this option if your csv file uses the semicolon as a field separator." ) ); - mDelimiterGroup->addButton( button, 1 ); - delimiterLayout->addWidget( button, 0, 1 ); - - button = new QRadioButton( i18nc( "@option:radio Field separator", "Tabulator" ) ); - button->setToolTip( - i18nc( "@info:tooltip", "Set the field separator to a tab character" ) ); - button->setWhatsThis( - i18nc( "@info:whatsthis", - "Select this option if your csv file uses the tab character as a field separator." ) ); - mDelimiterGroup->addButton( button, 2 ); - delimiterLayout->addWidget( button, 1, 0 ); - - button = new QRadioButton( i18nc( "@option:radio Field separator", "Space" ) ); - button->setToolTip( - i18nc( "@info:tooltip", "Set the field separator to a space character" ) ); - button->setWhatsThis( - i18nc( "@info:whatsthis", - "Select this option if your csv file uses the space character as a field separator." ) ); - mDelimiterGroup->addButton( button, 3 ); - delimiterLayout->addWidget( button, 1, 1 ); - - button = new QRadioButton( i18nc( "@option:radio Custum field separator", "Other" ) ); - button->setToolTip( - i18nc( "@info:tooltip", "Set the field separator to a custom character" ) ); - button->setWhatsThis( - i18nc( "@info:whatsthis", - "Select this option if to use some other character as the field delimiter " - "for the data in your csv file." ) ); - mDelimiterGroup->addButton( button, 4 ); - delimiterLayout->addWidget( button, 0, 2 ); - - mDelimiterEdit = new KLineEdit( group ); - mDelimiterEdit->setToolTip( - i18nc( "@info:tooltip", - "Set the custom delimiter character" ) ); - mDelimiterEdit->setWhatsThis( - i18nc( "@info:whatsthis", - "Enter a custom character to use as the delimiter character. " - "If you enter more than 1 character, only the first will be used and " - "the remaining characters will be ignored." ) ); - delimiterLayout->addWidget( mDelimiterEdit, 1, 2 ); - - // text quote - label = new QLabel( i18nc( "@label:listbox", "Text quote:" ), page ); - layout->addWidget( label, 1, 2 ); - - mComboQuote = new KComboBox( page ); - mComboQuote->setToolTip( - i18nc( "@info:tooltip", "Select the quote character" ) ); - mComboQuote->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose the character that your csv data uses to \"quote\" the field delimiter " - "if that character happens to occur within the data. For example, if the " - "comma is the field delimiter, then any comma occurring with the data " - "will be \"quoted\" by the character specified here." ) ); - mComboQuote->setEditable( false ); - mComboQuote->addItem( i18nc( "@item:inlistbox Qoute character option", "\"" ), 0 ); - mComboQuote->addItem( i18nc( "@item:inlistbox Quote character option", "'" ), 1 ); - mComboQuote->addItem( i18nc( "@item:inlistbox Quote character option", "None" ), 2 ); - layout->addWidget( mComboQuote, 1, 3 ); - - // date format - label = new QLabel( i18nc( "@label:listbox", "Date format:" ), page ); - layout->addWidget( label, 2, 2 ); - - mDatePatternEdit = new KLineEdit( page ); - mDatePatternEdit->setText( QLatin1String("Y-M-D") ); // ISO 8601 date format as default - mDatePatternEdit->setToolTip( - i18nc( "@info:tooltip", - "y: year with 2 digits" - "Y: year with 4 digits" - "m: month with 1 or 2 digits" - "M: month with 2 digits" - "d: day with 1 or 2 digits" - "D: day with 2 digits" - "H: hours with 2 digits" - "I: minutes with 2 digits" - "S: seconds with 2 digits" - "" ) ); - mDatePatternEdit->setWhatsThis( - i18nc( "@info:whatsthis", - "Specify a format to use for dates included in your csv data. " - "Use the following sequences to help you define the format:" - "y: year with 2 digits" - "Y: year with 4 digits" - "m: month with 1 or 2 digits" - "M: month with 2 digits" - "d: day with 1 or 2 digits" - "D: day with 2 digits" - "H: hours with 2 digits" - "I: minutes with 2 digits" - "S: seconds with 2 digits" - "" - "Example: \"Y-M-D\" corresponds to a date like \"2012-01-04\"" ) ); - layout->addWidget( mDatePatternEdit, 2, 3 ); - - // text codec - label = new QLabel( i18nc( "@label:listbox", "Text codec:" ), page ); - layout->addWidget( label, 3, 2 ); - - mCodecCombo = new KComboBox( page ); - mCodecCombo->setToolTip( - i18nc( "@info:tooltip", "Select the text codec" ) ); - mCodecCombo->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose the character encoding of the data in your csv file." ) ); - layout->addWidget( mCodecCombo, 3, 3 ); - - // skip first line - mSkipFirstRow = new QCheckBox( i18nc( "@option:check", "Skip first row of file" ), page ); - mSkipFirstRow->setToolTip( - i18nc( "@info:tooltip", "Skip first row of csv file when importing" ) ); - mSkipFirstRow->setWhatsThis( - i18nc( "@info:whatsthis", - "Check this box if you want the import to skip over the first row " - "of the csv data. In many cases, the first line of a csv file will be a " - "comment line describing the order of the data fields included in the file." ) ); - layout->addWidget( mSkipFirstRow, 4, 2, 1, 2 ); - - // csv view - mTable = new QTableView( page ); - mTable->setModel( mModel ); - mTable->setItemDelegateForRow( 0, new ContactFieldDelegate( this ) ); - mTable->horizontalHeader()->hide(); - mTable->verticalHeader()->hide(); - mTable->setEditTriggers( QAbstractItemView::CurrentChanged ); - mTable->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel ); - layout->addWidget( mTable, 5, 0, 1, 5 ); - - setButtonText( User1, i18nc( "@action:button", "Apply Template..." ) ); - setButtonText( User2, i18nc( "@action:button", "Save Template..." ) ); - - enableButton( Ok, false ); - enableButton( User1, false ); - enableButton( User2, false ); + QGridLayout *layout = new QGridLayout( page ); + layout->setSpacing( spacingHint() ); + layout->setMargin( 0 ); + + QHBoxLayout *hbox = new QHBoxLayout(); + hbox->setSpacing( spacingHint() ); + + QLabel *label = new QLabel( i18nc( "@label", "File to import:" ), page ); + hbox->addWidget( label ); + + mUrlRequester = new KUrlRequester( page ); + mUrlRequester->setFilter( QLatin1String("*.csv") ); + mUrlRequester->lineEdit()->setTrapReturnKey( true ); + mUrlRequester->setToolTip( + i18nc( "@info:tooltip", "Select a csv file to import" ) ); + mUrlRequester->setWhatsThis( + i18nc( "@info:whatsthis", + "Click this button to start a file chooser that will allow you to " + "select a csv file to import." ) ); + hbox->addWidget( mUrlRequester ); + + layout->addLayout( hbox, 0, 0, 1, 5 ); + + // Delimiter: comma, semicolon, tab, space, other + QGroupBox *group = new QGroupBox( i18nc( "@title:group", "Delimiter" ), page ); + QGridLayout *delimiterLayout = new QGridLayout; + delimiterLayout->setMargin( marginHint() ); + delimiterLayout->setSpacing( spacingHint() ); + group->setLayout( delimiterLayout ); + delimiterLayout->setAlignment( Qt::AlignTop ); + layout->addWidget( group, 1, 0, 4, 1 ); + + mDelimiterGroup = new QButtonGroup( this ); + mDelimiterGroup->setExclusive( true ); + + QRadioButton *button = new QRadioButton( i18nc( "@option:radio Field separator", "Comma" ) ); + button->setToolTip( + i18nc( "@info:tooltip", "Set the field separator to a comma" ) ); + button->setWhatsThis( + i18nc( "@info:whatsthis", + "Select this option if your csv file uses the comma as a field separator." ) ); + button->setChecked( true ); + mDelimiterGroup->addButton( button, 0 ); + delimiterLayout->addWidget( button, 0, 0 ); + + button = new QRadioButton( i18nc( "@option:radio Field separator", "Semicolon" ) ); + button->setToolTip( + i18nc( "@info:tooltip", "Set the field separator to a semicolon" ) ); + button->setWhatsThis( + i18nc( "@info:whatsthis", + "Select this option if your csv file uses the semicolon as a field separator." ) ); + mDelimiterGroup->addButton( button, 1 ); + delimiterLayout->addWidget( button, 0, 1 ); + + button = new QRadioButton( i18nc( "@option:radio Field separator", "Tabulator" ) ); + button->setToolTip( + i18nc( "@info:tooltip", "Set the field separator to a tab character" ) ); + button->setWhatsThis( + i18nc( "@info:whatsthis", + "Select this option if your csv file uses the tab character as a field separator." ) ); + mDelimiterGroup->addButton( button, 2 ); + delimiterLayout->addWidget( button, 1, 0 ); + + button = new QRadioButton( i18nc( "@option:radio Field separator", "Space" ) ); + button->setToolTip( + i18nc( "@info:tooltip", "Set the field separator to a space character" ) ); + button->setWhatsThis( + i18nc( "@info:whatsthis", + "Select this option if your csv file uses the space character as a field separator." ) ); + mDelimiterGroup->addButton( button, 3 ); + delimiterLayout->addWidget( button, 1, 1 ); + + button = new QRadioButton( i18nc( "@option:radio Custum field separator", "Other" ) ); + button->setToolTip( + i18nc( "@info:tooltip", "Set the field separator to a custom character" ) ); + button->setWhatsThis( + i18nc( "@info:whatsthis", + "Select this option if to use some other character as the field delimiter " + "for the data in your csv file." ) ); + mDelimiterGroup->addButton( button, 4 ); + delimiterLayout->addWidget( button, 0, 2 ); + + mDelimiterEdit = new KLineEdit( group ); + mDelimiterEdit->setToolTip( + i18nc( "@info:tooltip", + "Set the custom delimiter character" ) ); + mDelimiterEdit->setWhatsThis( + i18nc( "@info:whatsthis", + "Enter a custom character to use as the delimiter character. " + "If you enter more than 1 character, only the first will be used and " + "the remaining characters will be ignored." ) ); + delimiterLayout->addWidget( mDelimiterEdit, 1, 2 ); + + // text quote + label = new QLabel( i18nc( "@label:listbox", "Text quote:" ), page ); + layout->addWidget( label, 1, 2 ); + + mComboQuote = new KComboBox( page ); + mComboQuote->setToolTip( + i18nc( "@info:tooltip", "Select the quote character" ) ); + mComboQuote->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose the character that your csv data uses to \"quote\" the field delimiter " + "if that character happens to occur within the data. For example, if the " + "comma is the field delimiter, then any comma occurring with the data " + "will be \"quoted\" by the character specified here." ) ); + mComboQuote->setEditable( false ); + mComboQuote->addItem( i18nc( "@item:inlistbox Qoute character option", "\"" ), 0 ); + mComboQuote->addItem( i18nc( "@item:inlistbox Quote character option", "'" ), 1 ); + mComboQuote->addItem( i18nc( "@item:inlistbox Quote character option", "None" ), 2 ); + layout->addWidget( mComboQuote, 1, 3 ); + + // date format + label = new QLabel( i18nc( "@label:listbox", "Date format:" ), page ); + layout->addWidget( label, 2, 2 ); + + mDatePatternEdit = new KLineEdit( page ); + mDatePatternEdit->setText( QLatin1String("Y-M-D") ); // ISO 8601 date format as default + mDatePatternEdit->setToolTip( + i18nc( "@info:tooltip", + "y: year with 2 digits" + "Y: year with 4 digits" + "m: month with 1 or 2 digits" + "M: month with 2 digits" + "d: day with 1 or 2 digits" + "D: day with 2 digits" + "H: hours with 2 digits" + "I: minutes with 2 digits" + "S: seconds with 2 digits" + "" ) ); + mDatePatternEdit->setWhatsThis( + i18nc( "@info:whatsthis", + "Specify a format to use for dates included in your csv data. " + "Use the following sequences to help you define the format:" + "y: year with 2 digits" + "Y: year with 4 digits" + "m: month with 1 or 2 digits" + "M: month with 2 digits" + "d: day with 1 or 2 digits" + "D: day with 2 digits" + "H: hours with 2 digits" + "I: minutes with 2 digits" + "S: seconds with 2 digits" + "" + "Example: \"Y-M-D\" corresponds to a date like \"2012-01-04\"" ) ); + layout->addWidget( mDatePatternEdit, 2, 3 ); + + // text codec + label = new QLabel( i18nc( "@label:listbox", "Text codec:" ), page ); + layout->addWidget( label, 3, 2 ); + + mCodecCombo = new KComboBox( page ); + mCodecCombo->setToolTip( + i18nc( "@info:tooltip", "Select the text codec" ) ); + mCodecCombo->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose the character encoding of the data in your csv file." ) ); + layout->addWidget( mCodecCombo, 3, 3 ); + + // skip first line + mSkipFirstRow = new QCheckBox( i18nc( "@option:check", "Skip first row of file" ), page ); + mSkipFirstRow->setToolTip( + i18nc( "@info:tooltip", "Skip first row of csv file when importing" ) ); + mSkipFirstRow->setWhatsThis( + i18nc( "@info:whatsthis", + "Check this box if you want the import to skip over the first row " + "of the csv data. In many cases, the first line of a csv file will be a " + "comment line describing the order of the data fields included in the file." ) ); + layout->addWidget( mSkipFirstRow, 4, 2, 1, 2 ); + + // csv view + mTable = new QTableView( page ); + mTable->setModel( mModel ); + mTable->setItemDelegateForRow( 0, new ContactFieldDelegate( this ) ); + mTable->horizontalHeader()->hide(); + mTable->verticalHeader()->hide(); + mTable->setEditTriggers( QAbstractItemView::CurrentChanged ); + mTable->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel ); + layout->addWidget( mTable, 5, 0, 1, 5 ); + + setButtonText( User1, i18nc( "@action:button", "Apply Template..." ) ); + setButtonText( User2, i18nc( "@action:button", "Save Template..." ) ); + + enableButton( Ok, false ); + enableButton( User1, false ); + enableButton( User2, false ); - resize( 500, 400 ); + resize( 500, 400 ); } void CSVImportDialog::reloadCodecs() { - mCodecCombo->clear(); + mCodecCombo->clear(); + + mCodecs.clear(); + + Q_FOREACH ( const QByteArray &name, QTextCodec::availableCodecs() ) { + mCodecs.append( QTextCodec::codecForName( name ) ); + } - mCodecs.clear(); + mCodecCombo->addItem( i18nc( "@item:inlistbox Codec setting", "Local (%1)", + QLatin1String( QTextCodec::codecForLocale()->name() ) ), Local ); + mCodecCombo->addItem( i18nc( "@item:inlistbox Codec setting", "Latin1" ), Latin1 ); + mCodecCombo->addItem( i18nc( "@item:inlistbox Codec setting", "Unicode" ), Uni ); + mCodecCombo->addItem( i18nc( "@item:inlistbox Codec setting", "Microsoft Unicode" ), MSBug ); - Q_FOREACH ( const QByteArray &name, QTextCodec::availableCodecs() ) { - mCodecs.append( QTextCodec::codecForName( name ) ); - } - - mCodecCombo->addItem( i18nc( "@item:inlistbox Codec setting", "Local (%1)", - QLatin1String( QTextCodec::codecForLocale()->name() ) ), Local ); - mCodecCombo->addItem( i18nc( "@item:inlistbox Codec setting", "Latin1" ), Latin1 ); - mCodecCombo->addItem( i18nc( "@item:inlistbox Codec setting", "Unicode" ), Uni ); - mCodecCombo->addItem( i18nc( "@item:inlistbox Codec setting", "Microsoft Unicode" ), MSBug ); - - for ( int i = 0; i < mCodecs.count(); ++i ) { - mCodecCombo->addItem( QLatin1String(mCodecs.at( i )->name()), Codec + i ); - } + for ( int i = 0; i < mCodecs.count(); ++i ) { + mCodecCombo->addItem( QLatin1String(mCodecs.at( i )->name()), Codec + i ); + } } void CSVImportDialog::customDelimiterChanged() { - if ( mDelimiterGroup->checkedId() == 4 ) { - delimiterClicked( 4 ); - } + if ( mDelimiterGroup->checkedId() == 4 ) { + delimiterClicked( 4 ); + } } void CSVImportDialog::customDelimiterChanged( const QString &, bool reload ) { - mDelimiterGroup->button( 4 )->setChecked ( true ); - delimiterClicked( 4, reload ); // other + mDelimiterGroup->button( 4 )->setChecked ( true ); + delimiterClicked( 4, reload ); // other } void CSVImportDialog::delimiterClicked( int id, bool reload ) { - switch ( id ) { - case 0: // comma - mModel->setDelimiter( QLatin1Char(',') ); - break; - case 4: // other - mDelimiterEdit->setFocus( Qt::OtherFocusReason ); - if ( !mDelimiterEdit->text().isEmpty() ) { - mModel->setDelimiter( mDelimiterEdit->text().at( 0 ) ); - } - break; - case 2: // tab - mModel->setDelimiter( QLatin1Char('\t') ); - break; - case 3: // space - mModel->setDelimiter( QLatin1Char(' ') ); - break; - case 1: // semicolon - mModel->setDelimiter( QLatin1Char(';') ); - break; - } + switch ( id ) { + case 0: // comma + mModel->setDelimiter( QLatin1Char(',') ); + break; + case 4: // other + mDelimiterEdit->setFocus( Qt::OtherFocusReason ); + if ( !mDelimiterEdit->text().isEmpty() ) { + mModel->setDelimiter( mDelimiterEdit->text().at( 0 ) ); + } + break; + case 2: // tab + mModel->setDelimiter( QLatin1Char('\t') ); + break; + case 3: // space + mModel->setDelimiter( QLatin1Char(' ') ); + break; + case 1: // semicolon + mModel->setDelimiter( QLatin1Char(';') ); + break; + } - if ( mDevice && reload ) { - mModel->load( mDevice ); - } + if ( mDevice && reload ) { + mModel->load( mDevice ); + } } void CSVImportDialog::textQuoteChanged( const QString &mark, bool reload ) { - if ( mComboQuote->currentIndex() == 2 ) { - mModel->setTextQuote( QChar() ); - } else { - mModel->setTextQuote( mark.at( 0 ) ); - } + if ( mComboQuote->currentIndex() == 2 ) { + mModel->setTextQuote( QChar() ); + } else { + mModel->setTextQuote( mark.at( 0 ) ); + } - if ( mDevice && reload ) { - mModel->load( mDevice ); - } + if ( mDevice && reload ) { + mModel->load( mDevice ); + } } void CSVImportDialog::skipFirstRowChanged( bool checked, bool reload ) { - mFieldSelection.clear(); - for ( int column = 0; column < mModel->columnCount(); ++column ) { - mFieldSelection.append( - ( ContactFields::Field )mModel->data( mModel->index( 0, column ) ).toInt() ); - } - - if ( checked ) { - mModel->setStartRow( 1 ); - } else { - mModel->setStartRow( 0 ); - } + mFieldSelection.clear(); + for ( int column = 0; column < mModel->columnCount(); ++column ) { + mFieldSelection.append( + ( ContactFields::Field )mModel->data( mModel->index( 0, column ) ).toInt() ); + } - if ( mDevice && reload ) { - mModel->load( mDevice ); - } + if ( checked ) { + mModel->setStartRow( 1 ); + } else { + mModel->setStartRow( 0 ); + } + + if ( mDevice && reload ) { + mModel->load( mDevice ); + } } void CSVImportDialog::slotButtonClicked( int button ) { - if ( button == KDialog::Ok ) { - bool assigned = false; + if ( button == KDialog::Ok ) { + bool assigned = false; - for ( int column = 0; column < mModel->columnCount(); ++column ) { - if ( mModel->data( mModel->index( 0, column ), - Qt::DisplayRole ).toUInt() != ContactFields::Undefined ) { - assigned = true; - break; - } - } + for ( int column = 0; column < mModel->columnCount(); ++column ) { + if ( mModel->data( mModel->index( 0, column ), + Qt::DisplayRole ).toUInt() != ContactFields::Undefined ) { + assigned = true; + break; + } + } - if ( !assigned ) { - KMessageBox::sorry( - this, - i18nc( "@info:status", "You must assign at least one column." ) ); - } else { - accept(); + if ( !assigned ) { + KMessageBox::sorry( + this, + i18nc( "@info:status", "You must assign at least one column." ) ); + } else { + accept(); + } + } else if ( button == User1 ) { + applyTemplate(); + } else if ( button == User2 ) { + saveTemplate(); + } else if ( button == KDialog::Cancel ) { + reject(); } - } else if ( button == User1 ) { - applyTemplate(); - } else if ( button == User2 ) { - saveTemplate(); - } else if ( button == KDialog::Cancel ) { - reject(); - } } void CSVImportDialog::applyTemplate() { - QPointer dlg = new TemplateSelectionDialog( this ); - if ( !dlg->templatesAvailable() ) { - KMessageBox::sorry( - this, - i18nc( "@label", "There are no templates available yet." ), - i18nc( "@title:window", "No templates available" ) ); - delete dlg; - return; - } + QPointer dlg = new TemplateSelectionDialog( this ); + if ( !dlg->templatesAvailable() ) { + KMessageBox::sorry( + this, + i18nc( "@label", "There are no templates available yet." ), + i18nc( "@title:window", "No templates available" ) ); + delete dlg; + return; + } - if ( !dlg->exec() || !dlg ) { - delete dlg; - return; - } + if ( !dlg->exec() || !dlg ) { + delete dlg; + return; + } - const QString templateFileName = dlg->selectedTemplate(); - delete dlg; + const QString templateFileName = dlg->selectedTemplate(); + delete dlg; - KConfig config( templateFileName, KConfig::SimpleConfig ); + KConfig config( templateFileName, KConfig::SimpleConfig ); - const KConfigGroup generalGroup( &config, "General" ); - mDatePatternEdit->setText( generalGroup.readEntry( "DatePattern", "Y-M-D" ) ); - mDelimiterEdit->setText( generalGroup.readEntry( "DelimiterOther" ) ); + const KConfigGroup generalGroup( &config, "General" ); + mDatePatternEdit->setText( generalGroup.readEntry( "DatePattern", "Y-M-D" ) ); + mDelimiterEdit->setText( generalGroup.readEntry( "DelimiterOther" ) ); - const int delimiterButton = generalGroup.readEntry( "DelimiterType", 0 ); - const int quoteType = generalGroup.readEntry( "QuoteType", 0 ); - const bool skipFirstRow = generalGroup.readEntry( "SkipFirstRow", false ); + const int delimiterButton = generalGroup.readEntry( "DelimiterType", 0 ); + const int quoteType = generalGroup.readEntry( "QuoteType", 0 ); + const bool skipFirstRow = generalGroup.readEntry( "SkipFirstRow", false ); - mDelimiterGroup->button( delimiterButton )->setChecked( true ); - delimiterClicked( delimiterButton, false ); + mDelimiterGroup->button( delimiterButton )->setChecked( true ); + delimiterClicked( delimiterButton, false ); - mComboQuote->setCurrentIndex( quoteType ); - textQuoteChanged( mComboQuote->currentText(), false ); + mComboQuote->setCurrentIndex( quoteType ); + textQuoteChanged( mComboQuote->currentText(), false ); - // do block signals here, otherwise it will trigger a reload of the model and - // the following skipFirstRowChanged call end up with an empty model - mSkipFirstRow->blockSignals( true ); - mSkipFirstRow->setChecked( skipFirstRow ); - mSkipFirstRow->blockSignals( false ); + // do block signals here, otherwise it will trigger a reload of the model and + // the following skipFirstRowChanged call end up with an empty model + mSkipFirstRow->blockSignals( true ); + mSkipFirstRow->setChecked( skipFirstRow ); + mSkipFirstRow->blockSignals( false ); - skipFirstRowChanged( skipFirstRow, false ); + skipFirstRowChanged( skipFirstRow, false ); - if ( mDevice ) { - mModel->load( mDevice ); - } + if ( mDevice ) { + mModel->load( mDevice ); + } - setProperty( "TemplateFileName", templateFileName ); - connect( mModel, SIGNAL(finishedLoading()), this, SLOT(finalizeApplyTemplate()) ); + setProperty( "TemplateFileName", templateFileName ); + connect( mModel, SIGNAL(finishedLoading()), this, SLOT(finalizeApplyTemplate()) ); } void CSVImportDialog::finalizeApplyTemplate() { - const QString templateFileName = property( "TemplateFileName" ).toString(); + const QString templateFileName = property( "TemplateFileName" ).toString(); - KConfig config( templateFileName, KConfig::SimpleConfig ); + KConfig config( templateFileName, KConfig::SimpleConfig ); - const KConfigGroup generalGroup( &config, "General" ); - const uint columns = generalGroup.readEntry( "Columns", 0 ); + const KConfigGroup generalGroup( &config, "General" ); + const uint columns = generalGroup.readEntry( "Columns", 0 ); - // create the column map - const KConfigGroup columnMapGroup( &config, "csv column map" ); + // create the column map + const KConfigGroup columnMapGroup( &config, "csv column map" ); - for ( uint i = 0; i < columns; ++i ) { - const uint assignedField = columnMapGroup.readEntry( QString::number( i ), 0 ); - mModel->setData( mModel->index( 0, i ), assignedField, Qt::EditRole ); - } + for ( uint i = 0; i < columns; ++i ) { + const uint assignedField = columnMapGroup.readEntry( QString::number( i ), 0 ); + mModel->setData( mModel->index( 0, i ), assignedField, Qt::EditRole ); + } } void CSVImportDialog::saveTemplate() { - const QString name = - KInputDialog::getText( i18nc( "@title:window", "Template Name" ), - i18nc( "@info", "Please enter a name for the template:" ) ); - - if ( name.isEmpty() ) { - return; - } - - const QString fileName = - KStandardDirs::locateLocal( "data", QLatin1String( "kaddressbook/csv-templates/") + - QUuid::createUuid().toString() + - QLatin1String(".desktop" )); - - KConfig config( fileName ); - KConfigGroup generalGroup( &config, "General" ); - generalGroup.writeEntry( "DatePattern", mDatePatternEdit->text() ); - generalGroup.writeEntry( "Columns", mModel->columnCount() ); - generalGroup.writeEntry( "DelimiterType", mDelimiterGroup->checkedId() ); - generalGroup.writeEntry( "DelimiterOther", mDelimiterEdit->text() ); - generalGroup.writeEntry( "SkipFirstRow", mSkipFirstRow->isChecked() ); - generalGroup.writeEntry( "QuoteType", mComboQuote->currentIndex() ); - - KConfigGroup miscGroup( &config, "Misc" ); - miscGroup.writeEntry( "Name", name ); - - KConfigGroup columnMapGroup( &config, "csv column map" ); - for ( int column = 0; column < mModel->columnCount(); ++column ) { - columnMapGroup.writeEntry( QString::number( column ), - mModel->data( mModel->index( 0, column ), - Qt::DisplayRole ).toUInt() ); - } + const QString name = + KInputDialog::getText( i18nc( "@title:window", "Template Name" ), + i18nc( "@info", "Please enter a name for the template:" ) ); + + if ( name.isEmpty() ) { + return; + } + + const QString fileName = + KStandardDirs::locateLocal( "data", QLatin1String( "kaddressbook/csv-templates/") + + QUuid::createUuid().toString() + + QLatin1String(".desktop" )); + + KConfig config( fileName ); + KConfigGroup generalGroup( &config, "General" ); + generalGroup.writeEntry( "DatePattern", mDatePatternEdit->text() ); + generalGroup.writeEntry( "Columns", mModel->columnCount() ); + generalGroup.writeEntry( "DelimiterType", mDelimiterGroup->checkedId() ); + generalGroup.writeEntry( "DelimiterOther", mDelimiterEdit->text() ); + generalGroup.writeEntry( "SkipFirstRow", mSkipFirstRow->isChecked() ); + generalGroup.writeEntry( "QuoteType", mComboQuote->currentIndex() ); + + KConfigGroup miscGroup( &config, "Misc" ); + miscGroup.writeEntry( "Name", name ); + + KConfigGroup columnMapGroup( &config, "csv column map" ); + for ( int column = 0; column < mModel->columnCount(); ++column ) { + columnMapGroup.writeEntry( QString::number( column ), + mModel->data( mModel->index( 0, column ), + Qt::DisplayRole ).toUInt() ); + } - config.sync(); + config.sync(); } void CSVImportDialog::setFile( const KUrl &fileName ) { - setFile( fileName.toLocalFile() ); + setFile( fileName.toLocalFile() ); } void CSVImportDialog::setFile( const QString &fileName ) { - if ( fileName.isEmpty() ) { - return; - } - - QFile *file = new QFile( fileName ); - if ( !file->open( QIODevice::ReadOnly ) ) { - KMessageBox::sorry( this, i18nc( "@info:status", "Cannot open input file." ) ); - delete file; - return; - } + if ( fileName.isEmpty() ) { + return; + } + + QFile *file = new QFile( fileName ); + if ( !file->open( QIODevice::ReadOnly ) ) { + KMessageBox::sorry( this, i18nc( "@info:status", "Cannot open input file." ) ); + delete file; + return; + } - delete mDevice; + delete mDevice; - mDevice = file; + mDevice = file; - mModel->load( mDevice ); + mModel->load( mDevice ); } void CSVImportDialog::urlChanged( const QString &file ) { - bool state = !file.isEmpty(); + bool state = !file.isEmpty(); - enableButton( Ok, state ); - enableButton( User1, state ); - enableButton( User2, state ); + enableButton( Ok, state ); + enableButton( User1, state ); + enableButton( User2, state ); } void CSVImportDialog::codecChanged( bool reload ) { - const int code = mCodecCombo->currentIndex(); + const int code = mCodecCombo->currentIndex(); - if ( code == Local ) { - mModel->setTextCodec( QTextCodec::codecForLocale() ); - } else if ( code >= Codec ) { - mModel->setTextCodec( mCodecs.at( code - Codec ) ); - } else if ( code == Uni ) { - mModel->setTextCodec( QTextCodec::codecForName( "UTF-16" ) ); - } else if ( code == MSBug ) { - mModel->setTextCodec( QTextCodec::codecForName( "UTF-16LE" ) ); - } else if ( code == Latin1 ) { - mModel->setTextCodec( QTextCodec::codecForName( "ISO 8859-1" ) ); - } else { - mModel->setTextCodec( QTextCodec::codecForName( "UTF-8" ) ); - } + if ( code == Local ) { + mModel->setTextCodec( QTextCodec::codecForLocale() ); + } else if ( code >= Codec ) { + mModel->setTextCodec( mCodecs.at( code - Codec ) ); + } else if ( code == Uni ) { + mModel->setTextCodec( QTextCodec::codecForName( "UTF-16" ) ); + } else if ( code == MSBug ) { + mModel->setTextCodec( QTextCodec::codecForName( "UTF-16LE" ) ); + } else if ( code == Latin1 ) { + mModel->setTextCodec( QTextCodec::codecForName( "ISO 8859-1" ) ); + } else { + mModel->setTextCodec( QTextCodec::codecForName( "UTF-8" ) ); + } - if ( mDevice && reload ) { - mModel->load( mDevice ); - } + if ( mDevice && reload ) { + mModel->load( mDevice ); + } } void CSVImportDialog::modelFinishedLoading() { - ContactFieldComboBox *box = new ContactFieldComboBox(); - int preferredWidth = box->sizeHint().width(); - delete box; - - for ( int i = 0; i < mModel->columnCount(); ++i ) { - mTable->setColumnWidth( i, preferredWidth ); - } - - for ( int column = 0; column < mFieldSelection.count(); ++column ) { - mModel->setData( mModel->index( 0, column ), mFieldSelection.at( column ), Qt::EditRole ); - } - mFieldSelection.clear(); + ContactFieldComboBox *box = new ContactFieldComboBox(); + int preferredWidth = box->sizeHint().width(); + delete box; + + for ( int i = 0; i < mModel->columnCount(); ++i ) { + mTable->setColumnWidth( i, preferredWidth ); + } + + for ( int column = 0; column < mFieldSelection.count(); ++column ) { + mModel->setData( mModel->index( 0, column ), mFieldSelection.at( column ), Qt::EditRole ); + } + mFieldSelection.clear(); } #include diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/csvimportdialog.h kdepim-4.13.3/kaddressbook/xxport/csv/csvimportdialog.h --- kdepim-4.13.0/kaddressbook/xxport/csv/csvimportdialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/csvimportdialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -39,18 +39,18 @@ class CSVImportDialog : public KDialog { - Q_OBJECT + Q_OBJECT - public: +public: explicit CSVImportDialog( QWidget *parent = 0 ); ~CSVImportDialog(); KABC::AddresseeList contacts() const; - protected Q_SLOTS: +protected Q_SLOTS: virtual void slotButtonClicked( int ); - private Q_SLOTS: +private Q_SLOTS: void setFile( const QString & ); void setFile( const KUrl & ); void urlChanged( const QString & ); @@ -65,7 +65,7 @@ void modelFinishedLoading(); void finalizeApplyTemplate(); - private: +private: void applyTemplate(); void saveTemplate(); diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/csv_xxport.cpp kdepim-4.13.3/kaddressbook/xxport/csv/csv_xxport.cpp --- kdepim-4.13.0/kaddressbook/xxport/csv/csv_xxport.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/csv_xxport.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -35,129 +35,129 @@ #include CsvXXPort::CsvXXPort( QWidget *parent ) - : XXPort( parent ) + : XXPort( parent ) { } bool CsvXXPort::exportContacts( const KABC::Addressee::List &contacts ) const { - KUrl url = KFileDialog::getSaveUrl( KUrl( QLatin1String("addressbook.csv") ) ); - if ( url.isEmpty() ) { - return true; - } - - if ( QFileInfo( url.isLocalFile() ? url.toLocalFile() : url.path() ).exists() ) { - if ( url.isLocalFile() && QFileInfo( url.toLocalFile() ).exists() ) { - PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE; - PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget()); - result = static_cast(dialog->exec()); - if ( result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME ) { - url = dialog->newName(); - } else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) { - delete dialog; - return true; - } - delete dialog; - } - } - - if ( !url.isLocalFile() ) { - KTemporaryFile tmpFile; - if ( !tmpFile.open() ) { - const QString msg = i18n( "Unable to open file %1", url.url() ); - KMessageBox::error( parentWidget(), msg ); - return false; - } - - exportToFile( &tmpFile, contacts ); - tmpFile.flush(); - - return KIO::NetAccess::upload( tmpFile.fileName(), url, parentWidget() ); - - } else { - QFile file( url.toLocalFile() ); - if ( !file.open( QIODevice::WriteOnly ) ) { - const QString msg = i18n( "Unable to open file %1.", url.toLocalFile() ); - KMessageBox::error( parentWidget(), msg ); - return false; + KUrl url = KFileDialog::getSaveUrl( KUrl( QLatin1String("addressbook.csv") ) ); + if ( url.isEmpty() ) { + return true; } - exportToFile( &file, contacts ); - file.close(); + if ( QFileInfo( url.isLocalFile() ? url.toLocalFile() : url.path() ).exists() ) { + if ( url.isLocalFile() && QFileInfo( url.toLocalFile() ).exists() ) { + PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE; + PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget()); + result = static_cast(dialog->exec()); + if ( result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME ) { + url = dialog->newName(); + } else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) { + delete dialog; + return true; + } + delete dialog; + } + } + + if ( !url.isLocalFile() ) { + KTemporaryFile tmpFile; + if ( !tmpFile.open() ) { + const QString msg = i18n( "Unable to open file %1", url.url() ); + KMessageBox::error( parentWidget(), msg ); + return false; + } + + exportToFile( &tmpFile, contacts ); + tmpFile.flush(); - return true; - } + return KIO::NetAccess::upload( tmpFile.fileName(), url, parentWidget() ); + + } else { + QFile file( url.toLocalFile() ); + if ( !file.open( QIODevice::WriteOnly ) ) { + const QString msg = i18n( "Unable to open file %1.", url.toLocalFile() ); + KMessageBox::error( parentWidget(), msg ); + return false; + } + + exportToFile( &file, contacts ); + file.close(); + + return true; + } } void CsvXXPort::exportToFile( QFile *file, const KABC::Addressee::List &contacts ) const { - QTextStream stream( file ); - stream.setCodec( QTextCodec::codecForLocale() ); + QTextStream stream( file ); + stream.setCodec( QTextCodec::codecForLocale() ); - ContactFields::Fields fields = ContactFields::allFields(); - fields.remove( ContactFields::Undefined ); + ContactFields::Fields fields = ContactFields::allFields(); + fields.remove( ContactFields::Undefined ); - bool first = true; + bool first = true; - // First output the column headings - for ( int i = 0; i < fields.count(); ++i ) { - if ( !first ) { - stream << ","; - } - - // add quoting as defined in RFC 4180 - QString label = ContactFields::label( fields.at( i ) ); - label.replace( QLatin1Char( '"' ), QLatin1String( "\"\"" ) ); - - stream << "\"" << label << "\""; - first = false; - } - stream << "\n"; - - // Then all the contacts - for ( int i = 0; i < contacts.count(); ++i ) { - - const KABC::Addressee contact = contacts.at( i ); - first = true; - - for ( int j = 0; j < fields.count(); ++j ) { - if ( !first ) { - stream << ","; - } - - QString content; - if ( fields.at( j ) == ContactFields::Birthday || - fields.at( j ) == ContactFields::Anniversary ) { - const QDateTime dateTime = - QDateTime::fromString( ContactFields::value( fields.at( j ), contact ), Qt::ISODate ); - if ( dateTime.isValid() ) { - content = dateTime.date().toString( Qt::ISODate ); + // First output the column headings + for ( int i = 0; i < fields.count(); ++i ) { + if ( !first ) { + stream << ","; } - } else { - content = ContactFields::value( fields.at( j ), contact ).replace( QLatin1Char('\n'), QLatin1String("\\n") ); - } - // add quoting as defined in RFC 4180 - content.replace( QLatin1Char( '"' ), QLatin1String( "\"\"" ) ); + // add quoting as defined in RFC 4180 + QString label = ContactFields::label( fields.at( i ) ); + label.replace( QLatin1Char( '"' ), QLatin1String( "\"\"" ) ); - stream << '\"' << content << '\"'; - first = false; + stream << "\"" << label << "\""; + first = false; } - stream << "\n"; - } + + // Then all the contacts + for ( int i = 0; i < contacts.count(); ++i ) { + + const KABC::Addressee contact = contacts.at( i ); + first = true; + + for ( int j = 0; j < fields.count(); ++j ) { + if ( !first ) { + stream << ","; + } + + QString content; + if ( fields.at( j ) == ContactFields::Birthday || + fields.at( j ) == ContactFields::Anniversary ) { + const QDateTime dateTime = + QDateTime::fromString( ContactFields::value( fields.at( j ), contact ), Qt::ISODate ); + if ( dateTime.isValid() ) { + content = dateTime.date().toString( Qt::ISODate ); + } + } else { + content = ContactFields::value( fields.at( j ), contact ).replace( QLatin1Char('\n'), QLatin1String("\\n") ); + } + + // add quoting as defined in RFC 4180 + content.replace( QLatin1Char( '"' ), QLatin1String( "\"\"" ) ); + + stream << '\"' << content << '\"'; + first = false; + } + + stream << "\n"; + } } KABC::Addressee::List CsvXXPort::importContacts() const { - KABC::Addressee::List contacts; + KABC::Addressee::List contacts; - QPointer dlg = new CSVImportDialog( parentWidget() ); - if ( dlg->exec() && dlg ) { - contacts = dlg->contacts(); - } + QPointer dlg = new CSVImportDialog( parentWidget() ); + if ( dlg->exec() && dlg ) { + contacts = dlg->contacts(); + } - delete dlg; + delete dlg; - return contacts; + return contacts; } diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/csv_xxport.h kdepim-4.13.3/kaddressbook/xxport/csv/csv_xxport.h --- kdepim-4.13.0/kaddressbook/xxport/csv/csv_xxport.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/csv_xxport.h 2014-07-09 12:18:50.000000000 +0000 @@ -26,13 +26,13 @@ class CsvXXPort : public XXPort { - public: +public: explicit CsvXXPort( QWidget *parent = 0 ); bool exportContacts( const KABC::Addressee::List &contacts ) const; KABC::Addressee::List importContacts() const; - private: +private: void exportToFile( QFile *, const KABC::Addressee::List & ) const; }; diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/dateparser.cpp kdepim-4.13.3/kaddressbook/xxport/csv/dateparser.cpp --- kdepim-4.13.0/kaddressbook/xxport/csv/dateparser.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/dateparser.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -20,7 +20,7 @@ #include "dateparser.h" DateParser::DateParser( const QString &pattern ) - : mPattern( pattern ) + : mPattern( pattern ) { } @@ -30,102 +30,102 @@ QDateTime DateParser::parse( const QString &dateStr ) const { - int year, month, day, hour, minute, second; - year = month = day = hour = minute = second = 0; + int year, month, day, hour, minute, second; + year = month = day = hour = minute = second = 0; - int currPos = 0; - for ( int i = 0; i < mPattern.length(); ++i ) { - if ( mPattern[ i ] == QLatin1Char('y') ) { // 19YY - if ( currPos + 1 < dateStr.length() ) { - year = 1900 + dateStr.mid( currPos, 2 ).toInt(); - currPos += 2; - } else { - return QDateTime(); - } - } else if ( mPattern[ i ] == QLatin1Char('Y') ) { // YYYY - if ( currPos + 3 < dateStr.length() ) { - year = dateStr.mid( currPos, 4 ).toInt(); - currPos += 4; - } else { - return QDateTime(); - } - } else if ( mPattern[ i ] == QLatin1Char('m') ) { // M or MM - if ( currPos + 1 < dateStr.length() ) { - if ( dateStr[ currPos ].isDigit() ) { - if ( dateStr[ currPos + 1 ].isDigit() ) { - month = dateStr.mid( currPos, 2 ).toInt(); - currPos += 2; - continue; - } + int currPos = 0; + for ( int i = 0; i < mPattern.length(); ++i ) { + if ( mPattern[ i ] == QLatin1Char('y') ) { // 19YY + if ( currPos + 1 < dateStr.length() ) { + year = 1900 + dateStr.mid( currPos, 2 ).toInt(); + currPos += 2; + } else { + return QDateTime(); + } + } else if ( mPattern[ i ] == QLatin1Char('Y') ) { // YYYY + if ( currPos + 3 < dateStr.length() ) { + year = dateStr.mid( currPos, 4 ).toInt(); + currPos += 4; + } else { + return QDateTime(); + } + } else if ( mPattern[ i ] == QLatin1Char('m') ) { // M or MM + if ( currPos + 1 < dateStr.length() ) { + if ( dateStr[ currPos ].isDigit() ) { + if ( dateStr[ currPos + 1 ].isDigit() ) { + month = dateStr.mid( currPos, 2 ).toInt(); + currPos += 2; + continue; + } + } + } + if ( currPos < dateStr.length() ) { + if ( dateStr[ currPos ].isDigit() ) { + month = dateStr.mid( currPos, 1 ).toInt(); + currPos++; + continue; + } + } + + return QDateTime(); + } else if ( mPattern[ i ] == QLatin1Char('M') ) { // 0M or MM + if ( currPos + 1 < dateStr.length() ) { + month = dateStr.mid( currPos, 2 ).toInt(); + currPos += 2; + } else { + return QDateTime(); + } + } else if ( mPattern[ i ] == QLatin1Char('d') ) { // D or DD + if ( currPos + 1 < dateStr.length() ) { + if ( dateStr[ currPos ].isDigit() ) { + if ( dateStr[ currPos + 1 ].isDigit() ) { + day = dateStr.mid( currPos, 2 ).toInt(); + currPos += 2; + continue; + } + } + } + if ( currPos < dateStr.length() ) { + if ( dateStr[ currPos ].isDigit() ) { + day = dateStr.mid( currPos, 1 ).toInt(); + currPos++; + continue; + } + } + + return QDateTime(); + } else if ( mPattern[ i ] == QLatin1Char('D') ) { // 0D or DD + if ( currPos + 1 < dateStr.length() ) { + day = dateStr.mid( currPos, 2 ).toInt(); + currPos += 2; + } else { + return QDateTime(); + } + } else if ( mPattern[ i ] == QLatin1Char('H') ) { // 0H or HH + if ( currPos + 1 < dateStr.length() ) { + hour = dateStr.mid( currPos, 2 ).toInt(); + currPos += 2; + } else { + return QDateTime(); + } + } else if ( mPattern[ i ] == QLatin1Char('I') ) { // 0I or II + if ( currPos + 1 < dateStr.length() ) { + minute = dateStr.mid( currPos, 2 ).toInt(); + currPos += 2; + } else { + return QDateTime(); + } + } else if ( mPattern[ i ] == QLatin1Char('S') ) { // 0S or SS + if ( currPos + 1 < dateStr.length() ) { + second = dateStr.mid( currPos, 2 ).toInt(); + currPos += 2; + } else { + return QDateTime(); + } + } else { + currPos++; } - } - if ( currPos < dateStr.length() ) { - if ( dateStr[ currPos ].isDigit() ) { - month = dateStr.mid( currPos, 1 ).toInt(); - currPos++; - continue; - } - } - - return QDateTime(); - } else if ( mPattern[ i ] == QLatin1Char('M') ) { // 0M or MM - if ( currPos + 1 < dateStr.length() ) { - month = dateStr.mid( currPos, 2 ).toInt(); - currPos += 2; - } else { - return QDateTime(); - } - } else if ( mPattern[ i ] == QLatin1Char('d') ) { // D or DD - if ( currPos + 1 < dateStr.length() ) { - if ( dateStr[ currPos ].isDigit() ) { - if ( dateStr[ currPos + 1 ].isDigit() ) { - day = dateStr.mid( currPos, 2 ).toInt(); - currPos += 2; - continue; - } - } - } - if ( currPos < dateStr.length() ) { - if ( dateStr[ currPos ].isDigit() ) { - day = dateStr.mid( currPos, 1 ).toInt(); - currPos++; - continue; - } - } - - return QDateTime(); - } else if ( mPattern[ i ] == QLatin1Char('D') ) { // 0D or DD - if ( currPos + 1 < dateStr.length() ) { - day = dateStr.mid( currPos, 2 ).toInt(); - currPos += 2; - } else { - return QDateTime(); - } - } else if ( mPattern[ i ] == QLatin1Char('H') ) { // 0H or HH - if ( currPos + 1 < dateStr.length() ) { - hour = dateStr.mid( currPos, 2 ).toInt(); - currPos += 2; - } else { - return QDateTime(); - } - } else if ( mPattern[ i ] == QLatin1Char('I') ) { // 0I or II - if ( currPos + 1 < dateStr.length() ) { - minute = dateStr.mid( currPos, 2 ).toInt(); - currPos += 2; - } else { - return QDateTime(); - } - } else if ( mPattern[ i ] == QLatin1Char('S') ) { // 0S or SS - if ( currPos + 1 < dateStr.length() ) { - second = dateStr.mid( currPos, 2 ).toInt(); - currPos += 2; - } else { - return QDateTime(); - } - } else { - currPos++; } - } - return QDateTime( QDate( year, month, day ), QTime( hour, minute, second ) ); + return QDateTime( QDate( year, month, day ), QTime( hour, minute, second ) ); } diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/dateparser.h kdepim-4.13.3/kaddressbook/xxport/csv/dateparser.h --- kdepim-4.13.0/kaddressbook/xxport/csv/dateparser.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/dateparser.h 2014-07-09 12:18:50.000000000 +0000 @@ -40,13 +40,13 @@ */ class DateParser { - public: +public: explicit DateParser( const QString &pattern ); ~DateParser(); QDateTime parse( const QString &dateStr ) const; - private: +private: QString mPattern; }; diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/qcsvmodel.cpp kdepim-4.13.3/kaddressbook/xxport/csv/qcsvmodel.cpp --- kdepim-4.13.0/kaddressbook/xxport/csv/qcsvmodel.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/qcsvmodel.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -27,59 +27,59 @@ #include CsvParser::CsvParser( QObject *parent ) - : QThread( parent ), mDevice( 0 ), mRowCount( 0 ), mColumnCount( 0 ), mCacheCounter( 0 ) + : QThread( parent ), mDevice( 0 ), mRowCount( 0 ), mColumnCount( 0 ), mCacheCounter( 0 ) { - mReader = new QCsvReader( this ); + mReader = new QCsvReader( this ); } CsvParser::~CsvParser() { - delete mReader; + delete mReader; } void CsvParser::load( QIODevice *device ) { - mDevice = device; + mDevice = device; - start(); + start(); } void CsvParser::begin() { - mCacheCounter = 0; - mRowCount = 0; - mColumnCount = 0; + mCacheCounter = 0; + mRowCount = 0; + mColumnCount = 0; } void CsvParser::beginLine() { - mRowCount++; + mRowCount++; } void CsvParser::field( const QString &data, uint row, uint column ) { - const int tmp = qMax( mColumnCount, (int)column + 1 ); - if ( tmp != mColumnCount ) { - mColumnCount = tmp; - emit columnCountChanged( tmp ); - } + const int tmp = qMax( mColumnCount, (int)column + 1 ); + if ( tmp != mColumnCount ) { + mColumnCount = tmp; + emit columnCountChanged( tmp ); + } - emit dataChanged( data, row, column ); + emit dataChanged( data, row, column ); } void CsvParser::endLine() { - mCacheCounter++; - if ( mCacheCounter == 50 ) { - emit rowCountChanged( mRowCount ); - mCacheCounter = 0; - } + mCacheCounter++; + if ( mCacheCounter == 50 ) { + emit rowCountChanged( mRowCount ); + mCacheCounter = 0; + } } void CsvParser::end() { - emit rowCountChanged( mRowCount ); - emit ended(); + emit rowCountChanged( mRowCount ); + emit ended(); } void CsvParser::error( const QString & ) @@ -88,20 +88,20 @@ void CsvParser::run() { - if ( !mDevice->isOpen() ) { - mDevice->open( QIODevice::ReadOnly ); - } + if ( !mDevice->isOpen() ) { + mDevice->open( QIODevice::ReadOnly ); + } - mDevice->reset(); - mReader->read( mDevice ); + mDevice->reset(); + mReader->read( mDevice ); } class QCsvModel::Private { - public: +public: Private( QCsvModel *model ) - : mParent( model ), mParser( 0 ), - mDevice( 0 ), mRowCount( 0 ), mColumnCount( 0 ) + : mParent( model ), mParser( 0 ), + mDevice( 0 ), mRowCount( 0 ), mColumnCount( 0 ) { } @@ -122,215 +122,215 @@ void QCsvModel::Private::columnCountChanged( int columns ) { - mColumnCount = columns; - mFieldIdentifiers.resize( columns ); - mFieldIdentifiers[ columns - 1 ] = QLatin1String( "0" ); - emit mParent->layoutChanged(); + mColumnCount = columns; + mFieldIdentifiers.resize( columns ); + mFieldIdentifiers[ columns - 1 ] = QLatin1String( "0" ); + emit mParent->layoutChanged(); } void QCsvModel::Private::rowCountChanged( int rows ) { - mRowCount = rows; - emit mParent->layoutChanged(); + mRowCount = rows; + emit mParent->layoutChanged(); } void QCsvModel::Private::fieldChanged( const QString &data, int row, int column ) { - mFields.insert( QPair( row, column ), data ); + mFields.insert( QPair( row, column ), data ); } void QCsvModel::Private::finishedLoading() { - emit mParent->finishedLoading(); + emit mParent->finishedLoading(); } QCsvModel::QCsvModel( QObject *parent ) - : QAbstractTableModel( parent ), d( new Private( this ) ) + : QAbstractTableModel( parent ), d( new Private( this ) ) { - d->mParser = new CsvParser( this ); + d->mParser = new CsvParser( this ); - connect( d->mParser, SIGNAL(columnCountChanged(int)), - this, SLOT(columnCountChanged(int)), Qt::QueuedConnection ); - connect( d->mParser, SIGNAL(rowCountChanged(int)), - this, SLOT(rowCountChanged(int)), Qt::QueuedConnection ); - connect( d->mParser, SIGNAL(dataChanged(QString,int,int)), - this, SLOT(fieldChanged(QString,int,int)), Qt::QueuedConnection ); - connect( d->mParser, SIGNAL(ended()), this, SLOT(finishedLoading()) ); + connect( d->mParser, SIGNAL(columnCountChanged(int)), + this, SLOT(columnCountChanged(int)), Qt::QueuedConnection ); + connect( d->mParser, SIGNAL(rowCountChanged(int)), + this, SLOT(rowCountChanged(int)), Qt::QueuedConnection ); + connect( d->mParser, SIGNAL(dataChanged(QString,int,int)), + this, SLOT(fieldChanged(QString,int,int)), Qt::QueuedConnection ); + connect( d->mParser, SIGNAL(ended()), this, SLOT(finishedLoading()) ); } QCsvModel::~QCsvModel() { - delete d; + delete d; } bool QCsvModel::load( QIODevice *device ) { - d->mDevice = device; - d->mRowCount = 0; - d->mColumnCount = 0; + d->mDevice = device; + d->mRowCount = 0; + d->mColumnCount = 0; - emit layoutChanged(); + emit layoutChanged(); - d->mParser->load( device ); + d->mParser->load( device ); - return true; + return true; } void QCsvModel::setTextQuote( const QChar &textQuote ) { - const bool isRunning = d->mParser->isRunning(); + const bool isRunning = d->mParser->isRunning(); - if ( isRunning ) { - d->mParser->reader()->terminate(); - d->mParser->wait(); - } - - d->mParser->reader()->setTextQuote( textQuote ); - - if ( isRunning ) { - load( d->mDevice ); - } + if ( isRunning ) { + d->mParser->reader()->terminate(); + d->mParser->wait(); + } + + d->mParser->reader()->setTextQuote( textQuote ); + + if ( isRunning ) { + load( d->mDevice ); + } } QChar QCsvModel::textQuote() const { - return d->mParser->reader()->textQuote(); + return d->mParser->reader()->textQuote(); } void QCsvModel::setDelimiter( const QChar &delimiter ) { - const bool isRunning = d->mParser->isRunning(); + const bool isRunning = d->mParser->isRunning(); + + if ( isRunning ) { + d->mParser->reader()->terminate(); + d->mParser->wait(); + } + + d->mParser->reader()->setDelimiter( delimiter ); - if ( isRunning ) { - d->mParser->reader()->terminate(); - d->mParser->wait(); - } - - d->mParser->reader()->setDelimiter( delimiter ); - - if ( isRunning ) { - load( d->mDevice ); - } + if ( isRunning ) { + load( d->mDevice ); + } } QChar QCsvModel::delimiter() const { - return d->mParser->reader()->delimiter(); + return d->mParser->reader()->delimiter(); } void QCsvModel::setStartRow( uint startRow ) { - const bool isRunning = d->mParser->isRunning(); + const bool isRunning = d->mParser->isRunning(); + + if ( isRunning ) { + d->mParser->reader()->terminate(); + d->mParser->wait(); + } + + d->mParser->reader()->setStartRow( startRow ); - if ( isRunning ) { - d->mParser->reader()->terminate(); - d->mParser->wait(); - } - - d->mParser->reader()->setStartRow( startRow ); - - if ( isRunning ) { - load( d->mDevice ); - } + if ( isRunning ) { + load( d->mDevice ); + } } uint QCsvModel::startRow() const { - return d->mParser->reader()->startRow(); + return d->mParser->reader()->startRow(); } void QCsvModel::setTextCodec( QTextCodec *textCodec ) { - const bool isRunning = d->mParser->isRunning(); + const bool isRunning = d->mParser->isRunning(); + + if ( isRunning ) { + d->mParser->reader()->terminate(); + d->mParser->wait(); + } - if ( isRunning ) { - d->mParser->reader()->terminate(); - d->mParser->wait(); - } - - d->mParser->reader()->setTextCodec( textCodec ); - - if ( isRunning ) { - load( d->mDevice ); - } + d->mParser->reader()->setTextCodec( textCodec ); + + if ( isRunning ) { + load( d->mDevice ); + } } QTextCodec *QCsvModel::textCodec() const { - return d->mParser->reader()->textCodec(); + return d->mParser->reader()->textCodec(); } int QCsvModel::columnCount( const QModelIndex &parent ) const { - if ( !parent.isValid() ) { - return d->mColumnCount; - } else { - return 0; - } + if ( !parent.isValid() ) { + return d->mColumnCount; + } else { + return 0; + } } int QCsvModel::rowCount( const QModelIndex &parent ) const { - if ( !parent.isValid() ) { - return d->mRowCount + 1; // +1 for the header row - } else { - return 0; - } + if ( !parent.isValid() ) { + return d->mRowCount + 1; // +1 for the header row + } else { + return 0; + } } QVariant QCsvModel::data( const QModelIndex &index, int role ) const { - if ( !index.isValid() ) { - return QVariant(); - } - - if ( index.row() == 0 ) { - if ( index.column() >= d->mFieldIdentifiers.count() ) { - return QVariant(); + if ( !index.isValid() ) { + return QVariant(); } - if ( role == Qt::DisplayRole || role == Qt::EditRole ) { - return d->mFieldIdentifiers.at( index.column() ); - } + if ( index.row() == 0 ) { + if ( index.column() >= d->mFieldIdentifiers.count() ) { + return QVariant(); + } + + if ( role == Qt::DisplayRole || role == Qt::EditRole ) { + return d->mFieldIdentifiers.at( index.column() ); + } - return QVariant(); - } + return QVariant(); + } - const QPair pair( index.row() - 1, index.column() ); - if ( !d->mFields.contains( pair ) ) { - return QVariant(); - } + const QPair pair( index.row() - 1, index.column() ); + if ( !d->mFields.contains( pair ) ) { + return QVariant(); + } - const QString data = d->mFields.value( pair ); + const QString data = d->mFields.value( pair ); - if ( role == Qt::DisplayRole ) { - return data; - } else { - return QVariant(); - } + if ( role == Qt::DisplayRole ) { + return data; + } else { + return QVariant(); + } } bool QCsvModel::setData( const QModelIndex &index, const QVariant &data, int role ) { - if ( role == Qt::EditRole && index.row() == 0 && - index.column() <= d->mFieldIdentifiers.count() ) { - d->mFieldIdentifiers[ index.column() ] = data.toString(); + if ( role == Qt::EditRole && index.row() == 0 && + index.column() <= d->mFieldIdentifiers.count() ) { + d->mFieldIdentifiers[ index.column() ] = data.toString(); - emit dataChanged( index, index ); - return true; - } + emit dataChanged( index, index ); + return true; + } - return false; + return false; } Qt::ItemFlags QCsvModel::flags( const QModelIndex &index ) const { - Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; - if ( index.row() == 0 ) { - flags |= Qt::ItemIsEditable; - } + Qt::ItemFlags flags = Qt::ItemIsSelectable | Qt::ItemIsEnabled; + if ( index.row() == 0 ) { + flags |= Qt::ItemIsEditable; + } - return flags; + return flags; } #include "moc_qcsvmodel.cpp" diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/qcsvmodel.h kdepim-4.13.3/kaddressbook/xxport/csv/qcsvmodel.h --- kdepim-4.13.0/kaddressbook/xxport/csv/qcsvmodel.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/qcsvmodel.h 2014-07-09 12:18:50.000000000 +0000 @@ -24,9 +24,9 @@ class QCsvModel : public QAbstractTableModel { - Q_OBJECT + Q_OBJECT - public: +public: /** * Creates a new csv model. */ @@ -116,13 +116,13 @@ */ virtual Qt::ItemFlags flags( const QModelIndex &index ) const; - Q_SIGNALS: +Q_SIGNALS: /** * This signal is emitted whenever the model has loaded all data. */ void finishedLoading(); - private: +private: class Private; Private *const d; diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/qcsvreader.cpp kdepim-4.13.3/kaddressbook/xxport/csv/qcsvreader.cpp --- kdepim-4.13.0/kaddressbook/xxport/csv/qcsvreader.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/qcsvreader.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -31,14 +31,14 @@ class QCsvReader::Private { - public: +public: Private( QCsvBuilderInterface *builder ) - : mBuilder( builder ), mNotTerminated( true ) + : mBuilder( builder ), mNotTerminated( true ) { - mTextQuote = QLatin1Char( '"' ); - mDelimiter = QLatin1Char( ' ' ); - mStartRow = 0; - mCodec = QTextCodec::codecForLocale(); + mTextQuote = QLatin1Char( '"' ); + mDelimiter = QLatin1Char( ' ' ); + mStartRow = 0; + mCodec = QTextCodec::codecForLocale(); } void emitBeginLine( uint row ); @@ -56,68 +56,68 @@ void QCsvReader::Private::emitBeginLine( uint row ) { - if ( ( row - mStartRow ) > 0 ) { - mBuilder->beginLine(); - } + if ( ( row - mStartRow ) > 0 ) { + mBuilder->beginLine(); + } } void QCsvReader::Private::emitEndLine( uint row ) { - if ( ( row - mStartRow ) > 0 ) { - mBuilder->endLine(); - } + if ( ( row - mStartRow ) > 0 ) { + mBuilder->endLine(); + } } void QCsvReader::Private::emitField( const QString &data, int row, int column ) { - if ( ( row - mStartRow ) > 0 ) { - mBuilder->field( data, row - mStartRow - 1, column - 1 ); - } + if ( ( row - mStartRow ) > 0 ) { + mBuilder->field( data, row - mStartRow - 1, column - 1 ); + } } QCsvReader::QCsvReader( QCsvBuilderInterface *builder ) - : d( new Private( builder ) ) + : d( new Private( builder ) ) { - Q_ASSERT( builder ); + Q_ASSERT( builder ); } QCsvReader::~QCsvReader() { - delete d; + delete d; } bool QCsvReader::read( QIODevice *device ) { - enum State { - StartLine, - QuotedField, - QuotedFieldEnd, - NormalField, - EmptyField - }; - - int row, column; - - QString field; - QChar input; - State currentState = StartLine; - - row = column = 1; - - d->mBuilder->begin(); - - if ( !device->isOpen() ) { - d->emitBeginLine( row ); - d->mBuilder->error( i18n("Device is not open") ); - d->emitEndLine( row ); - d->mBuilder->end(); - return false; - } + enum State { + StartLine, + QuotedField, + QuotedFieldEnd, + NormalField, + EmptyField + }; + + int row, column; + + QString field; + QChar input; + State currentState = StartLine; + + row = column = 1; + + d->mBuilder->begin(); + + if ( !device->isOpen() ) { + d->emitBeginLine( row ); + d->mBuilder->error( i18n("Device is not open") ); + d->emitEndLine( row ); + d->mBuilder->end(); + return false; + } - QTextStream inputStream( device ); - inputStream.setCodec( d->mCodec ); + QTextStream inputStream( device ); + inputStream.setCodec( d->mCodec ); - /** + /** * We use the following state machine to parse CSV: * * digraph { @@ -148,173 +148,173 @@ * } */ - while ( !inputStream.atEnd() && d->mNotTerminated ) { - inputStream >> input; + while ( !inputStream.atEnd() && d->mNotTerminated ) { + inputStream >> input; - switch ( currentState ) { - case StartLine: - if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { - currentState = StartLine; - } else if ( input == d->mTextQuote ) { - d->emitBeginLine( row ); - currentState = QuotedField; - } else if ( input == d->mDelimiter ) { - d->emitBeginLine( row ); - d->emitField( field, row, column ); - column++; - currentState = EmptyField; - } else { - d->emitBeginLine( row ); - field.append( input ); - currentState = NormalField; - } - break; - case QuotedField: - if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { - field.append( input ); - currentState = QuotedField; - } else if ( input == d->mTextQuote ) { - currentState = QuotedFieldEnd; - } else if ( input == d->mDelimiter ) { - field.append( input ); - currentState = QuotedField; - } else { - field.append( input ); - currentState = QuotedField; - } - break; - case QuotedFieldEnd: - if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { - d->emitField( field, row, column ); - field.clear(); - d->emitEndLine( row ); - column = 1; - row++; - currentState = StartLine; - } else if ( input == d->mTextQuote ) { - field.append( input ); - currentState = QuotedField; - } else if ( input == d->mDelimiter ) { - d->emitField( field, row, column ); - field.clear(); - column++; - currentState = EmptyField; - } else { - d->emitField( field, row, column ); - field.clear(); - column++; - field.append( input ); - currentState = EmptyField; + switch ( currentState ) { + case StartLine: + if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { + currentState = StartLine; + } else if ( input == d->mTextQuote ) { + d->emitBeginLine( row ); + currentState = QuotedField; + } else if ( input == d->mDelimiter ) { + d->emitBeginLine( row ); + d->emitField( field, row, column ); + column++; + currentState = EmptyField; + } else { + d->emitBeginLine( row ); + field.append( input ); + currentState = NormalField; + } + break; + case QuotedField: + if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { + field.append( input ); + currentState = QuotedField; + } else if ( input == d->mTextQuote ) { + currentState = QuotedFieldEnd; + } else if ( input == d->mDelimiter ) { + field.append( input ); + currentState = QuotedField; + } else { + field.append( input ); + currentState = QuotedField; + } + break; + case QuotedFieldEnd: + if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { + d->emitField( field, row, column ); + field.clear(); + d->emitEndLine( row ); + column = 1; + row++; + currentState = StartLine; + } else if ( input == d->mTextQuote ) { + field.append( input ); + currentState = QuotedField; + } else if ( input == d->mDelimiter ) { + d->emitField( field, row, column ); + field.clear(); + column++; + currentState = EmptyField; + } else { + d->emitField( field, row, column ); + field.clear(); + column++; + field.append( input ); + currentState = EmptyField; + } + break; + case NormalField: + if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { + d->emitField( field, row, column ); + field.clear(); + d->emitEndLine( row ); + row++; + column = 1; + currentState = StartLine; + } else if ( input == d->mTextQuote ) { + field.append( input ); + currentState = NormalField; + } else if ( input == d->mDelimiter ) { + d->emitField( field, row, column ); + field.clear(); + column++; + currentState = EmptyField; + } else { + field.append( input ); + currentState = NormalField; + } + break; + case EmptyField: + if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { + d->emitField( QString(), row, column ); + field.clear(); + d->emitEndLine( row ); + column = 1; + row++; + currentState = StartLine; + } else if ( input == d->mTextQuote ) { + currentState = QuotedField; + } else if ( input == d->mDelimiter ) { + d->emitField( QString(), row, column ); + column++; + currentState = EmptyField; + } else { + field.append( input ); + currentState = NormalField; + } + break; } - break; - case NormalField: - if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { - d->emitField( field, row, column ); - field.clear(); - d->emitEndLine( row ); - row++; - column = 1; - currentState = StartLine; - } else if ( input == d->mTextQuote ) { - field.append( input ); - currentState = NormalField; - } else if ( input == d->mDelimiter ) { - d->emitField( field, row, column ); - field.clear(); - column++; - currentState = EmptyField; - } else { - field.append( input ); - currentState = NormalField; - } - break; - case EmptyField: - if ( input == QLatin1Char( '\r' ) || input == QLatin1Char( '\n' ) ) { - d->emitField( QString(), row, column ); - field.clear(); - d->emitEndLine( row ); - column = 1; - row++; - currentState = StartLine; - } else if ( input == d->mTextQuote ) { - currentState = QuotedField; - } else if ( input == d->mDelimiter ) { - d->emitField( QString(), row, column ); - column++; - currentState = EmptyField; - } else { - field.append( input ); - currentState = NormalField; - } - break; } - } - if ( currentState != StartLine ) { - if ( field.length() > 0 ) { - d->emitField( field, row, column ); - ++row; - field.clear(); + if ( currentState != StartLine ) { + if ( field.length() > 0 ) { + d->emitField( field, row, column ); + ++row; + field.clear(); + } + d->emitEndLine( row ); } - d->emitEndLine( row ); - } - d->mBuilder->end(); + d->mBuilder->end(); - return true; + return true; } void QCsvReader::setTextQuote( const QChar &textQuote ) { - d->mTextQuote = textQuote; + d->mTextQuote = textQuote; } QChar QCsvReader::textQuote() const { - return d->mTextQuote; + return d->mTextQuote; } void QCsvReader::setDelimiter( const QChar &delimiter ) { - d->mDelimiter = delimiter; + d->mDelimiter = delimiter; } QChar QCsvReader::delimiter() const { - return d->mDelimiter; + return d->mDelimiter; } void QCsvReader::setStartRow( uint startRow ) { - d->mStartRow = startRow; + d->mStartRow = startRow; } uint QCsvReader::startRow() const { - return d->mStartRow; + return d->mStartRow; } void QCsvReader::setTextCodec( QTextCodec *textCodec ) { - d->mCodec = textCodec; + d->mCodec = textCodec; } QTextCodec *QCsvReader::textCodec() const { - return d->mCodec; + return d->mCodec; } void QCsvReader::terminate() { - d->mNotTerminated = false; + d->mNotTerminated = false; } class QCsvStandardBuilder::Private { - public: +public: Private() { - init(); + init(); } void init(); @@ -327,69 +327,69 @@ void QCsvStandardBuilder::Private::init() { - mRows.clear(); - mRowCount = 0; - mColumnCount = 0; - mLastErrorString.clear(); + mRows.clear(); + mRowCount = 0; + mColumnCount = 0; + mLastErrorString.clear(); } QCsvStandardBuilder::QCsvStandardBuilder() - : d( new Private ) + : d( new Private ) { } QCsvStandardBuilder::~QCsvStandardBuilder() { - delete d; + delete d; } QString QCsvStandardBuilder::lastErrorString() const { - return d->mLastErrorString; + return d->mLastErrorString; } uint QCsvStandardBuilder::rowCount() const { - return d->mRowCount; + return d->mRowCount; } uint QCsvStandardBuilder::columnCount() const { - return d->mColumnCount; + return d->mColumnCount; } QString QCsvStandardBuilder::data( uint row, uint column ) const { - if ( row > d->mRowCount || column > d->mColumnCount || column >= (uint)d->mRows[ row ].count() ) { - return QString(); - } + if ( row > d->mRowCount || column > d->mColumnCount || column >= (uint)d->mRows[ row ].count() ) { + return QString(); + } - return d->mRows[ row ][ column ]; + return d->mRows[ row ][ column ]; } void QCsvStandardBuilder::begin() { - d->init(); + d->init(); } void QCsvStandardBuilder::beginLine() { - d->mRows.append( QStringList() ); - d->mRowCount++; + d->mRows.append( QStringList() ); + d->mRowCount++; } void QCsvStandardBuilder::field( const QString &data, uint row, uint column ) { - const uint size = d->mRows[ row ].size(); - if ( column >= size ) { - for ( uint i = column; i < size + 1; ++i ) { - d->mRows[ row ].append( QString() ); + const uint size = d->mRows[ row ].size(); + if ( column >= size ) { + for ( uint i = column; i < size + 1; ++i ) { + d->mRows[ row ].append( QString() ); + } } - } - d->mRows[ row ][ column ] = data; + d->mRows[ row ][ column ] = data; - d->mColumnCount = qMax( d->mColumnCount, column + 1 ); + d->mColumnCount = qMax( d->mColumnCount, column + 1 ); } void QCsvStandardBuilder::endLine() @@ -402,6 +402,6 @@ void QCsvStandardBuilder::error( const QString &errorMsg ) { - d->mLastErrorString = errorMsg; + d->mLastErrorString = errorMsg; } diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/qcsvreader.h kdepim-4.13.3/kaddressbook/xxport/csv/qcsvreader.h --- kdepim-4.13.0/kaddressbook/xxport/csv/qcsvreader.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/qcsvreader.h 2014-07-09 12:18:50.000000000 +0000 @@ -35,7 +35,7 @@ */ class QCsvBuilderInterface { - public: +public: /** * This method is called on the destruction of the interface. */ @@ -90,13 +90,13 @@ */ class QCsvReader : public QObject { - Q_OBJECT + Q_OBJECT - Q_PROPERTY( QChar textQuote READ textQuote WRITE setTextQuote ) - Q_PROPERTY( QChar delimiter READ delimiter WRITE setDelimiter ) - Q_PROPERTY( uint startRow READ startRow WRITE setStartRow ) + Q_PROPERTY( QChar textQuote READ textQuote WRITE setTextQuote ) + Q_PROPERTY( QChar delimiter READ delimiter WRITE setDelimiter ) + Q_PROPERTY( uint startRow READ startRow WRITE setStartRow ) - public: +public: /** * Creates a new csv reader. * @@ -170,7 +170,7 @@ */ void terminate(); - private: +private: class Private; Private *const d; }; @@ -185,7 +185,7 @@ */ class QCsvStandardBuilder : public QCsvBuilderInterface { - public: +public: /** * Creates a new csv standard builder. */ @@ -227,7 +227,7 @@ void end(); void error( const QString &errorMsg ); - private: +private: class Private; Private *const d; diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/templateselectiondialog.cpp kdepim-4.13.3/kaddressbook/xxport/csv/templateselectiondialog.cpp --- kdepim-4.13.0/kaddressbook/xxport/csv/templateselectiondialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/templateselectiondialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -35,205 +35,205 @@ #include typedef struct { - QString displayName; - QString fileName; - bool isDeletable; + QString displayName; + QString fileName; + bool isDeletable; } TemplateInfo; class TemplatesModel : public QAbstractTableModel { - public: +public: TemplatesModel( QObject *parent = 0 ) - : QAbstractTableModel( parent ) + : QAbstractTableModel( parent ) { - update(); + update(); } virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const { - if ( !parent.isValid() ) { - return mTemplates.count(); - } else { - return 0; - } + if ( !parent.isValid() ) { + return mTemplates.count(); + } else { + return 0; + } } virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const { - if ( !parent.isValid() ) { - return 2; - } else { - return 0; - } + if ( !parent.isValid() ) { + return 2; + } else { + return 0; + } } virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const { - if ( !index.isValid() || index.row() >= mTemplates.count() || index.column() >= 2 ) { - return QVariant(); - } + if ( !index.isValid() || index.row() >= mTemplates.count() || index.column() >= 2 ) { + return QVariant(); + } - if ( role == Qt::DisplayRole ) { - if ( index.column() == 0 ) { - return mTemplates[ index.row() ].displayName; - } else { - return mTemplates[ index.row() ].fileName; + if ( role == Qt::DisplayRole ) { + if ( index.column() == 0 ) { + return mTemplates[ index.row() ].displayName; + } else { + return mTemplates[ index.row() ].fileName; + } } - } - if ( role == Qt::UserRole ) { - return mTemplates[ index.row() ].isDeletable; - } + if ( role == Qt::UserRole ) { + return mTemplates[ index.row() ].isDeletable; + } - return QVariant(); + return QVariant(); } virtual bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ) { - if ( parent.isValid() || row < 0 || row >= mTemplates.count() ) { - return false; - } - - beginRemoveRows( parent, row, row + count - 1 ); - for ( int i = 0; i < count; ++i ) { - if ( !QFile::remove( mTemplates[ row ].fileName ) ) { - return false; + if ( parent.isValid() || row < 0 || row >= mTemplates.count() ) { + return false; } - mTemplates.removeAt( row ); - } - endRemoveRows(); - return true; + beginRemoveRows( parent, row, row + count - 1 ); + for ( int i = 0; i < count; ++i ) { + if ( !QFile::remove( mTemplates[ row ].fileName ) ) { + return false; + } + mTemplates.removeAt( row ); + } + + endRemoveRows(); + return true; } void update() { - beginResetModel(); - mTemplates.clear(); - const QStringList files = - KGlobal::dirs()->findAllResources( "data", QLatin1String("kaddressbook/csv-templates/*.desktop"), - KStandardDirs::Recursive | KStandardDirs::NoDuplicates ); - for ( int i = 0; i < files.count(); ++i ) { - KConfig config( files.at( i ), KConfig::SimpleConfig ); - - if ( !config.hasGroup( "csv column map" ) ) { - continue; - } - - KConfigGroup group( &config, "Misc" ); - TemplateInfo info; - info.displayName = group.readEntry( "Name" ); - info.fileName = files.at( i ); - - const QFileInfo fileInfo( info.fileName ); - info.isDeletable = QFileInfo( fileInfo.absolutePath() ).isWritable(); - - mTemplates.append( info ); - } - endResetModel(); + beginResetModel(); + mTemplates.clear(); + const QStringList files = + KGlobal::dirs()->findAllResources( "data", QLatin1String("kaddressbook/csv-templates/*.desktop"), + KStandardDirs::Recursive | KStandardDirs::NoDuplicates ); + for ( int i = 0; i < files.count(); ++i ) { + KConfig config( files.at( i ), KConfig::SimpleConfig ); + + if ( !config.hasGroup( "csv column map" ) ) { + continue; + } + + KConfigGroup group( &config, "Misc" ); + TemplateInfo info; + info.displayName = group.readEntry( "Name" ); + info.fileName = files.at( i ); + + const QFileInfo fileInfo( info.fileName ); + info.isDeletable = QFileInfo( fileInfo.absolutePath() ).isWritable(); + + mTemplates.append( info ); + } + endResetModel(); } bool templatesAvailable() const { - return !mTemplates.isEmpty(); + return !mTemplates.isEmpty(); } - private: +private: QList mTemplates; }; class TemplateSelectionDelegate : public QStyledItemDelegate { - public: +public: explicit TemplateSelectionDelegate( QObject *parent = 0 ) - : QStyledItemDelegate( parent ), mIcon( QLatin1String("list-remove") ) + : QStyledItemDelegate( parent ), mIcon( QLatin1String("list-remove") ) { } void paint( QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index ) const + const QModelIndex &index ) const { - QStyledItemDelegate::paint( painter, option, index ); + QStyledItemDelegate::paint( painter, option, index ); - if ( index.data( Qt::UserRole ).toBool() ) { - mIcon.paint( painter, option.rect, Qt::AlignRight ); - } + if ( index.data( Qt::UserRole ).toBool() ) { + mIcon.paint( painter, option.rect, Qt::AlignRight ); + } } QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const { - QSize hint = QStyledItemDelegate::sizeHint( option, index ); + QSize hint = QStyledItemDelegate::sizeHint( option, index ); - if ( index.data( Qt::UserRole ).toBool() ) { - hint.setWidth( hint.width() + 16 ); - } + if ( index.data( Qt::UserRole ).toBool() ) { + hint.setWidth( hint.width() + 16 ); + } - return hint; + return hint; } bool editorEvent( QEvent *event, QAbstractItemModel *model, - const QStyleOptionViewItem &option, const QModelIndex &index ) + const QStyleOptionViewItem &option, const QModelIndex &index ) { - if ( event->type() == QEvent::MouseButtonRelease && index.data( Qt::UserRole ).toBool() ) { - const QMouseEvent *mouseEvent = static_cast( event ); - QRect buttonRect = option.rect; - buttonRect.setLeft( buttonRect.right() - 16 ); - - if ( buttonRect.contains( mouseEvent->pos() ) ) { - const QString templateName = index.data( Qt::DisplayRole ).toString(); - if ( KMessageBox::questionYesNo( - 0, - i18nc( "@label", "Do you really want to delete template '%1'?", - templateName ) ) == KMessageBox::Yes ) { - model->removeRows( index.row(), 1 ); - return true; - } + if ( event->type() == QEvent::MouseButtonRelease && index.data( Qt::UserRole ).toBool() ) { + const QMouseEvent *mouseEvent = static_cast( event ); + QRect buttonRect = option.rect; + buttonRect.setLeft( buttonRect.right() - 16 ); + + if ( buttonRect.contains( mouseEvent->pos() ) ) { + const QString templateName = index.data( Qt::DisplayRole ).toString(); + if ( KMessageBox::questionYesNo( + 0, + i18nc( "@label", "Do you really want to delete template '%1'?", + templateName ) ) == KMessageBox::Yes ) { + model->removeRows( index.row(), 1 ); + return true; + } + } } - } - return QStyledItemDelegate::editorEvent( event, model, option, index ); + return QStyledItemDelegate::editorEvent( event, model, option, index ); } - private: +private: KIcon mIcon; }; TemplateSelectionDialog::TemplateSelectionDialog( QWidget *parent ) - : KDialog( parent ) + : KDialog( parent ) { - setCaption( i18nc( "@title:window", "Template Selection" ) ); - setButtons( Ok | Cancel ); + setCaption( i18nc( "@title:window", "Template Selection" ) ); + setButtons( Ok | Cancel ); - KVBox *wdg = new KVBox( this ); - setMainWidget( wdg ); + KVBox *wdg = new KVBox( this ); + setMainWidget( wdg ); - new QLabel( i18nc( "@info", "Please select a template, that matches the CSV file:" ), wdg ); + new QLabel( i18nc( "@info", "Please select a template, that matches the CSV file:" ), wdg ); - mView = new QListView( wdg ); + mView = new QListView( wdg ); - mView->setModel( new TemplatesModel( this ) ); - mView->setItemDelegate( new TemplateSelectionDelegate( this ) ); + mView->setModel( new TemplatesModel( this ) ); + mView->setItemDelegate( new TemplateSelectionDelegate( this ) ); - button( Ok )->setEnabled( false ); - connect( mView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(updateButtons()) ); + button( Ok )->setEnabled( false ); + connect( mView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), + this, SLOT(updateButtons()) ); } bool TemplateSelectionDialog::templatesAvailable() const { - return static_cast( mView->model() )->templatesAvailable(); + return static_cast( mView->model() )->templatesAvailable(); } QString TemplateSelectionDialog::selectedTemplate() const { - const QModelIndex rowIndex = mView->currentIndex(); - const QModelIndex index = mView->model()->index( rowIndex.row(), 1 ); + const QModelIndex rowIndex = mView->currentIndex(); + const QModelIndex index = mView->model()->index( rowIndex.row(), 1 ); - return index.data( Qt::DisplayRole ).toString(); + return index.data( Qt::DisplayRole ).toString(); } void TemplateSelectionDialog::updateButtons() { - button( Ok )->setEnabled( mView->currentIndex().isValid() ); + button( Ok )->setEnabled( mView->currentIndex().isValid() ); } diff -Nru kdepim-4.13.0/kaddressbook/xxport/csv/templateselectiondialog.h kdepim-4.13.3/kaddressbook/xxport/csv/templateselectiondialog.h --- kdepim-4.13.0/kaddressbook/xxport/csv/templateselectiondialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/csv/templateselectiondialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -26,19 +26,19 @@ class TemplateSelectionDialog : public KDialog { - Q_OBJECT + Q_OBJECT - public: +public: explicit TemplateSelectionDialog( QWidget *parent = 0 ); bool templatesAvailable() const; QString selectedTemplate() const; - private Q_SLOTS: +private Q_SLOTS: void updateButtons(); - private: +private: QListView *mView; }; diff -Nru kdepim-4.13.0/kaddressbook/xxport/gmx/gmx_xxport.cpp kdepim-4.13.3/kaddressbook/xxport/gmx/gmx_xxport.cpp --- kdepim-4.13.0/kaddressbook/xxport/gmx/gmx_xxport.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/gmx/gmx_xxport.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -100,565 +100,565 @@ const int typeOther = 2; GMXXXPort::GMXXXPort( QWidget *parentWidget ) - : XXPort( parentWidget ) + : XXPort( parentWidget ) { } static bool checkDateTime( const QString &dateStr, QDateTime &dt ) { - if ( dateStr.isEmpty() ) { - return false; - } - - dt = QDateTime::fromString( dateStr, Qt::ISODate ); - if ( dt.isValid() && dt.date().year() > 1901 ) { - return true; - } - dt.setDate( QDate() ); + if ( dateStr.isEmpty() ) { + return false; + } + + dt = QDateTime::fromString( dateStr, Qt::ISODate ); + if ( dt.isValid() && dt.date().year() > 1901 ) { + return true; + } + dt.setDate( QDate() ); - return false; + return false; } /* import */ KABC::Addressee::List GMXXXPort::importContacts() const { - KABC::Addressee::List addresseeList; - - QString fileName = - KFileDialog::getOpenFileName( QDir::homePath(), GMX_FILESELECTION_STRING, 0 ); - - if ( fileName.isEmpty() ) { - return addresseeList; - } + KABC::Addressee::List addresseeList; - QFile file( fileName ); - if ( !file.open( QIODevice::ReadOnly ) ) { - QString msg = i18n( "Unable to open %1 for reading.", fileName ); - KMessageBox::error( parentWidget(), msg ); - return addresseeList; - } + QString fileName = + KFileDialog::getOpenFileName( QDir::homePath(), GMX_FILESELECTION_STRING, 0 ); - QDateTime dt; - QTextStream gmxStream( &file ); - gmxStream.setCodec( "ISO 8859-1" ); - QString line, line2; - line = gmxStream.readLine(); - line2 = gmxStream.readLine(); - if ( !line.startsWith( QLatin1String( "AB_ADDRESSES:" ) ) || - !line2.startsWith( QLatin1String( "Address_id" ) ) ) { - KMessageBox::error( - parentWidget(), - i18n( "%1 is not a GMX address book file.", fileName ) ); - return addresseeList; - } - - QStringList itemList; - QMap categoriesOfAddressee; - typedef QMap AddresseeMap; - AddresseeMap addresseeMap; - - // "Address_id,Nickname,Firstname,Lastname,Title,Birthday,Comments, - // Change_date,Status,Address_link_id,Categories" - line = gmxStream.readLine(); - while ( ( line != QLatin1String( "####" ) ) && !gmxStream.atEnd() ) { - // an addressee entry may spread over several lines in the file - while ( 1 ) { - itemList = line.split( QLatin1Char('#'), QString::KeepEmptyParts ); - if ( itemList.count() >= 11 ) { - break; - } - line.append( QLatin1Char('\n') ); - line.append( gmxStream.readLine() ); - }; + if ( fileName.isEmpty() ) { + return addresseeList; + } - // populate the addressee - KABC::Addressee *addressee = new KABC::Addressee; - addressee->setNickName( itemList.at(1) ); - addressee->setGivenName( itemList.at(2) ); - addressee->setFamilyName( itemList.at(3) ); - addressee->setFormattedName( itemList.at(3) + QLatin1String(", ") + itemList.at(2) ); - addressee->setPrefix( itemList.at(4) ); - if ( checkDateTime( itemList.at(5), dt ) ) { - addressee->setBirthday( dt ); - } - addressee->setNote( itemList.at(6) ); - if ( checkDateTime( itemList.at(7), dt ) ) { - addressee->setRevision( dt ); - } - // addressee->setStatus( itemList[8] ); Status - // addressee->xxx( itemList[9] ); Address_link_id - categoriesOfAddressee[ itemList[0] ] = itemList[10]; - addresseeMap[ itemList[0] ] = addressee; + QFile file( fileName ); + if ( !file.open( QIODevice::ReadOnly ) ) { + QString msg = i18n( "Unable to open %1 for reading.", fileName ); + KMessageBox::error( parentWidget(), msg ); + return addresseeList; + } + + QDateTime dt; + QTextStream gmxStream( &file ); + gmxStream.setCodec( "ISO 8859-1" ); + QString line, line2; + line = gmxStream.readLine(); + line2 = gmxStream.readLine(); + if ( !line.startsWith( QLatin1String( "AB_ADDRESSES:" ) ) || + !line2.startsWith( QLatin1String( "Address_id" ) ) ) { + KMessageBox::error( + parentWidget(), + i18n( "%1 is not a GMX address book file.", fileName ) ); + return addresseeList; + } + + QStringList itemList; + QMap categoriesOfAddressee; + typedef QMap AddresseeMap; + AddresseeMap addresseeMap; + // "Address_id,Nickname,Firstname,Lastname,Title,Birthday,Comments, + // Change_date,Status,Address_link_id,Categories" + line = gmxStream.readLine(); + while ( ( line != QLatin1String( "####" ) ) && !gmxStream.atEnd() ) { + // an addressee entry may spread over several lines in the file + while ( 1 ) { + itemList = line.split( QLatin1Char('#'), QString::KeepEmptyParts ); + if ( itemList.count() >= 11 ) { + break; + } + line.append( QLatin1Char('\n') ); + line.append( gmxStream.readLine() ); + }; + + // populate the addressee + KABC::Addressee *addressee = new KABC::Addressee; + addressee->setNickName( itemList.at(1) ); + addressee->setGivenName( itemList.at(2) ); + addressee->setFamilyName( itemList.at(3) ); + addressee->setFormattedName( itemList.at(3) + QLatin1String(", ") + itemList.at(2) ); + addressee->setPrefix( itemList.at(4) ); + if ( checkDateTime( itemList.at(5), dt ) ) { + addressee->setBirthday( dt ); + } + addressee->setNote( itemList.at(6) ); + if ( checkDateTime( itemList.at(7), dt ) ) { + addressee->setRevision( dt ); + } + // addressee->setStatus( itemList[8] ); Status + // addressee->xxx( itemList[9] ); Address_link_id + categoriesOfAddressee[ itemList[0] ] = itemList[10]; + addresseeMap[ itemList[0] ] = addressee; + + line = gmxStream.readLine(); + } + + // now read the address records + line = gmxStream.readLine(); + if ( !line.startsWith( QLatin1String( "AB_ADDRESS_RECORDS:" ) ) ) { + kWarning() << "Could not find address records!"; + return addresseeList; + } + // Address_id,Record_id,Street,Country,Zipcode,City,Phone,Fax,Mobile, + // Mobile_type,Email,Homepage,Position,Comments,Record_type_id,Record_type, + // Company,Department,Change_date,Preferred,Status + line = gmxStream.readLine(); line = gmxStream.readLine(); - } - // now read the address records - line = gmxStream.readLine(); - if ( !line.startsWith( QLatin1String( "AB_ADDRESS_RECORDS:" ) ) ) { - kWarning() << "Could not find address records!"; - return addresseeList; - } - // Address_id,Record_id,Street,Country,Zipcode,City,Phone,Fax,Mobile, - // Mobile_type,Email,Homepage,Position,Comments,Record_type_id,Record_type, - // Company,Department,Change_date,Preferred,Status - line = gmxStream.readLine(); - line = gmxStream.readLine(); - - while ( !line.startsWith( QLatin1String( "####" ) ) && !gmxStream.atEnd() ) { - // an address entry may spread over several lines in the file - while ( 1 ) { - itemList = line.split( QLatin1Char('#'), QString::KeepEmptyParts ); - if ( itemList.count() >= 21 ) { - break; - } - line.append( QLatin1Char('\n') ); - line.append( gmxStream.readLine() ); - }; + while ( !line.startsWith( QLatin1String( "####" ) ) && !gmxStream.atEnd() ) { + // an address entry may spread over several lines in the file + while ( 1 ) { + itemList = line.split( QLatin1Char('#'), QString::KeepEmptyParts ); + if ( itemList.count() >= 21 ) { + break; + } + line.append( QLatin1Char('\n') ); + line.append( gmxStream.readLine() ); + }; + + KABC::Addressee *addressee = addresseeMap[ itemList[0] ]; + if ( addressee ) { + // itemList[1] = Record_id (numbered item, ignore here) + int recordTypeId = itemList[14].toInt(); + KABC::Address::Type addressType; + KABC::PhoneNumber::Type phoneType; + switch ( recordTypeId ) { + case typeHome: + addressType = KABC::Address::Home; + phoneType = KABC::PhoneNumber::Home; + break; + case typeWork: + addressType = KABC::Address::Work; + phoneType = KABC::PhoneNumber::Work; + break; + case typeOther: + default: + addressType = KABC::Address::Intl; + phoneType = KABC::PhoneNumber::Voice; + break; + } + KABC::Address address = addressee->address( addressType ); + address.setStreet( itemList[2] ); + address.setCountry( itemList[3] ); + address.setPostalCode( itemList[4] ); + address.setLocality( itemList[5] ); + if ( !itemList[6].isEmpty() ) { + addressee->insertPhoneNumber( + KABC::PhoneNumber( itemList[6], phoneType ) ); + } + if ( !itemList[7].isEmpty() ) { + addressee->insertPhoneNumber( + KABC::PhoneNumber( itemList[7], KABC::PhoneNumber::Fax ) ); + } + KABC::PhoneNumber::Type cellType = KABC::PhoneNumber::Cell; + // itemList[9]=Mobile_type // always 0 or -1(default phone). + // if ( itemList[19].toInt() & 4 ) cellType |= KABC::PhoneNumber::Pref; + // don't do the above to avoid duplicate mobile numbers + if ( !itemList[8].isEmpty() ) { + addressee->insertPhoneNumber( KABC::PhoneNumber( itemList[8], cellType ) ); + } + bool preferred = false; + if ( itemList[19].toInt() & 1 ) { + preferred = true; + } + addressee->insertEmail( itemList[10], preferred ); + if ( !itemList[11].isEmpty() ) { + addressee->setUrl( itemList[11] ); + } + if ( !itemList[12].isEmpty() ) { + addressee->setRole( itemList[12] ); + } + // itemList[13]=Comments + // itemList[14]=Record_type_id (0,1,2) - see above + // itemList[15]=Record_type (name of this additional record entry) + if ( !itemList[16].isEmpty() ) { + addressee->setOrganization( itemList[16] ); // Company + } + if ( !itemList[17].isEmpty() ) { + addressee->insertCustom( QLatin1String("KADDRESSBOOK"), QLatin1String("X-Department"), itemList[17] ); // Department + } + if ( checkDateTime( itemList[18], dt ) ) { + addressee->setRevision( dt ); // Change_date + } + // itemList[19]=Preferred (see above) + // itemList[20]=Status (should always be "1") + addressee->insertAddress( address ); + } else { + kWarning() << "unresolved line:" << line; + } + line = gmxStream.readLine(); + } - KABC::Addressee *addressee = addresseeMap[ itemList[0] ]; - if ( addressee ) { - // itemList[1] = Record_id (numbered item, ignore here) - int recordTypeId = itemList[14].toInt(); - KABC::Address::Type addressType; - KABC::PhoneNumber::Type phoneType; - switch ( recordTypeId ) { - case typeHome: - addressType = KABC::Address::Home; - phoneType = KABC::PhoneNumber::Home; - break; - case typeWork: - addressType = KABC::Address::Work; - phoneType = KABC::PhoneNumber::Work; - break; - case typeOther: - default: - addressType = KABC::Address::Intl; - phoneType = KABC::PhoneNumber::Voice; - break; - } - KABC::Address address = addressee->address( addressType ); - address.setStreet( itemList[2] ); - address.setCountry( itemList[3] ); - address.setPostalCode( itemList[4] ); - address.setLocality( itemList[5] ); - if ( !itemList[6].isEmpty() ) { - addressee->insertPhoneNumber( - KABC::PhoneNumber( itemList[6], phoneType ) ); - } - if ( !itemList[7].isEmpty() ) { - addressee->insertPhoneNumber( - KABC::PhoneNumber( itemList[7], KABC::PhoneNumber::Fax ) ); - } - KABC::PhoneNumber::Type cellType = KABC::PhoneNumber::Cell; - // itemList[9]=Mobile_type // always 0 or -1(default phone). - // if ( itemList[19].toInt() & 4 ) cellType |= KABC::PhoneNumber::Pref; - // don't do the above to avoid duplicate mobile numbers - if ( !itemList[8].isEmpty() ) { - addressee->insertPhoneNumber( KABC::PhoneNumber( itemList[8], cellType ) ); - } - bool preferred = false; - if ( itemList[19].toInt() & 1 ) { - preferred = true; - } - addressee->insertEmail( itemList[10], preferred ); - if ( !itemList[11].isEmpty() ) { - addressee->setUrl( itemList[11] ); - } - if ( !itemList[12].isEmpty() ) { - addressee->setRole( itemList[12] ); - } - // itemList[13]=Comments - // itemList[14]=Record_type_id (0,1,2) - see above - // itemList[15]=Record_type (name of this additional record entry) - if ( !itemList[16].isEmpty() ) { - addressee->setOrganization( itemList[16] ); // Company - } - if ( !itemList[17].isEmpty() ) { - addressee->insertCustom( QLatin1String("KADDRESSBOOK"), QLatin1String("X-Department"), itemList[17] ); // Department - } - if ( checkDateTime( itemList[18], dt ) ) { - addressee->setRevision( dt ); // Change_date - } - // itemList[19]=Preferred (see above) - // itemList[20]=Status (should always be "1") - addressee->insertAddress( address ); + // extract the categories from the list of addressees of the file to import + QStringList usedCategoryList; + line = gmxStream.readLine(); + line2 = gmxStream.readLine(); + if ( !line.startsWith( QLatin1String( "AB_CATEGORIES:" ) ) || + !line2.startsWith( QLatin1String( "Category_id" ) ) ) { + kWarning() << "Could not find category records!"; } else { - kWarning() << "unresolved line:" << line; + while ( !line.startsWith( QLatin1String( "####" ) ) && + !gmxStream.atEnd() ) { + // a category should not spread over multiple lines, but just in case + while ( 1 ) { + itemList = line.split( QLatin1Char('#'), QString::KeepEmptyParts ); + if ( itemList.count() >= 3 ) { + break; + } + line.append( QLatin1Char('\n') ); + line.append( gmxStream.readLine() ); + }; + usedCategoryList.append( itemList[1] ); + line = gmxStream.readLine(); + }; + } + + // now add the addresses to addresseeList + for ( AddresseeMap::Iterator addresseeIt = addresseeMap.begin(); + addresseeIt != addresseeMap.end(); ++addresseeIt ) { + KABC::Addressee *addressee = addresseeIt.value(); + // Add categories + // catgories is a bitfield with max 31 defined categories + int categories = categoriesOfAddressee[ addresseeIt.key() ].toInt(); + for ( int i=32; i >= 0; --i ) { + // convert category index to bitfield value for comparison + int catBit = 1 << i; + if ( catBit > categories ) { + continue; // current index unassigned + } + if ( catBit & categories && usedCategoryList.count() > i ) { + addressee->insertCategory( usedCategoryList[i] ); + } + } + addresseeList.append( *addressee ); + delete addressee; } - line = gmxStream.readLine(); - } - - // extract the categories from the list of addressees of the file to import - QStringList usedCategoryList; - line = gmxStream.readLine(); - line2 = gmxStream.readLine(); - if ( !line.startsWith( QLatin1String( "AB_CATEGORIES:" ) ) || - !line2.startsWith( QLatin1String( "Category_id" ) ) ) { - kWarning() << "Could not find category records!"; - } else { - while ( !line.startsWith( QLatin1String( "####" ) ) && - !gmxStream.atEnd() ) { - // a category should not spread over multiple lines, but just in case - while ( 1 ) { - itemList = line.split( QLatin1Char('#'), QString::KeepEmptyParts ); - if ( itemList.count() >= 3 ) { - break; - } - line.append( QLatin1Char('\n') ); - line.append( gmxStream.readLine() ); - }; - usedCategoryList.append( itemList[1] ); - line = gmxStream.readLine(); - }; - } - // now add the addresses to addresseeList - for ( AddresseeMap::Iterator addresseeIt = addresseeMap.begin(); - addresseeIt != addresseeMap.end(); ++addresseeIt ) { - KABC::Addressee *addressee = addresseeIt.value(); - // Add categories - // catgories is a bitfield with max 31 defined categories - int categories = categoriesOfAddressee[ addresseeIt.key() ].toInt(); - for ( int i=32; i >= 0; --i ) { - // convert category index to bitfield value for comparison - int catBit = 1 << i; - if ( catBit > categories ) { - continue; // current index unassigned - } - if ( catBit & categories && usedCategoryList.count() > i ) { - addressee->insertCategory( usedCategoryList[i] ); - } - } - addresseeList.append( *addressee ); - delete addressee; - } - - file.close(); - return addresseeList; + file.close(); + return addresseeList; } /* export */ bool GMXXXPort::exportContacts( const KABC::AddresseeList &list ) const { - KUrl url = KFileDialog::getSaveUrl( - KUrl( QDir::homePath() + QLatin1String("/addressbook.gmx") ), GMX_FILESELECTION_STRING ); - if ( url.isEmpty() ) { - return true; - } - - if ( QFileInfo( url.isLocalFile() ? - url.toLocalFile() : url.path() ).exists() ) { - if ( url.isLocalFile() && QFileInfo( url.toLocalFile() ).exists() ) { - PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE; - PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget()); - result = static_cast(dialog->exec()); - if ( result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME ) { - url = dialog->newName(); - } else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) { - delete dialog; - return true; - } - delete dialog; - } - } - - if ( !url.isLocalFile() ) { - KTemporaryFile tmpFile; - if ( !tmpFile.open() ) { - QString txt = i18n( "Unable to open file %1", url.url() ); - KMessageBox::error( parentWidget(), txt ); - return false; - } - - doExport( &tmpFile, list ); - tmpFile.flush(); - - return KIO::NetAccess::upload( tmpFile.fileName(), url, parentWidget() ); - } else { - QString fileName = url.toLocalFile(); - QFile file( fileName ); - - if ( !file.open( QIODevice::WriteOnly ) ) { - QString txt = i18n( "Unable to open file %1.", fileName ); - KMessageBox::error( parentWidget(), txt ); - return false; + KUrl url = KFileDialog::getSaveUrl( + KUrl( QDir::homePath() + QLatin1String("/addressbook.gmx") ), GMX_FILESELECTION_STRING ); + if ( url.isEmpty() ) { + return true; + } + + if ( QFileInfo( url.isLocalFile() ? + url.toLocalFile() : url.path() ).exists() ) { + if ( url.isLocalFile() && QFileInfo( url.toLocalFile() ).exists() ) { + PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE; + PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget()); + result = static_cast(dialog->exec()); + if ( result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME ) { + url = dialog->newName(); + } else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) { + delete dialog; + return true; + } + delete dialog; + } } - doExport( &file, list ); - file.close(); + if ( !url.isLocalFile() ) { + KTemporaryFile tmpFile; + if ( !tmpFile.open() ) { + QString txt = i18n( "Unable to open file %1", url.url() ); + KMessageBox::error( parentWidget(), txt ); + return false; + } + + doExport( &tmpFile, list ); + tmpFile.flush(); - return true; - } + return KIO::NetAccess::upload( tmpFile.fileName(), url, parentWidget() ); + } else { + QString fileName = url.toLocalFile(); + QFile file( fileName ); + + if ( !file.open( QIODevice::WriteOnly ) ) { + QString txt = i18n( "Unable to open file %1.", fileName ); + KMessageBox::error( parentWidget(), txt ); + return false; + } + + doExport( &file, list ); + file.close(); + + return true; + } } static const QString dateString( const QDateTime &dt ) { - if ( !dt.isValid() ) { - return QString::fromLatin1( "1000-01-01 00:00:00" ); - } - QString d( dt.toString( Qt::ISODate ) ); - d[10] = ' '; // remove the "T" in the middle of the string - return d; + if ( !dt.isValid() ) { + return QString::fromLatin1( "1000-01-01 00:00:00" ); + } + QString d( dt.toString( Qt::ISODate ) ); + d[10] = ' '; // remove the "T" in the middle of the string + return d; } static const QStringList assignedCategoriesSorted( const KABC::AddresseeList &list ) { - // Walk through the addressees and return a unique list of up to 31 - // categories, alphabetically sorted - QStringList categoryList; - const KABC::Addressee *addressee; - for ( KABC::AddresseeList::ConstIterator addresseeIt = list.begin(); - addresseeIt != list.end() && categoryList.count() < 32; ++addresseeIt ) { - addressee = &( *addresseeIt ); - if ( addressee->isEmpty() ) continue; - const QStringList categories = addressee->categories(); - for ( int i=0; i < categories.count() && categoryList.count() < 32; ++i ) { - if ( !categoryList.contains( categories[i]) ) { - categoryList.append( categories[i] ); - } - } - } - categoryList.sort(); - return categoryList; + // Walk through the addressees and return a unique list of up to 31 + // categories, alphabetically sorted + QStringList categoryList; + const KABC::Addressee *addressee; + for ( KABC::AddresseeList::ConstIterator addresseeIt = list.begin(); + addresseeIt != list.end() && categoryList.count() < 32; ++addresseeIt ) { + addressee = &( *addresseeIt ); + if ( addressee->isEmpty() ) continue; + const QStringList categories = addressee->categories(); + for ( int i=0; i < categories.count() && categoryList.count() < 32; ++i ) { + if ( !categoryList.contains( categories[i]) ) { + categoryList.append( categories[i] ); + } + } + } + categoryList.sort(); + return categoryList; } void GMXXXPort::doExport( QFile *fp, const KABC::AddresseeList &list ) const { - if ( !fp || !list.count() ) { - return; - } - - QTextStream t( fp ); - t.setCodec( "ISO 8859-1" ); - - typedef QMap AddresseeMap; - AddresseeMap addresseeMap; - const KABC::Addressee *addressee; - - t << "AB_ADDRESSES:\n"; - t << "Address_id,Nickname,Firstname,Lastname,Title,Birthday,Comments," - "Change_date,Status,Address_link_id,Categories\n"; - - QList categoryMap; - categoryMap.append( assignedCategoriesSorted( list ) ); - - int addresseeId = 0; - const QChar DELIM( QLatin1Char('#') ); - for ( KABC::AddresseeList::ConstIterator it = list.begin(); - it != list.end(); ++it ) { - addressee = &(*it); - if ( addressee->isEmpty() ) { - continue; - } - addresseeMap[ ++addresseeId ] = addressee; - - // Assign categories as bitfield - const QStringList categories = addressee->categories(); - long int category = 0; - if ( categories.count() > 0 ) { - for ( int i=0; i < categories.count(); ++i ) { - if ( categoryMap.contains( categories[i] ) ) { - category |= 1 << categoryMap.indexOf( categories[i], 0 ) ; - } - } - } - - // GMX sorts by nickname by default - don't leave empty - QString nickName = addressee->nickName(); - if ( nickName.isEmpty() ) { - nickName = addressee->formattedName(); - } - - t << addresseeId << DELIM // Address_id - << nickName << DELIM // Nickname - << addressee->givenName() << DELIM // Firstname - << addressee->familyName() << DELIM // Lastname - << addressee->prefix() << DELIM // Title - Note: ->title() - // refers to the professional title - << dateString( addressee->birthday() ) << DELIM // Birthday - << addressee->note() /*.replace('\n',"\r\n")*/ << DELIM // Comments - << dateString( addressee->revision() ) << DELIM // Change_date - << "1" << DELIM // Status - << DELIM // Address_link_id - << category << endl; // Categories - } - - t << "####\n"; - t << "AB_ADDRESS_RECORDS:\n"; - t << "Address_id,Record_id,Street,Country,Zipcode,City,Phone,Fax,Mobile," - "Mobile_type,Email,Homepage,Position,Comments,Record_type_id,Record_type," - "Company,Department,Change_date,Preferred,Status\n"; - - addresseeId = 1; - while ( ( addressee = addresseeMap[ addresseeId ] ) != 0 ) { - - const KABC::PhoneNumber::List cellPhones = - addressee->phoneNumbers( KABC::PhoneNumber::Cell ); - - const QStringList emails = addressee->emails(); - - for ( int recId=0; recId<3; ++recId ) { - KABC::Address address; - KABC::PhoneNumber phone, fax, cell; - - // address preference flag: - // & 1: preferred email address - // & 4: preferred cell phone - int prefFlag=0; - - switch ( recId ) { - // Assign address, phone and cellphone, fax if applicable - case typeHome: - address = addressee->address( KABC::Address::Home ); - phone = addressee->phoneNumber( KABC::PhoneNumber::Home ); - if ( cellPhones.count() > 0 ) { - cell = cellPhones.at( 0 ); - if ( !cell.isEmpty() ) { - prefFlag |= 4; - } - } - break; - case typeWork: - address = addressee->address( KABC::Address::Work ); - phone = addressee->phoneNumber( KABC::PhoneNumber::Work ); - if ( cellPhones.count() >= 2 ) { - cell = cellPhones.at( 1 ); - } - fax = addressee->phoneNumber( KABC::PhoneNumber::Fax ); - break; - case typeOther: - default: - if ( addressee->addresses( KABC::Address::Home ).count() > 1 ) { - address = addressee->addresses( KABC::Address::Home ).at( 1 ); - } - if ( ( address.isEmpty() ) && - ( addressee->addresses( KABC::Address::Work ).count() > 1 ) ) { - address = addressee->addresses( KABC::Address::Work ).at( 1 ); - } - if ( address.isEmpty() ) { - address = addressee->address( KABC::Address::Dom ); - } - if ( address.isEmpty() ) { - address = addressee->address( KABC::Address::Intl ); - } - if ( address.isEmpty() ) { - address = addressee->address( KABC::Address::Postal ); - } - if ( address.isEmpty() ) { - address = addressee->address( KABC::Address::Parcel ); - } - - if ( addressee->phoneNumbers( KABC::PhoneNumber::Home ).count() > 1 ) { - phone = addressee->phoneNumbers( KABC::PhoneNumber::Home ).at( 1 ); - } - if ( ( phone.isEmpty() ) && ( addressee->phoneNumbers( - KABC::PhoneNumber::Work ).count() > 1 ) ) - phone = addressee->phoneNumbers( KABC::PhoneNumber::Work ).at( 1 ); - if ( phone.isEmpty() ) { - phone = addressee->phoneNumber( KABC::PhoneNumber::Voice ); - } - if ( phone.isEmpty() ) { - phone = addressee->phoneNumber( KABC::PhoneNumber::Msg ); - } - if ( phone.isEmpty() ) { - phone = addressee->phoneNumber( KABC::PhoneNumber::Isdn ); - } - if ( phone.isEmpty() ) { - phone = addressee->phoneNumber( KABC::PhoneNumber::Car ); - } - if ( phone.isEmpty() ) { - phone = addressee->phoneNumber( KABC::PhoneNumber::Pager ); - } - - switch ( cellPhones.count() ) { - case 0: - break; - case 1: - case 2: - if ( !address.isEmpty() ) { - cell = cellPhones.at( 0 ); - } - break; - default: - cell = cellPhones.at( 2 ); - break; - } - break; - } - - QString email; - if ( emails.count()>recId ) { - email = emails[ recId ]; - if ( email == addressee->preferredEmail() ) { - prefFlag |= 1; + if ( !fp || !list.count() ) { + return; + } + + QTextStream t( fp ); + t.setCodec( "ISO 8859-1" ); + + typedef QMap AddresseeMap; + AddresseeMap addresseeMap; + const KABC::Addressee *addressee; + + t << "AB_ADDRESSES:\n"; + t << "Address_id,Nickname,Firstname,Lastname,Title,Birthday,Comments," + "Change_date,Status,Address_link_id,Categories\n"; + + QList categoryMap; + categoryMap.append( assignedCategoriesSorted( list ) ); + + int addresseeId = 0; + const QChar DELIM( QLatin1Char('#') ); + for ( KABC::AddresseeList::ConstIterator it = list.begin(); + it != list.end(); ++it ) { + addressee = &(*it); + if ( addressee->isEmpty() ) { + continue; + } + addresseeMap[ ++addresseeId ] = addressee; + + // Assign categories as bitfield + const QStringList categories = addressee->categories(); + long int category = 0; + if ( categories.count() > 0 ) { + for ( int i=0; i < categories.count(); ++i ) { + if ( categoryMap.contains( categories[i] ) ) { + category |= 1 << categoryMap.indexOf( categories[i], 0 ) ; + } + } + } + + // GMX sorts by nickname by default - don't leave empty + QString nickName = addressee->nickName(); + if ( nickName.isEmpty() ) { + nickName = addressee->formattedName(); } - } - if ( !address.isEmpty() || !phone.isEmpty() || - !cell.isEmpty() || !email.isEmpty() ) { t << addresseeId << DELIM // Address_id - << recId << DELIM // Record_id - << address.street() << DELIM // Street - << address.country() << DELIM // Country - << address.postalCode() << DELIM // Zipcode - << address.locality() << DELIM // City - << phone.number() << DELIM // Phone - << fax.number() << DELIM // Fax - << cell.number() << DELIM // Mobile - - << ( ( recId == typeWork ) ? 0 : 1 ) << DELIM // Mobile_type - - << email << DELIM // Email - - << ( ( recId == typeWork ) ? - addressee->url().url() : - QString() ) << DELIM // Homepage - - << ( ( recId == typeWork ) ? - addressee->role() : - QString() ) << DELIM // Position - - << ( ( recId == typeHome ) ? - addressee->custom( QLatin1String("KADDRESSBOOK"), QLatin1String("X-SpousesName") ) : - QString() ) << DELIM // Comments - - << recId << DELIM // Record_type_id (0,1,2) - - << DELIM // Record_type - - << ( ( recId == typeWork ) ? - addressee->organization() : - QString() ) << DELIM // Company - - << ( ( recId == typeWork ) ? - addressee->custom( QLatin1String("KADDRESSBOOK"), QLatin1String("X-Department") ) : - QString() ) << DELIM // Department - - << dateString( addressee->revision() ) << DELIM // Change_date - - << prefFlag << DELIM // Preferred: - // ( & 1: preferred email, - // & 4: preferred cell phone ) - << 1 << endl; // Status (should always be "1") - } - } - - ++addresseeId; - }; - - t << "####" << endl; - t << "AB_CATEGORIES:" << endl; - t << "Category_id,Name,Icon_id" << endl; - - // Write Category List (beware: Category_ID 0 is reserved for none - // Interestingly: The index here is an int sequence and does not - // correspond to the bit reference used above. - for ( int i = 0; i < categoryMap.size(); ++i ) { - t << ( i + 1 ) << DELIM << categoryMap.at( i ) << DELIM << 0 << endl; - } - t << "####" << endl; + << nickName << DELIM // Nickname + << addressee->givenName() << DELIM // Firstname + << addressee->familyName() << DELIM // Lastname + << addressee->prefix() << DELIM // Title - Note: ->title() + // refers to the professional title + << dateString( addressee->birthday() ) << DELIM // Birthday + << addressee->note() /*.replace('\n',"\r\n")*/ << DELIM // Comments + << dateString( addressee->revision() ) << DELIM // Change_date + << "1" << DELIM // Status + << DELIM // Address_link_id + << category << endl; // Categories + } + + t << "####\n"; + t << "AB_ADDRESS_RECORDS:\n"; + t << "Address_id,Record_id,Street,Country,Zipcode,City,Phone,Fax,Mobile," + "Mobile_type,Email,Homepage,Position,Comments,Record_type_id,Record_type," + "Company,Department,Change_date,Preferred,Status\n"; + + addresseeId = 1; + while ( ( addressee = addresseeMap[ addresseeId ] ) != 0 ) { + + const KABC::PhoneNumber::List cellPhones = + addressee->phoneNumbers( KABC::PhoneNumber::Cell ); + + const QStringList emails = addressee->emails(); + + for ( int recId=0; recId<3; ++recId ) { + KABC::Address address; + KABC::PhoneNumber phone, fax, cell; + + // address preference flag: + // & 1: preferred email address + // & 4: preferred cell phone + int prefFlag=0; + + switch ( recId ) { + // Assign address, phone and cellphone, fax if applicable + case typeHome: + address = addressee->address( KABC::Address::Home ); + phone = addressee->phoneNumber( KABC::PhoneNumber::Home ); + if ( cellPhones.count() > 0 ) { + cell = cellPhones.at( 0 ); + if ( !cell.isEmpty() ) { + prefFlag |= 4; + } + } + break; + case typeWork: + address = addressee->address( KABC::Address::Work ); + phone = addressee->phoneNumber( KABC::PhoneNumber::Work ); + if ( cellPhones.count() >= 2 ) { + cell = cellPhones.at( 1 ); + } + fax = addressee->phoneNumber( KABC::PhoneNumber::Fax ); + break; + case typeOther: + default: + if ( addressee->addresses( KABC::Address::Home ).count() > 1 ) { + address = addressee->addresses( KABC::Address::Home ).at( 1 ); + } + if ( ( address.isEmpty() ) && + ( addressee->addresses( KABC::Address::Work ).count() > 1 ) ) { + address = addressee->addresses( KABC::Address::Work ).at( 1 ); + } + if ( address.isEmpty() ) { + address = addressee->address( KABC::Address::Dom ); + } + if ( address.isEmpty() ) { + address = addressee->address( KABC::Address::Intl ); + } + if ( address.isEmpty() ) { + address = addressee->address( KABC::Address::Postal ); + } + if ( address.isEmpty() ) { + address = addressee->address( KABC::Address::Parcel ); + } + + if ( addressee->phoneNumbers( KABC::PhoneNumber::Home ).count() > 1 ) { + phone = addressee->phoneNumbers( KABC::PhoneNumber::Home ).at( 1 ); + } + if ( ( phone.isEmpty() ) && ( addressee->phoneNumbers( + KABC::PhoneNumber::Work ).count() > 1 ) ) + phone = addressee->phoneNumbers( KABC::PhoneNumber::Work ).at( 1 ); + if ( phone.isEmpty() ) { + phone = addressee->phoneNumber( KABC::PhoneNumber::Voice ); + } + if ( phone.isEmpty() ) { + phone = addressee->phoneNumber( KABC::PhoneNumber::Msg ); + } + if ( phone.isEmpty() ) { + phone = addressee->phoneNumber( KABC::PhoneNumber::Isdn ); + } + if ( phone.isEmpty() ) { + phone = addressee->phoneNumber( KABC::PhoneNumber::Car ); + } + if ( phone.isEmpty() ) { + phone = addressee->phoneNumber( KABC::PhoneNumber::Pager ); + } + + switch ( cellPhones.count() ) { + case 0: + break; + case 1: + case 2: + if ( !address.isEmpty() ) { + cell = cellPhones.at( 0 ); + } + break; + default: + cell = cellPhones.at( 2 ); + break; + } + break; + } + + QString email; + if ( emails.count()>recId ) { + email = emails[ recId ]; + if ( email == addressee->preferredEmail() ) { + prefFlag |= 1; + } + } + + if ( !address.isEmpty() || !phone.isEmpty() || + !cell.isEmpty() || !email.isEmpty() ) { + t << addresseeId << DELIM // Address_id + << recId << DELIM // Record_id + << address.street() << DELIM // Street + << address.country() << DELIM // Country + << address.postalCode() << DELIM // Zipcode + << address.locality() << DELIM // City + << phone.number() << DELIM // Phone + << fax.number() << DELIM // Fax + << cell.number() << DELIM // Mobile + + << ( ( recId == typeWork ) ? 0 : 1 ) << DELIM // Mobile_type + + << email << DELIM // Email + + << ( ( recId == typeWork ) ? + addressee->url().url() : + QString() ) << DELIM // Homepage + + << ( ( recId == typeWork ) ? + addressee->role() : + QString() ) << DELIM // Position + + << ( ( recId == typeHome ) ? + addressee->custom( QLatin1String("KADDRESSBOOK"), QLatin1String("X-SpousesName") ) : + QString() ) << DELIM // Comments + + << recId << DELIM // Record_type_id (0,1,2) + + << DELIM // Record_type + + << ( ( recId == typeWork ) ? + addressee->organization() : + QString() ) << DELIM // Company + + << ( ( recId == typeWork ) ? + addressee->custom( QLatin1String("KADDRESSBOOK"), QLatin1String("X-Department") ) : + QString() ) << DELIM // Department + + << dateString( addressee->revision() ) << DELIM // Change_date + + << prefFlag << DELIM // Preferred: + // ( & 1: preferred email, + // & 4: preferred cell phone ) + << 1 << endl; // Status (should always be "1") + } + } + + ++addresseeId; + }; + + t << "####" << endl; + t << "AB_CATEGORIES:" << endl; + t << "Category_id,Name,Icon_id" << endl; + + // Write Category List (beware: Category_ID 0 is reserved for none + // Interestingly: The index here is an int sequence and does not + // correspond to the bit reference used above. + for ( int i = 0; i < categoryMap.size(); ++i ) { + t << ( i + 1 ) << DELIM << categoryMap.at( i ) << DELIM << 0 << endl; + } + t << "####" << endl; } diff -Nru kdepim-4.13.0/kaddressbook/xxport/gmx/gmx_xxport.h kdepim-4.13.3/kaddressbook/xxport/gmx/gmx_xxport.h --- kdepim-4.13.0/kaddressbook/xxport/gmx/gmx_xxport.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/gmx/gmx_xxport.h 2014-07-09 12:18:50.000000000 +0000 @@ -32,13 +32,13 @@ class GMXXXPort : public XXPort { - public: +public: explicit GMXXXPort( QWidget *parent = 0 ); bool exportContacts( const KABC::AddresseeList &list ) const; KABC::Addressee::List importContacts() const; - private: +private: void doExport( QFile *fp, const KABC::AddresseeList &list ) const; }; diff -Nru kdepim-4.13.0/kaddressbook/xxport/ldap/ldap_xxport.cpp kdepim-4.13.3/kaddressbook/xxport/ldap/ldap_xxport.cpp --- kdepim-4.13.0/kaddressbook/xxport/ldap/ldap_xxport.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/ldap/ldap_xxport.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -30,26 +30,26 @@ #include LDAPXXPort::LDAPXXPort( QWidget *parentWidget ) - : XXPort( parentWidget ) + : XXPort( parentWidget ) { } KABC::Addressee::List LDAPXXPort::importContacts() const { - KABC::Addressee::List contacts; + KABC::Addressee::List contacts; - QPointer dlg = new KLDAP::LdapSearchDialog( parentWidget() ); + QPointer dlg = new KLDAP::LdapSearchDialog( parentWidget() ); - if ( dlg->exec() && dlg ) { - contacts = dlg->selectedContacts(); - } + if ( dlg->exec() && dlg ) { + contacts = dlg->selectedContacts(); + } - delete dlg; + delete dlg; - return contacts; + return contacts; } bool LDAPXXPort::exportContacts( const KABC::Addressee::List & ) const { - return false; + return false; } diff -Nru kdepim-4.13.0/kaddressbook/xxport/ldap/ldap_xxport.h kdepim-4.13.3/kaddressbook/xxport/ldap/ldap_xxport.h --- kdepim-4.13.0/kaddressbook/xxport/ldap/ldap_xxport.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/ldap/ldap_xxport.h 2014-07-09 12:18:50.000000000 +0000 @@ -30,7 +30,7 @@ class LDAPXXPort : public XXPort { - public: +public: explicit LDAPXXPort( QWidget *parent = 0 ); KABC::Addressee::List importContacts() const; bool exportContacts( const KABC::Addressee::List &contacts ) const; diff -Nru kdepim-4.13.0/kaddressbook/xxport/ldif/ldif_xxport.cpp kdepim-4.13.3/kaddressbook/xxport/ldif/ldif_xxport.cpp --- kdepim-4.13.0/kaddressbook/xxport/ldif/ldif_xxport.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/ldif/ldif_xxport.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -51,97 +51,97 @@ void doExport( QFile *file, const KABC::Addressee::List &list ) { - QString data; - KABC::LDIFConverter::addresseeToLDIF( list, data ); + QString data; + KABC::LDIFConverter::addresseeToLDIF( list, data ); - QTextStream stream( file ); - stream.setCodec( "UTF-8" ); - stream << data; + QTextStream stream( file ); + stream.setCodec( "UTF-8" ); + stream << data; } LDIFXXPort::LDIFXXPort( QWidget *parentWidget ) - : XXPort( parentWidget ) + : XXPort( parentWidget ) { } KABC::Addressee::List LDIFXXPort::importContacts() const { - KABC::Addressee::List contacts; + KABC::Addressee::List contacts; - const QString fileName = KFileDialog::getOpenFileName( QDir::homePath(), QLatin1String("text/x-ldif"), 0 ); - if ( fileName.isEmpty() ) { - return contacts; - } + const QString fileName = KFileDialog::getOpenFileName( QDir::homePath(), QLatin1String("text/x-ldif"), 0 ); + if ( fileName.isEmpty() ) { + return contacts; + } - QFile file( fileName ); - if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { - const QString msg = i18n( "Unable to open %1 for reading.", fileName ); - KMessageBox::error( parentWidget(), msg ); - return contacts; - } + QFile file( fileName ); + if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { + const QString msg = i18n( "Unable to open %1 for reading.", fileName ); + KMessageBox::error( parentWidget(), msg ); + return contacts; + } - QTextStream stream( &file ); - stream.setCodec( "ISO 8859-1" ); + QTextStream stream( &file ); + stream.setCodec( "ISO 8859-1" ); - const QString wholeFile = stream.readAll(); - const QDateTime dtDefault = QFileInfo( file ).lastModified(); - file.close(); + const QString wholeFile = stream.readAll(); + const QDateTime dtDefault = QFileInfo( file ).lastModified(); + file.close(); - KABC::LDIFConverter::LDIFToAddressee( wholeFile, contacts, dtDefault ); + KABC::LDIFConverter::LDIFToAddressee( wholeFile, contacts, dtDefault ); - return contacts; + return contacts; } bool LDIFXXPort::exportContacts( const KABC::Addressee::List &list ) const { - const KUrl url = - KFileDialog::getSaveUrl( KUrl( QDir::homePath() + QLatin1String("/addressbook.ldif") ), QLatin1String("text/x-ldif") ); - if ( url.isEmpty() ) { - return true; - } - - if ( !url.isLocalFile() ) { - KTemporaryFile tmpFile; - if ( !tmpFile.open() ) { - const QString msg = i18n( "Unable to open file %1", url.url() ); - KMessageBox::error( parentWidget(), msg ); - return false; + const KUrl url = + KFileDialog::getSaveUrl( KUrl( QDir::homePath() + QLatin1String("/addressbook.ldif") ), QLatin1String("text/x-ldif") ); + if ( url.isEmpty() ) { + return true; } - doExport( &tmpFile, list ); - tmpFile.flush(); + if ( !url.isLocalFile() ) { + KTemporaryFile tmpFile; + if ( !tmpFile.open() ) { + const QString msg = i18n( "Unable to open file %1", url.url() ); + KMessageBox::error( parentWidget(), msg ); + return false; + } - return KIO::NetAccess::upload( tmpFile.fileName(), url, parentWidget() ); - } else { - QString fileName = url.toLocalFile(); - - if ( QFileInfo( fileName ).exists() ) { - if ( url.isLocalFile() && QFileInfo( url.toLocalFile() ).exists() ) { - PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE; - PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget()); - result = static_cast(dialog->exec()); - if ( result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME ) { - fileName = dialog->newName().toLocalFile(); - } else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) { + doExport( &tmpFile, list ); + tmpFile.flush(); + + return KIO::NetAccess::upload( tmpFile.fileName(), url, parentWidget() ); + } else { + QString fileName = url.toLocalFile(); + + if ( QFileInfo( fileName ).exists() ) { + if ( url.isLocalFile() && QFileInfo( url.toLocalFile() ).exists() ) { + PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE; + PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget()); + result = static_cast(dialog->exec()); + if ( result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME ) { + fileName = dialog->newName().toLocalFile(); + } else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) { + delete dialog; + return true; + } delete dialog; - return true; } - delete dialog; } - } - //TODO fix export in network as other export function - QFile file( fileName ); + //TODO fix export in network as other export function + QFile file( fileName ); - if ( !file.open( QIODevice::WriteOnly ) ) { - QString txt = i18n( "Unable to open file %1.", fileName ); - KMessageBox::error( parentWidget(), txt ); - return false; - } + if ( !file.open( QIODevice::WriteOnly ) ) { + QString txt = i18n( "Unable to open file %1.", fileName ); + KMessageBox::error( parentWidget(), txt ); + return false; + } - doExport( &file, list ); - file.close(); + doExport( &file, list ); + file.close(); - return true; - } + return true; + } } diff -Nru kdepim-4.13.0/kaddressbook/xxport/ldif/ldif_xxport.h kdepim-4.13.3/kaddressbook/xxport/ldif/ldif_xxport.h --- kdepim-4.13.0/kaddressbook/xxport/ldif/ldif_xxport.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/ldif/ldif_xxport.h 2014-07-09 12:18:50.000000000 +0000 @@ -29,7 +29,7 @@ class LDIFXXPort : public XXPort { - public: +public: explicit LDIFXXPort( QWidget *parent = 0 ); bool exportContacts( const KABC::Addressee::List &contacts ) const; diff -Nru kdepim-4.13.0/kaddressbook/xxport/shared/xxport.cpp kdepim-4.13.3/kaddressbook/xxport/shared/xxport.cpp --- kdepim-4.13.0/kaddressbook/xxport/shared/xxport.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/shared/xxport.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -20,7 +20,7 @@ #include "xxport.h" XXPort::XXPort( QWidget *parent ) - : mParentWidget( parent ) + : mParentWidget( parent ) { } @@ -30,46 +30,46 @@ KABC::Addressee::List XXPort::importContacts() const { - return KABC::Addressee::List(); + return KABC::Addressee::List(); } bool XXPort::exportContacts( const KABC::Addressee::List & ) const { - return false; + return false; } void XXPort::setOption( const QString &key, const QString &value ) { - mOptions.insert( key, value ); + mOptions.insert( key, value ); } QString XXPort::option( const QString &key ) const { - return mOptions.value( key ); + return mOptions.value( key ); } QWidget *XXPort::parentWidget() const { - return mParentWidget; + return mParentWidget; } QString XXPort::contactFileName( const KABC::Addressee &contact ) const { - if ( !contact.givenName().isEmpty() && !contact.familyName().isEmpty() ) { - return QString::fromLatin1( "%1_%2" ).arg( contact.givenName() ).arg( contact.familyName() ); - } - - if ( !contact.familyName().isEmpty() ) { - return contact.familyName(); - } - - if ( !contact.givenName().isEmpty() ) { - return contact.givenName(); - } - - if ( !contact.organization().isEmpty() ) { - return contact.organization(); - } + if ( !contact.givenName().isEmpty() && !contact.familyName().isEmpty() ) { + return QString::fromLatin1( "%1_%2" ).arg( contact.givenName() ).arg( contact.familyName() ); + } + + if ( !contact.familyName().isEmpty() ) { + return contact.familyName(); + } + + if ( !contact.givenName().isEmpty() ) { + return contact.givenName(); + } + + if ( !contact.organization().isEmpty() ) { + return contact.organization(); + } - return contact.uid(); + return contact.uid(); } diff -Nru kdepim-4.13.0/kaddressbook/xxport/shared/xxport.h kdepim-4.13.3/kaddressbook/xxport/shared/xxport.h --- kdepim-4.13.0/kaddressbook/xxport/shared/xxport.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/shared/xxport.h 2014-07-09 12:18:50.000000000 +0000 @@ -31,7 +31,7 @@ */ class XXPort { - public: +public: /** * Creates a new xxport object. * @@ -68,7 +68,7 @@ */ QString option( const QString &key ) const; - protected: +protected: /** * Returns the parent widget that can be used as parent for * GUI components. @@ -80,7 +80,7 @@ */ QString contactFileName( const KABC::Addressee &contact ) const; - private: +private: QWidget *mParentWidget; QMap mOptions; }; diff -Nru kdepim-4.13.0/kaddressbook/xxport/vcard/vcard_xxport.cpp kdepim-4.13.3/kaddressbook/xxport/vcard/vcard_xxport.cpp --- kdepim-4.13.0/kaddressbook/xxport/vcard/vcard_xxport.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/vcard/vcard_xxport.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -57,20 +57,20 @@ class VCardViewerDialog : public KDialog { Q_OBJECT - public: +public: VCardViewerDialog( const KABC::Addressee::List &list, QWidget *parent ); ~VCardViewerDialog(); KABC::Addressee::List contacts() const; - protected Q_SLOTS: +protected Q_SLOTS: void slotYes(); void slotNo(); void slotApply(); void slotCancel(); - private: +private: void readConfig(); void writeConfig(); void updateView(); @@ -83,7 +83,7 @@ class VCardExportSelectionDialog : public KDialog { - public: +public: VCardExportSelectionDialog( QWidget *parent ); ~VCardExportSelectionDialog(); @@ -94,7 +94,7 @@ bool exportPictureFields() const; bool exportDisplayName() const; - private: +private: QCheckBox *mPrivateBox; QCheckBox *mBusinessBox; QCheckBox *mOtherBox; @@ -104,190 +104,190 @@ }; VCardXXPort::VCardXXPort( QWidget *parent ) - : XXPort( parent ) + : XXPort( parent ) { } bool VCardXXPort::exportContacts( const KABC::Addressee::List &contacts ) const { - KABC::VCardConverter converter; - KUrl url; + KABC::VCardConverter converter; + KUrl url; - const KABC::Addressee::List list = filterContacts( contacts ); - if ( list.isEmpty() ) { // no contact selected - return true; - } - - bool ok = true; - if ( list.count() == 1 ) { - url = KFileDialog::getSaveUrl( - QString( list[ 0 ].givenName() + - QLatin1Char( QLatin1Char('_') ) + - list[ 0 ].familyName() + - QLatin1String( ".vcf" ) ) ); - if ( url.isEmpty() ) { // user canceled export - return true; - } - - if ( option( QLatin1String("version") ) == QLatin1String("v21") ) { - ok = doExport( url, converter.exportVCards( list, KABC::VCardConverter::v2_1 ) ); - } else { - ok = doExport( url, converter.exportVCards( list, KABC::VCardConverter::v3_0 ) ); - } - } else { - const int answer = - KMessageBox::questionYesNoCancel( - parentWidget(), - i18nc( "@info", - "You have selected a list of contacts, " - "shall they be exported to several files?" ), - QString(), - KGuiItem( i18nc( "@action:button", "Export to One File" ) ), - KGuiItem( i18nc( "@action:button", "Export to Several Files" ) ) ); - - switch( answer ) { - case KMessageBox::No: - { - const KUrl baseUrl = KFileDialog::getExistingDirectoryUrl(); - if ( baseUrl.isEmpty() ) { - return true; // user canceled export - } - - for ( int i = 0; i < list.count(); ++i ) { - const KABC::Addressee contact = list.at( i ); - - url = baseUrl.url() + QLatin1Char('/') + contactFileName( contact ) + QLatin1String(".vcf"); - - bool tmpOk = false; + const KABC::Addressee::List list = filterContacts( contacts ); + if ( list.isEmpty() ) { // no contact selected + return true; + } + + bool ok = true; + if ( list.count() == 1 ) { + url = KFileDialog::getSaveUrl( + QString( list[ 0 ].givenName() + + QLatin1Char( QLatin1Char('_') ) + + list[ 0 ].familyName() + + QLatin1String( ".vcf" ) ) ); + if ( url.isEmpty() ) { // user canceled export + return true; + } if ( option( QLatin1String("version") ) == QLatin1String("v21") ) { - tmpOk = doExport( url, converter.exportVCard( contact, KABC::VCardConverter::v2_1 ) ); + ok = doExport( url, converter.exportVCards( list, KABC::VCardConverter::v2_1 ) ); } else { - tmpOk = doExport( url, converter.exportVCard( contact, KABC::VCardConverter::v3_0 ) ); + ok = doExport( url, converter.exportVCards( list, KABC::VCardConverter::v3_0 ) ); + } + } else { + const int answer = + KMessageBox::questionYesNoCancel( + parentWidget(), + i18nc( "@info", + "You have selected a list of contacts, " + "shall they be exported to several files?" ), + QString(), + KGuiItem( i18nc( "@action:button", "Export to One File" ) ), + KGuiItem( i18nc( "@action:button", "Export to Several Files" ) ) ); + + switch( answer ) { + case KMessageBox::No: + { + const KUrl baseUrl = KFileDialog::getExistingDirectoryUrl(); + if ( baseUrl.isEmpty() ) { + return true; // user canceled export + } + + for ( int i = 0; i < list.count(); ++i ) { + const KABC::Addressee contact = list.at( i ); + + url = baseUrl.url() + QLatin1Char('/') + contactFileName( contact ) + QLatin1String(".vcf"); + + bool tmpOk = false; + + if ( option( QLatin1String("version") ) == QLatin1String("v21") ) { + tmpOk = doExport( url, converter.exportVCard( contact, KABC::VCardConverter::v2_1 ) ); + } else { + tmpOk = doExport( url, converter.exportVCard( contact, KABC::VCardConverter::v3_0 ) ); + } + + ok = ok && tmpOk; + } + break; + } + case KMessageBox::Yes: + { + url = KFileDialog::getSaveUrl( KUrl( QLatin1String("addressbook.vcf") ) ); + if ( url.isEmpty() ) { + return true; // user canceled export + } + + if ( option( QLatin1String("version") ) == QLatin1String("v21") ) { + ok = doExport( url, converter.exportVCards( list, KABC::VCardConverter::v2_1 ) ); + } else { + ok = doExport( url, converter.exportVCards( list, KABC::VCardConverter::v3_0 ) ); + } + break; + } + case KMessageBox::Cancel: + default: + return true; // user canceled export } - - ok = ok && tmpOk; - } - break; - } - case KMessageBox::Yes: - { - url = KFileDialog::getSaveUrl( KUrl( QLatin1String("addressbook.vcf") ) ); - if ( url.isEmpty() ) { - return true; // user canceled export - } - - if ( option( QLatin1String("version") ) == QLatin1String("v21") ) { - ok = doExport( url, converter.exportVCards( list, KABC::VCardConverter::v2_1 ) ); - } else { - ok = doExport( url, converter.exportVCards( list, KABC::VCardConverter::v3_0 ) ); - } - break; - } - case KMessageBox::Cancel: - default: - return true; // user canceled export } - } - return ok; + return ok; } KABC::Addressee::List VCardXXPort::importContacts() const { - QString fileName; - KABC::Addressee::List addrList; - KUrl::List urls; - - if ( !option( QLatin1String("importData") ).isEmpty() ) { - addrList = parseVCard( option( QLatin1String("importData") ).toUtf8() ); - } else { - if ( !option( QLatin1String("importUrl") ).isEmpty() ) { - urls.append( KUrl( option( QLatin1String("importUrl") ) ) ); - } else { - const QString filter = i18n( "*.vcf|Vcard (*.vcf)\n*|all files (*)" ); - urls = - KFileDialog::getOpenUrls( - KUrl(), - filter, - parentWidget(), - i18nc( "@title:window", "Select vCard to Import" ) ); - } - - if ( urls.isEmpty() ) { - return addrList; - } - - const QString caption( i18nc( "@title:window", "vCard Import Failed" ) ); - bool anyFailures = false; + QString fileName; + KABC::Addressee::List addrList; + KUrl::List urls; - const int numberOfUrl( urls.count() ); - for ( int i = 0; i < numberOfUrl; ++i ) { - const KUrl url = urls.at( i ); + if ( !option( QLatin1String("importData") ).isEmpty() ) { + addrList = parseVCard( option( QLatin1String("importData") ).toUtf8() ); + } else { + if ( !option( QLatin1String("importUrl") ).isEmpty() ) { + urls.append( KUrl( option( QLatin1String("importUrl") ) ) ); + } else { + const QString filter = i18n( "*.vcf|Vcard (*.vcf)\n*|all files (*)" ); + urls = + KFileDialog::getOpenUrls( + KUrl(), + filter, + parentWidget(), + i18nc( "@title:window", "Select vCard to Import" ) ); + } - if ( KIO::NetAccess::download( url, fileName, parentWidget() ) ) { + if ( urls.isEmpty() ) { + return addrList; + } - QFile file( fileName ); + const QString caption( i18nc( "@title:window", "vCard Import Failed" ) ); + bool anyFailures = false; - if ( file.open( QIODevice::ReadOnly ) ) { - const QByteArray data = file.readAll(); - file.close(); - if ( !data.isEmpty() ) { - addrList += parseVCard( data ); - } + const int numberOfUrl( urls.count() ); + for ( int i = 0; i < numberOfUrl; ++i ) { + const KUrl url = urls.at( i ); + + if ( KIO::NetAccess::download( url, fileName, parentWidget() ) ) { + + QFile file( fileName ); + + if ( file.open( QIODevice::ReadOnly ) ) { + const QByteArray data = file.readAll(); + file.close(); + if ( !data.isEmpty() ) { + addrList += parseVCard( data ); + } + + KIO::NetAccess::removeTempFile( fileName ); + } else { + const QString msg = i18nc( + "@info", + "When trying to read the vCard, " + "there was an error opening the file %1:" + "%2", + url.pathOrUrl(), + i18nc( "QFile", file.errorString().toLatin1() ) ); + KMessageBox::error( parentWidget(), msg, caption ); + anyFailures = true; + } + } else { + const QString msg = i18nc( + "@info", + "Unable to access vCard:%1", + KIO::NetAccess::lastErrorString() ); + KMessageBox::error( parentWidget(), msg, caption ); + anyFailures = true; + } + } - KIO::NetAccess::removeTempFile( fileName ); - } else { - const QString msg = i18nc( - "@info", - "When trying to read the vCard, " - "there was an error opening the file %1:" - "%2", - url.pathOrUrl(), - i18nc( "QFile", file.errorString().toLatin1() ) ); - KMessageBox::error( parentWidget(), msg, caption ); - anyFailures = true; - } - } else { - const QString msg = i18nc( - "@info", - "Unable to access vCard:%1", - KIO::NetAccess::lastErrorString() ); - KMessageBox::error( parentWidget(), msg, caption ); - anyFailures = true; - } - } - - if ( !option( QLatin1String("importUrl") ).isEmpty() ) { // a vcard was passed via cmd - if ( addrList.isEmpty() ) { - if ( anyFailures && urls.count() > 1 ) { - KMessageBox::information( - parentWidget(), - i18nc( "@info", "No contacts were imported, due to errors with the vCards." ) ); - } else if ( !anyFailures ) { - KMessageBox::information( - parentWidget(), - i18nc( "@info", "The vCard does not contain any contacts." ) ); - } - } else { - QPointer dlg = new VCardViewerDialog( addrList, parentWidget() ); - if ( dlg->exec() && dlg ) { - addrList = dlg->contacts(); - } else { - addrList.clear(); + if ( !option( QLatin1String("importUrl") ).isEmpty() ) { // a vcard was passed via cmd + if ( addrList.isEmpty() ) { + if ( anyFailures && urls.count() > 1 ) { + KMessageBox::information( + parentWidget(), + i18nc( "@info", "No contacts were imported, due to errors with the vCards." ) ); + } else if ( !anyFailures ) { + KMessageBox::information( + parentWidget(), + i18nc( "@info", "The vCard does not contain any contacts." ) ); + } + } else { + QPointer dlg = new VCardViewerDialog( addrList, parentWidget() ); + if ( dlg->exec() && dlg ) { + addrList = dlg->contacts(); + } else { + addrList.clear(); + } + delete dlg; + } } - delete dlg; - } } - } - return addrList; + return addrList; } KABC::Addressee::List VCardXXPort::parseVCard( const QByteArray &data ) const { - KABC::VCardConverter converter; + KABC::VCardConverter converter; - return converter.parseVCards( data ); + return converter.parseVCards( data ); } bool VCardXXPort::doExport( const KUrl &url, const QByteArray &data ) const @@ -316,221 +316,221 @@ KABC::Addressee::List VCardXXPort::filterContacts( const KABC::Addressee::List &addrList ) const { - KABC::Addressee::List list; - - if ( addrList.isEmpty() ) { - return addrList; - } + KABC::Addressee::List list; - QPointer dlg = new VCardExportSelectionDialog( parentWidget() ); - if ( !dlg->exec() || !dlg ) { - delete dlg; - return list; - } + if ( addrList.isEmpty() ) { + return addrList; + } - KABC::Addressee::List::ConstIterator it; - KABC::Addressee::List::ConstIterator end( addrList.end() ); - for ( it = addrList.begin(); it != end; ++it ) { - KABC::Addressee addr; - - addr.setUid( (*it).uid() ); - addr.setFormattedName( (*it).formattedName() ); - - bool addrDone = false; - if ( dlg->exportDisplayName() ) { // output display name as N field - QString fmtName = (*it).formattedName(); - QStringList splitNames = fmtName.split( QLatin1Char(' '), QString::SkipEmptyParts ); - if ( splitNames.count() >= 2 ) { - addr.setPrefix( QString() ); - addr.setGivenName( splitNames.takeFirst() ); - addr.setFamilyName( splitNames.takeLast() ); - addr.setAdditionalName( splitNames.join( QLatin1String(" ") ) ); - addr.setSuffix( QString() ); - addrDone = true; - } - } - - if ( !addrDone ) { // not wanted, or could not be split - addr.setPrefix( (*it).prefix() ); - addr.setGivenName( (*it).givenName() ); - addr.setAdditionalName( (*it).additionalName() ); - addr.setFamilyName( (*it).familyName() ); - addr.setSuffix( (*it).suffix() ); - } - - addr.setNickName( (*it).nickName() ); - addr.setMailer( (*it).mailer() ); - addr.setTimeZone( (*it).timeZone() ); - addr.setGeo( (*it).geo() ); - addr.setProductId( (*it).productId() ); - addr.setSortString( (*it).sortString() ); - addr.setUrl( (*it).url() ); - addr.setSecrecy( (*it).secrecy() ); - addr.setSound( (*it).sound() ); - addr.setEmails( (*it).emails() ); - addr.setCategories( (*it).categories() ); - - if ( dlg->exportPrivateFields() ) { - addr.setBirthday( (*it).birthday() ); - addr.setNote( (*it).note() ); - } - - if ( dlg->exportPictureFields() ) { - if ( dlg->exportPrivateFields() ) { - addr.setPhoto( (*it).photo() ); - } - - if ( dlg->exportBusinessFields() ) { - addr.setLogo( (*it).logo() ); - } - } - - if ( dlg->exportBusinessFields() ) { - addr.setTitle( (*it).title() ); - addr.setRole( (*it).role() ); - addr.setOrganization( (*it).organization() ); - addr.setDepartment( (*it).department() ); - - KABC::PhoneNumber::List phones = (*it).phoneNumbers( KABC::PhoneNumber::Work ); - KABC::PhoneNumber::List::Iterator phoneIt; - for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { - addr.insertPhoneNumber( *phoneIt ); - } - - KABC::Address::List addresses = (*it).addresses( KABC::Address::Work ); - KABC::Address::List::Iterator addrIt; - for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { - addr.insertAddress( *addrIt ); - } - } - - KABC::PhoneNumber::List phones = (*it).phoneNumbers(); - KABC::PhoneNumber::List::Iterator phoneIt; - for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { - int type = (*phoneIt).type(); - - if ( type & KABC::PhoneNumber::Home && dlg->exportPrivateFields() ) { - addr.insertPhoneNumber( *phoneIt ); - } else if ( type & KABC::PhoneNumber::Work && dlg->exportBusinessFields() ) { - addr.insertPhoneNumber( *phoneIt ); - } else if ( dlg->exportOtherFields() ) { - addr.insertPhoneNumber( *phoneIt ); - } - } - - KABC::Address::List addresses = (*it).addresses(); - KABC::Address::List::Iterator addrIt; - for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { - int type = (*addrIt).type(); - - if ( type & KABC::Address::Home && dlg->exportPrivateFields() ) { - addr.insertAddress( *addrIt ); - } else if ( type & KABC::Address::Work && dlg->exportBusinessFields() ) { - addr.insertAddress( *addrIt ); - } else if ( dlg->exportOtherFields() ) { - addr.insertAddress( *addrIt ); - } - } - - if ( dlg->exportOtherFields() ) { - addr.setCustoms( (*it).customs() ); - } - - if ( dlg->exportEncryptionKeys() ) { - addKey( addr, KABC::Key::PGP ); - addKey( addr, KABC::Key::X509 ); + QPointer dlg = new VCardExportSelectionDialog( parentWidget() ); + if ( !dlg->exec() || !dlg ) { + delete dlg; + return list; } - list.append( addr ); - } + KABC::Addressee::List::ConstIterator it; + KABC::Addressee::List::ConstIterator end( addrList.end() ); + for ( it = addrList.begin(); it != end; ++it ) { + KABC::Addressee addr; + + addr.setUid( (*it).uid() ); + addr.setFormattedName( (*it).formattedName() ); + + bool addrDone = false; + if ( dlg->exportDisplayName() ) { // output display name as N field + QString fmtName = (*it).formattedName(); + QStringList splitNames = fmtName.split( QLatin1Char(' '), QString::SkipEmptyParts ); + if ( splitNames.count() >= 2 ) { + addr.setPrefix( QString() ); + addr.setGivenName( splitNames.takeFirst() ); + addr.setFamilyName( splitNames.takeLast() ); + addr.setAdditionalName( splitNames.join( QLatin1String(" ") ) ); + addr.setSuffix( QString() ); + addrDone = true; + } + } + + if ( !addrDone ) { // not wanted, or could not be split + addr.setPrefix( (*it).prefix() ); + addr.setGivenName( (*it).givenName() ); + addr.setAdditionalName( (*it).additionalName() ); + addr.setFamilyName( (*it).familyName() ); + addr.setSuffix( (*it).suffix() ); + } + + addr.setNickName( (*it).nickName() ); + addr.setMailer( (*it).mailer() ); + addr.setTimeZone( (*it).timeZone() ); + addr.setGeo( (*it).geo() ); + addr.setProductId( (*it).productId() ); + addr.setSortString( (*it).sortString() ); + addr.setUrl( (*it).url() ); + addr.setSecrecy( (*it).secrecy() ); + addr.setSound( (*it).sound() ); + addr.setEmails( (*it).emails() ); + addr.setCategories( (*it).categories() ); + + if ( dlg->exportPrivateFields() ) { + addr.setBirthday( (*it).birthday() ); + addr.setNote( (*it).note() ); + } + + if ( dlg->exportPictureFields() ) { + if ( dlg->exportPrivateFields() ) { + addr.setPhoto( (*it).photo() ); + } + + if ( dlg->exportBusinessFields() ) { + addr.setLogo( (*it).logo() ); + } + } + + if ( dlg->exportBusinessFields() ) { + addr.setTitle( (*it).title() ); + addr.setRole( (*it).role() ); + addr.setOrganization( (*it).organization() ); + addr.setDepartment( (*it).department() ); + + KABC::PhoneNumber::List phones = (*it).phoneNumbers( KABC::PhoneNumber::Work ); + KABC::PhoneNumber::List::Iterator phoneIt; + for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { + addr.insertPhoneNumber( *phoneIt ); + } + + KABC::Address::List addresses = (*it).addresses( KABC::Address::Work ); + KABC::Address::List::Iterator addrIt; + for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { + addr.insertAddress( *addrIt ); + } + } + + KABC::PhoneNumber::List phones = (*it).phoneNumbers(); + KABC::PhoneNumber::List::Iterator phoneIt; + for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { + int type = (*phoneIt).type(); + + if ( type & KABC::PhoneNumber::Home && dlg->exportPrivateFields() ) { + addr.insertPhoneNumber( *phoneIt ); + } else if ( type & KABC::PhoneNumber::Work && dlg->exportBusinessFields() ) { + addr.insertPhoneNumber( *phoneIt ); + } else if ( dlg->exportOtherFields() ) { + addr.insertPhoneNumber( *phoneIt ); + } + } + + KABC::Address::List addresses = (*it).addresses(); + KABC::Address::List::Iterator addrIt; + for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { + int type = (*addrIt).type(); + + if ( type & KABC::Address::Home && dlg->exportPrivateFields() ) { + addr.insertAddress( *addrIt ); + } else if ( type & KABC::Address::Work && dlg->exportBusinessFields() ) { + addr.insertAddress( *addrIt ); + } else if ( dlg->exportOtherFields() ) { + addr.insertAddress( *addrIt ); + } + } + + if ( dlg->exportOtherFields() ) { + addr.setCustoms( (*it).customs() ); + } + + if ( dlg->exportEncryptionKeys() ) { + addKey( addr, KABC::Key::PGP ); + addKey( addr, KABC::Key::X509 ); + } - delete dlg; + list.append( addr ); + } + + delete dlg; - return list; + return list; } void VCardXXPort::addKey( KABC::Addressee &addr, KABC::Key::Type type ) const { #ifdef QGPGME_FOUND - const QString fingerprint = addr.custom( QLatin1String("KADDRESSBOOK"), - ( type == KABC::Key::PGP ? QLatin1String("OPENPGPFP") : QLatin1String("SMIMEFP") ) ); - if ( fingerprint.isEmpty() ) { - return; - } + const QString fingerprint = addr.custom( QLatin1String("KADDRESSBOOK"), + ( type == KABC::Key::PGP ? QLatin1String("OPENPGPFP") : QLatin1String("SMIMEFP") ) ); + if ( fingerprint.isEmpty() ) { + return; + } - GpgME::Context *context = GpgME::Context::createForProtocol( GpgME::OpenPGP ); - if ( !context ) { - kError() << "No context available"; - return; - } + GpgME::Context *context = GpgME::Context::createForProtocol( GpgME::OpenPGP ); + if ( !context ) { + kError() << "No context available"; + return; + } - context->setArmor( false ); - context->setTextMode( false ); + context->setArmor( false ); + context->setTextMode( false ); - QGpgME::QByteArrayDataProvider dataProvider; - GpgME::Data dataObj( &dataProvider ); - GpgME::Error error = context->exportPublicKeys( fingerprint.toLatin1(), dataObj ); - delete context; + QGpgME::QByteArrayDataProvider dataProvider; + GpgME::Data dataObj( &dataProvider ); + GpgME::Error error = context->exportPublicKeys( fingerprint.toLatin1(), dataObj ); + delete context; - if ( error ) { - kError() << error.asString(); - return; - } + if ( error ) { + kError() << error.asString(); + return; + } - KABC::Key key; - key.setType( type ); - key.setBinaryData( dataProvider.data() ); + KABC::Key key; + key.setType( type ); + key.setBinaryData( dataProvider.data() ); - addr.insertKey( key ); + addr.insertKey( key ); #else - return; + return; #endif } // ---------- VCardViewer Dialog ---------------- // VCardViewerDialog::VCardViewerDialog( const KABC::Addressee::List &list, QWidget *parent ) - : KDialog( parent ), - mContacts( list ) + : KDialog( parent ), + mContacts( list ) { - setCaption( i18nc( "@title:window", "Import vCard" ) ); - setButtons( User1 | User2 | Apply | Cancel ); - setButtonGuiItem(User1, KStandardGuiItem::no()); - setButtonGuiItem(User2, KStandardGuiItem::yes()); - setDefaultButton( User1 ); - setModal( true ); - showButtonSeparator( true ); - - QFrame *page = new QFrame( this ); - setMainWidget( page ); - - QVBoxLayout *layout = new QVBoxLayout( page ); - layout->setSpacing( spacingHint() ); - layout->setMargin( marginHint() ); - - QLabel *label = - new QLabel( - i18nc( "@info", "Do you want to import this contact into your address book?" ), page ); - QFont font = label->font(); - font.setBold( true ); - label->setFont( font ); - layout->addWidget( label ); - - mView = new KAddressBookGrantlee::GrantleeContactViewer( page ); - - layout->addWidget( mView ); - - setButtonText( Apply, i18nc( "@action:button", "Import All..." ) ); - - mIt = mContacts.begin(); - - connect( this, SIGNAL(user2Clicked()), this, SLOT(slotYes()) ); - connect( this, SIGNAL(user1Clicked()), this, SLOT(slotNo()) ); - connect( this, SIGNAL(applyClicked()), this, SLOT(slotApply()) ); - connect( this, SIGNAL(cancelClicked()), this, SLOT(slotCancel()) ); + setCaption( i18nc( "@title:window", "Import vCard" ) ); + setButtons( User1 | User2 | Apply | Cancel ); + setButtonGuiItem(User1, KStandardGuiItem::no()); + setButtonGuiItem(User2, KStandardGuiItem::yes()); + setDefaultButton( User1 ); + setModal( true ); + showButtonSeparator( true ); + + QFrame *page = new QFrame( this ); + setMainWidget( page ); + + QVBoxLayout *layout = new QVBoxLayout( page ); + layout->setSpacing( spacingHint() ); + layout->setMargin( marginHint() ); + + QLabel *label = + new QLabel( + i18nc( "@info", "Do you want to import this contact into your address book?" ), page ); + QFont font = label->font(); + font.setBold( true ); + label->setFont( font ); + layout->addWidget( label ); + + mView = new KAddressBookGrantlee::GrantleeContactViewer( page ); + + layout->addWidget( mView ); + + setButtonText( Apply, i18nc( "@action:button", "Import All..." ) ); + + mIt = mContacts.begin(); + + connect( this, SIGNAL(user2Clicked()), this, SLOT(slotYes()) ); + connect( this, SIGNAL(user1Clicked()), this, SLOT(slotNo()) ); + connect( this, SIGNAL(applyClicked()), this, SLOT(slotApply()) ); + connect( this, SIGNAL(cancelClicked()), this, SLOT(slotCancel()) ); - updateView(); - readConfig(); + updateView(); + readConfig(); } VCardViewerDialog::~VCardViewerDialog() @@ -557,189 +557,189 @@ KABC::Addressee::List VCardViewerDialog::contacts() const { - return mContacts; + return mContacts; } void VCardViewerDialog::updateView() { - mView->setRawContact( *mIt ); + mView->setRawContact( *mIt ); - KABC::Addressee::List::Iterator it = mIt; - enableButton( Apply, ( ++it ) != mContacts.end() ); + KABC::Addressee::List::Iterator it = mIt; + enableButton( Apply, ( ++it ) != mContacts.end() ); } void VCardViewerDialog::slotYes() { - mIt++; + mIt++; - if ( mIt == mContacts.end() ) { - slotApply(); - return; - } + if ( mIt == mContacts.end() ) { + slotApply(); + return; + } - updateView(); + updateView(); } void VCardViewerDialog::slotNo() { if ( mIt == mContacts.end() ) { accept(); - return; + return; } // remove the current contact from the result set mIt = mContacts.erase( mIt ); - if ( mIt == mContacts.end() ) { - return; - } + if ( mIt == mContacts.end() ) { + return; + } - updateView(); + updateView(); } void VCardViewerDialog::slotApply() { - KDialog::accept(); + KDialog::accept(); } void VCardViewerDialog::slotCancel() { - mContacts.clear(); - reject(); + mContacts.clear(); + reject(); } // ---------- VCardExportSelection Dialog ---------------- // VCardExportSelectionDialog::VCardExportSelectionDialog( QWidget *parent ) - : KDialog( parent ) + : KDialog( parent ) { - setCaption( i18nc( "@title:window", "Select vCard Fields" ) ); - setButtons( Ok | Cancel ); - setDefaultButton( Ok ); - setModal( true ); - showButtonSeparator( true ); - - QFrame *page = new QFrame( this ); - setMainWidget( page ); - - QGridLayout *layout = new QGridLayout( page ); - layout->setSpacing( spacingHint() ); - layout->setMargin( marginHint() ); - - QGroupBox *gbox = new QGroupBox( - i18nc( "@title:group", "Fields to be exported" ), page ); - gbox->setFlat( true ); - layout->addWidget( gbox, 0, 0, 1, 2 ); - - mPrivateBox = new QCheckBox( i18nc( "@option:check", "Private fields" ), page ); - mPrivateBox->setToolTip( - i18nc( "@info:tooltip", "Export private fields" ) ); - mPrivateBox->setWhatsThis( - i18nc( "@info:whatsthis", - "Check this box if you want to export the contact's " - "private fields to the vCard output file." ) ); - layout->addWidget( mPrivateBox, 1, 0 ); - - mBusinessBox = new QCheckBox( i18nc( "@option:check", "Business fields" ), page ); - mBusinessBox->setToolTip( - i18nc( "@info:tooltip", "Export business fields" ) ); - mBusinessBox->setWhatsThis( - i18nc( "@info:whatsthis", - "Check this box if you want to export the contact's " - "business fields to the vCard output file." ) ); - layout->addWidget( mBusinessBox, 2, 0 ); - - mOtherBox = new QCheckBox( i18nc( "@option:check", "Other fields" ), page ); - mOtherBox->setToolTip( - i18nc( "@info:tooltip", "Export other fields" ) ); - mOtherBox->setWhatsThis( - i18nc( "@info:whatsthis", - "Check this box if you want to export the contact's " - "other fields to the vCard output file." ) ); - layout->addWidget( mOtherBox, 3, 0 ); - - mEncryptionKeys = new QCheckBox( i18nc( "@option:check", "Encryption keys" ), page ); - mEncryptionKeys->setToolTip( - i18nc( "@info:tooltip", "Export encryption keys" ) ); - mEncryptionKeys->setWhatsThis( - i18nc( "@info:whatsthis", - "Check this box if you want to export the contact's " - "encryption keys to the vCard output file." ) ); - layout->addWidget( mEncryptionKeys, 1, 1 ); - - mPictureBox = new QCheckBox( i18nc( "@option:check", "Pictures" ), page ); - mPictureBox->setToolTip( - i18nc( "@info:tooltip", "Export pictures" ) ); - mPictureBox->setWhatsThis( - i18nc( "@info:whatsthis", - "Check this box if you want to export the contact's " - "picture to the vCard output file." ) ); - layout->addWidget( mPictureBox, 2, 1 ); - - gbox = new QGroupBox( - i18nc( "@title:group", "Export options" ), page ); - gbox->setFlat( true ); - layout->addWidget( gbox, 4, 0, 1, 2 ); - - mDisplayNameBox = new QCheckBox( i18nc( "@option:check", "Display name as full name" ), page ); - mDisplayNameBox->setToolTip( - i18nc( "@info:tooltip", "Export display name as full name" ) ); - mDisplayNameBox->setWhatsThis( - i18nc( "@info:whatsthis", - "Check this box if you want to export the contact's display name " - "in the vCard's full name field. This may be required to get the " - "name shown correctly in GMail or Android." ) ); - layout->addWidget( mDisplayNameBox, 5, 0, 1, 2 ); - - KConfig config( QLatin1String("kaddressbookrc") ); - const KConfigGroup group( &config, "XXPortVCard" ); - - mPrivateBox->setChecked( group.readEntry( "ExportPrivateFields", true ) ); - mBusinessBox->setChecked( group.readEntry( "ExportBusinessFields", true ) ); - mOtherBox->setChecked( group.readEntry( "ExportOtherFields", true ) ); - mEncryptionKeys->setChecked( group.readEntry( "ExportEncryptionKeys", true ) ); - mPictureBox->setChecked( group.readEntry( "ExportPictureFields", true ) ); - mDisplayNameBox->setChecked( group.readEntry( "ExportDisplayName", false ) ); + setCaption( i18nc( "@title:window", "Select vCard Fields" ) ); + setButtons( Ok | Cancel ); + setDefaultButton( Ok ); + setModal( true ); + showButtonSeparator( true ); + + QFrame *page = new QFrame( this ); + setMainWidget( page ); + + QGridLayout *layout = new QGridLayout( page ); + layout->setSpacing( spacingHint() ); + layout->setMargin( marginHint() ); + + QGroupBox *gbox = new QGroupBox( + i18nc( "@title:group", "Fields to be exported" ), page ); + gbox->setFlat( true ); + layout->addWidget( gbox, 0, 0, 1, 2 ); + + mPrivateBox = new QCheckBox( i18nc( "@option:check", "Private fields" ), page ); + mPrivateBox->setToolTip( + i18nc( "@info:tooltip", "Export private fields" ) ); + mPrivateBox->setWhatsThis( + i18nc( "@info:whatsthis", + "Check this box if you want to export the contact's " + "private fields to the vCard output file." ) ); + layout->addWidget( mPrivateBox, 1, 0 ); + + mBusinessBox = new QCheckBox( i18nc( "@option:check", "Business fields" ), page ); + mBusinessBox->setToolTip( + i18nc( "@info:tooltip", "Export business fields" ) ); + mBusinessBox->setWhatsThis( + i18nc( "@info:whatsthis", + "Check this box if you want to export the contact's " + "business fields to the vCard output file." ) ); + layout->addWidget( mBusinessBox, 2, 0 ); + + mOtherBox = new QCheckBox( i18nc( "@option:check", "Other fields" ), page ); + mOtherBox->setToolTip( + i18nc( "@info:tooltip", "Export other fields" ) ); + mOtherBox->setWhatsThis( + i18nc( "@info:whatsthis", + "Check this box if you want to export the contact's " + "other fields to the vCard output file." ) ); + layout->addWidget( mOtherBox, 3, 0 ); + + mEncryptionKeys = new QCheckBox( i18nc( "@option:check", "Encryption keys" ), page ); + mEncryptionKeys->setToolTip( + i18nc( "@info:tooltip", "Export encryption keys" ) ); + mEncryptionKeys->setWhatsThis( + i18nc( "@info:whatsthis", + "Check this box if you want to export the contact's " + "encryption keys to the vCard output file." ) ); + layout->addWidget( mEncryptionKeys, 1, 1 ); + + mPictureBox = new QCheckBox( i18nc( "@option:check", "Pictures" ), page ); + mPictureBox->setToolTip( + i18nc( "@info:tooltip", "Export pictures" ) ); + mPictureBox->setWhatsThis( + i18nc( "@info:whatsthis", + "Check this box if you want to export the contact's " + "picture to the vCard output file." ) ); + layout->addWidget( mPictureBox, 2, 1 ); + + gbox = new QGroupBox( + i18nc( "@title:group", "Export options" ), page ); + gbox->setFlat( true ); + layout->addWidget( gbox, 4, 0, 1, 2 ); + + mDisplayNameBox = new QCheckBox( i18nc( "@option:check", "Display name as full name" ), page ); + mDisplayNameBox->setToolTip( + i18nc( "@info:tooltip", "Export display name as full name" ) ); + mDisplayNameBox->setWhatsThis( + i18nc( "@info:whatsthis", + "Check this box if you want to export the contact's display name " + "in the vCard's full name field. This may be required to get the " + "name shown correctly in GMail or Android." ) ); + layout->addWidget( mDisplayNameBox, 5, 0, 1, 2 ); + + KConfig config( QLatin1String("kaddressbookrc") ); + const KConfigGroup group( &config, "XXPortVCard" ); + + mPrivateBox->setChecked( group.readEntry( "ExportPrivateFields", true ) ); + mBusinessBox->setChecked( group.readEntry( "ExportBusinessFields", true ) ); + mOtherBox->setChecked( group.readEntry( "ExportOtherFields", true ) ); + mEncryptionKeys->setChecked( group.readEntry( "ExportEncryptionKeys", true ) ); + mPictureBox->setChecked( group.readEntry( "ExportPictureFields", true ) ); + mDisplayNameBox->setChecked( group.readEntry( "ExportDisplayName", false ) ); } VCardExportSelectionDialog::~VCardExportSelectionDialog() { - KConfig config( QLatin1String("kaddressbookrc") ); - KConfigGroup group( &config, "XXPortVCard" ); + KConfig config( QLatin1String("kaddressbookrc") ); + KConfigGroup group( &config, "XXPortVCard" ); - group.writeEntry( "ExportPrivateFields", mPrivateBox->isChecked() ); - group.writeEntry( "ExportBusinessFields", mBusinessBox->isChecked() ); - group.writeEntry( "ExportOtherFields", mOtherBox->isChecked() ); - group.writeEntry( "ExportEncryptionKeys", mEncryptionKeys->isChecked() ); - group.writeEntry( "ExportPictureFields", mPictureBox->isChecked() ); - group.writeEntry( "ExportDisplayName", mDisplayNameBox->isChecked() ); + group.writeEntry( "ExportPrivateFields", mPrivateBox->isChecked() ); + group.writeEntry( "ExportBusinessFields", mBusinessBox->isChecked() ); + group.writeEntry( "ExportOtherFields", mOtherBox->isChecked() ); + group.writeEntry( "ExportEncryptionKeys", mEncryptionKeys->isChecked() ); + group.writeEntry( "ExportPictureFields", mPictureBox->isChecked() ); + group.writeEntry( "ExportDisplayName", mDisplayNameBox->isChecked() ); } bool VCardExportSelectionDialog::exportPrivateFields() const { - return mPrivateBox->isChecked(); + return mPrivateBox->isChecked(); } bool VCardExportSelectionDialog::exportBusinessFields() const { - return mBusinessBox->isChecked(); + return mBusinessBox->isChecked(); } bool VCardExportSelectionDialog::exportOtherFields() const { - return mOtherBox->isChecked(); + return mOtherBox->isChecked(); } bool VCardExportSelectionDialog::exportEncryptionKeys() const { - return mEncryptionKeys->isChecked(); + return mEncryptionKeys->isChecked(); } bool VCardExportSelectionDialog::exportPictureFields() const { - return mPictureBox->isChecked(); + return mPictureBox->isChecked(); } bool VCardExportSelectionDialog::exportDisplayName() const { - return mDisplayNameBox->isChecked(); + return mDisplayNameBox->isChecked(); } #include "vcard_xxport.moc" diff -Nru kdepim-4.13.0/kaddressbook/xxport/vcard/vcard_xxport.h kdepim-4.13.3/kaddressbook/xxport/vcard/vcard_xxport.h --- kdepim-4.13.0/kaddressbook/xxport/vcard/vcard_xxport.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/vcard/vcard_xxport.h 2014-07-09 12:18:50.000000000 +0000 @@ -24,13 +24,13 @@ class VCardXXPort : public XXPort { - public: +public: explicit VCardXXPort( QWidget *parent = 0 ); bool exportContacts( const KABC::Addressee::List &contacts ) const; KABC::Addressee::List importContacts() const; - private: +private: KABC::Addressee::List parseVCard( const QByteArray &data ) const; bool doExport( const KUrl &url, const QByteArray &data ) const; diff -Nru kdepim-4.13.0/kaddressbook/xxport/xxportfactory.cpp kdepim-4.13.3/kaddressbook/xxport/xxportfactory.cpp --- kdepim-4.13.0/kaddressbook/xxport/xxportfactory.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/xxportfactory.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -27,21 +27,21 @@ XXPort *XXPortFactory::createXXPort( const QString &identifier, QWidget *parentWidget ) const { - if ( identifier == QLatin1String("vcard21") || identifier == QLatin1String("vcard30") ) { - XXPort *xxport = new VCardXXPort( parentWidget ); - if ( identifier == QLatin1String("vcard21") ) { - xxport->setOption( QLatin1String("version"), QLatin1String("v21") ); + if ( identifier == QLatin1String("vcard21") || identifier == QLatin1String("vcard30") ) { + XXPort *xxport = new VCardXXPort( parentWidget ); + if ( identifier == QLatin1String("vcard21") ) { + xxport->setOption( QLatin1String("version"), QLatin1String("v21") ); + } + return xxport; + } else if ( identifier == QLatin1String("csv") ) { + return new CsvXXPort( parentWidget ); + } else if ( identifier == QLatin1String("ldif") ) { + return new LDIFXXPort( parentWidget ); + } else if ( identifier == QLatin1String("ldap") ) { + return new LDAPXXPort( parentWidget ); + } else if ( identifier == QLatin1String("gmx") ) { + return new GMXXXPort( parentWidget ); + } else { + return 0; } - return xxport; - } else if ( identifier == QLatin1String("csv") ) { - return new CsvXXPort( parentWidget ); - } else if ( identifier == QLatin1String("ldif") ) { - return new LDIFXXPort( parentWidget ); - } else if ( identifier == QLatin1String("ldap") ) { - return new LDAPXXPort( parentWidget ); - } else if ( identifier == QLatin1String("gmx") ) { - return new GMXXXPort( parentWidget ); - } else { - return 0; - } } diff -Nru kdepim-4.13.0/kaddressbook/xxport/xxportfactory.h kdepim-4.13.3/kaddressbook/xxport/xxportfactory.h --- kdepim-4.13.0/kaddressbook/xxport/xxportfactory.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxport/xxportfactory.h 2014-07-09 12:18:50.000000000 +0000 @@ -32,7 +32,7 @@ */ class XXPortFactory { - public: +public: /** * Returns a new import/export module that matches the given * @p identifier or a null pointer if the identifier is invalid. diff -Nru kdepim-4.13.0/kaddressbook/xxportmanager.cpp kdepim-4.13.3/kaddressbook/xxportmanager.cpp --- kdepim-4.13.0/kaddressbook/xxportmanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxportmanager.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -38,16 +38,16 @@ #include XXPortManager::XXPortManager( QWidget *parent ) - : QObject( parent ), mSelectionModel( 0 ), - mParentWidget( parent ), mImportProgressDialog( 0 ) + : QObject( parent ), mSelectionModel( 0 ), + mParentWidget( parent ), mImportProgressDialog( 0 ) { - mImportMapper = new QSignalMapper( this ); - mExportMapper = new QSignalMapper( this ); + mImportMapper = new QSignalMapper( this ); + mExportMapper = new QSignalMapper( this ); - connect( mImportMapper, SIGNAL(mapped(QString)), - this, SLOT(slotImport(QString)) ); - connect( mExportMapper, SIGNAL(mapped(QString)), - this, SLOT(slotExport(QString)) ); + connect( mImportMapper, SIGNAL(mapped(QString)), + this, SLOT(slotImport(QString)) ); + connect( mExportMapper, SIGNAL(mapped(QString)), + this, SLOT(slotExport(QString)) ); } XXPortManager::~XXPortManager() @@ -56,24 +56,24 @@ void XXPortManager::addImportAction( QAction *action, const QString &identifier ) { - mImportMapper->setMapping( action, identifier ); - connect( action, SIGNAL(triggered(bool)), mImportMapper, SLOT(map()) ); + mImportMapper->setMapping( action, identifier ); + connect( action, SIGNAL(triggered(bool)), mImportMapper, SLOT(map()) ); } void XXPortManager::addExportAction( QAction *action, const QString &identifier ) { - mExportMapper->setMapping( action, identifier ); - connect( action, SIGNAL(triggered(bool)), mExportMapper, SLOT(map()) ); + mExportMapper->setMapping( action, identifier ); + connect( action, SIGNAL(triggered(bool)), mExportMapper, SLOT(map()) ); } void XXPortManager::setSelectionModel( QItemSelectionModel *selectionModel ) { - mSelectionModel = selectionModel; + mSelectionModel = selectionModel; } void XXPortManager::setDefaultAddressBook( const Akonadi::Collection &addressBook ) { - mDefaultAddressBook = addressBook; + mDefaultAddressBook = addressBook; } void XXPortManager::importFile( const KUrl &url) @@ -90,7 +90,7 @@ return; XXPort *xxport = mFactory.createXXPort( identifier, mParentWidget ); if( !xxport ) { - return; + return; } xxport->setOption(QLatin1String("importUrl"), url.path()); const KABC::Addressee::List contacts = xxport->importContacts(); @@ -101,110 +101,110 @@ void XXPortManager::slotImport( const QString &identifier ) { - const XXPort *xxport = mFactory.createXXPort( identifier, mParentWidget ); - if( !xxport ) { - return; - } + const XXPort *xxport = mFactory.createXXPort( identifier, mParentWidget ); + if( !xxport ) { + return; + } - const KABC::Addressee::List contacts = xxport->importContacts(); + const KABC::Addressee::List contacts = xxport->importContacts(); - delete xxport; - import(contacts); + delete xxport; + import(contacts); } void XXPortManager::import(const KABC::Addressee::List &contacts) { - if ( contacts.isEmpty() ) { // nothing to import - return; - } - - const QStringList mimeTypes( KABC::Addressee::mimeType() ); - - QPointer dlg = new Akonadi::CollectionDialog( mParentWidget ); - dlg->setMimeTypeFilter( mimeTypes ); - dlg->setAccessRightsFilter( Akonadi::Collection::CanCreateItem ); - dlg->setCaption( i18n( "Select Address Book" ) ); - dlg->setDescription( - i18n( "Select the address book the imported contact(s) shall be saved in:" ) ); - dlg->setDefaultCollection( mDefaultAddressBook ); + if ( contacts.isEmpty() ) { // nothing to import + return; + } - if ( !dlg->exec() || !dlg ) { + const QStringList mimeTypes( KABC::Addressee::mimeType() ); + + QPointer dlg = new Akonadi::CollectionDialog( mParentWidget ); + dlg->setMimeTypeFilter( mimeTypes ); + dlg->setAccessRightsFilter( Akonadi::Collection::CanCreateItem ); + dlg->setCaption( i18n( "Select Address Book" ) ); + dlg->setDescription( + i18n( "Select the address book the imported contact(s) shall be saved in:" ) ); + dlg->setDefaultCollection( mDefaultAddressBook ); + + if ( !dlg->exec() || !dlg ) { + delete dlg; + return; + } + + const Akonadi::Collection collection = dlg->selectedCollection(); delete dlg; - return; - } - const Akonadi::Collection collection = dlg->selectedCollection(); - delete dlg; + if ( !mImportProgressDialog ) { + mImportProgressDialog = new KProgressDialog( mParentWidget, i18n( "Import Contacts" ) ); + mImportProgressDialog->setLabelText( + i18np( "Importing one contact to %2", "Importing %1 contacts to %2", + contacts.count(), collection.name() ) ); + mImportProgressDialog->setAllowCancel( false ); + mImportProgressDialog->setAutoClose( true ); + mImportProgressDialog->progressBar()->setRange( 1, contacts.count() ); + } + + mImportProgressDialog->show(); - if ( !mImportProgressDialog ) { - mImportProgressDialog = new KProgressDialog( mParentWidget, i18n( "Import Contacts" ) ); - mImportProgressDialog->setLabelText( - i18np( "Importing one contact to %2", "Importing %1 contacts to %2", - contacts.count(), collection.name() ) ); - mImportProgressDialog->setAllowCancel( false ); - mImportProgressDialog->setAutoClose( true ); - mImportProgressDialog->progressBar()->setRange( 1, contacts.count() ); - } - - mImportProgressDialog->show(); - - for ( int i = 0; i < contacts.count(); ++i ) { - Akonadi::Item item; - item.setPayload( contacts.at( i ) ); - item.setMimeType( KABC::Addressee::mimeType() ); - - Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob( item, collection ); - connect( job, SIGNAL(result(KJob*)), SLOT(slotImportJobDone(KJob*)) ); - } + for ( int i = 0; i < contacts.count(); ++i ) { + Akonadi::Item item; + item.setPayload( contacts.at( i ) ); + item.setMimeType( KABC::Addressee::mimeType() ); + + Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob( item, collection ); + connect( job, SIGNAL(result(KJob*)), SLOT(slotImportJobDone(KJob*)) ); + } } void XXPortManager::slotImportJobDone( KJob * ) { - if ( !mImportProgressDialog ) { - return; - } - - QProgressBar *progressBar = mImportProgressDialog->progressBar(); - - progressBar->setValue( progressBar->value() + 1 ); - - // cleanup on last step - if ( progressBar->value() == progressBar->maximum() ) { - mImportProgressDialog->deleteLater(); - mImportProgressDialog = 0; - } + if ( !mImportProgressDialog ) { + return; + } + + QProgressBar *progressBar = mImportProgressDialog->progressBar(); + + progressBar->setValue( progressBar->value() + 1 ); + + // cleanup on last step + if ( progressBar->value() == progressBar->maximum() ) { + mImportProgressDialog->deleteLater(); + mImportProgressDialog = 0; + } } void XXPortManager::slotExport( const QString &identifier ) { - if ( !mSelectionModel ) { - return; - } - - QPointer dlg = - new ContactSelectionDialog( mSelectionModel, mParentWidget ); - dlg->setMessageText( i18n( "Which contact do you want to export?" ) ); - dlg->setDefaultAddressBook( mDefaultAddressBook ); - if ( !dlg->exec() || !dlg ) { - delete dlg; - return; - } + if ( !mSelectionModel ) { + return; + } - const KABC::AddresseeList contacts = dlg->selectedContacts(); - delete dlg; + QPointer dlg = + new ContactSelectionDialog( mSelectionModel, mParentWidget ); + dlg->setMessageText( i18n( "Which contact do you want to export?" ) ); + dlg->setDefaultAddressBook( mDefaultAddressBook ); + if ( !dlg->exec() || !dlg ) { + delete dlg; + return; + } - if ( contacts.isEmpty() ) { - KMessageBox::sorry( 0, i18n( "You have not selected any contacts to export." ) ); - return; - } + const KABC::AddresseeList contacts = dlg->selectedContacts(); + delete dlg; - const XXPort *xxport = mFactory.createXXPort( identifier, mParentWidget ); - if ( !xxport ) { - return; - } + if ( contacts.isEmpty() ) { + KMessageBox::sorry( 0, i18n( "You have not selected any contacts to export." ) ); + return; + } - xxport->exportContacts( contacts ); + const XXPort *xxport = mFactory.createXXPort( identifier, mParentWidget ); + if ( !xxport ) { + return; + } - delete xxport; + xxport->exportContacts( contacts ); + + delete xxport; } diff -Nru kdepim-4.13.0/kaddressbook/xxportmanager.h kdepim-4.13.3/kaddressbook/xxportmanager.h --- kdepim-4.13.0/kaddressbook/xxportmanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbook/xxportmanager.h 2014-07-09 12:18:50.000000000 +0000 @@ -39,9 +39,9 @@ */ class KADDRESSBOOK_EXPORT XXPortManager : public QObject { - Q_OBJECT + Q_OBJECT - public: +public: /** * Creates a new xxport manager. * @@ -80,20 +80,20 @@ void importFile( const KUrl &url); - public Q_SLOTS: +public Q_SLOTS: /** * Sets the @p addressBook that shall be preselected in the * ContactSelectionDialog. */ void setDefaultAddressBook( const Akonadi::Collection &addressBook ); - private Q_SLOTS: +private Q_SLOTS: void slotImport( const QString & ); void slotExport( const QString & ); void slotImportJobDone( KJob * ); - private: +private: void import(const KABC::Addressee::List &contacts); QItemSelectionModel *mSelectionModel; QWidget *mParentWidget; diff -Nru kdepim-4.13.0/kaddressbookgrantlee/grantleeutil.cpp kdepim-4.13.3/kaddressbookgrantlee/grantleeutil.cpp --- kdepim-4.13.0/kaddressbookgrantlee/grantleeutil.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kaddressbookgrantlee/grantleeutil.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -24,10 +24,7 @@ QString KAddressBookGrantlee::GrantleeUtil::kaddressBookAbsoluteThemePath() { - KSharedConfig::Ptr config = KSharedConfig::openConfig( QLatin1String("kaddressbookrc") ); - GrantleeTheme::GrantleeSettings::self()->setSharedConfig(config); - GrantleeTheme::GrantleeSettings::self()->readConfig(); - QString themeName = GrantleeTheme::GrantleeSettings::self()->grantleeThemeName(); + QString themeName = GrantleeTheme::GrantleeSettings::self()->grantleeAddressBookThemeName(); if (themeName.isEmpty()) { themeName = QLatin1String("default"); } diff -Nru kdepim-4.13.0/kalarm/akonadimodel.cpp kdepim-4.13.3/kalarm/akonadimodel.cpp --- kdepim-4.13.0/kalarm/akonadimodel.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/akonadimodel.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -93,7 +93,8 @@ AkonadiModel::AkonadiModel(ChangeRecorder* monitor, QObject* parent) : EntityTreeModel(monitor, parent), mMonitor(monitor), - mResourcesChecked(false) + mResourcesChecked(false), + mMigrating(false) { // Set lazy population to enable the contents of unselected collections to be ignored setItemPopulationStrategy(LazyPopulation); @@ -127,7 +128,9 @@ #endif connect(monitor, SIGNAL(collectionChanged(Akonadi::Collection,QSet)), SLOT(slotCollectionChanged(Akonadi::Collection,QSet))); connect(monitor, SIGNAL(collectionRemoved(Akonadi::Collection)), SLOT(slotCollectionRemoved(Akonadi::Collection))); - connect(CalendarMigrator::instance(), SIGNAL(creating(QString,bool)), SLOT(slotCollectionBeingCreated(QString,bool))); + connect(CalendarMigrator::instance(), SIGNAL(creating(QString,Akonadi::Collection::Id,bool)), + SLOT(slotCollectionBeingCreated(QString,Akonadi::Collection::Id,bool))); + connect(CalendarMigrator::instance(), SIGNAL(destroyed(QObject*)), SLOT(slotMigrationCompleted())); MinuteTimer::connect(this, SLOT(slotUpdateTimeTo())); Preferences::connect(SIGNAL(archivedColourChanged(QColor)), this, SLOT(slotUpdateArchivedColour(QColor))); Preferences::connect(SIGNAL(disabledColourChanged(QColor)), this, SLOT(slotUpdateDisabledColour(QColor))); @@ -143,6 +146,12 @@ checkResources(ServerManager::state()); } +AkonadiModel::~AkonadiModel() +{ + if (mInstance == this) + mInstance = 0; +} + /****************************************************************************** * Called when the server manager is running, i.e. the agent manager knows about * all existing resources. @@ -155,11 +164,20 @@ if (!mResourcesChecked && state == ServerManager::Running) { mResourcesChecked = true; + mMigrating = true; CalendarMigrator::execute(); } } /****************************************************************************** +* Return whether calendar migration has completed. +*/ +bool AkonadiModel::isMigrationCompleted() const +{ + return mResourcesChecked && !mMigrating; +} + +/****************************************************************************** * Return the data for a given role, for a specified item. */ QVariant AkonadiModel::data(const QModelIndex& index, int role) const @@ -394,7 +412,7 @@ return mIconSize; case Qt::AccessibleTextRole: #ifdef __GNUC__ -#warning Implement this +#warning Implement accessibility #endif return QString(); case ValueRole: @@ -1144,6 +1162,33 @@ return itemIndex(event.itemId()); } +/****************************************************************************** +* Search for an event's item ID. This method ignores any itemId() value +* contained in the KAEvent. The collectionId() is used if available. +*/ +Item::Id AkonadiModel::findItemId(const KAEvent& event) +{ + Collection::Id colId = event.collectionId(); + QModelIndex start = (colId < 0) ? index(0, 0) : collectionIndex(Collection(colId)); + Qt::MatchFlags flags = (colId < 0) ? Qt::MatchExactly | Qt::MatchRecursive | Qt::MatchCaseSensitive | Qt::MatchWrap + : Qt::MatchExactly | Qt::MatchRecursive | Qt::MatchCaseSensitive; + const QModelIndexList indexes = match(start, RemoteIdRole, event.id(), -1, flags); + foreach (const QModelIndex& ix, indexes) + { + if (ix.isValid()) + { + Item::Id id = ix.data(ItemIdRole).toLongLong(); + if (id >= 0) + { + if (colId < 0 + || ix.data(ParentCollectionRole).value().id() == colId) + return id; + } + } + } + return -1; +} + #if 0 /****************************************************************************** * Return all events of a given type belonging to a collection. @@ -1630,6 +1675,18 @@ refresh(col); CalendarMigrator::updateToCurrentFormat(col, false, MainWindow::mainMainWindow()); } + + if (mMigrating) + { + mCollectionIdsBeingCreated.removeAll(collection.id()); + if (mCollectionsBeingCreated.isEmpty() && mCollectionIdsBeingCreated.isEmpty() + && CalendarMigrator::completed()) + { + kDebug() << "Migration completed"; + mMigrating = false; + emit migrationCompleted(); + } + } } /****************************************************************************** @@ -1649,15 +1706,31 @@ /****************************************************************************** * Called when a collection creation is about to start, or has completed. */ -void AkonadiModel::slotCollectionBeingCreated(const QString& path, bool finished) +void AkonadiModel::slotCollectionBeingCreated(const QString& path, Akonadi::Collection::Id id, bool finished) { if (finished) + { mCollectionsBeingCreated.removeAll(path); + mCollectionIdsBeingCreated << id; + } else mCollectionsBeingCreated << path; } /****************************************************************************** +* Called when calendar migration has completed. +*/ +void AkonadiModel::slotMigrationCompleted() +{ + if (mCollectionsBeingCreated.isEmpty() && mCollectionIdsBeingCreated.isEmpty()) + { + kDebug() << "Migration completed"; + mMigrating = false; + emit migrationCompleted(); + } +} + +/****************************************************************************** * Called when an item in the monitored collections has changed. */ void AkonadiModel::slotMonitoredItemChanged(const Akonadi::Item& item, const QSet&) diff -Nru kdepim-4.13.0/kalarm/akonadimodel.h kdepim-4.13.3/kalarm/akonadimodel.h --- kdepim-4.13.0/kalarm/akonadimodel.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/akonadimodel.h 2014-07-09 12:18:50.000000000 +0000 @@ -1,7 +1,7 @@ /* * akonadimodel.h - KAlarm calendar file access using Akonadi * Program: kalarm - * Copyright © 2010-2012 by David Jarvie + * Copyright © 2010-2014 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 @@ -84,6 +84,8 @@ static AkonadiModel* instance(); + ~AkonadiModel(); + /** Return the display name for a collection. */ QString displayName(Akonadi::Collection&) const; /** Return the storage type (file/directory/URL etc.) for a collection. */ @@ -132,6 +134,9 @@ /** Reload all collections' data from Akonadi storage (not from the backend). */ void reload(); + /** Return whether calendar migration/creation at initialisation has completed. */ + bool isMigrationCompleted() const; + bool isCollectionBeingDeleted(Akonadi::Collection::Id) const; QModelIndex itemIndex(Akonadi::Item::Id id) const @@ -147,7 +152,12 @@ KAEvent event(const QModelIndex&) const; using QObject::event; // prevent warning about hidden virtual method + /** Return an event's model index, based on its itemId() value. */ QModelIndex eventIndex(const KAEvent&); + /** Search for an event's item ID. This method ignores any itemId() value + * contained in the KAEvent. The collectionId() is used if available. + */ + Akonadi::Item::Id findItemId(const KAEvent&); #if 0 /** Return all events in a collection, optionally of a specified type. */ @@ -231,16 +241,20 @@ */ void itemDone(Akonadi::Item::Id, bool status = true); + /** Signal emitted when calendar migration/creation has completed. */ + void migrationCompleted(); + protected: virtual QVariant entityHeaderData(int section, Qt::Orientation, int role, HeaderGroup) const; virtual int entityColumnCount(HeaderGroup) const; private slots: void checkResources(Akonadi::ServerManager::State); + void slotMigrationCompleted(); void slotCollectionChanged(const Akonadi::Collection& c, const QSet& attrNames) { setCollectionChanged(c, attrNames, false); } void slotCollectionRemoved(const Akonadi::Collection&); - void slotCollectionBeingCreated(const QString& path, bool finished); + void slotCollectionBeingCreated(const QString& path, Akonadi::Collection::Id, bool finished); void slotUpdateTimeTo(); void slotUpdateArchivedColour(const QColor&); void slotUpdateDisabledColour(const QColor&); @@ -309,12 +323,14 @@ QMap mPendingColCreateJobs; // default alarm type for pending collection creation jobs QMap mPendingItemJobs; // pending item creation/deletion jobs, with event ID QMap mItemModifyJobQueue; // pending item modification jobs, invalid item = queue empty but job active - QList mCollectionsBeingCreated; // path names of new collections being created + QList mCollectionsBeingCreated; // path names of new collections being created by migrator + QList mCollectionIdsBeingCreated; // ids of new collections being created by migrator QList mItemsBeingCreated; // new items not fully initialised yet QList mCollectionsDeleting; // collections currently being removed QList mCollectionsDeleted; // collections recently removed QQueue mPendingEventChanges; // changed events with changedEvent() signal pending bool mResourcesChecked; // whether resource existence has been checked yet + bool mMigrating; // currently migrating calendars }; #endif // AKONADIMODEL_H diff -Nru kdepim-4.13.0/kalarm/calendarmigrator.cpp kdepim-4.13.3/kalarm/calendarmigrator.cpp --- kdepim-4.13.0/kalarm/calendarmigrator.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/calendarmigrator.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -1,7 +1,7 @@ /* * calendarmigrator.cpp - migrates or creates KAlarm Akonadi resources * Program: kalarm - * Copyright © 2011-2012 by David Jarvie + * Copyright © 2011-2014 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 @@ -62,6 +62,7 @@ CalEvent::Type alarmType() const { return mAlarmType; } bool newCalendar() const { return mNew; } QString resourceName() const { return mName; } + Collection::Id collectionId() const { return mCollectionId; } QString path() const { return mPath; } QString errorMessage() const { return mErrorMessage; } void createAgent(const QString& agentType, QObject* parent); @@ -81,26 +82,27 @@ private: void finish(bool cleanup); - bool migrateLocalFile(); - bool migrateLocalDirectory(); - bool migrateRemoteFile(); - template Interface* migrateBasic(); + bool writeLocalFileConfig(); + bool writeLocalDirectoryConfig(); + bool writeRemoteFileConfig(); + template Interface* writeBasicConfig(); enum ResourceType { LocalFile, LocalDir, RemoteFile }; - Akonadi::AgentInstance mAgent; - CalEvent::Type mAlarmType; - ResourceType mResourceType; - QString mPath; - QString mName; - QColor mColour; - QString mErrorMessage; - int mCollectionFetchRetryCount; - bool mReadOnly; - bool mEnabled; - bool mStandard; - const bool mNew; - bool mFinished; + AgentInstance mAgent; + CalEvent::Type mAlarmType; + ResourceType mResourceType; + QString mPath; + QString mName; + QColor mColour; + QString mErrorMessage; + Collection::Id mCollectionId; + int mCollectionFetchRetryCount; + bool mReadOnly; + bool mEnabled; + bool mStandard; + const bool mNew; // true if creating default, false if converting + bool mFinished; }; // Updates the backend calendar format of a single alarm calendar @@ -131,6 +133,7 @@ CalendarMigrator* CalendarMigrator::mInstance = 0; +bool CalendarMigrator::mCompleted = false; CalendarMigrator::CalendarMigrator(QObject* parent) : QObject(parent), @@ -141,6 +144,7 @@ CalendarMigrator::~CalendarMigrator() { kDebug(); + mInstance = 0; } /****************************************************************************** @@ -148,7 +152,7 @@ */ CalendarMigrator* CalendarMigrator::instance() { - if (!mInstance) + if (!mInstance && !mCompleted) mInstance = new CalendarMigrator; return mInstance; } @@ -299,7 +303,10 @@ } if (mCalendarsPending.isEmpty()) + { + mCompleted = true; deleteLater(); + } } /****************************************************************************** @@ -308,7 +315,7 @@ */ void CalendarMigrator::creatingCalendar(const QString& path) { - emit creating(path, false); + emit creating(path, -1, false); } /****************************************************************************** @@ -321,7 +328,7 @@ if (i < 0) return; // calendar already finished - emit creating(creator->path(), true); + emit creating(creator->path(), creator->collectionId(), true); if (!creator->errorMessage().isEmpty()) { @@ -341,7 +348,10 @@ mCalendarsPending.removeAt(i); // remove it from the pending list if (mCalendarsPending.isEmpty()) + { + mCompleted = true; deleteLater(); + } } /****************************************************************************** @@ -613,13 +623,13 @@ switch (mResourceType) { case LocalFile: - ok = migrateLocalFile(); + ok = writeLocalFileConfig(); break; case LocalDir: - ok = migrateLocalDirectory(); + ok = writeLocalDirectoryConfig(); break; case RemoteFile: - ok = migrateRemoteFile(); + ok = writeRemoteFileConfig(); break; default: kError() << "Invalid resource type"; @@ -665,9 +675,9 @@ job->start(); } -bool CalendarCreator::migrateLocalFile() +bool CalendarCreator::writeLocalFileConfig() { - OrgKdeAkonadiKAlarmSettingsInterface* iface = migrateBasic(); + OrgKdeAkonadiKAlarmSettingsInterface* iface = writeBasicConfig(); if (!iface) return false; iface->setMonitorFile(true); @@ -676,9 +686,9 @@ return true; } -bool CalendarCreator::migrateLocalDirectory() +bool CalendarCreator::writeLocalDirectoryConfig() { - OrgKdeAkonadiKAlarmDirSettingsInterface* iface = migrateBasic(); + OrgKdeAkonadiKAlarmDirSettingsInterface* iface = writeBasicConfig(); if (!iface) return false; iface->setMonitorFiles(true); @@ -687,9 +697,9 @@ return true; } -bool CalendarCreator::migrateRemoteFile() +bool CalendarCreator::writeRemoteFileConfig() { - OrgKdeAkonadiKAlarmSettingsInterface* iface = migrateBasic(); + OrgKdeAkonadiKAlarmSettingsInterface* iface = writeBasicConfig(); if (!iface) return false; iface->setMonitorFile(true); @@ -698,7 +708,7 @@ return true; } -template Interface* CalendarCreator::migrateBasic() +template Interface* CalendarCreator::writeBasicConfig() { Interface* iface = CalendarMigrator::getAgentInterface(mAgent, mErrorMessage, this); if (iface) @@ -753,6 +763,7 @@ // Set Akonadi Collection attributes Collection collection = collections[0]; + mCollectionId = collection.id(); collection.setContentMimeTypes(CalEvent::mimeTypes(mAlarmType)); EntityDisplayAttribute* dattr = collection.attribute(Collection::AddIfMissing); dattr->setIconName(QLatin1String("kalarm")); diff -Nru kdepim-4.13.0/kalarm/calendarmigrator.h kdepim-4.13.3/kalarm/calendarmigrator.h --- kdepim-4.13.0/kalarm/calendarmigrator.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/calendarmigrator.h 2014-07-09 12:18:50.000000000 +0000 @@ -1,7 +1,7 @@ /* * calendarmigrator.h - migrates or creates KAlarm Akonadi resources * Program: kalarm - * Copyright © 2011-2012 by David Jarvie + * Copyright © 2011-2014 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 @@ -48,13 +48,15 @@ static CalendarMigrator* instance(); static void execute(); static void updateToCurrentFormat(const Akonadi::Collection&, bool ignoreKeepFormat, QWidget* parent); + static bool completed() { return mCompleted; } template static Interface* getAgentInterface(const Akonadi::AgentInstance&, QString& errorMessage, QObject* parent); signals: /** Signal emitted when a resource is about to be created, and when creation has * completed (successfully or not). + * @param id collection ID if @p finished is true, else invalid */ - void creating(const QString& path, bool finished); + void creating(const QString& path, Akonadi::Collection::Id id, bool finished); private slots: void collectionFetchResult(KJob*); @@ -71,6 +73,7 @@ QList mCalendarsPending; // pending calendar migration or creation jobs QList mFetchesPending; // pending collection fetch jobs for existing resources CalEvent::Types mExistingAlarmTypes; // alarm types provided by existing Akonadi resources + static bool mCompleted; // execute() has completed friend class CalendarUpdater; }; diff -Nru kdepim-4.13.0/kalarm/Changelog kdepim-4.13.3/kalarm/Changelog --- kdepim-4.13.0/kalarm/Changelog 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/Changelog 2014-07-09 12:18:50.000000000 +0000 @@ -1,6 +1,17 @@ KAlarm Change Log -=== Version 2.10.7 --- 21 March 2014 === +=== Version 2.10.10 --- 10 May 2014 === +- [Akonadi] Fix no Defer button in alarm windows restored after login [KDE Bug 334334] +- Fix display of duplicate alarm windows after login. + +=== Version 2.10.9 (KDE 4.13.1) --- 4 May 2014 === +- [Akonadi] Fix no Defer button in alarm windows restored after crash [KDE Bug 334334] + +=== Version 2.10.8 (KDE 4.12.5) --- 18 April 2014 === +- [Akonadi] Fix wrong startup message about no writable active alarm calendar. +- [Akonadi] Fix setting Akonadi resource read-only making it unusable (requires kdepim-runtime 4.12.5) [KDE Bug 332889] + +=== Version 2.10.7 (KDE 4.12.4, 4.13.0) --- 21 March 2014 === - [Akonadi] Fix deletion of alarm copies from KOrganiser not working. - Fix crash after session restoration has nothing to restore [KDE Bug 331719] - Prevent data in birthday import dialogue being editable. diff -Nru kdepim-4.13.0/kalarm/eventid.h kdepim-4.13.3/kalarm/eventid.h --- kdepim-4.13.0/kalarm/eventid.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/eventid.h 2014-07-09 12:18:50.000000000 +0000 @@ -1,7 +1,7 @@ /* * eventid.h - KAlarm unique event identifier for Akonadi * Program: kalarm - * Copyright © 2012 by David Jarvie + * Copyright © 2012,2014 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 @@ -50,6 +50,7 @@ Akonadi::Collection::Id collectionId() const { return first; } QString eventId() const { return second; } + void setCollectionId(Akonadi::Collection::Id id) { first = id; } }; // Declare as a movable type (note that QString is movable). diff -Nru kdepim-4.13.0/kalarm/kalarmapp.cpp kdepim-4.13.3/kalarm/kalarmapp.cpp --- kdepim-4.13.0/kalarm/kalarmapp.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/kalarmapp.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -112,6 +112,7 @@ KAlarmApp::KAlarmApp() : KUniqueApplication(), mInitialised(false), + mRedisplayAlarms(false), mQuitting(false), mReadOnly(false), mLoginAlarmsDone(false), @@ -164,6 +165,8 @@ SLOT(purgeNewArchivedDefault(Akonadi::Collection))); connect(AkonadiModel::instance(), SIGNAL(collectionTreeFetched(Akonadi::Collection::List)), SLOT(checkWritableCalendar())); + connect(AkonadiModel::instance(), SIGNAL(migrationCompleted()), + SLOT(checkWritableCalendar())); #endif KConfigGroup config(KGlobal::config(), "General"); @@ -295,7 +298,12 @@ MessageWin* win = new MessageWin; win->restore(i, false); if (win->isValid()) - win->show(); + { +#ifdef USE_AKONADI + if (AkonadiModel::instance()->isCollectionTreeFetched()) +#endif + win->show(); + } else delete win; } @@ -572,7 +580,19 @@ * to happen under the Xfce desktop.) */ if (AlarmCalendar::resources()) + { +#ifdef USE_AKONADI + if (AkonadiModel::instance()->isCollectionTreeFetched()) + { + mRedisplayAlarms = false; + MessageWin::redisplayAlarms(); + } + else + mRedisplayAlarms = true; +#else MessageWin::redisplayAlarms(); +#endif + } } --mActiveCount; @@ -1145,18 +1165,24 @@ */ void KAlarmApp::checkWritableCalendar() { -kDebug(); if (mReadOnly) return; // don't need write access to calendars #ifdef USE_AKONADI - if (!AkonadiModel::instance()->isCollectionTreeFetched()) + bool treeFetched = AkonadiModel::instance()->isCollectionTreeFetched(); + if (treeFetched && mRedisplayAlarms) + { + mRedisplayAlarms = false; + MessageWin::redisplayAlarms(); + } + if (!treeFetched + || !AkonadiModel::instance()->isMigrationCompleted()) return; #endif static bool done = false; if (done) return; done = true; -kDebug()<<"checking"; + kDebug(); // Find whether there are any writable active alarm calendars #ifdef USE_AKONADI bool active = !CollectionControlModel::enabledCollections(CalEvent::ACTIVE, true).isEmpty(); diff -Nru kdepim-4.13.0/kalarm/kalarmapp.h kdepim-4.13.3/kalarm/kalarmapp.h --- kdepim-4.13.0/kalarm/kalarmapp.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/kalarmapp.h 2014-07-09 12:18:50.000000000 +0000 @@ -232,6 +232,7 @@ static int mFatalError; // a fatal error has occurred - just wait to exit static QString mFatalMessage; // fatal error message to output bool mInitialised; // initialisation complete: ready to process execution queue + bool mRedisplayAlarms; // need to redisplay alarms when collection tree fetched bool mQuitting; // a forced quit is in progress bool mReadOnly; // only read-only access to calendars is needed bool mLoginAlarmsDone; // alarms repeated at login have been processed diff -Nru kdepim-4.13.0/kalarm/kalarm.h kdepim-4.13.3/kalarm/kalarm.h --- kdepim-4.13.0/kalarm/kalarm.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/kalarm.h 2014-07-09 12:18:50.000000000 +0000 @@ -28,7 +28,7 @@ #else #define VERSION_SUFFIX "-res" #endif -#define KALARM_VERSION "2.10.7" VERSION_SUFFIX +#define KALARM_VERSION "2.10.10" VERSION_SUFFIX #define KALARM_NAME "KAlarm" #define KALARM_DBUS_SERVICE "org.kde.kalarm" // D-Bus service name of KAlarm application diff -Nru kdepim-4.13.0/kalarm/messagewin.cpp kdepim-4.13.3/kalarm/messagewin.cpp --- kdepim-4.13.0/kalarm/messagewin.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/messagewin.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -166,6 +166,7 @@ #else QMap MessageWin::mErrorMessages; #endif +bool MessageWin::mRedisplayed = false; // There can only be one audio thread at a time: trying to play multiple // sound files simultaneously would result in a cacophony, and besides // that, Phonon currently crashes... @@ -238,7 +239,7 @@ mNoCloseConfirm(false), mDisableDeferral(false) { - kDebug() << "event"; + kDebug() << (void*)this << "event" << mEventId; setAttribute(static_cast(WidgetFlags)); setWindowModality(Qt::WindowModal); setObjectName(QLatin1String("MessageWin")); // used by LikeBack @@ -401,7 +402,7 @@ mNoCloseConfirm(false), mDisableDeferral(false) { - kDebug() << "restore"; + kDebug() << (void*)this << "restore"; setAttribute(WidgetFlags); setWindowModality(Qt::WindowModal); setObjectName(QLatin1String("RestoredMsgWin")); // used by LikeBack @@ -414,7 +415,7 @@ */ MessageWin::~MessageWin() { - kDebug() << mEventId; + kDebug() << (void*)this << mEventId; if (AudioThread::mAudioOwner == this && !mAudioThread.isNull()) mAudioThread->quit(); mErrorMessages.remove(mEventId); @@ -1053,18 +1054,17 @@ void MessageWin::readProperties(const KConfigGroup& config) { mInvalid = config.readEntry("Invalid", false); + QString eventId = config.readEntry("EventID"); #ifdef USE_AKONADI mEventItemId = config.readEntry("EventItemID", Akonadi::Item::Id(-1)); - mCollection = AkonadiModel::instance()->collectionForItem(mEventItemId); - mEventId = EventId(mCollection.id(), config.readEntry("EventID")); #else - mEventId = config.readEntry("EventID"); + mEventId = eventId; #endif mAlarmType = static_cast(config.readEntry("AlarmType", 0)); if (mAlarmType == KAAlarm::INVALID_ALARM) { mInvalid = true; - kError() << "Invalid alarm: id=" << mEventId; + kError() << "Invalid alarm: id=" << eventId; } mMessage = config.readEntry("Message"); mAction = static_cast(config.readEntry("Type", 0)); @@ -1110,37 +1110,80 @@ mShowEdit = false; #ifdef USE_AKONADI mCollection = Akonadi::Collection(); + mEventId = EventId(mCollection.id(), eventId); #else mResource = 0; #endif - kDebug() << mEventId; + kDebug() << eventId; if (mAlarmType != KAAlarm::INVALID_ALARM) { // Recreate the event from the calendar file (if possible) - if (!mEventId.isEmpty()) + if (eventId.isEmpty()) + initView(); + else { - KAEvent* event = AlarmCalendar::resources()->event(mEventId); - if (event) + // Close any other window for this alarm which has already been restored by redisplayAlarms() +#ifdef USE_AKONADI + if (!AkonadiModel::instance()->isCollectionTreeFetched()) { - mEvent = *event; + connect(AkonadiModel::instance(), SIGNAL(collectionTreeFetched(Akonadi::Collection::List)), + SLOT(showRestoredAlarm())); + return; + } +#endif + redisplayAlarm(); + } + } +} + +#ifdef USE_AKONADI +/****************************************************************************** +* Fetch the restored alarm from the calendar and redisplay it in this window. +*/ +void MessageWin::showRestoredAlarm() +{ + kDebug() << mEventId; + redisplayAlarm(); + show(); +} +#endif + +/****************************************************************************** +* Fetch the restored alarm from the calendar and redisplay it in this window. +*/ +void MessageWin::redisplayAlarm() +{ +#ifdef USE_AKONADI + mCollection = AkonadiModel::instance()->collectionForItem(mEventItemId); + mEventId.setCollectionId(mCollection.id()); +#endif + kDebug() << mEventId; + // Delete any already existing window for the same event + MessageWin* duplicate = findEvent(mEventId, this); + if (duplicate) + kDebug() << "Deleting duplicate window:" << mEventId; + delete duplicate; + + KAEvent* event = AlarmCalendar::resources()->event(mEventId); + if (event) + { + mEvent = *event; #ifndef USE_AKONADI - mResource = AlarmCalendar::resources()->resourceForEvent(mEventId); + mResource = AlarmCalendar::resources()->resourceForEvent(mEventId); #endif - mShowEdit = true; - } - else - { - // It's not in the active calendar, so try the displaying or archive calendars + mShowEdit = true; + } + else + { + // It's not in the active calendar, so try the displaying or archive calendars #ifdef USE_AKONADI - retrieveEvent(mEvent, mCollection, mShowEdit, mNoDefer); + retrieveEvent(mEvent, mCollection, mShowEdit, mNoDefer); #else - retrieveEvent(mEvent, mResource, mShowEdit, mNoDefer); + retrieveEvent(mEvent, mResource, mShowEdit, mNoDefer); #endif - mNoDefer = !mNoDefer; - } - } - initView(); + mNoDefer = !mNoDefer; } + initView(); } /****************************************************************************** @@ -1151,6 +1194,10 @@ */ void MessageWin::redisplayAlarms() { + if (mRedisplayed) + return; + kDebug(); + mRedisplayed = true; AlarmCalendar* cal = AlarmCalendar::displayCalendar(); if (cal->isOpen()) { @@ -1166,20 +1213,26 @@ bool showDefer, showEdit; #ifdef USE_AKONADI reinstateFromDisplaying(events[i], event, collection, showEdit, showDefer); - if (!findEvent(EventId(event))) + Akonadi::Item::Id id = AkonadiModel::instance()->findItemId(event); + if (id >= 0) + event.setItemId(id); + const EventId eventId(event); #else reinstateFromDisplaying(events[i], event, resource, showEdit, showDefer); - if (!findEvent(event.id())) + const QString eventId = event.id(); #endif + if (findEvent(eventId)) + kDebug() << "Message window already exists:" << eventId; + else { // This event should be displayed, but currently isn't being KAAlarm alarm = event.convertDisplayingAlarm(); if (alarm.type() == KAAlarm::INVALID_ALARM) { - kError() << "Invalid alarm: id=" << event.id(); + kError() << "Invalid alarm: id=" << eventId; continue; } - kDebug() << event.id(); + kDebug() << eventId; bool login = alarm.repeatAtLogin(); int flags = NO_RESCHEDULE | (login ? NO_DEFER : 0) | NO_INIT_VIEW; MessageWin* win = new MessageWin(&event, alarm, flags); @@ -1264,15 +1317,17 @@ #ifdef USE_AKONADI Akonadi::Collection::Id collectionId; event.reinstateFromDisplaying(kcalEvent, collectionId, showEdit, showDefer); + event.setCollectionId(collectionId); collection = AkonadiModel::instance()->collectionById(collectionId); + kDebug() << EventId(event) << ": success"; #else QString resourceID; event.reinstateFromDisplaying(kcalEvent, resourceID, showEdit, showDefer); resource = AlarmResources::instance()->resourceWithId(resourceID); if (resource && !resource->isOpen()) resource = 0; -#endif kDebug() << event.id() << ": success"; +#endif return true; } @@ -1412,9 +1467,9 @@ * with the specified ID. */ #ifdef USE_AKONADI -MessageWin* MessageWin::findEvent(const EventId& eventId) +MessageWin* MessageWin::findEvent(const EventId& eventId, MessageWin* exclude) #else -MessageWin* MessageWin::findEvent(const QString& eventId) +MessageWin* MessageWin::findEvent(const QString& eventId, MessageWin* exclude) #endif { if (!eventId.isEmpty()) @@ -1422,7 +1477,7 @@ for (int i = 0, end = mWindowList.count(); i < end; ++i) { MessageWin* w = mWindowList[i]; - if (w->mEventId == eventId && !w->mErrorWindow) + if (w != exclude && w->mEventId == eventId && !w->mErrorWindow) return w; } } @@ -1873,7 +1928,7 @@ void MessageWin::showEvent(QShowEvent* se) { MainWindowBase::showEvent(se); - if (mShown) + if (mShown || !mInitialised) return; if (mErrorWindow || mAlarmType == KAAlarm::INVALID_ALARM) { diff -Nru kdepim-4.13.0/kalarm/messagewin.h kdepim-4.13.3/kalarm/messagewin.h --- kdepim-4.13.0/kalarm/messagewin.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/messagewin.h 2014-07-09 12:18:50.000000000 +0000 @@ -86,9 +86,9 @@ virtual QSize sizeHint() const; static int instanceCount(bool excludeAlwaysHidden = false); #ifdef USE_AKONADI - static MessageWin* findEvent(const EventId& eventId); + static MessageWin* findEvent(const EventId& eventId, MessageWin* exclude = 0); #else - static MessageWin* findEvent(const QString& eventId); + static MessageWin* findEvent(const QString& eventId, MessageWin* exclude = 0); #endif static void redisplayAlarms(); static void stopAudio(bool wait = false); @@ -114,6 +114,9 @@ void activeWindowChanged(WId); void checkDeferralLimit(); void displayMainWindow(); +#ifdef USE_AKONADI + void showRestoredAlarm(); +#endif #ifdef KMAIL_SUPPORTED void slotShowKMailMessage(); #endif @@ -146,6 +149,7 @@ #endif bool haveErrorMessage(unsigned msg) const; void clearErrorMessage(unsigned msg) const; + void redisplayAlarm(); #ifdef USE_AKONADI static bool reinstateFromDisplaying(const KCalCore::Event::Ptr&, KAEvent&, Akonadi::Collection&, bool& showEdit, bool& showDefer); #else @@ -159,6 +163,7 @@ #else static QMap mErrorMessages; // error messages currently displayed, by event ID #endif + static bool mRedisplayed; // redisplayAlarms() was called // Sound file playing static QPointer mAudioThread; // thread to play audio file // Properties needed by readProperties() diff -Nru kdepim-4.13.0/kalarm/resources/local.desktop kdepim-4.13.3/kalarm/resources/local.desktop --- kdepim-4.13.0/kalarm/resources/local.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/resources/local.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -54,7 +54,7 @@ Comment=Provides access to an alarm calendar stored in a single local file Comment[ar]=يوفر الوصول لمنبه التقويم المحفوظ في ملف محلي مفرد Comment[bs]=Obezbjeđuje prostup alarm kalendaru sačuvanom u jednoj lokalnoj datoteci -Comment[ca]=Proporciona l'accés a un calendari d'alarmes emmagatzemat en un fitxer local individual +Comment[ca]=Proporciona accés a un calendari d'alarmes emmagatzemat en un fitxer local individual Comment[ca@valencia]=Proporciona l'accés a un calendari d'alarmes emmagatzemat en un fitxer local individual Comment[cs]=Poskytuje přístup ke kalendáři alarmu uloženém v jednom lokálním souboru Comment[da]=Giver adgang til en alarmkalender lagret i en enkelt lokal fil diff -Nru kdepim-4.13.0/kalarm/resources/localdir.desktop kdepim-4.13.3/kalarm/resources/localdir.desktop --- kdepim-4.13.0/kalarm/resources/localdir.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/resources/localdir.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -55,7 +55,7 @@ Comment=Provides access to an alarm calendar stored in a local directory, in which each calendar item is stored in a separate file Comment[ar]=يوفر وصول لمنبه التقويم المحفوظ في الدليل المحلي ، بحيث كل عنصر تقويم محفوظ في ملف منفرد Comment[bs]=Obezbjeđuje prostup alarm kalendaru sačuvanom u lokalnom direktoriju, u kojem svaki od kalendarskih primjeraka je sačuvan u odvojenoj datoteci -Comment[ca]=Proporciona l'accés a un calendari d'alarmes emmagatzemat en un directori local, en el que cada element del calendari està emmagatzemat en un fitxer separat +Comment[ca]=Proporciona accés a un calendari d'alarmes emmagatzemat en un directori local, en el que cada element del calendari està emmagatzemat en un fitxer separat Comment[ca@valencia]=Proporciona l'accés a un calendari d'alarmes emmagatzemat en un directori local, en el que cada element del calendari està emmagatzemat en un fitxer separat Comment[da]=Giver adgang til en alarmkalender lagret i en lokal mappe, hvori hvert enkelt kalenderelement lagres i en seperat fil Comment[de]=Ermöglicht den Zugriff auf einen Erinnerungen-Kalender in einem lokalen Ordner, in dem jeder Kalender-Eintrag als separate Datei gespeichert ist. diff -Nru kdepim-4.13.0/kalarm/resources/remote.desktop kdepim-4.13.3/kalarm/resources/remote.desktop --- kdepim-4.13.0/kalarm/resources/remote.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/resources/remote.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -55,7 +55,7 @@ Comment=Provides access to an alarm calendar in a remote file using KDE's network framework KIO Comment[ar]=يوفر وصول لمنبه التقويم في ملف بعيد بإستخدام إطار شبكة كدي KIO Comment[bs]=Obezbjeđuje pristup alarm kalendaru u udaljenoj datoteci koristeći KDE-ov mrežni okvir KIO -Comment[ca]=Proporciona l'accés a un calendari d'alarmes en un fitxer remot usant la infraestructura KIO de xarxa del KDE +Comment[ca]=Proporciona accés a un calendari d'alarmes en un fitxer remot usant la infraestructura KIO de xarxa del KDE Comment[ca@valencia]=Proporciona l'accés a un calendari d'alarmes en un fitxer remot usant la infraestructura KIO de xarxa del KDE Comment[da]=Giver adgang til en alarm-kalender i en ekstern fil der bruger KDE's netværks-framework KIO Comment[de]=Ermöglicht den Zugriff auf einen entfernten Erinnerungen-Kalender über KDEs Netzwerk-Zugriffsystem KIO. diff -Nru kdepim-4.13.0/kalarm/rtcwakeaction.actions kdepim-4.13.3/kalarm/rtcwakeaction.actions --- kdepim-4.13.0/kalarm/rtcwakeaction.actions 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kalarm/rtcwakeaction.actions 2014-07-09 12:18:50.000000000 +0000 @@ -79,6 +79,7 @@ Name[da]=Angiv RTC-opvågningstidspunkt Name[de]=Den Zeitpunkt zum Aufwachen gemäß der Echtzeituhr setzen Name[el]=Ρύθμιση της ώρας ξυπνήματος RTC +Name[en_GB]=Set RTC wakeup time Name[es]=Establecer hora de despertar RTC Name[et]=RTC äratusaja määramine Name[fi]=Aseta RTC-herätysaika @@ -120,6 +121,7 @@ Description[da]=Angiv RTC-opvågningstidspunkt fra suspendering Description[de]=Den Zeitpunkt zum Aufwachen aus dem Ruhezustand gemäß der Echtzeituhr setzen Description[el]=Ρύθμιση της ώρας RTC «ξύπνημα από αναστολή» +Description[en_GB]=Set RTC wake-from-suspend time Description[es]=Establecer hora despertar-desde-suspendido RTC Description[et]=RTC uneseisundist ärkamise aja määramine Description[fi]=Aseta RTC:n herätys keskeytyksistä -aika diff -Nru kdepim-4.13.0/kleopatra/conf/kleopatra_config_appear.desktop kdepim-4.13.3/kleopatra/conf/kleopatra_config_appear.desktop --- kdepim-4.13.0/kleopatra/conf/kleopatra_config_appear.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/conf/kleopatra_config_appear.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -161,6 +161,7 @@ X-KDE-Keywords[da]=farve,skriftype,konfiguration X-KDE-Keywords[de]=Farben,Schriftarten,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=χρώμα,γραμματοσειρά, διαμόρφωση +X-KDE-Keywords[en_GB]=colour,font, configuration X-KDE-Keywords[es]=color, tipo de letra, configuración X-KDE-Keywords[et]=värv,font, seadistamine X-KDE-Keywords[fi]=color, väri, font, kirjasin, fontti, configuration, asetukset diff -Nru kdepim-4.13.0/kleopatra/conf/kleopatra_config_cryptooperations.desktop kdepim-4.13.3/kleopatra/conf/kleopatra_config_cryptooperations.desktop --- kdepim-4.13.0/kleopatra/conf/kleopatra_config_cryptooperations.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/conf/kleopatra_config_cryptooperations.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -111,6 +111,7 @@ X-KDE-Keywords[da]=signer,krypter,e-mail,kviktilstand,tjeksum,konfiguration X-KDE-Keywords[de]=signieren,verschlüsseln,E-Mail,email,schneller Modus,Prüfsumme,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=υπογραφή,κρυπτογράφηση,αλληλογραφία,γρήγορη λειτουργία,άθροισμα ελέγχου,διαμόρφωση +X-KDE-Keywords[en_GB]=sign,encrypt,email,quick mode,checksum,configuration X-KDE-Keywords[es]=firma,cifrado,correo,modo rápido,suma de verificación,configuración X-KDE-Keywords[et]=allkirjastamine,krüptimine,e-post,e-kiri.kiirrežiim,kontrollsumma,seadistamine X-KDE-Keywords[fi]=sign, encrypt, email, quick mode, checksum, configuration, allekirjoitus, allekirjoita, salaa, salaus, sähköposti, pikatila, tarkistussumma, asetukset diff -Nru kdepim-4.13.0/kleopatra/conf/kleopatra_config_dirserv.desktop kdepim-4.13.3/kleopatra/conf/kleopatra_config_dirserv.desktop --- kdepim-4.13.0/kleopatra/conf/kleopatra_config_dirserv.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/conf/kleopatra_config_dirserv.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -134,6 +134,7 @@ X-KDE-Keywords[da]=ldap,directory,tjenester,hkp,nøgleserver X-KDE-Keywords[de]=LDAP,Verzeichnis,Dienste,HKP,Schlüsselserver X-KDE-Keywords[el]=ldap,κατάλογος,υπηρεσίες,hkp,keyserver +X-KDE-Keywords[en_GB]=ldap,directory,services,hkp,keyserver X-KDE-Keywords[es]=ldap,directorio,servicios,hkp,servidor de claves X-KDE-Keywords[et]=ldap,kataloog,teenused,hkp,võtmeserver X-KDE-Keywords[fi]=ldap, directory, hakemisto, services, palvelut, hkp, keyserver, avainpalvelin diff -Nru kdepim-4.13.0/kleopatra/conf/kleopatra_config_gnupgsystem.desktop kdepim-4.13.3/kleopatra/conf/kleopatra_config_gnupgsystem.desktop --- kdepim-4.13.0/kleopatra/conf/kleopatra_config_gnupgsystem.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/conf/kleopatra_config_gnupgsystem.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -117,6 +117,7 @@ X-KDE-Keywords[da]=gpg,gpgsm,gpg-agent,dirmngr,scdaemon,kleopatra,signering,kryptering X-KDE-Keywords[de]=GPG,GPGSM,GPG-Agent,dirmngr,SC-Daemon,Kleopatra,signieren,verschlüsseln X-KDE-Keywords[el]=gpg,gpgsm,gpg-agent,dirmngr,scdaemon,kleopatra,υπογραφή,κρυπτογράφηση +X-KDE-Keywords[en_GB]=gpg,gpgsm,gpg-agent,dirmngr,scdaemon,kleopatra,signing,encryption X-KDE-Keywords[es]=gpg,gpgsm,agente-gpg,dirmngr,scdaemon,kleopatra,firmado,cifrado X-KDE-Keywords[et]=gpg,gpgsm,gpg-agent,dirmngr,scdaemon,kleopatra,allkirjastamine,krüptimine X-KDE-Keywords[fi]=gpg,gpgsm,gpg-agent,gpg-agentti,dirmngr,scdaemon,kleopatra,signing,allekirjoitus,encryption,salaus diff -Nru kdepim-4.13.0/kleopatra/conf/kleopatra_config_smimevalidation.desktop kdepim-4.13.3/kleopatra/conf/kleopatra_config_smimevalidation.desktop --- kdepim-4.13.0/kleopatra/conf/kleopatra_config_smimevalidation.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/conf/kleopatra_config_smimevalidation.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -114,6 +114,7 @@ X-KDE-Keywords[da]=smime,validering,kleopatra,signering,kryptering X-KDE-Keywords[de]=SMIME,Überprüfung,Kleopatra,signieren,verschlüsseln X-KDE-Keywords[el]=smime,επικύρωση,kleopatra,υπογραφή,κρυπτογράφηση +X-KDE-Keywords[en_GB]=smime,validation,kleopatra,signing,encryption X-KDE-Keywords[es]=smime,validación,kleopatra,firmado,cifrado X-KDE-Keywords[et]=smime,valideerimine,kleopatra,allkirjastamine,krüptimine X-KDE-Keywords[fi]=smime,validation,tarkistus,kleopatra,signing,allekirjoitus,encryption,salaus diff -Nru kdepim-4.13.0/kleopatra/crypto/createchecksumscontroller.cpp kdepim-4.13.3/kleopatra/crypto/createchecksumscontroller.cpp --- kdepim-4.13.0/kleopatra/crypto/createchecksumscontroller.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/crypto/createchecksumscontroller.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -45,6 +45,8 @@ #include #include #include +#include +#include #include #include @@ -119,6 +121,26 @@ connect( &buttonBox, SIGNAL(accepted()), this, SLOT(accept()) ); connect( &buttonBox, SIGNAL(rejected()), this, SLOT(reject()) ); + readConfig(); + } + ~ResultDialog() + { + writeConfig(); + } + + void readConfig() + { + KConfigGroup dialog( KGlobal::config(), "ResultDialog" ); + const QSize size = dialog.readEntry( "Size", QSize(600, 400) ); + if ( size.isValid() ) { + resize( size ); + } + } + void writeConfig() + { + KConfigGroup dialog( KGlobal::config(), "ResultDialog" ); + dialog.writeEntry( "Size",size() ); + dialog.sync(); } private: @@ -198,6 +220,7 @@ } #endif // QT_NO_PROGRESSDIALOG ResultDialog * const dlg = new ResultDialog( created, errors ); + dlg->setAttribute(Qt::WA_DeleteOnClose); q->bringToForeground( dlg ); if ( !errors.empty() ) q->setLastError( gpg_error( GPG_ERR_GENERAL ), diff -Nru kdepim-4.13.0/kleopatra/dialogs/exportcertificatesdialog.cpp kdepim-4.13.3/kleopatra/dialogs/exportcertificatesdialog.cpp --- kdepim-4.13.0/kleopatra/dialogs/exportcertificatesdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/dialogs/exportcertificatesdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -40,7 +40,7 @@ #include #include -#include +#include #include using namespace Kleo; @@ -66,19 +66,21 @@ q->setButtons( KDialog::Ok | KDialog::Cancel ); q->setButtonGuiItem( KDialog::Ok, KGuiItem( i18n( "Export" ) ) ); QWidget* const main = new QWidget; - QGridLayout* const grid = new QGridLayout( main ); + QFormLayout *layout = new QFormLayout; + main->setLayout(layout); + 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 ); + layout->addRow(pgpLabel, pgpRequester); + QLabel* const cmsLabel = new QLabel; cmsLabel->setText( i18n( "S/MIME export file:" ) ); - grid->addWidget( cmsLabel, 1, 0 ); cmsRequester = new FileNameRequester; + layout->addRow(cmsLabel, cmsRequester); + connect( cmsRequester, SIGNAL(fileNameChanged(QString)), q, SLOT(fileNamesChanged()) ); - grid->addWidget( cmsRequester, 1, 1 ); q->setMainWidget( main ); fileNamesChanged(); } diff -Nru kdepim-4.13.0/kleopatra/dialogs/selftestdialog.cpp kdepim-4.13.3/kleopatra/dialogs/selftestdialog.cpp --- kdepim-4.13.0/kleopatra/dialogs/selftestdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/dialogs/selftestdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -151,7 +151,7 @@ Q_OBJECT public: explicit Proxy( QObject * parent=0 ) - : QSortFilterProxyModel( parent ), m_showAll( false ) + : QSortFilterProxyModel( parent ), m_showAll( true ) { setDynamicSortFilter( true ); } diff -Nru kdepim-4.13.0/kleopatra/dialogs/selftestdialog.ui kdepim-4.13.3/kleopatra/dialogs/selftestdialog.ui --- kdepim-4.13.0/kleopatra/dialogs/selftestdialog.ui 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/dialogs/selftestdialog.ui 2014-07-09 12:18:50.000000000 +0000 @@ -1,7 +1,8 @@ - + + SelfTestDialog - - + + 0 0 @@ -9,82 +10,88 @@ 610 - + Kleopatra Self-Test Results - - + + QLayout::SetMinimumSize - - - <para>These are the results of the Kleopatra self-test suite. Click on a test for details.</para><para>Note that all but the first failure might be due to prior tests failing.</para> + + + <para>These are the results of the Kleopatra self-test suite. Click on a test for details.</para><para>Note that all but the first failure might be due to prior tests failing.</para> - + true - - + + Qt::Vertical - - + + - - - + + + 0 1 - + 0 100 - + false - + true - - + + Show all test results + + true + + + false + - - + + Details - + - - + + 0 100 - + QFrame::NoFrame - + Qt::ScrollBarAlwaysOff - - + + 0 0 @@ -92,16 +99,25 @@ 100 - - + + + 0 + + + 0 + + + 0 + + 0 - - + + Qt::RichText - + true @@ -112,27 +128,27 @@ - - + + Proposed Corrective Action - + - - + + 0 100 - + QFrame::NoFrame - + Qt::ScrollBarAlwaysOff - - + + 0 0 @@ -140,16 +156,25 @@ 100 - - + + + 0 + + + 0 + + + 0 + + 0 - - + + Qt::RichText - + true @@ -159,13 +184,13 @@ - + - - + + Qt::Horizontal - + 40 20 @@ -174,11 +199,11 @@ - - + + false - + Do It @@ -190,18 +215,18 @@ - - + + Run these tests at startup - + true - - + + QDialogButtonBox::Cancel|QDialogButtonBox::Close|QDialogButtonBox::Ok @@ -224,11 +249,11 @@ SelfTestDialog accept() - + 236 490 - + 157 274 @@ -240,11 +265,11 @@ SelfTestDialog reject() - + 304 490 - + 286 274 @@ -256,11 +281,11 @@ SelfTestDialog slotDoItClicked() - + 354 398 - + 375 304 diff -Nru kdepim-4.13.0/kleopatra/kleopatra_signencryptfolders.desktop kdepim-4.13.3/kleopatra/kleopatra_signencryptfolders.desktop --- kdepim-4.13.0/kleopatra/kleopatra_signencryptfolders.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/kleopatra_signencryptfolders.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -61,6 +61,7 @@ Name[da]=Arkivér, signér og kryptér mappe Name[de]=Ordner packen, signieren und verschlüsseln Name[el]=Αρχειοθέτηση, υπογραφή && κρυπτογράφηση φακέλου +Name[en_GB]=Archive, Sign && Encrypt Folder Name[es]=Archivar, firmar y cifrar carpeta Name[et]=Kataloogi arhiveerimine, allkirjastamine ja krüptimine Name[fi]=Arkistoi, allekirjoita ja salaa kansio @@ -109,6 +110,7 @@ Name[da]=Arkivér og kryptér mappe Name[de]=Ordner packen und verschlüsseln Name[el]=Αρχειοθέτηση && κρυπτογράφηση φακέλου +Name[en_GB]=Archive && Encrypt Folder Name[es]=Archivar y cifrar carpeta Name[et]=Kataloogi arhiveerimine ja krüptimine Name[fi]=Arkistoi ja salaa kansio diff -Nru kdepim-4.13.0/kleopatra/models/keylistmodel.cpp kdepim-4.13.3/kleopatra/models/keylistmodel.cpp --- kdepim-4.13.0/kleopatra/models/keylistmodel.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/models/keylistmodel.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -67,7 +67,7 @@ #include #include -#ifdef __GNUC__ +#ifdef __GLIBCXX__ #include // for is_sorted #endif @@ -454,7 +454,7 @@ } QList FlatKeyListModel::doAddKeys( const std::vector & keys ) { -#ifdef __GNUC__ +#ifdef __GLIBCXX__ assert( __gnu_cxx::is_sorted( keys.begin(), keys.end(), _detail::ByFingerprint() ) ); #endif if ( keys.empty() ) @@ -711,7 +711,7 @@ } QList HierarchicalKeyListModel::doAddKeys( const std::vector & keys ) { -#ifdef __GNUC__ +#ifdef __GLIBCXX__ assert( __gnu_cxx::is_sorted( keys.begin(), keys.end(), _detail::ByFingerprint() ) ); #endif if ( keys.empty() ) diff -Nru kdepim-4.13.0/kleopatra/uiserver/assuanserverconnection.cpp kdepim-4.13.3/kleopatra/uiserver/assuanserverconnection.cpp --- kdepim-4.13.0/kleopatra/uiserver/assuanserverconnection.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/uiserver/assuanserverconnection.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -93,7 +93,7 @@ #include -#ifdef __GNUC__ +#ifdef __GLIBCXX__ # include // for is_sorted #endif @@ -835,7 +835,7 @@ sessionId( 0 ), factories( factories_ ) { -#ifdef __GNUC__ +#ifdef __GLIBCXX__ assert( __gnu_cxx::is_sorted( factories_.begin(), factories_.end(), _detail::ByName() ) ); #endif diff -Nru kdepim-4.13.0/kleopatra/utils/classify.cpp kdepim-4.13.3/kleopatra/utils/classify.cpp --- kdepim-4.13.0/kleopatra/utils/classify.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/utils/classify.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -45,7 +45,7 @@ #include -#ifdef __GNUC__ +#ifdef __GLIBCXX__ # include #endif @@ -152,7 +152,7 @@ } unsigned int Kleo::classify( const QString & filename ) { -#ifdef __GNUC__ +#ifdef __GLIBCXX__ assert( __gnu_cxx::is_sorted( begin( classifications ), end( classifications ), ByExtension() ) ); #endif @@ -181,7 +181,7 @@ } unsigned int Kleo::classifyContent( const QByteArray & data ) { -#ifdef __GNUC__ +#ifdef __GLIBCXX__ assert( __gnu_cxx::is_sorted( begin( content_classifications ), end( content_classifications ), ByContent(100) ) ); #endif diff -Nru kdepim-4.13.0/kleopatra/view/tabwidget.cpp kdepim-4.13.3/kleopatra/view/tabwidget.cpp --- kdepim-4.13.0/kleopatra/view/tabwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kleopatra/view/tabwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -740,12 +740,15 @@ static const bool KCONFIG_DELETEGROUP_BROKEN = true; void TabWidget::loadViews( const KConfig * config ) { - if ( config ) - Q_FOREACH( const QString & group, extractViewGroups( config ) ) { + if ( config ) { + QStringList groupList = extractViewGroups( config ); + groupList.sort(); + Q_FOREACH( const QString & group, groupList ) { const KConfigGroup kcg( config, group ); if ( !KCONFIG_DELETEGROUP_BROKEN || kcg.readEntry( "magic", 0U ) == 0xFA1AFE1U ) addView( kcg ); } + } if ( !count() ) { // add default views: addView( QString(), QLatin1String("my-certificates") ); diff -Nru kdepim-4.13.0/kmail/configuredialog/accountconfigorderdialog.cpp kdepim-4.13.3/kmail/configuredialog/accountconfigorderdialog.cpp --- kdepim-4.13.0/kmail/configuredialog/accountconfigorderdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/configuredialog/accountconfigorderdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -19,7 +19,7 @@ #include "kmkernel.h" #include "mailcommon/util/mailutil.h" - +#include "settings/globalsettings.h" #include #include @@ -129,8 +129,7 @@ void AccountConfigOrderDialog::init() { - KConfigGroup group( KMKernel::self()->config(), "AccountOrder" ); - const QStringList listOrderAccount = group.readEntry("order",QStringList()); + const QStringList listOrderAccount = GlobalSettings::self()->order(); QStringList instanceList; QMap mapInstance; @@ -183,22 +182,21 @@ void AccountConfigOrderDialog::slotOk() { - KConfigGroup group( KMKernel::self()->config(), "AccountOrder" ); - QStringList order; const int numberOfItems(mListAccount->count()); for (int i = 0; iitem(i)->data(AccountConfigOrderDialog::IdentifierAccount).toString(); } - group.writeEntry("order",order); - group.sync(); - + GlobalSettings::self()->setOrder(order); + GlobalSettings::self()->writeConfig(); KDialog::accept(); } void AccountConfigOrderDialog::readConfig() { + if (!KMKernel::self()) + return; KConfigGroup accountConfigDialog( KMKernel::self()->config(), "AccountConfigOrderDialog" ); const QSize size = accountConfigDialog.readEntry( "Size", QSize(600, 400) ); if ( size.isValid() ) { @@ -208,6 +206,8 @@ void AccountConfigOrderDialog::writeConfig() { + if (!KMKernel::self()) + return; KConfigGroup accountConfigDialog( KMKernel::self()->config(), "AccountConfigOrderDialog" ); accountConfigDialog.writeEntry( "Size", size() ); accountConfigDialog.sync(); diff -Nru kdepim-4.13.0/kmail/configuredialog/configureaccountpage.cpp kdepim-4.13.3/kmail/configuredialog/configureaccountpage.cpp --- kdepim-4.13.0/kmail/configuredialog/configureaccountpage.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/configuredialog/configureaccountpage.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -293,7 +293,15 @@ bool CheckOnStartup; if( !mRetrievalHash.contains( ident ) ) { const QString resourceGroupPattern( QLatin1String("Resource %1") ); - KConfigGroup group( KMKernel::self()->config(), resourceGroupPattern.arg( ident ) ); + + KConfigGroup group; + KConfig *conf = 0; + if (KMKernel::self()) { + group = KConfigGroup( KMKernel::self()->config(), resourceGroupPattern.arg( ident ) ); + } else { + conf = new KConfig(QLatin1String("kmail2rc")); + group = KConfigGroup( conf, resourceGroupPattern.arg( ident ) ); + } IncludeInManualChecks = group.readEntry( "IncludeInManualChecks", true ); @@ -303,6 +311,7 @@ CheckOnStartup = group.readEntry( "CheckOnStartup", false ); QSharedPointer opts( new RetrievalOptions( IncludeInManualChecks, OfflineOnShutdown, CheckOnStartup ) ); mRetrievalHash.insert( ident, opts ); + delete conf; } else { QSharedPointer opts = mRetrievalHash.value( ident ); IncludeInManualChecks = opts->IncludeInManualChecks; @@ -471,11 +480,19 @@ QHashIterator > it( mRetrievalHash ); while( it.hasNext() ) { it.next(); - KConfigGroup group( KMKernel::self()->config(), resourceGroupPattern.arg( it.key() ) ); + KConfigGroup group; + KConfig *conf = 0; + if (KMKernel::self()) { + group = KConfigGroup( KMKernel::self()->config(), resourceGroupPattern.arg( it.key() ) ); + } else { + conf = new KConfig(QLatin1String("kmail2rc")); + group = KConfigGroup( conf, resourceGroupPattern.arg( it.key() ) ); + } QSharedPointer opts = it.value(); group.writeEntry( "IncludeInManualChecks", opts->IncludeInManualChecks); group.writeEntry( "OfflineOnShutdown", opts->OfflineOnShutdown); group.writeEntry( "CheckOnStartup", opts->CheckOnStartup); + delete conf; } } diff -Nru kdepim-4.13.0/kmail/configuredialog/configureappearancepage.cpp kdepim-4.13.3/kmail/configuredialog/configureappearancepage.cpp --- kdepim-4.13.0/kmail/configuredialog/configureappearancepage.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/configuredialog/configureappearancepage.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -248,58 +248,64 @@ void AppearancePage::FontsTab::doLoadOther() { - KConfigGroup fonts( KMKernel::self()->config(), "Fonts" ); - KConfigGroup messagelistFont( KMKernel::self()->config(), "MessageListView::Fonts" ); - - mFont[0] = KGlobalSettings::generalFont(); - QFont fixedFont = KGlobalSettings::fixedFont(); - - for ( int i = 0 ; i < numFontNames ; ++i ) { - const QString configName = QLatin1String(fontNames[i].configName); - if ( configName == QLatin1String( "MessageListFont" ) || - configName == QLatin1String( "UnreadMessageFont" ) || - configName == QLatin1String( "ImportantMessageFont" ) || - configName == QLatin1String( "TodoMessageFont" ) ) { - mFont[i] = messagelistFont.readEntry( configName, - (fontNames[i].onlyFixed) ? fixedFont : mFont[0] ); - } else { - mFont[i] = fonts.readEntry( configName, - (fontNames[i].onlyFixed) ? fixedFont : mFont[0] ); + if (KMKernel::self()) { + KConfigGroup fonts( KMKernel::self()->config(), "Fonts" ); + KConfigGroup messagelistFont( KMKernel::self()->config(), "MessageListView::Fonts" ); + + mFont[0] = KGlobalSettings::generalFont(); + QFont fixedFont = KGlobalSettings::fixedFont(); + + for ( int i = 0 ; i < numFontNames ; ++i ) { + const QString configName = QLatin1String(fontNames[i].configName); + if ( configName == QLatin1String( "MessageListFont" ) || + configName == QLatin1String( "UnreadMessageFont" ) || + configName == QLatin1String( "ImportantMessageFont" ) || + configName == QLatin1String( "TodoMessageFont" ) ) { + mFont[i] = messagelistFont.readEntry( configName, + (fontNames[i].onlyFixed) ? fixedFont : mFont[0] ); + } else { + mFont[i] = fonts.readEntry( configName, + (fontNames[i].onlyFixed) ? fixedFont : mFont[0] ); + } } + mCustomFontCheck->setChecked( !MessageCore::GlobalSettings::self()->useDefaultFonts() ); + mFontLocationCombo->setCurrentIndex( 0 ); + slotFontSelectorChanged( 0 ); + } else { + setEnabled(false); } - mCustomFontCheck->setChecked( !MessageCore::GlobalSettings::self()->useDefaultFonts() ); - mFontLocationCombo->setCurrentIndex( 0 ); - slotFontSelectorChanged( 0 ); } void AppearancePage::FontsTab::save() { - KConfigGroup fonts( KMKernel::self()->config(), "Fonts" ); - KConfigGroup messagelistFont( KMKernel::self()->config(), "MessageListView::Fonts" ); - - // read the current font (might have been modified) - if ( mActiveFontIndex >= 0 ) - mFont[ mActiveFontIndex ] = mFontChooser->font(); - - const bool customFonts = mCustomFontCheck->isChecked(); - MessageCore::GlobalSettings::self()->setUseDefaultFonts( !customFonts ); - - for ( int i = 0 ; i < numFontNames ; ++i ) { - const QString configName = QLatin1String(fontNames[i].configName); - if ( configName == QLatin1String( "MessageListFont" ) || - configName == QLatin1String( "UnreadMessageFont" ) || - configName == QLatin1String( "ImportantMessageFont" ) || - configName == QLatin1String( "TodoMessageFont" ) ) { - if ( customFonts || messagelistFont.hasKey( configName ) ) { - // Don't write font info when we use default fonts, but write - // if it's already there: - messagelistFont.writeEntry( configName, mFont[i] ); + if (KMKernel::self()) { + KConfigGroup fonts( KMKernel::self()->config(), "Fonts" ); + KConfigGroup messagelistFont( KMKernel::self()->config(), "MessageListView::Fonts" ); + + // read the current font (might have been modified) + if ( mActiveFontIndex >= 0 ) + mFont[ mActiveFontIndex ] = mFontChooser->font(); + + const bool customFonts = mCustomFontCheck->isChecked(); + MessageCore::GlobalSettings::self()->setUseDefaultFonts( !customFonts ); + + for ( int i = 0 ; i < numFontNames ; ++i ) { + const QString configName = QLatin1String(fontNames[i].configName); + if ( configName == QLatin1String( "MessageListFont" ) || + configName == QLatin1String( "UnreadMessageFont" ) || + configName == QLatin1String( "ImportantMessageFont" ) || + configName == QLatin1String( "TodoMessageFont" ) ) { + if ( customFonts || messagelistFont.hasKey( configName ) ) { + // Don't write font info when we use default fonts, but write + // if it's already there: + messagelistFont.writeEntry( configName, mFont[i] ); + } + } else { + if ( customFonts || fonts.hasKey( configName ) ) + // Don't write font info when we use default fonts, but write + // if it's already there: + fonts.writeEntry( configName, mFont[i] ); } - } else { - if ( customFonts || fonts.hasKey( configName ) ) - // Don't write font info when we use default fonts, but write - // if it's already there: - fonts.writeEntry( configName, mFont[i] ); } } } @@ -407,54 +413,58 @@ void AppearancePage::ColorsTab::loadColor( bool loadFromConfig ) { - KColorScheme scheme( QPalette::Active, KColorScheme::View ); + if (KMKernel::self()) { + KColorScheme scheme( QPalette::Active, KColorScheme::View ); - KConfigGroup reader( KMKernel::self()->config(), "Reader" ); + KConfigGroup reader( KMKernel::self()->config(), "Reader" ); - KConfigGroup messageListView( KMKernel::self()->config(), "MessageListView::Colors" ); + KConfigGroup messageListView( KMKernel::self()->config(), "MessageListView::Colors" ); - KConfigGroup collectionFolderView( KMKernel::self()->config(), "CollectionFolderView" ); + KConfigGroup collectionFolderView( KMKernel::self()->config(), "CollectionFolderView" ); - static const QColor defaultColor[ numColorNames ] = { - KMail::Util::quoteL1Color(), - KMail::Util::quoteL2Color(), - KMail::Util::quoteL3Color(), - scheme.foreground( KColorScheme::LinkText ).color(), // link - scheme.foreground( KColorScheme::VisitedText ).color(),// visited link - scheme.foreground( KColorScheme::NegativeText ).color(), // misspelled words - MessageList::Util::unreadDefaultMessageColor(), // unread mgs - MessageList::Util::importantDefaultMessageColor(), // important msg - MessageList::Util::todoDefaultMessageColor(), // action item mgs - QColor( 0x00, 0x80, 0xFF ), // pgp encrypted - scheme.background( KColorScheme::PositiveBackground ).color(), // pgp ok, trusted key - QColor( 0xFF, 0xFF, 0x40 ), // pgp ok, untrusted key - QColor( 0xFF, 0xFF, 0x40 ), // pgp unchk - Qt::red, // pgp bad - QColor( 0xFF, 0x40, 0x40 ), // warning text color - MailCommon::Util::defaultQuotaColor(), // close to quota - Qt::lightGray, // colorbar plain bg - Qt::black, // colorbar plain fg - Qt::black, // colorbar html bg - Qt::white, // colorbar html fg - scheme.foreground(KColorScheme::NegativeText).color(), //Broken Account Color - scheme.background().color() // reader background color - }; - - for ( int i = 0 ; i < numColorNames ; ++i ) { - if ( loadFromConfig ) { - const QString configName = QLatin1String(colorNames[i].configName); - if ( configName == QLatin1String( "UnreadMessageColor" ) || - configName == QLatin1String( "ImportantMessageColor" ) || - configName == QLatin1String( "TodoMessageColor" ) ) { - mColorList->setColorSilently( i, messageListView.readEntry( configName, defaultColor[i] ) ); - } else if( configName == QLatin1String("BrokenAccountColor")) { - mColorList->setColorSilently( i, collectionFolderView.readEntry(configName,defaultColor[i])); + static const QColor defaultColor[ numColorNames ] = { + KMail::Util::quoteL1Color(), + KMail::Util::quoteL2Color(), + KMail::Util::quoteL3Color(), + scheme.foreground( KColorScheme::LinkText ).color(), // link + scheme.foreground( KColorScheme::VisitedText ).color(),// visited link + scheme.foreground( KColorScheme::NegativeText ).color(), // misspelled words + MessageList::Util::unreadDefaultMessageColor(), // unread mgs + MessageList::Util::importantDefaultMessageColor(), // important msg + MessageList::Util::todoDefaultMessageColor(), // action item mgs + QColor( 0x00, 0x80, 0xFF ), // pgp encrypted + scheme.background( KColorScheme::PositiveBackground ).color(), // pgp ok, trusted key + QColor( 0xFF, 0xFF, 0x40 ), // pgp ok, untrusted key + QColor( 0xFF, 0xFF, 0x40 ), // pgp unchk + Qt::red, // pgp bad + QColor( 0xFF, 0x40, 0x40 ), // warning text color + MailCommon::Util::defaultQuotaColor(), // close to quota + Qt::lightGray, // colorbar plain bg + Qt::black, // colorbar plain fg + Qt::black, // colorbar html bg + Qt::white, // colorbar html fg + scheme.foreground(KColorScheme::NegativeText).color(), //Broken Account Color + scheme.background().color() // reader background color + }; + + for ( int i = 0 ; i < numColorNames ; ++i ) { + if ( loadFromConfig ) { + const QString configName = QLatin1String(colorNames[i].configName); + if ( configName == QLatin1String( "UnreadMessageColor" ) || + configName == QLatin1String( "ImportantMessageColor" ) || + configName == QLatin1String( "TodoMessageColor" ) ) { + mColorList->setColorSilently( i, messageListView.readEntry( configName, defaultColor[i] ) ); + } else if( configName == QLatin1String("BrokenAccountColor")) { + mColorList->setColorSilently( i, collectionFolderView.readEntry(configName,defaultColor[i])); + } else { + mColorList->setColorSilently( i, reader.readEntry( configName, defaultColor[i] ) ); + } } else { - mColorList->setColorSilently( i, reader.readEntry( configName, defaultColor[i] ) ); + mColorList->setColorSilently( i, defaultColor[i] ); } - } else { - mColorList->setColorSilently( i, defaultColor[i] ); } + } else { + setEnabled(false); } } @@ -468,6 +478,8 @@ void AppearancePage::ColorsTab::save() { + if (!KMKernel::self()) + return; KConfigGroup reader( KMKernel::self()->config(), "Reader" ); KConfigGroup messageListView( KMKernel::self()->config(), "MessageListView::Colors" ); KConfigGroup collectionFolderView( KMKernel::self()->config(), "CollectionFolderView" ); @@ -589,8 +601,8 @@ loadWidget( mFavoriteFoldersViewGroupBox, mFavoriteFoldersViewGroup, MailCommon::MailCommonSettings::self()->favoriteCollectionViewModeItem() ); loadWidget( mFolderQuickSearchCB, GlobalSettings::self()->enableFolderQuickSearchItem() ); const int checkedFolderToolTipsPolicy = GlobalSettings::self()->toolTipDisplayPolicy(); - if ( checkedFolderToolTipsPolicy < mFolderToolTipsGroup->buttons().size() && checkedFolderToolTipsPolicy >= 0 ) - mFolderToolTipsGroup->buttons()[ checkedFolderToolTipsPolicy ]->setChecked( true ); + if ( checkedFolderToolTipsPolicy >= 0 ) + mFolderToolTipsGroup->button(checkedFolderToolTipsPolicy)->setChecked( true ); } void AppearancePage::LayoutTab::save() diff -Nru kdepim-4.13.0/kmail/configuredialog/configurecomposerpage.cpp kdepim-4.13.3/kmail/configuredialog/configurecomposerpage.cpp --- kdepim-4.13.0/kmail/configuredialog/configurecomposerpage.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/configuredialog/configurecomposerpage.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -895,6 +895,7 @@ connect( mCharsetListEditor, SIGNAL(aboutToAdd(QString&)), this, SLOT(slotVerifyCharset(QString&)) ); + setEnabled(kmkernel); } void ComposerPage::CharsetTab::slotVerifyCharset( QString & charset ) @@ -927,6 +928,8 @@ void ComposerPage::CharsetTab::doLoadOther() { + if (!kmkernel) + return; QStringList charsets = MessageComposer::MessageComposerSettings::preferredCharsets(); QStringList::Iterator end( charsets.end() ); for ( QStringList::Iterator it = charsets.begin() ; @@ -955,6 +958,8 @@ void ComposerPage::CharsetTab::save() { + if (!kmkernel) + return; QStringList charsetList = mCharsetListEditor->stringList(); QStringList::Iterator it = charsetList.begin(); QStringList::Iterator end = charsetList.end(); diff -Nru kdepim-4.13.0/kmail/configuredialog/configuredialog.cpp kdepim-4.13.3/kmail/configuredialog/configuredialog.cpp --- kdepim-4.13.0/kmail/configuredialog/configuredialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/configuredialog/configuredialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -75,14 +75,16 @@ void ConfigureDialog::slotApply() { slotApplyClicked(); - KMKernel::self()->slotRequestConfigSync(); + if (KMKernel::self()) + KMKernel::self()->slotRequestConfigSync(); emit configChanged(); } void ConfigureDialog::slotOk() { slotOkClicked(); - KMKernel::self()->slotRequestConfigSync(); + if (KMKernel::self()) + KMKernel::self()->slotRequestConfigSync(); emit configChanged(); } diff -Nru kdepim-4.13.0/kmail/configuredialog/configuresecuritypage.cpp kdepim-4.13.3/kmail/configuredialog/configuresecuritypage.cpp --- kdepim-4.13.0/kmail/configuredialog/configuresecuritypage.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/configuredialog/configuresecuritypage.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -135,9 +135,11 @@ KStandardGuiItem::cont(), KStandardGuiItem::cancel(), QLatin1String("htmlMailOverride")) == KMessageBox::Continue) { saveCheckBox(mSGTab.mHtmlMailCheck, MessageViewer::GlobalSettings::self()->htmlMailItem()); - foreach( const Akonadi::Collection &collection, kmkernel->allFolders() ) { - KConfigGroup config( KMKernel::self()->config(), MailCommon::FolderCollection::configGroupName(collection) ); - config.writeEntry("htmlMailOverride", false); + if (kmkernel) { + foreach( const Akonadi::Collection &collection, kmkernel->allFolders() ) { + KConfigGroup config( KMKernel::self()->config(), MailCommon::FolderCollection::configGroupName(collection) ); + config.writeEntry("htmlMailOverride", false); + } } } } diff -Nru kdepim-4.13.0/kmail/configuredialog/configurestorageservicewidget.cpp kdepim-4.13.3/kmail/configuredialog/configurestorageservicewidget.cpp --- kdepim-4.13.0/kmail/configuredialog/configurestorageservicewidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/configuredialog/configurestorageservicewidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -53,7 +53,11 @@ } QList lstCapabilities; lstCapabilities << PimCommon::StorageServiceAbstract::ShareLinkCapability; - mStorageServiceWidget->setListService(KMKernel::self()->storageServiceManager()->listService(), lstCapabilities); + if (KMKernel::self() && KMKernel::self()->storageServiceManager()) { + mStorageServiceWidget->setListService(KMKernel::self()->storageServiceManager()->listService(), lstCapabilities); + } else { + mStorageServiceWidget->setEnabled(false); + } setLayout(lay); } @@ -71,7 +75,8 @@ void ConfigureStorageServiceWidget::save() { - KMKernel::self()->storageServiceManager()->setListService(mStorageServiceWidget->listService()); + if (KMKernel::self() && KMKernel::self()->storageServiceManager()) + KMKernel::self()->storageServiceManager()->setListService(mStorageServiceWidget->listService()); } void ConfigureStorageServiceWidget::doLoadFromGlobalSettings() diff -Nru kdepim-4.13.0/kmail/data/kmail2.notifyrc kdepim-4.13.3/kmail/data/kmail2.notifyrc --- kdepim-4.13.0/kmail/data/kmail2.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/data/kmail2.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -80,6 +80,7 @@ Name[da]=Akonadi-serveren sendte en advarsel Name[de]=Warnung des Akonadi-Servers Name[el]=Ο εξυπηρετητής Akonadi έστειλε μια προειδοποίηση +Name[en_GB]=Akonadi server sent a warning Name[es]=El servidor Akonadi envió un aviso Name[et]=Akonadi server saatis hoiatuse Name[fi]=Akonadi-palvelin lähetti varoituksen @@ -122,6 +123,7 @@ Comment[da]=Akonadi-serveren sendte en advarsel Comment[de]=Warnung des Akonadi-Servers Comment[el]=Ο εξυπηρετητής Akonadi έστειλε μια προειδοποίηση +Comment[en_GB]=Akonadi server sent a warning Comment[es]=El servidor Akonadi envió un aviso Comment[et]=Akonadi server saatis hoiatuse Comment[fi]=Akonadi-palvelin lähetti varoituksen @@ -167,6 +169,7 @@ Name[da]=Akonadi-serveren sendte en fejl Name[de]=Fehlermeldung des Akonadi-Servers Name[el]=Ο εξυπηρετητής Akonadi έστειλε ένα σφάλμα +Name[en_GB]=Akonadi server sent an error Name[es]=El servidor Akonadi envión un error Name[et]=Akonadi server saatis vea Name[fi]=Akonadi-palvelin lähetti virheen @@ -209,6 +212,7 @@ Comment[da]=Akonadi-serveren sendte en fejl Comment[de]=Fehlermeldung des Akonadi-Servers Comment[el]=Ο εξυπηρετητής Akonadi έστειλε ένα σφάλμα +Comment[en_GB]=Akonadi server sent an error Comment[es]=El servidor Akonadi envió un error Comment[et]=Akonadi server saatis vea Comment[fi]=Akonadi-palvelin lähetti virheen @@ -254,6 +258,7 @@ Name[da]=En ressource er defekt Name[de]=Eine Ressource ist nicht funktionsfähig Name[el]=Ένας πόρος είναι σπασμένος +Name[en_GB]=A resource is broken Name[es]=Un recurso está dañado Name[et]=Ressurss on katki Name[fi]=Resurssi on rikki @@ -295,6 +300,7 @@ Comment[da]=En ressource ændrede sin status til defekt Comment[de]=Eine Ressource meldet eine Funktionsstörung Comment[el]=Ένας πόρος άλλαξε την κατάστασή του σε «σπασμένος» +Comment[en_GB]=A resource change its state to broken Comment[es]=Un recurso cambia su estado a dañado Comment[et]=Ressurssi olekuks on nüüd katki. Comment[fi]=Resurssi vaihtoi tilakseen ”rikki” @@ -392,7 +398,7 @@ Comment[et]=Uute kirjade kontrollimisel tekkis viga Comment[fi]=Sattui virhe tarkistettaessa uutta postia Comment[fr]=Il y a eu une erreur lors de la vérification du courriel -Comment[gl]=Produciuse un erro cando se comprobaba o correo novo +Comment[gl]=Produciuse un erro ao comprobar o correo novo Comment[hu]=Hiba történt az új levelek keresése közben Comment[ia]=Il habeva un error durante verification pro nove e-posta Comment[it]=Si è verificato un errore durante il controllo dei nuovi messaggi di posta @@ -437,7 +443,9 @@ Name[da]=Arkivering af e-mails i mappe gennemført Name[de]=E-Mail-Archivierung im Ordner beendet Name[el]=Η αρχειοθέτηση της αλληλογραφίας στο φάκελο ολοκληρώθηκε +Name[en_GB]=Archive Mails in Folder done Name[es]=Archivado de correos en carpeta terminado +Name[et]=Kirjad on kausta arhiveeritud Name[fi]=Viestien arkistointi kansioihin valmis Name[fr]=Archivage des dossiers terminé Name[gl]=Rematou Arquivar o correo @@ -472,7 +480,9 @@ Name[da]=Fejl ved mappe-arkivering Name[de]=Ordner-Archivierungs-Fehler Name[el]=Σφάλμα φακέλου αρχειοθέτησης +Name[en_GB]=Folder Archive Error Name[es]=Error de archivado de carpeta +Name[et]=Kirjade arhiveerimise tõrge Name[fi]=Kansion arkistointivirhe Name[fr]=Erreur d'archivage des dossiers Name[gl]=Erro do arquivo de cartafoles diff -Nru kdepim-4.13.0/kmail/data/kmail_addattachmentservicemenu.desktop kdepim-4.13.3/kmail/data/kmail_addattachmentservicemenu.desktop --- kdepim-4.13.0/kmail/data/kmail_addattachmentservicemenu.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/data/kmail_addattachmentservicemenu.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -14,6 +14,7 @@ Name[da]=Send som bilag til e-mail Name[de]=Als E-Mail-Anhang versenden Name[el]=Αποστολή μέσω αλληλογραφίας +Name[en_GB]=Send as Email Attachment Name[es]=Enviar como adjunto de correo Name[et]=Saatmine e-kirja manusena Name[fi]=Lähetä sähköpostin liitteenä diff -Nru kdepim-4.13.0/kmail/data/kmail_config_accounts.desktop kdepim-4.13.3/kmail/data/kmail_config_accounts.desktop --- kdepim-4.13.0/kmail/data/kmail_config_accounts.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/data/kmail_config_accounts.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -158,6 +158,7 @@ X-KDE-Keywords[da]=kmail,konti X-KDE-Keywords[de]=KMail,Zugänge X-KDE-Keywords[el]=kmail,λογαριασμοί +X-KDE-Keywords[en_GB]=kmail,accounts X-KDE-Keywords[es]=kmail,cuentas X-KDE-Keywords[et]=kmail,kontod X-KDE-Keywords[fi]=kmail,accounts,tilit diff -Nru kdepim-4.13.0/kmail/data/kmail_config_appearance.desktop kdepim-4.13.3/kmail/data/kmail_config_appearance.desktop --- kdepim-4.13.0/kmail/data/kmail_config_appearance.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/data/kmail_config_appearance.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -161,6 +161,7 @@ X-KDE-Keywords[da]=kmail,udseende X-KDE-Keywords[de]=KMail,Erscheinungsbild X-KDE-Keywords[el]=kmail,εμφάνιση +X-KDE-Keywords[en_GB]=kmail,appearance X-KDE-Keywords[es]=kmail,apariencia X-KDE-Keywords[et]=kmail,välimus X-KDE-Keywords[fi]=kmail,appearance,ulkoasu diff -Nru kdepim-4.13.0/kmail/data/kmail_config_composer.desktop kdepim-4.13.3/kmail/data/kmail_config_composer.desktop --- kdepim-4.13.0/kmail/data/kmail_config_composer.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/data/kmail_config_composer.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -136,6 +136,7 @@ X-KDE-Keywords[da]=kmail,brevskriver X-KDE-Keywords[de]=KMail,Komposer,Editor X-KDE-Keywords[el]=kmail,σύνταξη +X-KDE-Keywords[en_GB]=kmail,composer X-KDE-Keywords[es]=kmail,editor X-KDE-Keywords[et]=kmail,koostaja X-KDE-Keywords[fi]=kmail,composer, kirjoittaminen diff -Nru kdepim-4.13.0/kmail/data/kmail_config_identity.desktop kdepim-4.13.3/kmail/data/kmail_config_identity.desktop --- kdepim-4.13.0/kmail/data/kmail_config_identity.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/data/kmail_config_identity.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -159,6 +159,7 @@ X-KDE-Keywords[da]=kmail,identitet X-KDE-Keywords[de]=KMail,Identitäten X-KDE-Keywords[el]=kmail,ταυτότητα +X-KDE-Keywords[en_GB]=kmail,identity X-KDE-Keywords[es]=kmail,identidad X-KDE-Keywords[et]=kmail,identiteet X-KDE-Keywords[fi]=kmail, identity, henkilöys, henkilöllisyys diff -Nru kdepim-4.13.0/kmail/data/kmail_config_misc.desktop kdepim-4.13.3/kmail/data/kmail_config_misc.desktop --- kdepim-4.13.0/kmail/data/kmail_config_misc.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/data/kmail_config_misc.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -155,6 +155,7 @@ X-KDE-Keywords[da]=kmail,diverse X-KDE-Keywords[de]=KMail,Verschiedenes X-KDE-Keywords[el]=kmail,διάφορα +X-KDE-Keywords[en_GB]=kmail,misc X-KDE-Keywords[es]=kmail,miscelánea X-KDE-Keywords[et]=kmail,muud X-KDE-Keywords[fi]=kmail,misc,muut diff -Nru kdepim-4.13.0/kmail/data/kmail_config_security.desktop kdepim-4.13.3/kmail/data/kmail_config_security.desktop --- kdepim-4.13.0/kmail/data/kmail_config_security.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/data/kmail_config_security.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -161,6 +161,7 @@ X-KDE-Keywords[da]=kmail,sikkerhed X-KDE-Keywords[de]=KMail,Sicherheit X-KDE-Keywords[el]=kmail,ασφάλεια +X-KDE-Keywords[en_GB]=kmail,security X-KDE-Keywords[es]=kmail,seguridad X-KDE-Keywords[et]=kmail,turvalisus X-KDE-Keywords[fi]=kmail,security,turvallisuus diff -Nru kdepim-4.13.0/kmail/dialog/kmknotify.cpp kdepim-4.13.3/kmail/dialog/kmknotify.cpp --- kdepim-4.13.0/kmail/dialog/kmknotify.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/dialog/kmknotify.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -112,7 +112,6 @@ lstNotify<< QLatin1String( "akonadi_archivemail_agent/akonadi_archivemail_agent.notifyrc" ); lstNotify<< QLatin1String( "akonadi_sendlater_agent/akonadi_sendlater_agent.notifyrc" ); lstNotify<< QLatin1String( "akonadi_newmailnotifier_agent/akonadi_newmailnotifier_agent.notifyrc" ); - lstNotify<< QLatin1String( "akonadi_folderarchive_agent/akonadi_folderarchive_agent.notifyrc" ); lstNotify<< QLatin1String( "messageviewer/messageviewer.notifyrc" ); //TODO add other notifyrc here if necessary diff -Nru kdepim-4.13.0/kmail/editor/kmcomposereditor.cpp kdepim-4.13.3/kmail/editor/kmcomposereditor.cpp --- kdepim-4.13.0/kmail/editor/kmcomposereditor.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/editor/kmcomposereditor.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -149,22 +149,22 @@ void KMComposerEditor::showSpellConfigDialog( const QString & configFileName ) { - KConfig config( configFileName ); - Sonnet::ConfigDialog dialog( &config, this ); - if ( !spellCheckingLanguage().isEmpty() ) { - dialog.setLanguage( spellCheckingLanguage() ); - } - // Hackish way to hide the "Enable spell check by default" checkbox - // Our highlighter ignores this setting, so we should not expose its UI - QCheckBox *enabledByDefaultCB = dialog.findChild( QLatin1String("m_checkerEnabledByDefaultCB") ); - if ( enabledByDefaultCB ) { - enabledByDefaultCB->hide(); - } else { - kWarning() << "Could not find any checkbox named 'm_checkerEnabledByDefaultCB'. Sonnet::ConfigDialog must have changed!"; - } - if ( dialog.exec() ) { - setSpellCheckingLanguage( dialog.language() ); - } + KConfig config( configFileName ); + Sonnet::ConfigDialog dialog( &config, this ); + if ( !spellCheckingLanguage().isEmpty() ) { + dialog.setLanguage( spellCheckingLanguage() ); + } + // Hackish way to hide the "Enable spell check by default" checkbox + // Our highlighter ignores this setting, so we should not expose its UI + QCheckBox *enabledByDefaultCB = dialog.findChild( QLatin1String("m_checkerEnabledByDefaultCB") ); + if ( enabledByDefaultCB ) { + enabledByDefaultCB->hide(); + } else { + kWarning() << "Could not find any checkbox named 'm_checkerEnabledByDefaultCB'. Sonnet::ConfigDialog must have changed!"; + } + if ( dialog.exec() ) { + setSpellCheckingLanguage( dialog.language() ); + } } void KMComposerEditor::mousePopupMenuImplementation(const QPoint& pos) diff -Nru kdepim-4.13.0/kmail/editor/kmcomposewin.cpp kdepim-4.13.3/kmail/editor/kmcomposewin.cpp --- kdepim-4.13.0/kmail/editor/kmcomposewin.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/editor/kmcomposewin.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -114,6 +114,7 @@ #include #include #include +#include #include #include #include @@ -162,8 +163,6 @@ #include #include -// MOC - using Sonnet::DictionaryComboBox; using MailTransport::TransportManager; using MailTransport::Transport; @@ -202,6 +201,7 @@ mIdentityAction( 0 ), mTransportAction( 0 ), mFccAction( 0 ), mWordWrapAction( 0 ), mFixedFontAction( 0 ), mAutoSpellCheckingAction( 0 ), mDictionaryAction( 0 ), mSnippetAction( 0 ), mTranslateAction(0), + mAppendSignature( 0 ), mPrependSignature( 0 ), mInsertSignatureAtCursorPosition( 0 ), mGenerateShortenUrl( 0 ), mCodecAction( 0 ), mCryptoModuleAction( 0 ), @@ -219,9 +219,10 @@ mCheckForForgottenAttachments( true ), mIgnoreStickyFields( false ), mWasModified( false ), - mNumProgressUploadFile(0) + mNumProgressUploadFile(0), + mStorageManager(new PimCommon::StorageServiceManager(this)) { - + m_verifyMissingAttachment = 0; mComposerBase = new MessageComposer::ComposerViewBase( this, this ); mComposerBase->setIdentityManager( kmkernel->identityManager() ); @@ -286,6 +287,7 @@ MailTransport::TransportComboBox* transport = new MailTransport::TransportComboBox( mHeadersArea ); transport->setToolTip( i18n( "Select the outgoing account to use for sending this message" ) ); mComposerBase->setTransportCombo( transport ); + connect(transport, SIGNAL(activated(int)), this, SLOT(slotTransportChanged())); mEdtFrom = new MessageComposer::ComposerLineEdit( false, mHeadersArea ); mEdtFrom->setObjectName( QLatin1String("fromLine") ); @@ -438,9 +440,11 @@ connect(mAttachmentMissing, SIGNAL(explicitClosedMissingAttachment()), this, SLOT(slotExplicitClosedMissingAttachment())); v->addWidget(mAttachmentMissing); - m_verifyMissingAttachment = new QTimer(this); - m_verifyMissingAttachment->start(1000*5); - connect( m_verifyMissingAttachment, SIGNAL(timeout()), this, SLOT(slotVerifyMissingAttachmentTimeout()) ); + if (GlobalSettings::self()->showForgottenAttachmentWarning()) { + m_verifyMissingAttachment = new QTimer(this); + m_verifyMissingAttachment->start(1000*5); + connect( m_verifyMissingAttachment, SIGNAL(timeout()), this, SLOT(slotVerifyMissingAttachmentTimeout()) ); + } connect( attachmentController, SIGNAL(fileAttached()), mAttachmentMissing, SLOT(slotFileAttached()) ); mExternalEditorWarning = new ExternalEditorWarning(this); @@ -494,11 +498,11 @@ mDummyComposer = new MessageComposer::Composer( this ); mDummyComposer->globalPart()->setParentWidgetForGui( this ); - connect(KMKernel::self()->storageServiceManager(), SIGNAL(uploadFileDone(QString,QString)), this, SLOT(slotUploadFileDone(QString,QString))); - connect(KMKernel::self()->storageServiceManager(), SIGNAL(uploadFileFailed(QString,QString)), this, SLOT(slotUploadFileFailed(QString,QString))); - connect(KMKernel::self()->storageServiceManager(), SIGNAL(shareLinkDone(QString,QString)), this, SLOT(slotShareLinkDone(QString,QString))); - connect(KMKernel::self()->storageServiceManager(), SIGNAL(uploadFileStart(PimCommon::StorageServiceAbstract*)), this, SLOT(slotUploadFileStart(PimCommon::StorageServiceAbstract*))); - connect(KMKernel::self()->storageServiceManager(), SIGNAL(actionFailed(QString,QString)), this, SLOT(slotActionFailed(QString,QString))); + connect(mStorageManager, SIGNAL(uploadFileDone(QString,QString)), this, SLOT(slotUploadFileDone(QString,QString))); + connect(mStorageManager, SIGNAL(uploadFileFailed(QString,QString)), this, SLOT(slotUploadFileFailed(QString,QString))); + connect(mStorageManager, SIGNAL(shareLinkDone(QString,QString)), this, SLOT(slotShareLinkDone(QString,QString))); + connect(mStorageManager, SIGNAL(uploadFileStart(PimCommon::StorageServiceAbstract*)), this, SLOT(slotUploadFileStart(PimCommon::StorageServiceAbstract*))); + connect(mStorageManager, SIGNAL(actionFailed(QString,QString)), this, SLOT(slotActionFailed(QString,QString))); } //----------------------------------------------------------------------------- @@ -1349,15 +1353,17 @@ connect(mSubjectAction, SIGNAL(triggered(bool)), SLOT(slotView())); //end of checkable - action = new KAction( i18n("Append S&ignature"), this ); - actionCollection()->addAction( QLatin1String("append_signature"), action ); - connect( action, SIGNAL(triggered(bool)), mComposerBase->signatureController(), SLOT(appendSignature())); - action = new KAction( i18n("Pr&epend Signature"), this ); - actionCollection()->addAction( QLatin1String("prepend_signature"), action ); - connect( action, SIGNAL(triggered(bool)), mComposerBase->signatureController(), SLOT(prependSignature()) ); - action = new KAction( i18n("Insert Signature At C&ursor Position"), this ); - actionCollection()->addAction( QLatin1String("insert_signature_at_cursor_position"), action ); - connect( action, SIGNAL(triggered(bool)), mComposerBase->signatureController(), SLOT(insertSignatureAtCursor()) ); + mAppendSignature = new KAction( i18n("Append S&ignature"), this ); + actionCollection()->addAction( QLatin1String("append_signature"), mAppendSignature ); + connect( mAppendSignature, SIGNAL(triggered(bool)), mComposerBase->signatureController(), SLOT(appendSignature())); + + mPrependSignature = new KAction( i18n("Pr&epend Signature"), this ); + actionCollection()->addAction( QLatin1String("prepend_signature"), mPrependSignature ); + connect( mPrependSignature, SIGNAL(triggered(bool)), mComposerBase->signatureController(), SLOT(prependSignature()) ); + + mInsertSignatureAtCursorPosition = new KAction( i18n("Insert Signature At C&ursor Position"), this ); + actionCollection()->addAction( QLatin1String("insert_signature_at_cursor_position"), mInsertSignatureAtCursorPosition ); + connect( mInsertSignatureAtCursorPosition, SIGNAL(triggered(bool)), mComposerBase->signatureController(), SLOT(insertSignatureAtCursor()) ); action = new KAction( i18n("Insert Special Character..."), this ); @@ -1444,7 +1450,7 @@ mCryptoModuleAction->setToolTip( i18n( "Select a cryptographic format for this message" ) ); mComposerBase->editor()->createActions( actionCollection() ); - actionCollection()->addAction( QLatin1String("shared_link"), KMKernel::self()->storageServiceManager()->menuShareLinkServices(this) ); + actionCollection()->addAction( QLatin1String("shared_link"), mStorageManager->menuShareLinkServices(this) ); createGUI( QLatin1String("kmcomposerui.rc") ); connect( toolBar( QLatin1String("htmlToolBar") )->toggleViewAction(), @@ -2440,7 +2446,8 @@ KMime::Message::Ptr msg( new KMime::Message ); MessageHelper::initHeader( msg, KMKernel::self()->identityManager() ); - win = new KMComposeWin( msg, false, false ); + win = new KMComposeWin( msg, false, false, KMail::Composer::New ); + win->setCollectionForNewMessage(mCollectionForNewMessage); win->show(); } @@ -3209,6 +3216,11 @@ mLastIdentityHasSigningKey = bNewIdentityHasSigningKey; mLastIdentityHasEncryptionKey = bNewIdentityHasEncryptionKey; + const KPIMIdentities::Signature sig = const_cast( ident ).signature(); + bool isEnabledSignature = sig.isEnabledSignature(); + mAppendSignature->setEnabled(isEnabledSignature); + mPrependSignature->setEnabled(isEnabledSignature); + mInsertSignatureAtCursorPosition->setEnabled(isEnabledSignature); mId = uoid; changeCryptoAction(); @@ -3448,6 +3460,7 @@ void KMComposeWin::slotFccFolderChanged(const Akonadi::Collection& collection) { mComposerBase->setFcc( collection ); + mComposerBase->editor()->document()->setModified(true); } void KMComposeWin::insertSpecialCharacter() @@ -3599,3 +3612,9 @@ KMessageBox::error(this, i18n("%1 return an error '%2'", serviceName, error), i18n("Error")); --mNumProgressUploadFile; } + +void KMComposeWin::slotTransportChanged() +{ + mComposerBase->editor()->document()->setModified(true); +} + diff -Nru kdepim-4.13.0/kmail/editor/kmcomposewin.h kdepim-4.13.3/kmail/editor/kmcomposewin.h --- kdepim-4.13.0/kmail/editor/kmcomposewin.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/editor/kmcomposewin.h 2014-07-09 12:18:50.000000000 +0000 @@ -103,6 +103,7 @@ class CustomToolsWidget; class LineEditWithAutoCorrection; class StorageServiceAbstract; +class StorageServiceManager; } //----------------------------------------------------------------------------- @@ -460,6 +461,7 @@ void slotUploadFileStart(PimCommon::StorageServiceAbstract *service); void slotActionFailed(const QString &serviceName, const QString &error); + void slotTransportChanged(); public: // kmcommand // FIXME we need to remove these, but they're pure virtual in Composer. void addAttach( KMime::Content *msgPart ); @@ -642,6 +644,9 @@ KToggleAction *mIdentityAction, *mTransportAction, *mFccAction; KToggleAction *mWordWrapAction, *mFixedFontAction, *mAutoSpellCheckingAction; KToggleAction *mDictionaryAction, *mSnippetAction, *mTranslateAction; + KAction *mAppendSignature; + KAction *mPrependSignature; + KAction *mInsertSignatureAtCursorPosition; KToggleAction *mGenerateShortenUrl; KToggleAction *markupAction; @@ -691,6 +696,7 @@ Akonadi::Collection mCollectionForNewMessage; QMap mExtraHeaders; int mNumProgressUploadFile; + PimCommon::StorageServiceManager *mStorageManager; }; #endif diff -Nru kdepim-4.13.0/kmail/kcm_kpimidentities/kcm_kpimidentities.desktop kdepim-4.13.3/kmail/kcm_kpimidentities/kcm_kpimidentities.desktop --- kdepim-4.13.0/kmail/kcm_kpimidentities/kcm_kpimidentities.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/kcm_kpimidentities/kcm_kpimidentities.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -155,6 +155,7 @@ X-KDE-Keywords[da]=kmail,identitet X-KDE-Keywords[de]=KMail,Identitäten X-KDE-Keywords[el]=kmail,ταυτότητα +X-KDE-Keywords[en_GB]=kmail,identity X-KDE-Keywords[es]=kmail,identidad X-KDE-Keywords[et]=kmail,identiteet X-KDE-Keywords[fi]=kmail, identity, henkilöys, henkilöllisyys diff -Nru kdepim-4.13.0/kmail/kconf_update/kmail.upd kdepim-4.13.3/kmail/kconf_update/kmail.upd --- kdepim-4.13.0/kmail/kconf_update/kmail.upd 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/kconf_update/kmail.upd 2014-07-09 12:18:50.000000000 +0000 @@ -229,6 +229,12 @@ Id=4.13 File=akonadi_folderarchive_agentrc,foldermailarchiverc AllGroups + +Id=4.13.2 +File=kmail2rc +Group=GrantleeTheme +Key=grantlee-theme-name,grantlee-mail-theme-name + # # Important notice: # If you add updates here, keep this text below them. diff -Nru kdepim-4.13.0/kmail/kmkernel.cpp kdepim-4.13.3/kmail/kmkernel.cpp --- kdepim-4.13.0/kmail/kmkernel.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/kmkernel.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -973,11 +973,8 @@ return false; } -void KMKernel::checkMailOnStartup() +void KMKernel::verifyAccount() { - if ( !kmkernel->askToGoOnline() ) - return; - const QString resourceGroupPattern( QLatin1String("Resource %1") ); const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances(); @@ -997,6 +994,27 @@ } } +void KMKernel::slotCheckAccount(Akonadi::ServerManager::State state) +{ + if (state == Akonadi::ServerManager::Running) { + disconnect(Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State))); + verifyAccount(); + } +} + +void KMKernel::checkMailOnStartup() +{ + if ( !kmkernel->askToGoOnline() ) + return; + + if (Akonadi::ServerManager::state() != Akonadi::ServerManager::Running) { + connect(Akonadi::ServerManager::self(), SIGNAL(stateChanged(Akonadi::ServerManager::State)), + SLOT(slotCheckAccount(Akonadi::ServerManager::State))); + } else { + verifyAccount(); + } +} + bool KMKernel::askToGoOnline() { // already asking means we are offline and need to wait anyhow diff -Nru kdepim-4.13.0/kmail/kmkernel.h kdepim-4.13.3/kmail/kmkernel.h --- kdepim-4.13.0/kmail/kmkernel.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/kmkernel.h 2014-07-09 12:18:50.000000000 +0000 @@ -490,7 +490,9 @@ void slotSystemNetworkStatusChanged( Solid::Networking::Status ); void slotCollectionChanged(const Akonadi::Collection &, const QSet &set); + void slotCheckAccount(Akonadi::ServerManager::State state); private: + void verifyAccount(); void resourceGoOnLine(); void openReader( bool onlyCheck ); QSharedPointer currentFolderCollection(); diff -Nru kdepim-4.13.0/kmail/kmmainwidget.cpp kdepim-4.13.3/kmail/kmmainwidget.cpp --- kdepim-4.13.0/kmail/kmmainwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/kmmainwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -783,9 +783,9 @@ { if ( mFavoriteCollectionsView ) { if ( MailCommon::MailCommonSettings::self()->favoriteCollectionViewMode() == MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::IconMode ) - mFavoriteCollectionsView->setViewMode( QListView::IconMode ); + mFavoriteCollectionsView->changeViewMode( QListView::IconMode ); else if ( MailCommon::MailCommonSettings::self()->favoriteCollectionViewMode() == MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::ListMode ) - mFavoriteCollectionsView->setViewMode( QListView::ListMode ); + mFavoriteCollectionsView->changeViewMode( QListView::ListMode ); else Q_ASSERT(false); // we should never get here in hidden mode mFavoriteCollectionsView->setDropActionMenuEnabled( kmkernel->showPopupAfterDnD() ); @@ -1157,7 +1157,7 @@ actionCollection()->action( QLatin1String("go_next_unread_message") )->setEnabled( enable_goto_unread ); actionCollection()->action( QLatin1String("go_prev_message") )->setEnabled( hasMails ); actionCollection()->action( QLatin1String("go_prev_unread_message") )->setEnabled( enable_goto_unread ); - if ( mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MarkAllMailAsRead ) ) { + if ( mAkonadiStandardActionManager && mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MarkAllMailAsRead ) ) { mAkonadiStandardActionManager->action( Akonadi::StandardMailActionManager::MarkAllMailAsRead )->setEnabled(hasUnreadMails); } } diff -Nru kdepim-4.13.0/kmail/kmstartup.cpp kdepim-4.13.3/kmail/kmstartup.cpp --- kdepim-4.13.0/kmail/kmstartup.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/kmstartup.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -58,7 +58,9 @@ "4.0-misc", "4.2", "4.4-akonadi", - "4.12" + "4.12", + "4.13", + "4.13.2" }; static const int numUpdates = sizeof updates / sizeof *updates; // Warning: do not remove entries in the above array, or the update-level check below will break @@ -97,6 +99,7 @@ "kabc", "akonadi_sendlater_agent", "akonadi_folderagent_agent", + "akonadi_imap_resource", "libkgapi" }; diff -Nru kdepim-4.13.0/kmail/kmsystemtray.cpp kdepim-4.13.3/kmail/kmsystemtray.cpp --- kdepim-4.13.0/kmail/kmsystemtray.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/kmsystemtray.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -84,6 +84,8 @@ connect( KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), this, SLOT(slotGeneralPaletteChanged())); + connect( KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()), this, SLOT(slotGeneralFontChanged()) ); + connect( this, SIGNAL(activateRequested(bool,QPoint)), this, SLOT(slotActivated()) ); connect( contextMenu(), SIGNAL(aboutToShow()), @@ -177,10 +179,16 @@ return mMode; } +void KMSystemTray::slotGeneralFontChanged() +{ + updateSystemTray(); +} + void KMSystemTray::slotGeneralPaletteChanged() { const KColorScheme scheme( QPalette::Active, KColorScheme::View ); mTextColor = scheme.foreground( KColorScheme::LinkText ).color(); + updateSystemTray(); } diff -Nru kdepim-4.13.0/kmail/kmsystemtray.h kdepim-4.13.3/kmail/kmsystemtray.h --- kdepim-4.13.0/kmail/kmsystemtray.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/kmsystemtray.h 2014-07-09 12:18:50.000000000 +0000 @@ -65,6 +65,7 @@ void initListOfCollection(); void slotCollectionStatisticsChanged( Akonadi::Collection::Id ,const Akonadi::CollectionStatistics &); void slotGeneralPaletteChanged(); + void slotGeneralFontChanged(); private: bool mainWindowIsOnCurrentDesktop(); diff -Nru kdepim-4.13.0/kmail/Mainpage.dox kdepim-4.13.3/kmail/Mainpage.dox --- kdepim-4.13.0/kmail/Mainpage.dox 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/Mainpage.dox 2014-07-09 12:18:50.000000000 +0000 @@ -1,2 +1,2 @@ -// DOXYGEN_REFERENCES = kdecore kdeui kio kparts kutils sonnet kresources kabc gpgme++ qgpgme kleo libkdepim +// DOXYGEN_REFERENCES = kdecore kdeui kio kparts kutils sonnet kresources kabc gpgme++ qgpgme kleo libkdepim akonadi // DOXYGEN_SET_IGNORE_PREFIX = KM K diff -Nru kdepim-4.13.0/kmail/settings/kmail.kcfg.cmake kdepim-4.13.3/kmail/settings/kmail.kcfg.cmake --- kdepim-4.13.0/kmail/settings/kmail.kcfg.cmake 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kmail/settings/kmail.kcfg.cmake 2014-07-09 12:18:50.000000000 +0000 @@ -472,4 +472,8 @@ 100
    + + + + diff -Nru kdepim-4.13.0/knotes/apps/main.cpp kdepim-4.13.3/knotes/apps/main.cpp --- kdepim-4.13.0/knotes/apps/main.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/apps/main.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -18,6 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *******************************************************************/ +#include #include "kdepim-version.h" #include "knotes_options.h" #include "apps/application.h" @@ -57,6 +58,10 @@ KUniqueApplication::addCmdLineOptions(); + if ( !Application::start() ) { + qDebug()<<" knotes already started"; + return 0; + } // Create Application diff -Nru kdepim-4.13.0/knotes/configdialog/knoteconfigdialog.cpp kdepim-4.13.3/knotes/configdialog/knoteconfigdialog.cpp --- kdepim-4.13.0/knotes/configdialog/knoteconfigdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/configdialog/knoteconfigdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -282,7 +282,7 @@ void KNotePrintConfig::defaults() { - mSelectTheme->setCurrentIndex(0); + mSelectTheme->selectDefaultTheme(); Q_EMIT changed(true); } diff -Nru kdepim-4.13.0/knotes/data/knote_config_collection.desktop kdepim-4.13.3/knotes/data/knote_config_collection.desktop --- kdepim-4.13.0/knotes/data/knote_config_collection.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/data/knote_config_collection.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -15,11 +15,18 @@ Name=Collections Name[ca]=Col·leccions Name[cs]=Sbírky +Name[da]=Samlinger Name[de]=Sammlungen +Name[en_GB]=Collections Name[es]=Colecciones +Name[et]=Kogud Name[fi]=Kokoelmat +Name[fr]=Collections +Name[gl]=Coleccións +Name[hu]=Gyűjtemények Name[ia]=Collectiones Name[it]=Collezioni +Name[nb]=Samlinger Name[nds]=Sammeln Name[nl]=Verzamelingen Name[pl]=Zbiory @@ -43,7 +50,9 @@ Comment[da]=Opsætning af samlinger for noter Comment[de]=Sammlungen für Notizen einrichten Comment[el]=Ρύθμιση συλλογών για τις σημειώσεις +Comment[en_GB]=Setup collections for notes Comment[es]=Configurar colecciones para notas +Comment[et]=Märkmete kogude seadistamine Comment[fi]=Muistiinpanojen kokoelma-asetukset Comment[fr]=Configuration des collections pour les notes Comment[gl]=Configurar as coleccións de notas diff -Nru kdepim-4.13.0/knotes/data/knote_config_print.desktop kdepim-4.13.3/knotes/data/knote_config_print.desktop --- kdepim-4.13.0/knotes/data/knote_config_print.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/data/knote_config_print.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -20,7 +20,9 @@ Name[da]=Udskriv Name[de]=Drucken Name[el]=Εκτύπωση +Name[en_GB]=Print Name[es]=Imprimir +Name[et]=Trükkimine Name[fi]=Tulostus Name[fr]=Impression Name[gl]=Imprimir @@ -53,7 +55,9 @@ Comment[da]=Opsætning af udskrift af noter Comment[de]=Drucken für Notizen einrichten Comment[el]=Ρύθμιση εκτύπωσης για τις σημειώσεις +Comment[en_GB]=Setup printing for notes Comment[es]=Configurar impresión para notas +Comment[et]=Märkmete trükkimise seadistamine Comment[fi]=Muistiinpanojen tulostusasetukset Comment[fr]=Configuration de l'impression pour les notes Comment[gl]=Configurar a impresión das notas diff -Nru kdepim-4.13.0/knotes/data/knotes.notifyrc kdepim-4.13.3/knotes/data/knotes.notifyrc --- kdepim-4.13.0/knotes/data/knotes.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/data/knotes.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -8,7 +8,9 @@ Comment[da]=noter Comment[de]=Notizen Comment[el]=σημειώσεις +Comment[en_GB]=notes Comment[es]=notas +Comment[et]=märkmed Comment[fi]=muistiinpanot Comment[fr]=Notes Comment[gl]=notas @@ -40,7 +42,9 @@ Name[da]=Modtog en note Name[de]=Erhaltene Notiz Name[el]=Σημείωση λήφθηκε +Name[en_GB]=Received note Name[es]=Nota recibida +Name[et]=Saadi märge Name[fi]=Muistiinpano vastaanotettu Name[fr]=Notes reçues Name[gl]=Nota recibida diff -Nru kdepim-4.13.0/knotes/Mainpage.dox kdepim-4.13.3/knotes/Mainpage.dox --- kdepim-4.13.0/knotes/Mainpage.dox 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/Mainpage.dox 2014-07-09 12:18:50.000000000 +0000 @@ -1 +1 @@ -// DOXYGEN_REFERENCES = kdecore kdeui kresources +// DOXYGEN_REFERENCES = kdecore kdeui akonadi diff -Nru kdepim-4.13.0/knotes/notes/knote.cpp kdepim-4.13.3/knotes/notes/knote.cpp --- kdepim-4.13.0/knotes/notes/knote.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/notes/knote.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -145,7 +145,8 @@ } if (set.contains("PLD:RFC822")) { KMime::Message::Ptr noteMessage = item.payload(); - setName(noteMessage->subject(false)->asUnicodeString()); + const KMime::Headers::Subject * const subject = noteMessage ? noteMessage->subject(false) : 0; + setName(subject ? subject->asUnicodeString() : QString()); if ( noteMessage->contentType()->isHTMLText() ) { m_editor->setAcceptRichText(true); m_editor->setHtml(noteMessage->mainBodyPart()->decodedText()); @@ -214,7 +215,9 @@ saveNoteContent(); } if (needToSave) { - qDebug()<<" saveNote "<exec(); @@ -319,6 +322,7 @@ } } if (!mBlockSave) { + updateAllAttributes(); Akonadi::ItemModifyJob *job = new Akonadi::ItemModifyJob(mItem); #ifdef DEBUG_SAVE_NOTE qDebug()<<" void KNote::slotUpdateReadOnly() slotNoteSaved(KJob*)"; @@ -358,7 +362,7 @@ updateFocus(); } -void KNote::slotClose() +void KNote::updateAllAttributes() { NoteShared::NoteDisplayAttribute *attribute = mItem.attribute(Akonadi::Entity::AddIfMissing); #ifdef Q_WS_X11 @@ -370,9 +374,18 @@ } #endif saveNoteContent(); - m_editor->clearFocus(); attribute->setIsHidden(true); attribute->setPosition(pos()); + const QSize currentSize(QSize(width(), height())); + if (attribute->size() != currentSize) { + attribute->setSize(currentSize); + } +} + +void KNote::slotClose() +{ + updateAllAttributes(); + m_editor->clearFocus(); Akonadi::ItemModifyJob *job = new Akonadi::ItemModifyJob(mItem); #ifdef DEBUG_SAVE_NOTE qDebug()<<"slotClose() slotNoteSaved(KJob*)"; @@ -855,7 +868,10 @@ { mBlockSave = true; KMime::Message::Ptr noteMessage = mItem.payload(); - setName(noteMessage->subject(false)->asUnicodeString()); + const KMime::Headers::Subject * const subject = noteMessage ? noteMessage->subject(false) : 0; + if (subject) { + setName(subject->asUnicodeString()); + } if ( noteMessage->contentType()->isHTMLText() ) { m_editor->setAcceptRichText(true); m_editor->setHtml(noteMessage->mainBodyPart()->decodedText()); @@ -922,17 +938,18 @@ // HACK: update the icon color - again after showing the note, to make kicker // aware of the new colors KIconEffect effect; - QPixmap icon = effect.apply( qApp->windowIcon().pixmap( + const QColor col = mDisplayAttribute->backgroundColor(); + const QPixmap icon = effect.apply( qApp->windowIcon().pixmap( IconSize( KIconLoader::Desktop ), IconSize( KIconLoader::Desktop ) ), KIconEffect::Colorize, - 1, mDisplayAttribute->backgroundColor(), false ); - QPixmap miniIcon = effect.apply( qApp->windowIcon().pixmap( + 1, col, false ); +#ifdef Q_WS_X11 + const QPixmap miniIcon = effect.apply( qApp->windowIcon().pixmap( IconSize( KIconLoader::Small ), IconSize( KIconLoader::Small ) ), KIconEffect::Colorize, - 1, mDisplayAttribute->backgroundColor(), false ); -#ifdef Q_WS_X11 + 1, col, false ); KWindowSystem::setIcons( winId(), icon, miniIcon ); #endif diff -Nru kdepim-4.13.0/knotes/notes/knote.h kdepim-4.13.3/knotes/notes/knote.h --- kdepim-4.13.0/knotes/notes/knote.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/notes/knote.h 2014-07-09 12:18:50.000000000 +0000 @@ -118,7 +118,6 @@ void slotNoteSaved(KJob *job); private: - QString createConfig(); void buildGui(); void createActions(); void createNoteEditor(const QString &configFile); @@ -135,6 +134,7 @@ void setDisplayDefaultValue(); private: + void updateAllAttributes(); void saveNoteContent(); Akonadi::Item mItem; QLayout *m_noteLayout; diff -Nru kdepim-4.13.0/knotes/print/knoteprinter.cpp kdepim-4.13.3/knotes/print/knoteprinter.cpp --- kdepim-4.13.0/knotes/print/knoteprinter.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/print/knoteprinter.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -73,9 +74,10 @@ { QPrinter printer( QPrinter::HighResolution ); //printer.setFullPage( true ); //disabled, causes asymmetric margins - QPrintDialog printDialog(/*KdePrint::createPrintDialog*/(&printer)); - printDialog.setWindowTitle( dialogCaption ); - if ( !printDialog.exec() ) { + QPointer printDialog = KdePrint::createPrintDialog(&printer); + printDialog->setWindowTitle(dialogCaption); + if ( !printDialog->exec() || !printDialog ) { + delete printDialog; return; } print(printer, htmlText); diff -Nru kdepim-4.13.0/knotes/print/knoteprintobject.cpp kdepim-4.13.3/knotes/print/knoteprintobject.cpp --- kdepim-4.13.0/knotes/print/knoteprintobject.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/print/knoteprintobject.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -51,7 +51,8 @@ QString KNotePrintObject::name() const { KMime::Message::Ptr noteMessage = mItem.payload(); - return noteMessage->subject(false)->asUnicodeString(); + const KMime::Headers::Subject * const subject = noteMessage ? noteMessage->subject(false) : 0; + return subject ? subject->asUnicodeString() : QString(); } QString KNotePrintObject::currentDateTime() const @@ -69,7 +70,7 @@ { NoteShared::NoteAlarmAttribute *attr = mItem.attribute(); if (attr) { - return KGlobal::locale()->formatDateTime(attr->dateTime()); + return KGlobal::locale()->formatDateTime(attr->dateTime(),KLocale::LongDate); } return QString(); } diff -Nru kdepim-4.13.0/knotes/print/knoteprintselectthemecombobox.cpp kdepim-4.13.3/knotes/print/knoteprintselectthemecombobox.cpp --- kdepim-4.13.0/knotes/print/knoteprintselectthemecombobox.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/print/knoteprintselectthemecombobox.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -87,4 +87,12 @@ return itemData(currentIndex()).toString(); } +void KNotePrintSelectThemeComboBox::selectDefaultTheme() +{ + const bool bUseDefaults = KNotesGlobalConfig::self()->useDefaults( true ); + const QString defaultTheme = KNotesGlobalConfig::self()->theme(); + const int index = findData(defaultTheme); + setCurrentIndex(index == -1 ? 0 : index); + KNotesGlobalConfig::self()->useDefaults( bUseDefaults ); +} diff -Nru kdepim-4.13.0/knotes/print/knoteprintselectthemecombobox.h kdepim-4.13.3/knotes/print/knoteprintselectthemecombobox.h --- kdepim-4.13.0/knotes/print/knoteprintselectthemecombobox.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/print/knoteprintselectthemecombobox.h 2014-07-09 12:18:50.000000000 +0000 @@ -31,6 +31,7 @@ QString selectedTheme() const; void loadThemes(); + void selectDefaultTheme(); }; #endif // KNOTEPRINTSELECTTHEMECOMBOBOX_H diff -Nru kdepim-4.13.0/knotes/print/README.themes kdepim-4.13.3/knotes/print/README.themes --- kdepim-4.13.0/knotes/print/README.themes 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/print/README.themes 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,7 @@ - note description: use "description" keyword - current date time: use "currentDateTime" keyword - allow to inform that we have an alarm: use "hasAlarm" keyword -- show alarm info: use "alarm" keyword +- show alarm info: use "alarm" keyword (return date time as long format) - allow to inform that note is locked: use "isLock" keyword - note backgroundcolor name : use "backgroundColorName" keyword diff -Nru kdepim-4.13.0/knotes/print/themes/big-title/theme.desktop kdepim-4.13.3/knotes/print/themes/big-title/theme.desktop --- kdepim-4.13.0/knotes/print/themes/big-title/theme.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/print/themes/big-title/theme.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=Stor overskrift Name[de]=Großer Titel Name[el]=Μεγάλος τίτλος +Name[en_GB]=Big Title Name[es]=Título grande +Name[et]=Suur pealkiri Name[fi]=Iso otsikko Name[fr]=Grand titre Name[gl]=Título Grande @@ -38,7 +40,9 @@ Description[da]=Udskriftstema til KNote med stor overskrift Description[de]=KNote-Druckdesign mit großem Titel Description[el]=Θέμα εκτύπωσης του KNote με μεγάλο τίτλο +Description[en_GB]=KNote printing theme with big title Description[es]=Tema de impresión de KNote con título grande +Description[et]=KNote'i suure pealkirjaga trükkimisteema Description[fi]=KNoten tulostusteema ison otsikon kanssa Description[fr]=Thème d'impression avec grand titre pour knotes Description[gl]=Tema de impresión do KNote cun título grande diff -Nru kdepim-4.13.0/knotes/print/themes/default/theme.desktop kdepim-4.13.3/knotes/print/themes/default/theme.desktop --- kdepim-4.13.0/knotes/print/themes/default/theme.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/print/themes/default/theme.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -28,6 +28,7 @@ Name[ia]=Predefinite Name[is]=Sjálfgefið Name[it]=Predefinito +Name[ja]=標準 Name[ka]=ნაგულისხმევი Name[kk]=Әдетті Name[lv]=Noklusētais @@ -73,7 +74,9 @@ Description[da]=Standard knotes udskriftstema Description[de]=KNotes-Standarddruckstil Description[el]=Προκαθορισμένο θέμα εκτύπωσης του knotes +Description[en_GB]=Default knotes printing theme Description[es]=Tema de impresión predeterminado de knotes +Description[et]=KNotesi vaikimisi trükkimisteema Description[fi]=KNotesin oletustulostusteema Description[fr]=Thème d'impression par défaut pour knotes Description[gl]=Tema de impresión do knotes por omisión diff -Nru kdepim-4.13.0/knotes/tests/apps/knotesakonadiapp.cpp kdepim-4.13.3/knotes/tests/apps/knotesakonadiapp.cpp --- kdepim-4.13.0/knotes/tests/apps/knotesakonadiapp.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/tests/apps/knotesakonadiapp.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -79,13 +79,16 @@ } if (set.contains("PLD:RFC822")) { KMime::Message::Ptr noteMessage = item.payload(); - note->title()->setText(noteMessage->subject(false)->asUnicodeString()); - if ( noteMessage->contentType()->isHTMLText() ) { - note->editor()->setAcceptRichText(true); - note->editor()->setHtml(noteMessage->mainBodyPart()->decodedText()); - } else { - note->editor()->setAcceptRichText(false); - note->editor()->setPlainText(noteMessage->mainBodyPart()->decodedText()); + if (noteMessage) { + const KMime::Headers::Subject * const subject = noteMessage->subject(false); + note->title()->setText(subject ? subject->asUnicodeString() : QString()); + if ( noteMessage->contentType()->isHTMLText() ) { + note->editor()->setAcceptRichText(true); + note->editor()->setHtml(noteMessage->mainBodyPart()->decodedText()); + } else { + note->editor()->setAcceptRichText(false); + note->editor()->setPlainText(noteMessage->mainBodyPart()->decodedText()); + } } } if (set.contains("ATR:NoteDisplayAttribute")) { @@ -109,7 +112,8 @@ continue; KMime::Message::Ptr noteMessage = item.payload(); KNoteAkonadiNote *note = new KNoteAkonadiNote(0); - note->title()->setText(noteMessage->subject(false)->asUnicodeString()); + const KMime::Headers::Subject * const subject = noteMessage ? noteMessage->subject(false) : 0; + note->title()->setText(subject ? subject->asUnicodeString() : QString()); if ( noteMessage->contentType()->isHTMLText() ) { note->editor()->setAcceptRichText(true); note->editor()->setHtml(noteMessage->mainBodyPart()->decodedText()); diff -Nru kdepim-4.13.0/knotes/utils/knoteutils.cpp kdepim-4.13.3/knotes/utils/knoteutils.cpp --- kdepim-4.13.0/knotes/utils/knoteutils.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/knotes/utils/knoteutils.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -70,7 +70,7 @@ if ( needMigration ) { const bool enabled = migrationCfg.readEntry( "Enabled", true ); const int currentVersion = migrationCfg.readEntry( "Version", 0 ); - const int targetVersion = migrationCfg.readEntry( "TargetVersion", 1 ); + const int targetVersion = migrationCfg.readEntry( "TargetVersion", 2 ); if ( enabled && currentVersion < targetVersion ) { const int choice = KMessageBox::questionYesNoCancel( 0, i18n( "Thanks for using KNotes!" diff -Nru kdepim-4.13.0/kontact/plugins/kjots/kjots_plugin.desktop kdepim-4.13.3/kontact/plugins/kjots/kjots_plugin.desktop --- kdepim-4.13.0/kontact/plugins/kjots/kjots_plugin.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/kjots/kjots_plugin.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -68,7 +68,7 @@ Name=Notebooks Name[ar]=دفاتر الملاحظات Name[bs]=Sveske -Name[ca]=Notebooks +Name[ca]=Llibres de notes Name[ca@valencia]=Notebooks Name[cs]=Poznámky Name[da]=Notesbøger diff -Nru kdepim-4.13.0/kontact/plugins/kjots/kjots.setdlg kdepim-4.13.3/kontact/plugins/kjots/kjots.setdlg --- kdepim-4.13.0/kontact/plugins/kjots/kjots.setdlg 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/kjots/kjots.setdlg 2014-07-09 12:18:50.000000000 +0000 @@ -2,7 +2,7 @@ Name=Notebooks Name[ar]=دفاتر الملاحظات Name[bs]=Sveske -Name[ca]=Notebooks +Name[ca]=Llibres de notes Name[ca@valencia]=Notebooks Name[cs]=Poznámky Name[da]=Notesbøger @@ -52,7 +52,7 @@ Comment=Notebooks Component Comment[ar]=مكون دفاتر الملاحظات Comment[bs]=Komponenta sveski -Comment[ca]=Component del Notebooks +Comment[ca]=Component dels llibres de notes Comment[ca@valencia]=Component del Notebooks Comment[cs]=Komponenta poznámek Comment[da]=Notesbogkomponent diff -Nru kdepim-4.13.0/kontact/plugins/kmail/kcmkmailsummary.desktop kdepim-4.13.3/kontact/plugins/kmail/kcmkmailsummary.desktop --- kdepim-4.13.0/kontact/plugins/kmail/kcmkmailsummary.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/kmail/kcmkmailsummary.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -137,6 +137,7 @@ X-KDE-Keywords[da]=e-mail, oversigt, indstil, indstillinger X-KDE-Keywords[de]=E-Mail,email,Übersicht,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=αλληλογραφία, σύνοψη, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=email, summary, configure, settings X-KDE-Keywords[es]=correo, resumen, configurar, preferencias X-KDE-Keywords[et]=e-post, meil, kokkuvõte, seadistamine, seadistused X-KDE-Keywords[fi]=email, sähköposti, summary, yhteenveto, configure, settings, asetukset diff -Nru kdepim-4.13.0/kontact/plugins/knotes/kcmknotessummary.desktop kdepim-4.13.3/kontact/plugins/knotes/kcmknotessummary.desktop --- kdepim-4.13.0/kontact/plugins/knotes/kcmknotessummary.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/knotes/kcmknotessummary.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -19,7 +19,9 @@ Name[da]=Nye noter Name[de]=Neue Notizen Name[el]=Νέες σημειώσεις +Name[en_GB]=New Notes Name[es]=Nuevas notas +Name[et]=Uued märkmed Name[fi]=Uudet muistiinpanot Name[fr]=Nouvelles notes Name[gl]=Novas notas @@ -50,7 +52,9 @@ Comment[da]=Opsætning af noteoversigt Comment[de]=Einstellung der Notizen-Übersicht Comment[el]=Ρύθμιση σύνοψης σημειώσεων +Comment[en_GB]=Notes Summary Setup Comment[es]=Configuración del resumen de notas +Comment[et]=Märkmete kokkuvõtte seadistus Comment[fi]=Muistiinpanoyhteenvedon asetukset Comment[fr]=Configuration du résumé des notes Comment[gl]=Configuración do resumo das notas @@ -80,7 +84,9 @@ X-KDE-Keywords[da]=noter, oversigt, indstil, indstillinger X-KDE-Keywords[de]=Notizen,Übersicht,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=σημειώσεις, σύνοψη, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=notes, summary, configure, settings X-KDE-Keywords[es]=notas, resumen, configurar, preferencias +X-KDE-Keywords[et]=märkmed, kokkuvõte, seadistamine, seadistused X-KDE-Keywords[fi]=notes, muistiinpanot, summary, yhteenveto, configure, asetukset X-KDE-Keywords[fr]=notes,résumé,configuration,paramètres X-KDE-Keywords[gl]=notas, resumo, configurar, opcións diff -Nru kdepim-4.13.0/kontact/plugins/knotes/knotesiconview.cpp kdepim-4.13.3/kontact/plugins/knotes/knotesiconview.cpp --- kdepim-4.13.0/kontact/plugins/knotes/knotesiconview.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/knotes/knotesiconview.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -132,7 +132,8 @@ void KNotesIconViewItem::prepare() { KMime::Message::Ptr noteMessage = mItem.payload(); - setText(noteMessage->subject(false)->asUnicodeString()); + const KMime::Headers::Subject * const subject = noteMessage ? noteMessage->subject(false) : 0; + setText(subject ? subject->asUnicodeString() : QString()); if ( mItem.hasAttribute() ) { mReadOnly = true; @@ -206,7 +207,8 @@ QString KNotesIconViewItem::realName() const { const KMime::Message::Ptr noteMessage = mItem.payload(); - return noteMessage->subject(false)->asUnicodeString(); + const KMime::Headers::Subject * const subject = noteMessage ? noteMessage->subject(false) : 0; + return subject ? subject->asUnicodeString() : QString(); } int KNotesIconViewItem::tabSize() const @@ -300,7 +302,8 @@ } if (set.contains("PLD:RFC822")) { KMime::Message::Ptr noteMessage = item.payload(); - setIconText(noteMessage->subject(false)->asUnicodeString(), false); + const KMime::Headers::Subject * const subject = noteMessage ? noteMessage->subject(false) : 0; + setIconText(subject ? subject->asUnicodeString() : QString(), false); } if (set.contains("ATR:NoteDisplayAttribute")) { updateSettings(); diff -Nru kdepim-4.13.0/kontact/plugins/knotes/knotes_plugin.cpp kdepim-4.13.3/kontact/plugins/knotes/knotes_plugin.cpp --- kdepim-4.13.0/kontact/plugins/knotes/knotes_plugin.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/knotes/knotes_plugin.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -223,6 +223,7 @@ { if ( part() ) { static_cast( part() )->newNote(); + core()->selectPlugin( this ); } } diff -Nru kdepim-4.13.0/kontact/plugins/knotes/summarywidget.cpp kdepim-4.13.3/kontact/plugins/knotes/summarywidget.cpp --- kdepim-4.13.0/kontact/plugins/knotes/summarywidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/knotes/summarywidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -143,7 +143,6 @@ mModelProxy->data( child, Akonadi::EntityTreeModel::ItemRole ).value(); if (item.isValid()) { - qDebug()<<" createNote "<()) + return; KMime::Message::Ptr noteMessage = item.payload(); - KUrlLabel *urlLabel = new KUrlLabel( QString::number( item.id() ), noteMessage->subject(false)->asUnicodeString(), this ); + if (!noteMessage) + return; + const KMime::Headers::Subject * const subject = noteMessage->subject(false); + KUrlLabel *urlLabel = new KUrlLabel( QString::number( item.id() ), subject ? subject->asUnicodeString() : QString(), this ); urlLabel->installEventFilter( this ); urlLabel->setAlignment( Qt::AlignLeft ); diff -Nru kdepim-4.13.0/kontact/plugins/korganizer/kcmapptsummary.desktop kdepim-4.13.3/kontact/plugins/korganizer/kcmapptsummary.desktop --- kdepim-4.13.0/kontact/plugins/korganizer/kcmapptsummary.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/korganizer/kcmapptsummary.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -122,12 +122,13 @@ X-KDE-Keywords[da]=kalender, begivenheder, indstil, indstillinger X-KDE-Keywords[de]=Ereignisse,Kalender,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=ημερολόγια, γεγονότα, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=calendar, events, configure, settings X-KDE-Keywords[es]=calendario, eventos, configurar, preferencias X-KDE-Keywords[et]=kalender, sündmused, seadistamine, seadistused X-KDE-Keywords[fi]=calendar, kalenteri, events, tapahtumat, configure, settings, asetukset X-KDE-Keywords[fr]=agenda,évènement,configuration,paramètres X-KDE-Keywords[ga]=féilire, imeachtaí, cumraigh, socruithe -X-KDE-Keywords[gl]=calendario,actividades,eventos,configurar,opcións +X-KDE-Keywords[gl]=calendario,actividades,actividades,configurar,opcións X-KDE-Keywords[hu]=naptár, események, beállítás, beállítások X-KDE-Keywords[ia]=calendario,eventos,configura,preferentias X-KDE-Keywords[it]=calendario, eventi, configurazione, impostazioni diff -Nru kdepim-4.13.0/kontact/plugins/korganizer/kcmtodosummary.desktop kdepim-4.13.3/kontact/plugins/korganizer/kcmtodosummary.desktop --- kdepim-4.13.0/kontact/plugins/korganizer/kcmtodosummary.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/korganizer/kcmtodosummary.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -122,6 +122,7 @@ X-KDE-Keywords[da]=kalender, gøremål, indstil, indstillinger X-KDE-Keywords[de]=Kalender,Aufgaben,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=ημερολόγιο, εργασίες, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=calendar, todos, configure, settings X-KDE-Keywords[es]=calendario, tareas pendientes, configurar, preferencias X-KDE-Keywords[et]=kalender, ülesanded, seadistamine, seadistused X-KDE-Keywords[fi]=calendar, kalenteri, todos, tehtävät, configure, settings, asetukset diff -Nru kdepim-4.13.0/kontact/plugins/planner/kcmplanner.desktop kdepim-4.13.3/kontact/plugins/planner/kcmplanner.desktop --- kdepim-4.13.0/kontact/plugins/planner/kcmplanner.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/planner/kcmplanner.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -119,6 +119,7 @@ X-KDE-Keywords[da]=kalender, gøremål, indstil, indstillinger X-KDE-Keywords[de]=Kalender,Aufgaben,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=ημερολόγιο, εργασίες, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=calendar, todos, configure, settings X-KDE-Keywords[es]=calendario, tareas pendientes, configurar, preferencias X-KDE-Keywords[et]=kalender, ülesanded, seadistamine, seadistused X-KDE-Keywords[fi]=calendar, kalenteri, todos, tehtävät, configure, settings, asetukset diff -Nru kdepim-4.13.0/kontact/plugins/specialdates/kcmsdsummary.desktop kdepim-4.13.3/kontact/plugins/specialdates/kcmsdsummary.desktop --- kdepim-4.13.0/kontact/plugins/specialdates/kcmsdsummary.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/plugins/specialdates/kcmsdsummary.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -124,6 +124,7 @@ X-KDE-Keywords[da]=fødselsdag, årsdag, helligdag, indstil, indstillinger X-KDE-Keywords[de]=Geburtstag,Jahrestag,Feiertag,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=γενέθλια, επέτειος, διακοπές, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=birthday, anniversary, holiday, configure, settings X-KDE-Keywords[es]=cumpleaños, aniversario, vacaciones, configurar, preferencias X-KDE-Keywords[et]=sünnipäev, tähtpäev, pidupäev, seadistamine, seadistused X-KDE-Keywords[fi]=birthday, syntymäpäivä, anniversary, vuosipäivä, holiday, loma, configure, settings, asetukset diff -Nru kdepim-4.13.0/kontact/src/aboutdialog.cpp kdepim-4.13.3/kontact/src/aboutdialog.cpp --- kdepim-4.13.0/kontact/src/aboutdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/aboutdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -38,263 +38,263 @@ #include AboutDialog::AboutDialog( KontactInterface::Core *core ) - : KPageDialog( core ), mCore( core ) + : KPageDialog( core ), mCore( core ) { - setCaption( i18n( "About Kontact" ) ); - setButtons( Close ); - setDefaultButton( Close ); - setModal( false ); - showButtonSeparator( true ); - setFaceType( KPageDialog::List ); - addAboutData( i18n( "Kontact Container" ), QLatin1String( "kontact" ), - KGlobal::mainComponent().aboutData() ); - - QList plugins = mCore->pluginList(); - QList::ConstIterator end = plugins.constEnd(); - QList::ConstIterator it = plugins.constBegin(); - for ( ; it != end; ++it ) { - addAboutPlugin( *it ); - } - - addLicenseText( KGlobal::mainComponent().aboutData() ); - - setInitialSize( QSize( 600, 400 ) ); - restoreDialogSize( KConfigGroup( KGlobal::config(), "AboutDialog" ) ); - connect( this, SIGNAL(finished(int)), this, SLOT(saveSize()) ); + setCaption( i18n( "About Kontact" ) ); + setButtons( Close ); + setDefaultButton( Close ); + setModal( false ); + showButtonSeparator( true ); + setFaceType( KPageDialog::List ); + addAboutData( i18n( "Kontact Container" ), QLatin1String( "kontact" ), + KGlobal::mainComponent().aboutData() ); + + QList plugins = mCore->pluginList(); + QList::ConstIterator end = plugins.constEnd(); + QList::ConstIterator it = plugins.constBegin(); + for ( ; it != end; ++it ) { + addAboutPlugin( *it ); + } + + addLicenseText( KGlobal::mainComponent().aboutData() ); + + setInitialSize( QSize( 600, 400 ) ); + restoreDialogSize( KConfigGroup( KGlobal::config(), "AboutDialog" ) ); + connect( this, SIGNAL(finished(int)), this, SLOT(saveSize()) ); } void AboutDialog::saveSize() { - KConfigGroup group( KGlobal::config(), "AboutDialog" ); - saveDialogSize( group ); - group.sync(); + KConfigGroup group( KGlobal::config(), "AboutDialog" ); + saveDialogSize( group ); + group.sync(); } void AboutDialog::addAboutPlugin( KontactInterface::Plugin *plugin ) { - addAboutData( plugin->title(), plugin->icon(), plugin->aboutData() ); + addAboutData( plugin->title(), plugin->icon(), plugin->aboutData() ); } void AboutDialog::addAboutData( const QString &title, const QString &icon, const KAboutData *about ) { - QIcon pixmap = KIcon( icon ); + QIcon pixmap = KIcon( icon ); - QFrame *topFrame = new QFrame(); - KPageWidgetItem *pageItem = new KPageWidgetItem( topFrame, title ); - pageItem->setIcon( KIcon( pixmap ) ); + QFrame *topFrame = new QFrame(); + KPageWidgetItem *pageItem = new KPageWidgetItem( topFrame, title ); + pageItem->setIcon( KIcon( pixmap ) ); - addPage( pageItem ); + addPage( pageItem ); - QBoxLayout *topLayout = new QVBoxLayout( topFrame ); + QBoxLayout *topLayout = new QVBoxLayout( topFrame ); - if ( !about ) { - QLabel *label = new QLabel( i18n( "No about information available." ), topFrame ); - topLayout->addWidget( label ); - } else { - QString text; + if ( !about ) { + QLabel *label = new QLabel( i18n( "No about information available." ), topFrame ); + topLayout->addWidget( label ); + } else { + QString text; - text += QLatin1String("

    "); - text += QLatin1String("") + about->programName() + QLatin1String(""); - text += QLatin1String("
    "); + text += QLatin1String("

    "); + text += QLatin1String("") + about->programName() + QLatin1String(""); + text += QLatin1String("
    "); - text += i18n( "Version %1", about->version() ); - text += QLatin1String("

    "); + text += i18n( "Version %1", about->version() ); + text += QLatin1String("

    "); - if ( !about->shortDescription().isEmpty() ) { - text += QLatin1String("

    ") + about->shortDescription() +QLatin1String( "
    ") + - about->copyrightStatement() + QLatin1String("

    "); - } + if ( !about->shortDescription().isEmpty() ) { + text += QLatin1String("

    ") + about->shortDescription() +QLatin1String( "
    ") + + about->copyrightStatement() + QLatin1String("

    "); + } - QString home = about->homepage(); - if ( !home.isEmpty() ) { - text += QLatin1String("") + home + QLatin1String("
    "); - } + QString home = about->homepage(); + if ( !home.isEmpty() ) { + text += QLatin1String("") + home + QLatin1String("
    "); + } - text.replace( QLatin1Char('\n'), QLatin1String("
    ") ); + text.replace( QLatin1Char('\n'), QLatin1String("
    ") ); - QLabel *label = new QLabel( text, topFrame ); - label->setAlignment( Qt::AlignTop ); - label->setOpenExternalLinks(true); - label->setTextInteractionFlags( - Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard | Qt::LinksAccessibleByMouse ); - topLayout->addWidget( label ); - - KTextBrowser *personView = new KTextBrowser( topFrame ); - personView->setReadOnly( true ); - topLayout->addWidget( personView, 1 ); - - text.clear(); - const QList authors = about->authors(); - if ( !authors.isEmpty() ) { - text += i18n( "

    Authors:

    " ); - - QList::ConstIterator it; - QList::ConstIterator end(authors.end()); - for ( it = authors.begin(); it != end; ++it ) { - text += formatPerson( (*it).name(), (*it).emailAddress() ); - if ( !(*it).task().isEmpty() ) { - text += QLatin1String("") + (*it).task() + QLatin1String("
    "); + QLabel *label = new QLabel( text, topFrame ); + label->setAlignment( Qt::AlignTop ); + label->setOpenExternalLinks(true); + label->setTextInteractionFlags( + Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard | Qt::LinksAccessibleByMouse ); + topLayout->addWidget( label ); + + KTextBrowser *personView = new KTextBrowser( topFrame ); + personView->setReadOnly( true ); + topLayout->addWidget( personView, 1 ); + + text.clear(); + const QList authors = about->authors(); + if ( !authors.isEmpty() ) { + text += i18n( "

    Authors:

    " ); + + QList::ConstIterator it; + QList::ConstIterator end(authors.end()); + for ( it = authors.begin(); it != end; ++it ) { + text += formatPerson( (*it).name(), (*it).emailAddress() ); + if ( !(*it).task().isEmpty() ) { + text += QLatin1String("") + (*it).task() + QLatin1String("
    "); + } + } } - } - } - const QList credits = about->credits(); - if ( !credits.isEmpty() ) { - text += i18n( "

    Thanks to:

    " ); - - QList::ConstIterator it; - QList::ConstIterator end(credits.end()); - for ( it = credits.begin(); it != end; ++it ) { - text += formatPerson( (*it).name(), (*it).emailAddress() ); - if ( !(*it).task().isEmpty() ) { - text += QLatin1String("") + (*it).task() + QLatin1String("
    "); + const QList credits = about->credits(); + if ( !credits.isEmpty() ) { + text += i18n( "

    Thanks to:

    " ); + + QList::ConstIterator it; + QList::ConstIterator end(credits.end()); + for ( it = credits.begin(); it != end; ++it ) { + text += formatPerson( (*it).name(), (*it).emailAddress() ); + if ( !(*it).task().isEmpty() ) { + text += QLatin1String("") + (*it).task() + QLatin1String("
    "); + } + } } - } - } - const QList translators = about->translators(); - if ( !translators.isEmpty() ) { - text += i18n( "

    Translators:

    " ); - - QList::ConstIterator it; - QList::ConstIterator end(translators.end()); - for ( it = translators.begin(); it != end; ++it ) { - text += formatPerson( (*it).name(), (*it).emailAddress() ); - } - } -//krazy:excludeall=style (really need krazy conditional code sections) - text += i18n("

    \ - This Free Software product was improved as part of a commercial project:\ -

    Credits

    \ - Project Kowi (March 2007 - )

    \ - \ - Production / Project Coordination
    \ - Bernhard Reiter
    \ - Director of Development
    \ - Till Adam\ -

    \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
    \ - Osnabrück Unit, Intevation GmbH\ -
    \ - Unit Lead
    \ - Senior QA, Packaging
    \ - QA, Packaging
    \ - Additional NSIS
    \ - Backup Coordinator\ -
    \ - Bernhard Reiter
    \ - Bernhard Herzog
    \ - Ludwig Reiter
    \ - Emanuel Schütze
    \ - Dr. Jan-Oliver Wagner\ -
    \ -

    \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
    \ - Berlin Unit, Klarälvdalens Datakonsult AB\ -
    \ - Unit Lead
    \ - Development
    \ - Development
    \ - Additional D. + Crypto
    \ - Crypto GUI Development\ -
    \ - Till Adam
    \ - Jaroslaw Staniek
    \ - Volker Krause
    \ - Frank Osterfeld
    \ - Marc Mutz\ -
    \ -

    \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
    \ - Düsseldorf Unit, g10 Code GmbH\ -
    \ - Crypto-Backend Porting
    \ - Crypto-Backend\ -
    \ - Werner Koch
    \ - Marcus Brinkmann\ -
    \ -

    \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
    \ - External QA Darmstadt, basysKom GmbH\ -
    \ - Unit-Lead\ - \ - Dr. Stefan Werden\ -


    "); + const QList translators = about->translators(); + if ( !translators.isEmpty() ) { + text += i18n( "

    Translators:

    " ); + + QList::ConstIterator it; + QList::ConstIterator end(translators.end()); + for ( it = translators.begin(); it != end; ++it ) { + text += formatPerson( (*it).name(), (*it).emailAddress() ); + } + } + //krazy:excludeall=style (really need krazy conditional code sections) + text += i18n("

    \ + This Free Software product was improved as part of a commercial project:\ +

    Credits

    \ + Project Kowi (March 2007 - )

    \ + \ + Production / Project Coordination
    \ + Bernhard Reiter
    \ + Director of Development
    \ + Till Adam\ +

    \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
    \ + Osnabrück Unit, Intevation GmbH\ +
    \ + Unit Lead
    \ + Senior QA, Packaging
    \ + QA, Packaging
    \ + Additional NSIS
    \ + Backup Coordinator\ +
    \ + Bernhard Reiter
    \ + Bernhard Herzog
    \ + Ludwig Reiter
    \ + Emanuel Schütze
    \ + Dr. Jan-Oliver Wagner\ +
    \ +

    \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
    \ + Berlin Unit, Klarälvdalens Datakonsult AB\ +
    \ + Unit Lead
    \ + Development
    \ + Development
    \ + Additional D. + Crypto
    \ + Crypto GUI Development\ +
    \ + Till Adam
    \ + Jaroslaw Staniek
    \ + Volker Krause
    \ + Frank Osterfeld
    \ + Marc Mutz\ +
    \ +

    \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
    \ + Düsseldorf Unit, g10 Code GmbH\ +
    \ + Crypto-Backend Porting
    \ + Crypto-Backend\ +
    \ + Werner Koch
    \ + Marcus Brinkmann\ +
    \ +

    \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
    \ + External QA Darmstadt, basysKom GmbH\ +
    \ + Unit-Lead\ + \ + Dr. Stefan Werden\ +


    "); - personView->setText( text ); - } + personView->setText( text ); + } } QString AboutDialog::formatPerson( const QString &name, const QString &email ) { - QString text = name; - if ( !email.isEmpty() ) { - text += QLatin1String(" <") + email + QLatin1String(">"); - } + QString text = name; + if ( !email.isEmpty() ) { + text += QLatin1String(" <") + email + QLatin1String(">"); + } - text += QLatin1String("
    "); - return text; + text += QLatin1String("
    "); + return text; } void AboutDialog::addLicenseText( const KAboutData *about ) { - if ( !about || about->license().isEmpty() ) { - return; - } + if ( !about || about->license().isEmpty() ) { + return; + } - QPixmap pixmap = KIconLoader::global()->loadIcon( QLatin1String("help-about"), - KIconLoader::Desktop, 48 ); + QPixmap pixmap = KIconLoader::global()->loadIcon( QLatin1String("help-about"), + KIconLoader::Desktop, 48 ); - const QString title = i18n( "%1 License", about->programName() ); + const QString title = i18n( "%1 License", about->programName() ); - QFrame *topFrame = new QFrame(); - KPageWidgetItem *page = new KPageWidgetItem( topFrame, title ); - page->setIcon( KIcon( pixmap ) ); - addPage( page ); - QBoxLayout *topLayout = new QVBoxLayout( topFrame ); + QFrame *topFrame = new QFrame(); + KPageWidgetItem *page = new KPageWidgetItem( topFrame, title ); + page->setIcon( KIcon( pixmap ) ); + addPage( page ); + QBoxLayout *topLayout = new QVBoxLayout( topFrame ); - KTextBrowser *textBrowser = new KTextBrowser( topFrame ); - textBrowser->setHtml( QString::fromLatin1( "
    %1
    " ).arg( about->license() ) ); + KTextBrowser *textBrowser = new KTextBrowser( topFrame ); + textBrowser->setHtml( QString::fromLatin1( "
    %1
    " ).arg( about->license() ) ); - topLayout->addWidget( textBrowser ); + topLayout->addWidget( textBrowser ); } diff -Nru kdepim-4.13.0/kontact/src/aboutdialog.h kdepim-4.13.3/kontact/src/aboutdialog.h --- kdepim-4.13.0/kontact/src/aboutdialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/aboutdialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -28,8 +28,8 @@ #include namespace KontactInterface { - class Core; - class Plugin; +class Core; +class Plugin; } class KAboutData; @@ -38,12 +38,12 @@ class AboutDialog : public KPageDialog { - Q_OBJECT + Q_OBJECT - public: +public: explicit AboutDialog( KontactInterface::Core *core ); - protected: +protected: void addAboutPlugin( KontactInterface::Plugin *plugin ); void addAboutData( const QString &title, const QString &icon, @@ -53,10 +53,10 @@ QString formatPerson( const QString &name, const QString &email ); - private slots: +private slots: void saveSize(); - private: +private: KontactInterface::Core *mCore; }; diff -Nru kdepim-4.13.0/kontact/src/iconsidepane.cpp kdepim-4.13.3/kontact/src/iconsidepane.cpp --- kdepim-4.13.0/kontact/src/iconsidepane.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/iconsidepane.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -44,49 +44,49 @@ class SelectionModel : public QItemSelectionModel { - public: +public: SelectionModel( QAbstractItemModel *model, QObject *parent ) - : QItemSelectionModel( model, parent ) + : QItemSelectionModel( model, parent ) { } - public slots: +public slots: void clear() { - // Don't allow the current selection to be cleared. QListView doesn't call to this method - // nowadays, but just to cover of future change of implementation, since QTreeView does call - // to this one when clearing the selection. + // Don't allow the current selection to be cleared. QListView doesn't call to this method + // nowadays, but just to cover of future change of implementation, since QTreeView does call + // to this one when clearing the selection. } void select( const QModelIndex &index, QItemSelectionModel::SelectionFlags command ) { - // Don't allow the current selection to be cleared - if ( !index.isValid() && ( command & QItemSelectionModel::Clear ) ) { - return; - } - QItemSelectionModel::select( index, command ); + // Don't allow the current selection to be cleared + if ( !index.isValid() && ( command & QItemSelectionModel::Clear ) ) { + return; + } + QItemSelectionModel::select( index, command ); } void select( const QItemSelection &selection, - QItemSelectionModel::SelectionFlags command ) + QItemSelectionModel::SelectionFlags command ) { - // Don't allow the current selection to be cleared - if ( !selection.count() && ( command & QItemSelectionModel::Clear ) ) { - return; - } - QItemSelectionModel::select( selection, command ); + // Don't allow the current selection to be cleared + if ( !selection.count() && ( command & QItemSelectionModel::Clear ) ) { + return; + } + QItemSelectionModel::select( selection, command ); } }; class Model : public QStringListModel { - public: +public: enum SpecialRoles { - PluginName = Qt::UserRole + PluginName = Qt::UserRole }; Model( Navigator *parentNavigator = 0 ) - : QStringListModel( parentNavigator ), mNavigator(parentNavigator) + : QStringListModel( parentNavigator ), mNavigator(parentNavigator) { } @@ -96,430 +96,430 @@ } void setPluginList( const QList &list ) { - pluginList = list; + pluginList = list; } Qt::ItemFlags flags( const QModelIndex &index ) const { - Qt::ItemFlags flags = QStringListModel::flags( index ); + Qt::ItemFlags flags = QStringListModel::flags( index ); - flags &= ~Qt::ItemIsEditable; + flags &= ~Qt::ItemIsEditable; - if ( index.isValid() ) { - if ( static_cast( index.internalPointer() )->disabled() ) { - flags &= ~Qt::ItemIsEnabled; - flags &= ~Qt::ItemIsSelectable; - flags &= ~Qt::ItemIsDropEnabled; + if ( index.isValid() ) { + if ( static_cast( index.internalPointer() )->disabled() ) { + flags &= ~Qt::ItemIsEnabled; + flags &= ~Qt::ItemIsSelectable; + flags &= ~Qt::ItemIsDropEnabled; + } else { + flags |= Qt::ItemIsDropEnabled; + } } else { - flags |= Qt::ItemIsDropEnabled; + flags &= ~Qt::ItemIsDropEnabled; } - } else { - flags &= ~Qt::ItemIsDropEnabled; - } - return flags; + return flags; } QModelIndex index( int row, int column, - const QModelIndex &parent = QModelIndex() ) const + const QModelIndex &parent = QModelIndex() ) const { - Q_UNUSED( parent ); - if ( row < 0 || row >= pluginList.count() ) { - return QModelIndex(); - } - return createIndex( row, column, pluginList[row] ); + Q_UNUSED( parent ); + if ( row < 0 || row >= pluginList.count() ) { + return QModelIndex(); + } + return createIndex( row, column, pluginList[row] ); } QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const { - if ( !index.isValid() || !index.internalPointer() ) { - return QVariant(); - } - - if ( role == Qt::DisplayRole ) { - if ( !mNavigator->showText() ) { - return QVariant(); - } - return static_cast( index.internalPointer() )->title(); - } else if ( role == Qt::DecorationRole ) { - if ( !mNavigator->showIcons() ) { - return QVariant(); - } - return KIcon( static_cast( index.internalPointer() )->icon() ); - } else if ( role == Qt::TextAlignmentRole ) { - return Qt::AlignCenter; - } else if ( role == Qt::ToolTipRole ) { - if ( !mNavigator->showText() ) { - return static_cast( index.internalPointer() )->title(); - } - return QVariant(); - } else if ( role == PluginName ) { - return static_cast( index.internalPointer() )->identifier(); - } - return QStringListModel::data( index, role ); + if ( !index.isValid() || !index.internalPointer() ) { + return QVariant(); + } + + if ( role == Qt::DisplayRole ) { + if ( !mNavigator->showText() ) { + return QVariant(); + } + return static_cast( index.internalPointer() )->title(); + } else if ( role == Qt::DecorationRole ) { + if ( !mNavigator->showIcons() ) { + return QVariant(); + } + return KIcon( static_cast( index.internalPointer() )->icon() ); + } else if ( role == Qt::TextAlignmentRole ) { + return Qt::AlignCenter; + } else if ( role == Qt::ToolTipRole ) { + if ( !mNavigator->showText() ) { + return static_cast( index.internalPointer() )->title(); + } + return QVariant(); + } else if ( role == PluginName ) { + return static_cast( index.internalPointer() )->identifier(); + } + return QStringListModel::data( index, role ); } - private: +private: QList pluginList; Navigator *mNavigator; }; class SortFilterProxyModel - : public QSortFilterProxyModel + : public QSortFilterProxyModel { - public: +public: SortFilterProxyModel( QObject *parent = 0 ): QSortFilterProxyModel( parent ) { - setDynamicSortFilter( true ); - sort ( 0 ); + setDynamicSortFilter( true ); + sort ( 0 ); } - protected: +protected: bool lessThan( const QModelIndex &left, const QModelIndex &right ) const { - KontactInterface::Plugin *leftPlugin = - static_cast( left.internalPointer() ); - KontactInterface::Plugin *rightPlugin = - static_cast( right.internalPointer() ); - - if ( leftPlugin->weight() == rightPlugin->weight() ) { - return KStringHandler::naturalCompare( leftPlugin->title(), rightPlugin->title() ) < 0; - } + KontactInterface::Plugin *leftPlugin = + static_cast( left.internalPointer() ); + KontactInterface::Plugin *rightPlugin = + static_cast( right.internalPointer() ); - return leftPlugin->weight() < rightPlugin->weight(); + if ( leftPlugin->weight() == rightPlugin->weight() ) { + return KStringHandler::naturalCompare( leftPlugin->title(), rightPlugin->title() ) < 0; + } + + return leftPlugin->weight() < rightPlugin->weight(); } }; class Delegate : public QStyledItemDelegate { - public: +public: Delegate( Navigator *parentNavigator = 0 ) - : QStyledItemDelegate( parentNavigator ), mNavigator( parentNavigator ) + : QStyledItemDelegate( parentNavigator ), mNavigator( parentNavigator ) { } void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const { - if ( !index.isValid() || !index.internalPointer() ) { - return; - } + if ( !index.isValid() || !index.internalPointer() ) { + return; + } - QStyleOptionViewItemV4 optionCopy( *static_cast( &option ) ); - optionCopy.decorationPosition = QStyleOptionViewItem::Top; - optionCopy.decorationSize = QSize( mNavigator->iconSize(), mNavigator->iconSize() ); - optionCopy.textElideMode = Qt::ElideNone; - QStyledItemDelegate::paint( painter, optionCopy, index ); + QStyleOptionViewItemV4 optionCopy( *static_cast( &option ) ); + optionCopy.decorationPosition = QStyleOptionViewItem::Top; + optionCopy.decorationSize = QSize( mNavigator->iconSize(), mNavigator->iconSize() ); + optionCopy.textElideMode = Qt::ElideNone; + QStyledItemDelegate::paint( painter, optionCopy, index ); } QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const { - if ( !index.isValid() || !index.internalPointer() ) { - return QSize(); - } - - QStyleOptionViewItemV4 optionCopy( *static_cast( &option ) ); - optionCopy.decorationPosition = QStyleOptionViewItem::Top; - optionCopy.decorationSize = - mNavigator->showIcons() ? QSize( mNavigator->iconSize(), mNavigator->iconSize() ) : QSize(); - optionCopy.textElideMode = Qt::ElideNone; - return QStyledItemDelegate::sizeHint( optionCopy, index ); + if ( !index.isValid() || !index.internalPointer() ) { + return QSize(); + } + + QStyleOptionViewItemV4 optionCopy( *static_cast( &option ) ); + optionCopy.decorationPosition = QStyleOptionViewItem::Top; + optionCopy.decorationSize = + mNavigator->showIcons() ? QSize( mNavigator->iconSize(), mNavigator->iconSize() ) : QSize(); + optionCopy.textElideMode = Qt::ElideNone; + return QStyledItemDelegate::sizeHint( optionCopy, index ); } - private: +private: Navigator *mNavigator; }; } Navigator::Navigator( SidePaneBase *parent ) - : QListView( parent ), mSidePane( parent ) + : QListView( parent ), mSidePane( parent ) { - setViewport( new QWidget( this ) ); + setViewport( new QWidget( this ) ); - setVerticalScrollMode( ScrollPerPixel ); - setHorizontalScrollMode( ScrollPerPixel ); + setVerticalScrollMode( ScrollPerPixel ); + setHorizontalScrollMode( ScrollPerPixel ); - mIconSize = Prefs::self()->sidePaneIconSize(); - mShowIcons = Prefs::self()->sidePaneShowIcons(); - mShowText = Prefs::self()->sidePaneShowText(); - - QActionGroup *viewMode = new QActionGroup( this ); - - mShowIconsAction = new KAction( i18nc( "@action:inmenu", "Show Icons Only" ), this ); - mShowIconsAction->setCheckable( true ); - mShowIconsAction->setActionGroup( viewMode ); - mShowIconsAction->setChecked( !mShowText && mShowIcons ); - mShowIconsAction->setHelpText( - i18nc( "@info:status", - "Show sidebar items with icons and without text" ) ); - mShowIconsAction->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option if you want the sidebar items to have icons without text." ) ); - connect( mShowIconsAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); - - mShowTextAction = new KAction( i18nc( "@action:inmenu", "Show Text Only" ), this ); - mShowTextAction->setCheckable( true ); - mShowTextAction->setActionGroup( viewMode ); - mShowTextAction->setChecked( mShowText && !mShowIcons ); - mShowTextAction->setHelpText( - i18nc( "@info:status", - "Show sidebar items with text and without icons" ) ); - mShowTextAction->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option if you want the sidebar items to have text without icons." ) ); - connect( mShowTextAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); - - mShowBothAction = new KAction( i18nc( "@action:inmenu", "Show Icons && Text" ), this ); - mShowBothAction->setCheckable( true ); - mShowBothAction->setActionGroup( viewMode ); - mShowBothAction->setChecked( mShowText && mShowIcons ); - mShowBothAction->setHelpText( - i18nc( "@info:status", - "Show sidebar items with icons and text" ) ); - mShowBothAction->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option if you want the sidebar items to have icons and text." ) ); - connect( mShowBothAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); - - KAction *sep = new KAction( this ); - sep->setSeparator( true ); - - QActionGroup *iconSize = new QActionGroup( this ); - - mBigIconsAction = new KAction( i18nc( "@action:inmenu", "Big Icons" ), this ); - mBigIconsAction->setCheckable( iconSize ); - mBigIconsAction->setActionGroup( iconSize ); - mBigIconsAction->setChecked( mIconSize == KIconLoader::SizeLarge ); - mBigIconsAction->setHelpText( - i18nc( "@info:status", - "Show large size sidebar icons" ) ); - mBigIconsAction->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option if you want the sidebar icons to be extra big." ) ); - connect( mBigIconsAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); - - mNormalIconsAction = new KAction( i18nc( "@action:inmenu", "Normal Icons" ), this ); - mNormalIconsAction->setCheckable( true ); - mNormalIconsAction->setActionGroup( iconSize ); - mNormalIconsAction->setChecked( mIconSize == KIconLoader::SizeMedium ); - mNormalIconsAction->setHelpText( - i18nc( "@info:status", - "Show normal size sidebar icons" ) ); - mNormalIconsAction->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option if you want the sidebar icons to be normal size." ) ); - connect( mNormalIconsAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); - - mSmallIconsAction = new KAction( i18nc( "@action:inmenu", "Small Icons" ), this ); - mSmallIconsAction->setCheckable( true ); - mSmallIconsAction->setActionGroup( iconSize ); - mSmallIconsAction->setChecked( mIconSize == KIconLoader::SizeSmallMedium ); - mSmallIconsAction->setHelpText( - i18nc( "@info:status", - "Show small size sidebar icons" ) ); - mSmallIconsAction->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option if you want the sidebar icons to be extra small." ) ); - connect( mSmallIconsAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); - - QList actionList; - actionList << mShowIconsAction << mShowTextAction << mShowBothAction << sep - << mBigIconsAction << mNormalIconsAction << mSmallIconsAction; - - insertActions( 0, actionList ); - - setContextMenuPolicy( Qt::ActionsContextMenu ); - setViewMode( ListMode ); - setItemDelegate( new Delegate( this ) ); - mModel = new Model( this ); - SortFilterProxyModel *sortFilterProxyModel = new SortFilterProxyModel; - sortFilterProxyModel->setSourceModel( mModel ); - setModel( sortFilterProxyModel ); - setSelectionModel( new SelectionModel( sortFilterProxyModel, this ) ); - - setDragDropMode( DropOnly ); - viewport()->setAcceptDrops( true ); - setDropIndicatorShown( true ); + mIconSize = Prefs::self()->sidePaneIconSize(); + mShowIcons = Prefs::self()->sidePaneShowIcons(); + mShowText = Prefs::self()->sidePaneShowText(); + + QActionGroup *viewMode = new QActionGroup( this ); + + mShowIconsAction = new KAction( i18nc( "@action:inmenu", "Show Icons Only" ), this ); + mShowIconsAction->setCheckable( true ); + mShowIconsAction->setActionGroup( viewMode ); + mShowIconsAction->setChecked( !mShowText && mShowIcons ); + mShowIconsAction->setHelpText( + i18nc( "@info:status", + "Show sidebar items with icons and without text" ) ); + mShowIconsAction->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option if you want the sidebar items to have icons without text." ) ); + connect( mShowIconsAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); + + mShowTextAction = new KAction( i18nc( "@action:inmenu", "Show Text Only" ), this ); + mShowTextAction->setCheckable( true ); + mShowTextAction->setActionGroup( viewMode ); + mShowTextAction->setChecked( mShowText && !mShowIcons ); + mShowTextAction->setHelpText( + i18nc( "@info:status", + "Show sidebar items with text and without icons" ) ); + mShowTextAction->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option if you want the sidebar items to have text without icons." ) ); + connect( mShowTextAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); + + mShowBothAction = new KAction( i18nc( "@action:inmenu", "Show Icons && Text" ), this ); + mShowBothAction->setCheckable( true ); + mShowBothAction->setActionGroup( viewMode ); + mShowBothAction->setChecked( mShowText && mShowIcons ); + mShowBothAction->setHelpText( + i18nc( "@info:status", + "Show sidebar items with icons and text" ) ); + mShowBothAction->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option if you want the sidebar items to have icons and text." ) ); + connect( mShowBothAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); + + KAction *sep = new KAction( this ); + sep->setSeparator( true ); + + QActionGroup *iconSize = new QActionGroup( this ); + + mBigIconsAction = new KAction( i18nc( "@action:inmenu", "Big Icons" ), this ); + mBigIconsAction->setCheckable( iconSize ); + mBigIconsAction->setActionGroup( iconSize ); + mBigIconsAction->setChecked( mIconSize == KIconLoader::SizeLarge ); + mBigIconsAction->setHelpText( + i18nc( "@info:status", + "Show large size sidebar icons" ) ); + mBigIconsAction->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option if you want the sidebar icons to be extra big." ) ); + connect( mBigIconsAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); + + mNormalIconsAction = new KAction( i18nc( "@action:inmenu", "Normal Icons" ), this ); + mNormalIconsAction->setCheckable( true ); + mNormalIconsAction->setActionGroup( iconSize ); + mNormalIconsAction->setChecked( mIconSize == KIconLoader::SizeMedium ); + mNormalIconsAction->setHelpText( + i18nc( "@info:status", + "Show normal size sidebar icons" ) ); + mNormalIconsAction->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option if you want the sidebar icons to be normal size." ) ); + connect( mNormalIconsAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); + + mSmallIconsAction = new KAction( i18nc( "@action:inmenu", "Small Icons" ), this ); + mSmallIconsAction->setCheckable( true ); + mSmallIconsAction->setActionGroup( iconSize ); + mSmallIconsAction->setChecked( mIconSize == KIconLoader::SizeSmallMedium ); + mSmallIconsAction->setHelpText( + i18nc( "@info:status", + "Show small size sidebar icons" ) ); + mSmallIconsAction->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option if you want the sidebar icons to be extra small." ) ); + connect( mSmallIconsAction, SIGNAL(triggered(bool)), this, SLOT(slotActionTriggered(bool)) ); + + QList actionList; + actionList << mShowIconsAction << mShowTextAction << mShowBothAction << sep + << mBigIconsAction << mNormalIconsAction << mSmallIconsAction; + + insertActions( 0, actionList ); + + setContextMenuPolicy( Qt::ActionsContextMenu ); + setViewMode( ListMode ); + setItemDelegate( new Delegate( this ) ); + mModel = new Model( this ); + SortFilterProxyModel *sortFilterProxyModel = new SortFilterProxyModel; + sortFilterProxyModel->setSourceModel( mModel ); + setModel( sortFilterProxyModel ); + setSelectionModel( new SelectionModel( sortFilterProxyModel, this ) ); + + setDragDropMode( DropOnly ); + viewport()->setAcceptDrops( true ); + setDropIndicatorShown( true ); - connect( selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), - this, SLOT(slotCurrentChanged(QModelIndex)) ); + connect( selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), + this, SLOT(slotCurrentChanged(QModelIndex)) ); } void Navigator::updatePlugins( QList plugins_ ) { - QString currentPlugin; - if ( currentIndex().isValid() ) { - currentPlugin = currentIndex().model()->data( currentIndex(), Model::PluginName ).toString(); - } - - QList pluginsToShow; - foreach ( KontactInterface::Plugin *plugin, plugins_ ) { - if ( plugin->showInSideBar() ) { - pluginsToShow << plugin; - } - } - - mModel->setPluginList( pluginsToShow ); - - mModel->removeRows( 0, mModel->rowCount() ); - mModel->insertRows( 0, pluginsToShow.count() ); - - // Restore the previous selected index, if any - if ( !currentPlugin.isEmpty() ) { - setCurrentPlugin( currentPlugin ); - } + QString currentPlugin; + if ( currentIndex().isValid() ) { + currentPlugin = currentIndex().model()->data( currentIndex(), Model::PluginName ).toString(); + } + + QList pluginsToShow; + foreach ( KontactInterface::Plugin *plugin, plugins_ ) { + if ( plugin->showInSideBar() ) { + pluginsToShow << plugin; + } + } + + mModel->setPluginList( pluginsToShow ); + + mModel->removeRows( 0, mModel->rowCount() ); + mModel->insertRows( 0, pluginsToShow.count() ); + + // Restore the previous selected index, if any + if ( !currentPlugin.isEmpty() ) { + setCurrentPlugin( currentPlugin ); + } } void Navigator::setCurrentPlugin( const QString &plugin ) { - const int numberOfRows( model()->rowCount() ); - for ( int i = 0; i < numberOfRows; ++i ) { - const QModelIndex index = model()->index( i, 0 ); - const QString pluginName = model()->data( index, Model::PluginName ).toString(); - - if ( plugin == pluginName ) { - selectionModel()->setCurrentIndex( index, QItemSelectionModel::SelectCurrent ); - break; + const int numberOfRows( model()->rowCount() ); + for ( int i = 0; i < numberOfRows; ++i ) { + const QModelIndex index = model()->index( i, 0 ); + const QString pluginName = model()->data( index, Model::PluginName ).toString(); + + if ( plugin == pluginName ) { + selectionModel()->setCurrentIndex( index, QItemSelectionModel::SelectCurrent ); + break; + } } - } } QSize Navigator::sizeHint() const { - //### TODO: We can cache this value, so this reply is faster. Since here we won't - // have too many elements, it is not that important. When caching this value - // make sure it is updated correctly when new rows have been added or - // removed. (ereslibre) - - int maxWidth = 0; - const int numberOfRows( model()->rowCount() ); - for ( int i = 0; i < numberOfRows; ++i ) { - const QModelIndex index = model()->index( i, 0 ); - maxWidth = qMax( maxWidth, sizeHintForIndex( index ).width() ); - } + //### TODO: We can cache this value, so this reply is faster. Since here we won't + // have too many elements, it is not that important. When caching this value + // make sure it is updated correctly when new rows have been added or + // removed. (ereslibre) - int viewHeight = QListView::sizeHint().height(); + int maxWidth = 0; + const int numberOfRows( model()->rowCount() ); + for ( int i = 0; i < numberOfRows; ++i ) { + const QModelIndex index = model()->index( i, 0 ); + maxWidth = qMax( maxWidth, sizeHintForIndex( index ).width() ); + } - return QSize( maxWidth + rect().width() - contentsRect().width(), viewHeight ); + int viewHeight = QListView::sizeHint().height(); + + return QSize( maxWidth + rect().width() - contentsRect().width(), viewHeight ); } void Navigator::dragEnterEvent( QDragEnterEvent *event ) { - if ( event->proposedAction() == Qt::IgnoreAction ) { - return; - } - event->acceptProposedAction(); + if ( event->proposedAction() == Qt::IgnoreAction ) { + return; + } + event->acceptProposedAction(); } void Navigator::dragMoveEvent( QDragMoveEvent *event ) { - if ( event->proposedAction() == Qt::IgnoreAction ) { - return; - } - - const QModelIndex dropIndex = indexAt( event->pos() ); - - if ( !dropIndex.isValid() || - !( dropIndex.model()->flags( dropIndex ) & Qt::ItemIsEnabled ) ) { - event->setAccepted( false ); - return; - } else { - const QModelIndex sourceIndex = - static_cast( model() )->mapToSource( dropIndex ); - KontactInterface::Plugin *plugin = - static_cast( sourceIndex.internalPointer() ); - if ( !plugin->canDecodeMimeData( event->mimeData() ) ) { - event->setAccepted( false ); - return; + if ( event->proposedAction() == Qt::IgnoreAction ) { + return; + } + + const QModelIndex dropIndex = indexAt( event->pos() ); + + if ( !dropIndex.isValid() || + !( dropIndex.model()->flags( dropIndex ) & Qt::ItemIsEnabled ) ) { + event->setAccepted( false ); + return; + } else { + const QModelIndex sourceIndex = + static_cast( model() )->mapToSource( dropIndex ); + KontactInterface::Plugin *plugin = + static_cast( sourceIndex.internalPointer() ); + if ( !plugin->canDecodeMimeData( event->mimeData() ) ) { + event->setAccepted( false ); + return; + } } - } - event->acceptProposedAction(); + event->acceptProposedAction(); } void Navigator::dropEvent( QDropEvent *event ) { - if ( event->proposedAction() == Qt::IgnoreAction ) { - return; - } - - const QModelIndex dropIndex = indexAt( event->pos() ); - - if ( !dropIndex.isValid() ) { - return; - } else { - const QModelIndex sourceIndex = - static_cast( model() )->mapToSource( dropIndex ); - KontactInterface::Plugin *plugin = - static_cast( sourceIndex.internalPointer() ); - plugin->processDropEvent( event ); - } + if ( event->proposedAction() == Qt::IgnoreAction ) { + return; + } + + const QModelIndex dropIndex = indexAt( event->pos() ); + + if ( !dropIndex.isValid() ) { + return; + } else { + const QModelIndex sourceIndex = + static_cast( model() )->mapToSource( dropIndex ); + KontactInterface::Plugin *plugin = + static_cast( sourceIndex.internalPointer() ); + plugin->processDropEvent( event ); + } } void Navigator::showEvent( QShowEvent *event ) { - parentWidget()->setMaximumWidth( sizeHint().width() ); - parentWidget()->setMinimumWidth( sizeHint().width() ); + parentWidget()->setMaximumWidth( sizeHint().width() ); + parentWidget()->setMinimumWidth( sizeHint().width() ); - QListView::showEvent( event ); + QListView::showEvent( event ); } void Navigator::slotCurrentChanged( const QModelIndex ¤t ) { - if ( !current.isValid() || !current.internalPointer() || - !( current.model()->flags( current ) & Qt::ItemIsEnabled ) ) { - return; - } + if ( !current.isValid() || !current.internalPointer() || + !( current.model()->flags( current ) & Qt::ItemIsEnabled ) ) { + return; + } - QModelIndex source = - static_cast( current.model() )->mapToSource( current ); + QModelIndex source = + static_cast( current.model() )->mapToSource( current ); - emit pluginActivated( static_cast( source.internalPointer() ) ); + emit pluginActivated( static_cast( source.internalPointer() ) ); } void Navigator::slotActionTriggered( bool checked ) { - QObject *object = sender(); + QObject *object = sender(); - if ( object == mShowIconsAction ) { - mShowIcons = checked; - mShowText = !checked; - } else if ( object == mShowTextAction ) { - mShowIcons = !checked; - mShowText = checked; - } else if ( object == mShowBothAction ) { - mShowIcons = checked; - mShowText = checked; - } else if ( object == mBigIconsAction ) { - mIconSize = KIconLoader::SizeLarge; - } else if ( object == mNormalIconsAction ) { - mIconSize = KIconLoader::SizeMedium; - } else if ( object == mSmallIconsAction ) { - mIconSize = KIconLoader::SizeSmallMedium; - } - - Prefs::self()->setSidePaneIconSize( mIconSize ); - Prefs::self()->setSidePaneShowIcons( mShowIcons ); - Prefs::self()->setSidePaneShowText( mShowText ); + if ( object == mShowIconsAction ) { + mShowIcons = checked; + mShowText = !checked; + } else if ( object == mShowTextAction ) { + mShowIcons = !checked; + mShowText = checked; + } else if ( object == mShowBothAction ) { + mShowIcons = checked; + mShowText = checked; + } else if ( object == mBigIconsAction ) { + mIconSize = KIconLoader::SizeLarge; + } else if ( object == mNormalIconsAction ) { + mIconSize = KIconLoader::SizeMedium; + } else if ( object == mSmallIconsAction ) { + mIconSize = KIconLoader::SizeSmallMedium; + } + + Prefs::self()->setSidePaneIconSize( mIconSize ); + Prefs::self()->setSidePaneShowIcons( mShowIcons ); + Prefs::self()->setSidePaneShowText( mShowText ); - mModel->emitReset(); + mModel->emitReset(); - QTimer::singleShot( 0, this, SLOT(updateNavigatorSize()) ); + QTimer::singleShot( 0, this, SLOT(updateNavigatorSize()) ); } void Navigator::updateNavigatorSize() { - parentWidget()->setMaximumWidth( sizeHint().width() ); - parentWidget()->setMinimumWidth( sizeHint().width() ); + parentWidget()->setMaximumWidth( sizeHint().width() ); + parentWidget()->setMinimumWidth( sizeHint().width() ); } IconSidePane::IconSidePane( KontactInterface::Core *core, QWidget *parent ) - : SidePaneBase( core, parent ) + : SidePaneBase( core, parent ) { - mNavigator = new Navigator( this ); - mNavigator->setFocusPolicy( Qt::NoFocus ); - connect( mNavigator, SIGNAL(pluginActivated(KontactInterface::Plugin*)), - SIGNAL(pluginSelected(KontactInterface::Plugin*)) ); + mNavigator = new Navigator( this ); + mNavigator->setFocusPolicy( Qt::NoFocus ); + connect( mNavigator, SIGNAL(pluginActivated(KontactInterface::Plugin*)), + SIGNAL(pluginSelected(KontactInterface::Plugin*)) ); } IconSidePane::~IconSidePane() @@ -528,19 +528,19 @@ void IconSidePane::setCurrentPlugin( const QString &plugin ) { - mNavigator->setCurrentPlugin( plugin ); + mNavigator->setCurrentPlugin( plugin ); } void IconSidePane::updatePlugins() { - mNavigator->updatePlugins( core()->pluginList() ); + mNavigator->updatePlugins( core()->pluginList() ); } void IconSidePane::resizeEvent( QResizeEvent *event ) { - Q_UNUSED( event ); - setMaximumWidth( mNavigator->sizeHint().width() ); - setMinimumWidth( mNavigator->sizeHint().width() ); + Q_UNUSED( event ); + setMaximumWidth( mNavigator->sizeHint().width() ); + setMinimumWidth( mNavigator->sizeHint().width() ); } diff -Nru kdepim-4.13.0/kontact/src/iconsidepane.h kdepim-4.13.3/kontact/src/iconsidepane.h --- kdepim-4.13.0/kontact/src/iconsidepane.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/iconsidepane.h 2014-07-09 12:18:50.000000000 +0000 @@ -28,8 +28,8 @@ #include namespace KontactInterface { - class Core; - class Plugin; +class Core; +class Plugin; } class KAction; @@ -41,9 +41,9 @@ class Navigator : public QListView { - Q_OBJECT + Q_OBJECT - public: +public: explicit Navigator( SidePaneBase *parent = 0 ); void updatePlugins( QList plugins ); @@ -51,36 +51,36 @@ int iconSize() const { - return mIconSize; + return mIconSize; } bool showIcons() const { - return mShowIcons; + return mShowIcons; } bool showText() const { - return mShowText; + return mShowText; } virtual QSize sizeHint() const; - signals: +signals: void pluginActivated( KontactInterface::Plugin *plugin ); - protected: +protected: virtual void dragEnterEvent( QDragEnterEvent *event ); virtual void dragMoveEvent( QDragMoveEvent *event ); virtual void dropEvent( QDropEvent *event ); virtual void showEvent( QShowEvent * event ); - private slots: +private slots: void slotCurrentChanged( const QModelIndex ¤t ); void slotActionTriggered( bool checked ); void updateNavigatorSize(); - private: +private: SidePaneBase *mSidePane; Model *mModel; @@ -98,21 +98,21 @@ class IconSidePane : public SidePaneBase { - Q_OBJECT + Q_OBJECT - public: +public: IconSidePane( KontactInterface::Core *core, QWidget *parent ); ~IconSidePane(); void setCurrentPlugin( const QString &plugin ); - public slots: +public slots: virtual void updatePlugins(); - protected: +protected: void resizeEvent( QResizeEvent *event ); - private: +private: Navigator *mNavigator; }; diff -Nru kdepim-4.13.0/kontact/src/kcmkontact.cpp kdepim-4.13.3/kontact/src/kcmkontact.cpp --- kdepim-4.13.0/kontact/src/kcmkontact.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/kcmkontact.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -38,71 +38,71 @@ extern "C" { - KDE_EXPORT KCModule *create_kontactconfig( QWidget *parent, const char * ) - { +KDE_EXPORT KCModule *create_kontactconfig( QWidget *parent, const char * ) +{ KComponentData inst( "kcmkontact" ); return new KcmKontact( inst, parent ); - } +} } KcmKontact::KcmKontact( const KComponentData &inst, QWidget *parent ) - : KPrefsModule( Prefs::self(), inst, parent ) + : KPrefsModule( Prefs::self(), inst, parent ) { - QBoxLayout *topLayout = new QVBoxLayout( this ); - QBoxLayout *pluginStartupLayout = new QHBoxLayout(); - topLayout->addItem( pluginStartupLayout ); - topLayout->addStretch(); + QBoxLayout *topLayout = new QVBoxLayout( this ); + QBoxLayout *pluginStartupLayout = new QHBoxLayout(); + topLayout->addItem( pluginStartupLayout ); + topLayout->addStretch(); - KPrefsWidBool *forceStartupPlugin = - addWidBool( Prefs::self()->forceStartupPluginItem(), this ); - pluginStartupLayout->addWidget( forceStartupPlugin->checkBox() ); + KPrefsWidBool *forceStartupPlugin = + addWidBool( Prefs::self()->forceStartupPluginItem(), this ); + pluginStartupLayout->addWidget( forceStartupPlugin->checkBox() ); - PluginSelection *selection = - new PluginSelection( Prefs::self()->forcedStartupPluginItem(), this ); - addWid( selection ); + PluginSelection *selection = + new PluginSelection( Prefs::self()->forcedStartupPluginItem(), this ); + addWid( selection ); - pluginStartupLayout->addWidget( selection->comboBox() ); - selection->comboBox()->setEnabled( false ); + pluginStartupLayout->addWidget( selection->comboBox() ); + selection->comboBox()->setEnabled( false ); - pluginStartupLayout->addStretch( 1 ); + pluginStartupLayout->addStretch( 1 ); - connect( forceStartupPlugin->checkBox(), SIGNAL(toggled(bool)), - selection->comboBox(), SLOT(setEnabled(bool)) ); - load(); + connect( forceStartupPlugin->checkBox(), SIGNAL(toggled(bool)), + selection->comboBox(), SLOT(setEnabled(bool)) ); + load(); } const KAboutData *KcmKontact::aboutData() const { - KAboutData *about = new KAboutData( - "kontactconfig", 0, - ki18nc( "@title", "KDE Kontact" ), - 0, - KLocalizedString(), - KAboutData::License_GPL, - ki18nc( "@info:credit", "(c), 2003 Cornelius Schumacher" ) ); - - about->addAuthor( ki18nc( "@info:credit", "Cornelius Schumacher" ), - ki18nc( "@info:credit", "Developer" ), - "schumacher@kde.org" ); - about->addAuthor( ki18nc( "@info:credit", "Tobias Koenig" ), - ki18nc( "@info:credit", "Developer" ), - "tokoe@kde.org" ); + KAboutData *about = new KAboutData( + "kontactconfig", 0, + ki18nc( "@title", "KDE Kontact" ), + 0, + KLocalizedString(), + KAboutData::License_GPL, + ki18nc( "@info:credit", "(c), 2003 Cornelius Schumacher" ) ); + + about->addAuthor( ki18nc( "@info:credit", "Cornelius Schumacher" ), + ki18nc( "@info:credit", "Developer" ), + "schumacher@kde.org" ); + about->addAuthor( ki18nc( "@info:credit", "Tobias Koenig" ), + ki18nc( "@info:credit", "Developer" ), + "tokoe@kde.org" ); - return about; + return about; } PluginSelection::PluginSelection( KConfigSkeleton::ItemString *item, QWidget *parent ) { - mItem = item; - mPluginCombo = new KComboBox( parent ); - mPluginCombo->setToolTip( - i18nc( "@info:tooltip", "Select the initial plugin to use on each start" ) ); - mPluginCombo->setWhatsThis( - i18nc( "@info:whatsthis", - "Select the plugin from this drop down list to be used as the " - "initial plugin each time Kontact is started. Otherwise, Kontact " - "will restore the last active plugin from the previous usage." ) ); - connect( mPluginCombo, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) ); + mItem = item; + mPluginCombo = new KComboBox( parent ); + mPluginCombo->setToolTip( + i18nc( "@info:tooltip", "Select the initial plugin to use on each start" ) ); + mPluginCombo->setWhatsThis( + i18nc( "@info:whatsthis", + "Select the plugin from this drop down list to be used as the " + "initial plugin each time Kontact is started. Otherwise, Kontact " + "will restore the last active plugin from the previous usage." ) ); + connect( mPluginCombo, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) ); } PluginSelection::~PluginSelection() @@ -111,43 +111,43 @@ void PluginSelection::readConfig() { - const KService::List offers = KServiceTypeTrader::self()->query( - QString::fromLatin1( "Kontact/Plugin" ), - QString::fromLatin1( "[X-KDE-KontactPluginVersion] == %1" ).arg( KONTACT_PLUGIN_VERSION ) ); - - int activeComponent = 0; - mPluginCombo->clear(); - mPluginList.clear(); - KService::List::ConstIterator end( offers.end() ); - for ( KService::List::ConstIterator it = offers.begin(); it != end; ++it ) { - KService::Ptr service = *it; - // skip summary only plugins - QVariant var = service->property( QLatin1String("X-KDE-KontactPluginHasPart") ); - if ( var.isValid() && var.toBool() == false ) { - continue; - } - mPluginCombo->addItem( service->name() ); - mPluginList.append( service ); - - if ( service->property( QLatin1String("X-KDE-PluginInfo-Name") ).toString() == mItem->value() ) { - activeComponent = mPluginList.count() - 1; + const KService::List offers = KServiceTypeTrader::self()->query( + QString::fromLatin1( "Kontact/Plugin" ), + QString::fromLatin1( "[X-KDE-KontactPluginVersion] == %1" ).arg( KONTACT_PLUGIN_VERSION ) ); + + int activeComponent = 0; + mPluginCombo->clear(); + mPluginList.clear(); + KService::List::ConstIterator end( offers.end() ); + for ( KService::List::ConstIterator it = offers.begin(); it != end; ++it ) { + KService::Ptr service = *it; + // skip summary only plugins + QVariant var = service->property( QLatin1String("X-KDE-KontactPluginHasPart") ); + if ( var.isValid() && var.toBool() == false ) { + continue; + } + mPluginCombo->addItem( service->name() ); + mPluginList.append( service ); + + if ( service->property( QLatin1String("X-KDE-PluginInfo-Name") ).toString() == mItem->value() ) { + activeComponent = mPluginList.count() - 1; + } } - } - mPluginCombo->setCurrentIndex( activeComponent ); + mPluginCombo->setCurrentIndex( activeComponent ); } void PluginSelection::writeConfig() { - KService::Ptr ptr = mPluginList.at( mPluginCombo->currentIndex() ); - mItem->setValue( ptr->property( QLatin1String("X-KDE-PluginInfo-Name") ).toString() ); + KService::Ptr ptr = mPluginList.at( mPluginCombo->currentIndex() ); + mItem->setValue( ptr->property( QLatin1String("X-KDE-PluginInfo-Name") ).toString() ); } QList PluginSelection::widgets() const { - QList widgets; - widgets.append( mPluginCombo ); + QList widgets; + widgets.append( mPluginCombo ); - return widgets; + return widgets; } diff -Nru kdepim-4.13.0/kontact/src/kcmkontact.h kdepim-4.13.3/kontact/src/kcmkontact.h --- kdepim-4.13.0/kontact/src/kcmkontact.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/kcmkontact.h 2014-07-09 12:18:50.000000000 +0000 @@ -34,9 +34,9 @@ class KcmKontact : public KPrefsModule { - Q_OBJECT + Q_OBJECT - public: +public: explicit KcmKontact( const KComponentData &inst, QWidget *parent = 0 ); virtual const KAboutData *aboutData() const; @@ -44,9 +44,9 @@ class PluginSelection : public KPrefsWid { - Q_OBJECT + Q_OBJECT - public: +public: PluginSelection( KConfigSkeleton::ItemString *item, QWidget *parent ); ~PluginSelection(); @@ -56,7 +56,7 @@ QList widgets() const; KComboBox *comboBox() const { return mPluginCombo; } - private: +private: KComboBox *mPluginCombo; KService::List mPluginList; KConfigSkeleton::ItemString *mItem; diff -Nru kdepim-4.13.0/kontact/src/kontactconfig.desktop kdepim-4.13.3/kontact/src/kontactconfig.desktop --- kdepim-4.13.0/kontact/src/kontactconfig.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/kontactconfig.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -19,6 +19,7 @@ Name[da]=Indstilling af Kontact Name[de]=Einrichtung von Kontact Name[el]=Διαμόρφωση Kontact +Name[en_GB]=Kontact Configuration Name[es]=Configuración de Kontact Name[et]=Kontacti seadistamine Name[fi]=Kontactin asetukset @@ -108,6 +109,7 @@ X-KDE-Keywords[da]=kontact X-KDE-Keywords[de]=Kontact X-KDE-Keywords[el]=kontact +X-KDE-Keywords[en_GB]=kontact X-KDE-Keywords[es]=kontact X-KDE-Keywords[et]=kontact X-KDE-Keywords[fi]=kontact diff -Nru kdepim-4.13.0/kontact/src/kontactconfiguredialog.cpp kdepim-4.13.3/kontact/src/kontactconfiguredialog.cpp --- kdepim-4.13.0/kontact/src/kontactconfiguredialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/kontactconfiguredialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -25,10 +25,10 @@ using namespace Kontact; KontactConfigureDialog::KontactConfigureDialog( QWidget *parent ) - : KSettings::Dialog( parent ) + : KSettings::Dialog( parent ) { - connect( this, SIGNAL(okClicked()), SLOT(slotOk()) ); - connect( this, SIGNAL(applyClicked()), SLOT(slotApply()) ); + connect( this, SIGNAL(okClicked()), SLOT(slotOk()) ); + connect( this, SIGNAL(applyClicked()), SLOT(slotApply()) ); } KontactConfigureDialog::~KontactConfigureDialog() @@ -37,40 +37,40 @@ void KontactConfigureDialog::emitConfigChanged() { - //Add code from plugins which needs to be call when we close kontact dialog config - QDBusInterface kmailIface( QLatin1String("org.kde.kmail"), QLatin1String("/KMail"), QLatin1String("org.kde.kmail.kmail"), - QDBusConnection::sessionBus() ); - if ( kmailIface.isValid() ) { - QDBusReply reply; - if ( !( reply = kmailIface.call( QLatin1String("updateConfig") ) ).isValid() ) { - QDBusError err = kmailIface.lastError(); - kError() << "Communication problem with KMail. " - << "Error message was:" << err.name() << ": \"" << err.message() << "\""; - } - } - QDBusInterface knotesIface( QLatin1String("org.kde.kontact"), QLatin1String("/KNotes"), QLatin1String("org.kde.kontact.KNotes"), - QDBusConnection::sessionBus() ); - if ( knotesIface.isValid() ) { - QDBusReply reply; - if ( !( reply = knotesIface.call( QLatin1String("updateConfig") ) ).isValid() ) { - QDBusError err = knotesIface.lastError(); - kError() << "Communication problem with KNotes. " - << "Error message was:" << err.name() << ": \"" << err.message() << "\""; - } + //Add code from plugins which needs to be call when we close kontact dialog config + QDBusInterface kmailIface( QLatin1String("org.kde.kmail"), QLatin1String("/KMail"), QLatin1String("org.kde.kmail.kmail"), + QDBusConnection::sessionBus() ); + if ( kmailIface.isValid() ) { + QDBusReply reply; + if ( !( reply = kmailIface.call( QLatin1String("updateConfig") ) ).isValid() ) { + QDBusError err = kmailIface.lastError(); + kError() << "Communication problem with KMail. " + << "Error message was:" << err.name() << ": \"" << err.message() << "\""; + } + } + QDBusInterface knotesIface( QLatin1String("org.kde.kontact"), QLatin1String("/KNotes"), QLatin1String("org.kde.kontact.KNotes"), + QDBusConnection::sessionBus() ); + if ( knotesIface.isValid() ) { + QDBusReply reply; + if ( !( reply = knotesIface.call( QLatin1String("updateConfig") ) ).isValid() ) { + const QDBusError err = knotesIface.lastError(); + kError() << "Communication problem with KNotes. " + << "Error message was:" << err.name() << ": \"" << err.message() << "\""; + } - } + } } void KontactConfigureDialog::slotApply() { - slotApplyClicked(); - emitConfigChanged(); + slotApplyClicked(); + emitConfigChanged(); } void KontactConfigureDialog::slotOk() { - slotOkClicked(); - emitConfigChanged(); + slotOkClicked(); + emitConfigChanged(); } diff -Nru kdepim-4.13.0/kontact/src/kontactconfiguredialog.h kdepim-4.13.3/kontact/src/kontactconfiguredialog.h --- kdepim-4.13.0/kontact/src/kontactconfiguredialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/kontactconfiguredialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -24,13 +24,13 @@ class KontactConfigureDialog : public KSettings::Dialog { - Q_OBJECT + Q_OBJECT - public: +public: explicit KontactConfigureDialog( QWidget *parent = 0 ); ~KontactConfigureDialog(); - protected slots: +protected slots: /** @reimplemented */ void slotApply(); diff -Nru kdepim-4.13.0/kontact/src/main.cpp kdepim-4.13.3/kontact/src/main.cpp --- kdepim-4.13.0/kontact/src/main.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/main.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -50,17 +50,17 @@ static const char version[] = KDEPIM_VERSION; class KontactApp : public -#ifdef Q_WS_WIN -KontactInterface::PimUniqueApplication -#else -KUniqueApplication -#endif + #ifdef Q_WS_WIN + KontactInterface::PimUniqueApplication + #else + KUniqueApplication + #endif { - Q_OBJECT - public: + Q_OBJECT +public: KontactApp() : mMainWindow( 0 ), mSessionRestored( false ) { - KIconLoader::global()->addAppDir( QLatin1String("kdepim") ); + KIconLoader::global()->addAppDir( QLatin1String("kdepim") ); } ~KontactApp() {} @@ -69,157 +69,157 @@ void setMainWindow( MainWindow *window ) { - mMainWindow = window; - KontactInterface::UniqueAppHandler::setMainWidget( window ); + mMainWindow = window; + KontactInterface::UniqueAppHandler::setMainWidget( window ); } void setSessionRestored( bool restored ) { - mSessionRestored = restored; + mSessionRestored = restored; } - public Q_SLOTS: +public Q_SLOTS: void loadCommandLineOptionsForNewInstance(); - private: +private: MainWindow *mMainWindow; bool mSessionRestored; }; static void listPlugins() { - KComponentData instance( "kontact" ); //Can't use KontactApp -- too late for adding cmdline opts + KComponentData instance( "kontact" ); //Can't use KontactApp -- too late for adding cmdline opts - const KService::List offers = KServiceTypeTrader::self()->query( - QString::fromLatin1( "Kontact/Plugin" ), - QString::fromLatin1( "[X-KDE-KontactPluginVersion] == %1" ).arg( KONTACT_PLUGIN_VERSION ) ); - KService::List::ConstIterator end( offers.end() ); - for ( KService::List::ConstIterator it = offers.begin(); it != end; ++it ) { - KService::Ptr service = (*it); - // skip summary only plugins - QVariant var = service->property( QLatin1String("X-KDE-KontactPluginHasPart") ); - if ( var.isValid() && var.toBool() == false ) { - continue; + const KService::List offers = KServiceTypeTrader::self()->query( + QString::fromLatin1( "Kontact/Plugin" ), + QString::fromLatin1( "[X-KDE-KontactPluginVersion] == %1" ).arg( KONTACT_PLUGIN_VERSION ) ); + KService::List::ConstIterator end( offers.end() ); + for ( KService::List::ConstIterator it = offers.begin(); it != end; ++it ) { + KService::Ptr service = (*it); + // skip summary only plugins + QVariant var = service->property( QLatin1String("X-KDE-KontactPluginHasPart") ); + if ( var.isValid() && var.toBool() == false ) { + continue; + } + cout << service->library().remove( QLatin1String("kontact_") ).toLatin1().data() << endl; } - cout << service->library().remove( QLatin1String("kontact_") ).toLatin1().data() << endl; - } } static void loadCommandLineOptions() { - KCmdLineOptions options; - options.add( "module ", ki18n( "Start with a specific Kontact module" ) ); - options.add( "iconify", ki18n( "Start in iconified (minimized) mode" ) ); - options.add( "list", ki18n( "List all possible modules and exit" ) ); - KCmdLineArgs::addCmdLineOptions( options ); + KCmdLineOptions options; + options.add( "module ", ki18n( "Start with a specific Kontact module" ) ); + options.add( "iconify", ki18n( "Start in iconified (minimized) mode" ) ); + options.add( "list", ki18n( "List all possible modules and exit" ) ); + KCmdLineArgs::addCmdLineOptions( options ); } // Called by KUniqueApplication void KontactApp::loadCommandLineOptionsForNewInstance() { - KCmdLineArgs::reset(); // forget options defined by other "applications" - loadCommandLineOptions(); // re-add the kontact options + KCmdLineArgs::reset(); // forget options defined by other "applications" + loadCommandLineOptions(); // re-add the kontact options } int KontactApp::newInstance() { - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - QString moduleName; - if ( Prefs::self()->forceStartupPlugin() ) { - moduleName = Prefs::self()->forcedStartupPlugin(); - } - if ( args->isSet( "module" ) ) { - moduleName = args->getOption( "module" ); - } - if ( !mSessionRestored ) { - if ( !mMainWindow ) { - mMainWindow = new MainWindow(); - if ( !moduleName.isEmpty() ) { - mMainWindow->setInitialActivePluginModule( moduleName ); - } - mMainWindow->show(); - KontactInterface::UniqueAppHandler::setMainWidget( mMainWindow ); - // --iconify is needed in kontact, although kstart can do that too, - // because kstart returns immediately so it's too early to talk D-Bus to the app. - if ( args->isSet( "iconify" ) ) { - KWindowSystem::minimizeWindow( mMainWindow->winId(), false /*no animation*/); - } - } else { - if ( !moduleName.isEmpty() ) { - mMainWindow->setInitialActivePluginModule( moduleName ); - } - } - } - - KPIM::ReminderClient::startDaemon(); - - // Handle startup notification and window activation - // (The first time it will do nothing except note that it was called) - return KUniqueApplication::newInstance(); + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + QString moduleName; + if ( Prefs::self()->forceStartupPlugin() ) { + moduleName = Prefs::self()->forcedStartupPlugin(); + } + if ( args->isSet( "module" ) ) { + moduleName = args->getOption( "module" ); + } + if ( !mSessionRestored ) { + if ( !mMainWindow ) { + mMainWindow = new MainWindow(); + if ( !moduleName.isEmpty() ) { + mMainWindow->setInitialActivePluginModule( moduleName ); + } + mMainWindow->show(); + KontactInterface::UniqueAppHandler::setMainWidget( mMainWindow ); + // --iconify is needed in kontact, although kstart can do that too, + // because kstart returns immediately so it's too early to talk D-Bus to the app. + if ( args->isSet( "iconify" ) ) { + KWindowSystem::minimizeWindow( mMainWindow->winId(), false /*no animation*/); + } + } else { + if ( !moduleName.isEmpty() ) { + mMainWindow->setInitialActivePluginModule( moduleName ); + } + } + } + + KPIM::ReminderClient::startDaemon(); + + // Handle startup notification and window activation + // (The first time it will do nothing except note that it was called) + return KUniqueApplication::newInstance(); } int main( int argc, char **argv ) { - KAboutData about( "kontact", 0, ki18n( "Kontact" ), version, ki18n(description), - KAboutData::License_GPL, - ki18n( "Copyright © 2001–2014 Kontact authors" ), - KLocalizedString(), "http://kontact.org" ); - - about.addAuthor( ki18n( "Allen Winter" ), KLocalizedString(), "winter@kde.org" ); - about.addAuthor( ki18n( "Rafael Fernández López" ), KLocalizedString(), "ereslibre@kde.org" ); - about.addAuthor( ki18n( "Daniel Molkentin" ), KLocalizedString(), "molkentin@kde.org" ); - about.addAuthor( ki18n( "Don Sanders" ), KLocalizedString(), "sanders@kde.org" ); - about.addAuthor( ki18n( "Cornelius Schumacher" ), KLocalizedString(), "schumacher@kde.org" ); - about.addAuthor( ki18n( "Tobias K\303\266nig" ), KLocalizedString(), "tokoe@kde.org" ); - about.addAuthor( ki18n( "David Faure" ), KLocalizedString(), "faure@kde.org" ); - about.addAuthor( ki18n( "Ingo Kl\303\266cker" ), KLocalizedString(), "kloecker@kde.org" ); - about.addAuthor( ki18n( "Sven L\303\274ppken" ), KLocalizedString(), "sven@kde.org" ); - about.addAuthor( ki18n( "Zack Rusin" ), KLocalizedString(), "zack@kde.org" ); - about.addAuthor( ki18n( "Matthias Hoelzer-Kluepfel" ), - ki18n( "Original Author" ), "mhk@kde.org" ); - about.addCredit( ki18n( "Torgny Nyblom" ), ki18n("Git Migration"), "nyblom@kde.org" ); - about.setOrganizationDomain( "kde.org" ); - - KCmdLineArgs::init( argc, argv, &about ); - - loadCommandLineOptions(); - KUniqueApplication::addCmdLineOptions(); - KCmdLineArgs::addStdCmdLineOptions(); - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if ( args->isSet( "list" ) ) { - listPlugins(); - return 0; - } - - if ( !KontactApp::start() ) { - // Already running, brought to the foreground. - return 0; - } - - KontactApp app; - - // Qt doesn't treat the system tray as a window, and therefore Qt would quit - // the event loop when an error message is clicked away while Kontact is in the - // tray. - // Rely on KGlobal::ref() and KGlobal::deref() instead, like we did in KDE3. - // See http://bugs.kde.org/show_bug.cgi?id=163479 - QApplication::setQuitOnLastWindowClosed( false ); - - if ( app.restoringSession() ) { - // There can only be one main window - if ( KMainWindow::canBeRestored( 1 ) ) { - MainWindow *mainWindow = new MainWindow(); - app.setMainWindow( mainWindow ); - app.setSessionRestored( true ); - mainWindow->show(); - mainWindow->restore( 1 ); + KAboutData about( "kontact", 0, ki18n( "Kontact" ), version, ki18n(description), + KAboutData::License_GPL, + ki18n( "Copyright © 2001–2014 Kontact authors" ), + KLocalizedString(), "http://kontact.org" ); + + about.addAuthor( ki18n( "Allen Winter" ), KLocalizedString(), "winter@kde.org" ); + about.addAuthor( ki18n( "Rafael Fernández López" ), KLocalizedString(), "ereslibre@kde.org" ); + about.addAuthor( ki18n( "Daniel Molkentin" ), KLocalizedString(), "molkentin@kde.org" ); + about.addAuthor( ki18n( "Don Sanders" ), KLocalizedString(), "sanders@kde.org" ); + about.addAuthor( ki18n( "Cornelius Schumacher" ), KLocalizedString(), "schumacher@kde.org" ); + about.addAuthor( ki18n( "Tobias K\303\266nig" ), KLocalizedString(), "tokoe@kde.org" ); + about.addAuthor( ki18n( "David Faure" ), KLocalizedString(), "faure@kde.org" ); + about.addAuthor( ki18n( "Ingo Kl\303\266cker" ), KLocalizedString(), "kloecker@kde.org" ); + about.addAuthor( ki18n( "Sven L\303\274ppken" ), KLocalizedString(), "sven@kde.org" ); + about.addAuthor( ki18n( "Zack Rusin" ), KLocalizedString(), "zack@kde.org" ); + about.addAuthor( ki18n( "Matthias Hoelzer-Kluepfel" ), + ki18n( "Original Author" ), "mhk@kde.org" ); + about.addCredit( ki18n( "Torgny Nyblom" ), ki18n("Git Migration"), "nyblom@kde.org" ); + about.setOrganizationDomain( "kde.org" ); + + KCmdLineArgs::init( argc, argv, &about ); + + loadCommandLineOptions(); + KUniqueApplication::addCmdLineOptions(); + KCmdLineArgs::addStdCmdLineOptions(); + + KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); + if ( args->isSet( "list" ) ) { + listPlugins(); + return 0; + } + + if ( !KontactApp::start() ) { + // Already running, brought to the foreground. + return 0; + } + + KontactApp app; + + // Qt doesn't treat the system tray as a window, and therefore Qt would quit + // the event loop when an error message is clicked away while Kontact is in the + // tray. + // Rely on KGlobal::ref() and KGlobal::deref() instead, like we did in KDE3. + // See http://bugs.kde.org/show_bug.cgi?id=163479 + QApplication::setQuitOnLastWindowClosed( false ); + + if ( app.restoringSession() ) { + // There can only be one main window + if ( KMainWindow::canBeRestored( 1 ) ) { + MainWindow *mainWindow = new MainWindow(); + app.setMainWindow( mainWindow ); + app.setSessionRestored( true ); + mainWindow->show(); + mainWindow->restore( 1 ); + } } - } - bool ret = app.exec(); - qDeleteAll( KMainWindow::memberList() ); + bool ret = app.exec(); + qDeleteAll( KMainWindow::memberList() ); - return ret; + return ret; } #include "main.moc" diff -Nru kdepim-4.13.0/kontact/src/mainwindow.cpp kdepim-4.13.3/kontact/src/mainwindow.cpp --- kdepim-4.13.0/kontact/src/mainwindow.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/mainwindow.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -86,7 +86,7 @@ // way of starting a service. class ServiceStarter : public KDBusServiceStarter { - public: +public: virtual int startServiceFor( const QString &serviceType, const QString &constraint = QString(), @@ -97,14 +97,14 @@ // to the plugin list here. Be sure to reset it back to 0 with // setPluginList() as soon as the list gets destroyed. ServiceStarter( PluginList *pluginList ) { - mPlugins = pluginList; + mPlugins = pluginList; } static void setPluginList( PluginList *pluginList ) { - mPlugins = pluginList; + mPlugins = pluginList; } - protected: +protected: virtual ~ServiceStarter() {} static PluginList *mPlugins; @@ -117,184 +117,184 @@ QString *error, QString *dbusService, int flags ) { - if ( mPlugins ) { - PluginList::ConstIterator end = mPlugins->constEnd(); - for ( PluginList::ConstIterator it = mPlugins->constBegin(); it != end; ++it ) { - if ( (*it)->createDBUSInterface( serviceType ) ) { - kDebug() << "found interface for" << serviceType; - if ( dbusService ) { - *dbusService = (*it)->registerClient(); - } - return 0; - } - } - } - - kDebug() << "Didn't find dbus interface, falling back to external process"; - return KDBusServiceStarter::startServiceFor( serviceType, constraint, - error, dbusService, flags ); + if ( mPlugins ) { + PluginList::ConstIterator end = mPlugins->constEnd(); + for ( PluginList::ConstIterator it = mPlugins->constBegin(); it != end; ++it ) { + if ( (*it)->createDBUSInterface( serviceType ) ) { + kDebug() << "found interface for" << serviceType; + if ( dbusService ) { + *dbusService = (*it)->registerClient(); + } + return 0; + } + } + } + + kDebug() << "Didn't find dbus interface, falling back to external process"; + return KDBusServiceStarter::startServiceFor( serviceType, constraint, + error, dbusService, flags ); } MainWindow::MainWindow() - : KontactInterface::Core(), mSplitter( 0 ), mCurrentPlugin( 0 ), mAboutDialog( 0 ), - mReallyClose( false ), mSyncActionsEnabled( true ) + : KontactInterface::Core(), mSplitter( 0 ), mCurrentPlugin( 0 ), mAboutDialog( 0 ), + mReallyClose( false ), mSyncActionsEnabled( true ) { - // The ServiceStarter created here will be deleted by the KDbusServiceStarter - // base class, which is a global static. - new ServiceStarter( &mPlugins ); + // The ServiceStarter created here will be deleted by the KDbusServiceStarter + // base class, which is a global static. + new ServiceStarter( &mPlugins ); - QDBusConnection::sessionBus().registerObject( - QLatin1String("/KontactInterface"), this, QDBusConnection::ExportScriptableSlots ); + QDBusConnection::sessionBus().registerObject( + QLatin1String("/KontactInterface"), this, QDBusConnection::ExportScriptableSlots ); - // Set this to be the group leader for all subdialogs - this means - // modal subdialogs will only affect this dialog, not the other windows - setAttribute( Qt::WA_GroupLeader ); + // Set this to be the group leader for all subdialogs - this means + // modal subdialogs will only affect this dialog, not the other windows + setAttribute( Qt::WA_GroupLeader ); - initGUI(); - initObject(); + initGUI(); + initObject(); - mSidePane->setMaximumWidth( mSidePane->sizeHint().width() ); - mSidePane->setMinimumWidth( mSidePane->sizeHint().width() ); + mSidePane->setMaximumWidth( mSidePane->sizeHint().width() ); + mSidePane->setMinimumWidth( mSidePane->sizeHint().width() ); - factory()->plugActionList( this, QLatin1String( "navigator_actionlist" ), mActionPlugins ); + factory()->plugActionList( this, QLatin1String( "navigator_actionlist" ), mActionPlugins ); - restoreWindowSize( KConfigGroup( KGlobal::config(), "MainWindow" ) ); - setAutoSaveSettings(); + restoreWindowSize( KConfigGroup( KGlobal::config(), "MainWindow" ) ); + setAutoSaveSettings(); } void MainWindow::initGUI() { - initWidgets(); - setupActions(); - setHelpMenuEnabled( false ); - KHelpMenu *helpMenu = new KHelpMenu( this, 0, true, actionCollection() ); - connect( helpMenu, SIGNAL(showAboutApplication()), SLOT(showAboutDialog()) ); - - KStandardAction::keyBindings( this, SLOT(configureShortcuts()), actionCollection() ); - KStandardAction::configureToolbars( this, SLOT(configureToolbars()), actionCollection() ); - setXMLFile( QLatin1String("kontactui.rc") ); - - setStandardToolBarMenuEnabled( true ); - - createGUI( 0 ); - - KToolBar *navigatorToolBar = findToolBar( "navigatorToolBar" ); - if ( navigatorToolBar ) { - if ( layoutDirection() == Qt::LeftToRight ) { - navigatorToolBar->setLayoutDirection( Qt::RightToLeft ); + initWidgets(); + setupActions(); + setHelpMenuEnabled( false ); + KHelpMenu *helpMenu = new KHelpMenu( this, 0, true, actionCollection() ); + connect( helpMenu, SIGNAL(showAboutApplication()), SLOT(showAboutDialog()) ); + + KStandardAction::keyBindings( this, SLOT(configureShortcuts()), actionCollection() ); + KStandardAction::configureToolbars( this, SLOT(configureToolbars()), actionCollection() ); + setXMLFile( QLatin1String("kontactui.rc") ); + + setStandardToolBarMenuEnabled( true ); + + createGUI( 0 ); + + KToolBar *navigatorToolBar = findToolBar( "navigatorToolBar" ); + if ( navigatorToolBar ) { + if ( layoutDirection() == Qt::LeftToRight ) { + navigatorToolBar->setLayoutDirection( Qt::RightToLeft ); + } else { + navigatorToolBar->setLayoutDirection( Qt::LeftToRight ); + } + Q_ASSERT( navigatorToolBar->sizeHint().isValid() ); + navigatorToolBar->setMinimumWidth( navigatorToolBar->sizeHint().width() ); } else { - navigatorToolBar->setLayoutDirection( Qt::LeftToRight ); + kError() << "Unable to find navigatorToolBar, probably kontactui.rc is missing"; } - Q_ASSERT( navigatorToolBar->sizeHint().isValid() ); - navigatorToolBar->setMinimumWidth( navigatorToolBar->sizeHint().width() ); - } else { - kError() << "Unable to find navigatorToolBar, probably kontactui.rc is missing"; - } } void MainWindow::waitForKSycoca() { - int i = 0; - while ( i < KSYCOCA_WAIT_TIMEOUT ) { - if ( KSycoca::isAvailable() ) { - return; - } - // When KSycoca is not availabe that usually means Kontact - // was started before kded is done with it's first run - // we want to block Kontact execution to - // give Kded time to initialize and create the - // System Configuration database necessary for further - // Kontact startup - kDebug() << "Waiting for KSycoca"; - sleep(1); - ++i; - } - // This should only happen if the distribution is broken - kFatal() << "KSycoca unavailable. Kontact will be unable to find plugins."; + int i = 0; + while ( i < KSYCOCA_WAIT_TIMEOUT ) { + if ( KSycoca::isAvailable() ) { + return; + } + // When KSycoca is not availabe that usually means Kontact + // was started before kded is done with it's first run + // we want to block Kontact execution to + // give Kded time to initialize and create the + // System Configuration database necessary for further + // Kontact startup + kDebug() << "Waiting for KSycoca"; + sleep(1); + ++i; + } + // This should only happen if the distribution is broken + kFatal() << "KSycoca unavailable. Kontact will be unable to find plugins."; } void MainWindow::initObject() { - if ( !KSycoca::isAvailable() ) { - waitForKSycoca(); - } - KService::List offers = KServiceTypeTrader::self()->query( - QString::fromLatin1( "Kontact/Plugin" ), - QString::fromLatin1( "[X-KDE-KontactPluginVersion] == %1" ).arg( KONTACT_PLUGIN_VERSION ) ); - mPluginInfos = KPluginInfo::fromServices( - offers, KConfigGroup( Prefs::self()->config(), "Plugins" ) ); - - KPluginInfo::List::Iterator it; - KPluginInfo::List::Iterator end( mPluginInfos.end() ); - - for ( it = mPluginInfos.begin(); it != end; ++it ) { - it->load(); - } - - // prepare the part manager - mPartManager = new KParts::PartManager( this ); - connect( mPartManager, SIGNAL(activePartChanged(KParts::Part*)), - this, SLOT(slotActivePartChanged(KParts::Part*)) ); + if ( !KSycoca::isAvailable() ) { + waitForKSycoca(); + } + KService::List offers = KServiceTypeTrader::self()->query( + QString::fromLatin1( "Kontact/Plugin" ), + QString::fromLatin1( "[X-KDE-KontactPluginVersion] == %1" ).arg( KONTACT_PLUGIN_VERSION ) ); + mPluginInfos = KPluginInfo::fromServices( + offers, KConfigGroup( Prefs::self()->config(), "Plugins" ) ); - loadPlugins(); + KPluginInfo::List::Iterator it; + KPluginInfo::List::Iterator end( mPluginInfos.end() ); - if ( mSidePane ) { - mSidePane->updatePlugins(); - } + for ( it = mPluginInfos.begin(); it != end; ++it ) { + it->load(); + } + + // prepare the part manager + mPartManager = new KParts::PartManager( this ); + connect( mPartManager, SIGNAL(activePartChanged(KParts::Part*)), + this, SLOT(slotActivePartChanged(KParts::Part*)) ); - KSettings::Dispatcher::registerComponent( componentData(), this, "updateConfig" ); + loadPlugins(); - loadSettings(); + if ( mSidePane ) { + mSidePane->updatePlugins(); + } + + KSettings::Dispatcher::registerComponent( componentData(), this, "updateConfig" ); - statusBar()->show(); + loadSettings(); - QTimer::singleShot( 200, this, SLOT(slotShowTipOnStart()) ); + statusBar()->show(); - // done initializing - slotShowStatusMsg( QString::null ); //krazy:exclude=nullstrassign for old broken gcc + QTimer::singleShot( 200, this, SLOT(slotShowTipOnStart()) ); - connect( KPIM::BroadcastStatus::instance(), SIGNAL(statusMsg(QString)), - this, SLOT(slotShowStatusMsg(QString)) ); + // done initializing + slotShowStatusMsg( QString::null ); //krazy:exclude=nullstrassign for old broken gcc - // launch commandline specified module if any - activateInitialPluginModule(); + connect( KPIM::BroadcastStatus::instance(), SIGNAL(statusMsg(QString)), + this, SLOT(slotShowStatusMsg(QString)) ); - if ( Prefs::lastVersionSeen() == KGlobal::mainComponent().aboutData()->version() ) { - selectPlugin( mCurrentPlugin ); - } + // launch commandline specified module if any + activateInitialPluginModule(); - paintAboutScreen( introductionString() ); - Prefs::setLastVersionSeen( KGlobal::mainComponent().aboutData()->version() ); + if ( Prefs::lastVersionSeen() == KGlobal::mainComponent().aboutData()->version() ) { + selectPlugin( mCurrentPlugin ); + } + + paintAboutScreen( introductionString() ); + Prefs::setLastVersionSeen( KGlobal::mainComponent().aboutData()->version() ); } MainWindow::~MainWindow() { - if ( mCurrentPlugin ) { - saveMainWindowSettings( - KGlobal::config()->group( - QString::fromLatin1( "MainWindow%1" ).arg( mCurrentPlugin->identifier() ) ) ); - } - - createGUI( 0 ); - ServiceStarter::setPluginList( 0 ); - saveSettings(); - - //QList parts = mPartManager->parts(); - -// Q_FOREACH( KParts::Part *p, parts ) { -// delete p; -// p = 0; -// } - - Prefs::self()->writeConfig(); - - // During deletion of plugins, we should not access the plugin list (bug #182176) - delete mSidePane; - - PluginList::ConstIterator end = mPlugins.constEnd(); - for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { - delete *it; - } + if ( mCurrentPlugin ) { + saveMainWindowSettings( + KGlobal::config()->group( + QString::fromLatin1( "MainWindow%1" ).arg( mCurrentPlugin->identifier() ) ) ); + } + + createGUI( 0 ); + ServiceStarter::setPluginList( 0 ); + saveSettings(); + + //QList parts = mPartManager->parts(); + + // Q_FOREACH( KParts::Part *p, parts ) { + // delete p; + // p = 0; + // } + + Prefs::self()->writeConfig(); + + // During deletion of plugins, we should not access the plugin list (bug #182176) + delete mSidePane; + + PluginList::ConstIterator end = mPlugins.constEnd(); + for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { + delete *it; + } } // Called by main(). @@ -308,972 +308,972 @@ bool MainWindow::pluginActionWeightLessThan( const QAction *left, const QAction *right ) { - // Since this lessThan method is used only for the toolbar (which is on - // the inverse layout direction than the rest of the system), we add the - // elements on the exactly inverse order. (ereslibre) - return !pluginWeightLessThan( left->data().value(), - right->data().value() ); + // Since this lessThan method is used only for the toolbar (which is on + // the inverse layout direction than the rest of the system), we add the + // elements on the exactly inverse order. (ereslibre) + return !pluginWeightLessThan( left->data().value(), + right->data().value() ); } bool MainWindow::pluginWeightLessThan( const KontactInterface::Plugin *left, const KontactInterface::Plugin *right ) { - return left->weight() < right->weight(); + return left->weight() < right->weight(); } void MainWindow::activateInitialPluginModule() { - if ( !mInitialActiveModule.isEmpty() && !mPlugins.isEmpty() ) { - PluginList::ConstIterator end = mPlugins.constEnd(); - for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { - if ( !(*it)->identifier().isEmpty() && - (*it)->identifier().contains( mInitialActiveModule ) ) { - selectPlugin( *it ); - return; - } + if ( !mInitialActiveModule.isEmpty() && !mPlugins.isEmpty() ) { + PluginList::ConstIterator end = mPlugins.constEnd(); + for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { + if ( !(*it)->identifier().isEmpty() && + (*it)->identifier().contains( mInitialActiveModule ) ) { + selectPlugin( *it ); + return; + } + } } - } } void MainWindow::initWidgets() { - QWidget *mTopWidget = new QWidget( this ); - QVBoxLayout *layout = new QVBoxLayout; - layout->setMargin(0); - layout->setSpacing(0); - mTopWidget->setLayout( layout ); - setCentralWidget( mTopWidget ); - - mSplitter = new QSplitter( mTopWidget ); - layout->addWidget( mSplitter ); - mSidePane = new IconSidePane( this, mSplitter ); -/* + QWidget *mTopWidget = new QWidget( this ); + QVBoxLayout *layout = new QVBoxLayout; + layout->setMargin(0); + layout->setSpacing(0); + mTopWidget->setLayout( layout ); + setCentralWidget( mTopWidget ); + + mSplitter = new QSplitter( mTopWidget ); + layout->addWidget( mSplitter ); + mSidePane = new IconSidePane( this, mSplitter ); + /* // don't occupy screen estate on load QList sizes; sizes << 0; mSplitter->setSizes(sizes); */ - connect( mSidePane, SIGNAL(pluginSelected(KontactInterface::Plugin*)), - SLOT(selectPlugin(KontactInterface::Plugin*)) ); + connect( mSidePane, SIGNAL(pluginSelected(KontactInterface::Plugin*)), + SLOT(selectPlugin(KontactInterface::Plugin*)) ); - mPartsStack = new QStackedWidget( mSplitter ); - mPartsStack->layout()->setSpacing( 0 ); + mPartsStack = new QStackedWidget( mSplitter ); + mPartsStack->layout()->setSpacing( 0 ); - initAboutScreen(); + initAboutScreen(); - const QString loading = - i18nc( "@item", - "

    %1

    ", - i18nc( "@item:intext", "Loading Kontact..." ) ); + const QString loading = + i18nc( "@item", + "

    %1

    ", + i18nc( "@item:intext", "Loading Kontact..." ) ); - paintAboutScreen( loading ); + paintAboutScreen( loading ); - KPIM::ProgressStatusBarWidget * progressStatusBarWidget = new KPIM::ProgressStatusBarWidget(statusBar(), this); + KPIM::ProgressStatusBarWidget * progressStatusBarWidget = new KPIM::ProgressStatusBarWidget(statusBar(), this); - mStatusMsgLabel = - new KSqueezedTextLabel( i18nc( "@info:status", " Initializing..." ), statusBar() ); - mStatusMsgLabel->setTextElideMode( Qt::ElideRight ); - mStatusMsgLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); + mStatusMsgLabel = + new KSqueezedTextLabel( i18nc( "@info:status", " Initializing..." ), statusBar() ); + mStatusMsgLabel->setTextElideMode( Qt::ElideRight ); + mStatusMsgLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); - statusBar()->addWidget( mStatusMsgLabel, 10 ); - statusBar()->addPermanentWidget( progressStatusBarWidget->littleProgress(), 0 ); + statusBar()->addWidget( mStatusMsgLabel, 10 ); + statusBar()->addPermanentWidget( progressStatusBarWidget->littleProgress(), 0 ); - mSplitter->setCollapsible( 1, false ); + mSplitter->setCollapsible( 1, false ); } void MainWindow::paintAboutScreen( const QString &msg ) { - QString location = KStandardDirs::locate( "data", QLatin1String("kontact/about/main.html") ); - QString content = QLatin1String(KPIMUtils::kFileToByteArray( location )); - content = content.arg( QLatin1String("file:") + KStandardDirs::locate( - "data", QLatin1String("kdeui/about/kde_infopage.css") ) ); - if ( QApplication::isRightToLeft() ) { - content = - content.arg( QLatin1String("@import \"%1\";") ). - arg( QLatin1String("file:") + KStandardDirs::locate( - "data", QLatin1String("kdeui/about/kde_infopage_rtl.css") ) ); - } else { - content = content.arg( QString() ); - } - - mIntroPart->setHtml( - content.arg( QFont().pointSize() + 2 ). - arg( i18nc( "@item:intext", "KDE Kontact" ) ). - arg( i18nc( "@item:intext", "Get Organized!" ) ). - arg( i18nc( "@item:intext", "The KDE Personal Information Management Suite" ) ). - arg( msg ) ); + QString location = KStandardDirs::locate( "data", QLatin1String("kontact/about/main.html") ); + QString content = QLatin1String(KPIMUtils::kFileToByteArray( location )); + content = content.arg( QLatin1String("file:") + KStandardDirs::locate( + "data", QLatin1String("kdeui/about/kde_infopage.css") ) ); + if ( QApplication::isRightToLeft() ) { + content = + content.arg( QLatin1String("@import \"%1\";") ). + arg( QLatin1String("file:") + KStandardDirs::locate( + "data", QLatin1String("kdeui/about/kde_infopage_rtl.css") ) ); + } else { + content = content.arg( QString() ); + } + + mIntroPart->setHtml( + content.arg( QFont().pointSize() + 2 ). + arg( i18nc( "@item:intext", "KDE Kontact" ) ). + arg( i18nc( "@item:intext", "Get Organized!" ) ). + arg( i18nc( "@item:intext", "The KDE Personal Information Management Suite" ) ). + arg( msg ) ); } void MainWindow::initAboutScreen() { - KHBox *introbox = new KHBox( mPartsStack ); - mPartsStack->addWidget( introbox ); - mPartsStack->setCurrentWidget( introbox ); - mIntroPart = new KWebView( introbox ); - mIntroPart->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks ); - mIntroPart->setFocusPolicy( Qt::WheelFocus ); - // Let's better be paranoid and disable plugins (it defaults to enabled): - mIntroPart->settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); - mIntroPart->settings()->setAttribute( QWebSettings::JavaEnabled, false ); - mIntroPart->settings()->setAttribute( QWebSettings::PluginsEnabled, false ); + KHBox *introbox = new KHBox( mPartsStack ); + mPartsStack->addWidget( introbox ); + mPartsStack->setCurrentWidget( introbox ); + mIntroPart = new KWebView( introbox ); + mIntroPart->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks ); + mIntroPart->setFocusPolicy( Qt::WheelFocus ); + // Let's better be paranoid and disable plugins (it defaults to enabled): + mIntroPart->settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); + mIntroPart->settings()->setAttribute( QWebSettings::JavaEnabled, false ); + mIntroPart->settings()->setAttribute( QWebSettings::PluginsEnabled, false ); - connect( mIntroPart->page(), SIGNAL(linkClicked(QUrl)), this, - SLOT(slotOpenUrl(QUrl)), Qt::QueuedConnection ); + connect( mIntroPart->page(), SIGNAL(linkClicked(QUrl)), this, + SLOT(slotOpenUrl(QUrl)), Qt::QueuedConnection ); } void MainWindow::setupActions() { - actionCollection()->addAction( KStandardAction::Quit, this, SLOT(slotQuit()) ); + actionCollection()->addAction( KStandardAction::Quit, this, SLOT(slotQuit()) ); - mNewActions = new KActionMenu( - i18nc( "@title:menu create new pim items (message,calendar,to-do,etc.)", "New" ), this ); - actionCollection()->addAction( QLatin1String("action_new"), mNewActions ); - mNewActions->setShortcut( KStandardShortcut::openNew() ); - connect( mNewActions, SIGNAL(triggered(bool)), this, SLOT(slotNewClicked()) ); - - // If the user is using disconnected imap mail folders as groupware, we add - // plugins' Synchronize actions to the toolbar which trigger an imap sync. - // Otherwise it's redundant and misleading. - KConfig _config( QLatin1String("kmail2rc") ); - KConfigGroup config( &_config, "Groupware" ); + mNewActions = new KActionMenu( + i18nc( "@title:menu create new pim items (message,calendar,to-do,etc.)", "New" ), this ); + actionCollection()->addAction( QLatin1String("action_new"), mNewActions ); + mNewActions->setShortcut( KStandardShortcut::openNew() ); + connect( mNewActions, SIGNAL(triggered(bool)), this, SLOT(slotNewClicked()) ); + + // If the user is using disconnected imap mail folders as groupware, we add + // plugins' Synchronize actions to the toolbar which trigger an imap sync. + // Otherwise it's redundant and misleading. + KConfig _config( QLatin1String("kmail2rc") ); + KConfigGroup config( &_config, "Groupware" ); #if defined(KDEPIM_ENTERPRISE_BUILD) - bool defGW = config.readEntry( "Enabled", true ); + bool defGW = config.readEntry( "Enabled", true ); #else - bool defGW = config.readEntry( "Enabled", false ); + bool defGW = config.readEntry( "Enabled", false ); #endif - KConfig *_cfg = Prefs::self()->config(); - KConfigGroup cfg( _cfg, "Kontact Groupware Settings" ); - mSyncActionsEnabled = cfg.readEntry( "GroupwareMailFoldersEnabled", defGW ); - - if ( mSyncActionsEnabled ) { - mSyncActions = new KActionMenu( - KIcon( QLatin1String("view-refresh") ), - i18nc( "@title:menu synchronize pim items (message,calendar,to-do,etc.)", "Sync" ), this ); - actionCollection()->addAction( QLatin1String("action_sync"), mSyncActions ); - mSyncActions->setShortcut( KStandardShortcut::reload() ); - connect( mSyncActions, SIGNAL(triggered(bool)), this, SLOT(slotSyncClicked()) ); - } - - KAction *action = - new KAction( KIcon( QLatin1String("configure") ), - i18nc( "@action:inmenu", "Configure Kontact..." ), this ); - action->setHelpText( - i18nc( "@info:status", "Configure Kontact" ) ); - action->setWhatsThis( - i18nc( "@info:whatsthis", - "You will be presented with a dialog where you can configure Kontact." ) ); - actionCollection()->addAction( QLatin1String("settings_configure_kontact"), action ); - connect( action, SIGNAL(triggered(bool)), SLOT(slotPreferences()) ); - - action = - new KAction( KIcon( QLatin1String("kontact") ), - i18nc( "@action:inmenu", "&Kontact Introduction" ), this ); - action->setHelpText( - i18nc( "@info:status", "Show the Kontact Introduction page" ) ); - action->setWhatsThis( - i18nc( "@info:whatsthis", - "Choose this option to see the Kontact Introduction page." ) ); - actionCollection()->addAction( QLatin1String("help_introduction"), action ); - connect( action, SIGNAL(triggered(bool)), SLOT(slotShowIntroduction()) ); - - action = - new KAction( KIcon( QLatin1String("ktip") ), - i18nc( "@action:inmenu", "&Tip of the Day" ), this ); - action->setHelpText( - i18nc( "@info:status", "Show the Tip-of-the-Day dialog" ) ); - action->setWhatsThis( - i18nc( "@info:whatsthis", - "You will be presented with a dialog showing small tips to help " - "you use this program more effectively." ) ); - actionCollection()->addAction( QLatin1String("help_tipofday"), action ); - connect( action, SIGNAL(triggered(bool)), SLOT(slotShowTip()) ); - //TODO 4.12: add description - QShortcut *shortcut = new QShortcut( QKeySequence(Qt::Key_F9), this ); - connect(shortcut, SIGNAL(activated()), this, SLOT(slotShowHideSideBar())); + KConfig *_cfg = Prefs::self()->config(); + KConfigGroup cfg( _cfg, "Kontact Groupware Settings" ); + mSyncActionsEnabled = cfg.readEntry( "GroupwareMailFoldersEnabled", defGW ); + + if ( mSyncActionsEnabled ) { + mSyncActions = new KActionMenu( + KIcon( QLatin1String("view-refresh") ), + i18nc( "@title:menu synchronize pim items (message,calendar,to-do,etc.)", "Sync" ), this ); + actionCollection()->addAction( QLatin1String("action_sync"), mSyncActions ); + mSyncActions->setShortcut( KStandardShortcut::reload() ); + connect( mSyncActions, SIGNAL(triggered(bool)), this, SLOT(slotSyncClicked()) ); + } + + KAction *action = + new KAction( KIcon( QLatin1String("configure") ), + i18nc( "@action:inmenu", "Configure Kontact..." ), this ); + action->setHelpText( + i18nc( "@info:status", "Configure Kontact" ) ); + action->setWhatsThis( + i18nc( "@info:whatsthis", + "You will be presented with a dialog where you can configure Kontact." ) ); + actionCollection()->addAction( QLatin1String("settings_configure_kontact"), action ); + connect( action, SIGNAL(triggered(bool)), SLOT(slotPreferences()) ); + + action = + new KAction( KIcon( QLatin1String("kontact") ), + i18nc( "@action:inmenu", "&Kontact Introduction" ), this ); + action->setHelpText( + i18nc( "@info:status", "Show the Kontact Introduction page" ) ); + action->setWhatsThis( + i18nc( "@info:whatsthis", + "Choose this option to see the Kontact Introduction page." ) ); + actionCollection()->addAction( QLatin1String("help_introduction"), action ); + connect( action, SIGNAL(triggered(bool)), SLOT(slotShowIntroduction()) ); + + action = + new KAction( KIcon( QLatin1String("ktip") ), + i18nc( "@action:inmenu", "&Tip of the Day" ), this ); + action->setHelpText( + i18nc( "@info:status", "Show the Tip-of-the-Day dialog" ) ); + action->setWhatsThis( + i18nc( "@info:whatsthis", + "You will be presented with a dialog showing small tips to help " + "you use this program more effectively." ) ); + actionCollection()->addAction( QLatin1String("help_tipofday"), action ); + connect( action, SIGNAL(triggered(bool)), SLOT(slotShowTip()) ); + //TODO 4.12: add description + QShortcut *shortcut = new QShortcut( QKeySequence(Qt::Key_F9), this ); + connect(shortcut, SIGNAL(activated()), this, SLOT(slotShowHideSideBar())); } bool MainWindow::isPluginLoaded( const KPluginInfo &info ) { - return ( pluginFromInfo( info ) != 0 ); + return ( pluginFromInfo( info ) != 0 ); } KontactInterface::Plugin *MainWindow::pluginFromInfo( const KPluginInfo &info ) { - PluginList::ConstIterator end = mPlugins.constEnd(); - for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { - if ( (*it)->identifier() == info.pluginName() ) { - return *it; + PluginList::ConstIterator end = mPlugins.constEnd(); + for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { + if ( (*it)->identifier() == info.pluginName() ) { + return *it; + } } - } - return 0; + return 0; } void MainWindow::loadPlugins() { - QList plugins; + QList plugins; - int i; - KPluginInfo::List::ConstIterator it; - KPluginInfo::List::ConstIterator end( mPluginInfos.constEnd() ); - for ( it = mPluginInfos.constBegin(); it != end; ++it ) { - if ( !it->isPluginEnabled() ) { - continue; - } - - KontactInterface::Plugin *plugin = 0; - if ( isPluginLoaded( *it ) ) { - plugin = pluginFromInfo( *it ); - if ( plugin ) { - plugin->configUpdated(); - } - continue; - } - - kDebug() << "Loading Plugin:" << it->name(); - QString error; - plugin = - it->service()->createInstance( this, QVariantList(), &error ); + int i; + KPluginInfo::List::ConstIterator it; + KPluginInfo::List::ConstIterator end( mPluginInfos.constEnd() ); + for ( it = mPluginInfos.constBegin(); it != end; ++it ) { + if ( !it->isPluginEnabled() ) { + continue; + } - if ( !plugin ) { - kDebug() << "Unable to create plugin for" << it->name() << error; - continue; - } + KontactInterface::Plugin *plugin = 0; + if ( isPluginLoaded( *it ) ) { + plugin = pluginFromInfo( *it ); + if ( plugin ) { + plugin->configUpdated(); + } + continue; + } + + kDebug() << "Loading Plugin:" << it->name(); + QString error; + plugin = + it->service()->createInstance( this, QVariantList(), &error ); + + if ( !plugin ) { + kDebug() << "Unable to create plugin for" << it->name() << error; + continue; + } - plugin->setIdentifier( it->pluginName() ); - plugin->setTitle( it->name() ); - plugin->setIcon( it->icon() ); + plugin->setIdentifier( it->pluginName() ); + plugin->setTitle( it->name() ); + plugin->setIcon( it->icon() ); + + QVariant libNameProp = it->property( QLatin1String("X-KDE-KontactPartLibraryName") ); + QVariant exeNameProp = it->property( QLatin1String("X-KDE-KontactPartExecutableName") ); + QVariant loadOnStart = it->property( QLatin1String("X-KDE-KontactPartLoadOnStart") ); + QVariant hasPartProp = it->property( QLatin1String("X-KDE-KontactPluginHasPart") ); - QVariant libNameProp = it->property( QLatin1String("X-KDE-KontactPartLibraryName") ); - QVariant exeNameProp = it->property( QLatin1String("X-KDE-KontactPartExecutableName") ); - QVariant loadOnStart = it->property( QLatin1String("X-KDE-KontactPartLoadOnStart") ); - QVariant hasPartProp = it->property( QLatin1String("X-KDE-KontactPluginHasPart") ); + if ( !loadOnStart.isNull() && loadOnStart.toBool() ) { + mDelayedPreload.append( plugin ); + } - if ( !loadOnStart.isNull() && loadOnStart.toBool() ) { - mDelayedPreload.append( plugin ); - } + kDebug() << "LIBNAMEPART:" << libNameProp.toString(); - kDebug() << "LIBNAMEPART:" << libNameProp.toString(); + plugin->setPartLibraryName( libNameProp.toString().toUtf8() ); + plugin->setExecutableName( exeNameProp.toString() ); + if ( hasPartProp.isValid() ) { + plugin->setShowInSideBar( hasPartProp.toBool() ); + } - plugin->setPartLibraryName( libNameProp.toString().toUtf8() ); - plugin->setExecutableName( exeNameProp.toString() ); - if ( hasPartProp.isValid() ) { - plugin->setShowInSideBar( hasPartProp.toBool() ); - } + for ( i = 0; i < plugins.count(); ++i ) { + KontactInterface::Plugin *p = plugins.at( i ); + if ( plugin->weight() < p->weight() ) { + break; + } + } + plugins.insert( i, plugin ); - for ( i = 0; i < plugins.count(); ++i ) { - KontactInterface::Plugin *p = plugins.at( i ); - if ( plugin->weight() < p->weight() ) { - break; - } } - plugins.insert( i, plugin ); - } + const int numberOfPlugins( plugins.count() ); + for ( i = 0; i < numberOfPlugins; ++i ) { + KontactInterface::Plugin *plugin = plugins.at( i ); - const int numberOfPlugins( plugins.count() ); - for ( i = 0; i < numberOfPlugins; ++i ) { - KontactInterface::Plugin *plugin = plugins.at( i ); + const QList actionList = plugin->newActions(); + QList::const_iterator listIt; + QList::const_iterator end( actionList.end() ); - const QList actionList = plugin->newActions(); - QList::const_iterator listIt; - QList::const_iterator end( actionList.end() ); + for ( listIt = actionList.begin(); listIt != end; ++listIt ) { + kDebug() << QLatin1String("Plugging New actions") << (*listIt)->objectName(); + mNewActions->addAction( (*listIt) ); + } - for ( listIt = actionList.begin(); listIt != end; ++listIt ) { - kDebug() << QLatin1String("Plugging New actions") << (*listIt)->objectName(); - mNewActions->addAction( (*listIt) ); + if ( mSyncActionsEnabled ) { + Q_FOREACH ( KAction *listIt, plugin->syncActions() ) { + kDebug() << QLatin1String("Plugging Sync actions") << listIt->objectName(); + mSyncActions->addAction( listIt ); + } + } + addPlugin( plugin ); } + const bool state = ( !mPlugins.isEmpty() ); + mNewActions->setEnabled( state ); if ( mSyncActionsEnabled ) { - Q_FOREACH ( KAction *listIt, plugin->syncActions() ) { - kDebug() << QLatin1String("Plugging Sync actions") << listIt->objectName(); - mSyncActions->addAction( listIt ); - } - } - addPlugin( plugin ); - } - - const bool state = ( !mPlugins.isEmpty() ); - mNewActions->setEnabled( state ); - if ( mSyncActionsEnabled ) { - mSyncActions->setEnabled( state ); - } + mSyncActions->setEnabled( state ); + } } void MainWindow::unloadPlugins() { - KPluginInfo::List::ConstIterator end = mPluginInfos.constEnd(); - KPluginInfo::List::ConstIterator it; - for ( it = mPluginInfos.constBegin(); it != end; ++it ) { - if ( !it->isPluginEnabled() ) { - removePlugin( *it ); + KPluginInfo::List::ConstIterator end = mPluginInfos.constEnd(); + KPluginInfo::List::ConstIterator it; + for ( it = mPluginInfos.constBegin(); it != end; ++it ) { + if ( !it->isPluginEnabled() ) { + removePlugin( *it ); + } } - } } void MainWindow::updateShortcuts() { - ActionPluginList::ConstIterator end = mActionPlugins.constEnd(); - ActionPluginList::ConstIterator it; - int i = 0; - for ( it = mActionPlugins.constBegin(); it != end; ++it ) { - KAction *action = static_cast( *it ); - const QString shortcut = QString::fromLatin1( "Ctrl+%1" ).arg( mActionPlugins.count() - i ); - action->setShortcut( KShortcut( shortcut ) ); - ++i; - } - factory()->plugActionList( this, QLatin1String( "navigator_actionlist" ), mActionPlugins ); + ActionPluginList::ConstIterator end = mActionPlugins.constEnd(); + ActionPluginList::ConstIterator it; + int i = 0; + for ( it = mActionPlugins.constBegin(); it != end; ++it ) { + KAction *action = static_cast( *it ); + const QString shortcut = QString::fromLatin1( "Ctrl+%1" ).arg( mActionPlugins.count() - i ); + action->setShortcut( KShortcut( shortcut ) ); + ++i; + } + factory()->plugActionList( this, QLatin1String( "navigator_actionlist" ), mActionPlugins ); } bool MainWindow::removePlugin( const KPluginInfo &info ) { - PluginList::Iterator end = mPlugins.end(); - for ( PluginList::Iterator it = mPlugins.begin(); it != end; ++it ) { - KontactInterface::Plugin *plugin = *it; - if ( ( *it )->identifier() == info.pluginName() ) { - QList actionList = plugin->newActions(); - QList::const_iterator listIt; - QList::const_iterator listEnd( actionList.constEnd() ); - for ( listIt = actionList.constBegin(); listIt != listEnd; ++listIt ) { - kDebug() << QLatin1String("Unplugging New actions") << (*listIt)->objectName(); - mNewActions->removeAction( *listIt ); - } - - if ( mSyncActionsEnabled ) { - actionList = plugin->syncActions(); - for ( listIt = actionList.constBegin(); listIt != actionList.constEnd(); ++listIt ) { - kDebug() << QLatin1String("Unplugging Sync actions") << (*listIt)->objectName(); - mSyncActions->removeAction( *listIt ); - } - } - removeChildClient( plugin ); - - if ( mCurrentPlugin == plugin ) { - mCurrentPlugin = 0; - createGUI( 0 ); - } - - plugin->deleteLater(); // removes the part automatically - mPlugins.erase( it ); - if ( plugin->showInSideBar() ) { - QAction *q = mPluginAction[plugin]; // remove KAction, to free the shortcut for later use - mActionPlugins.removeAll( q ); - mPluginAction.remove(plugin); - delete q; - } - - if ( mCurrentPlugin == 0 ) { - PluginList::Iterator it; - PluginList::Iterator pluginEnd( mPlugins.end() ); - for ( it = mPlugins.begin(); it != pluginEnd; ++it ) { - if ( (*it)->showInSideBar() ) { - selectPlugin( *it ); + PluginList::Iterator end = mPlugins.end(); + for ( PluginList::Iterator it = mPlugins.begin(); it != end; ++it ) { + KontactInterface::Plugin *plugin = *it; + if ( ( *it )->identifier() == info.pluginName() ) { + QList actionList = plugin->newActions(); + QList::const_iterator listIt; + QList::const_iterator listEnd( actionList.constEnd() ); + for ( listIt = actionList.constBegin(); listIt != listEnd; ++listIt ) { + kDebug() << QLatin1String("Unplugging New actions") << (*listIt)->objectName(); + mNewActions->removeAction( *listIt ); + } + + if ( mSyncActionsEnabled ) { + actionList = plugin->syncActions(); + for ( listIt = actionList.constBegin(); listIt != actionList.constEnd(); ++listIt ) { + kDebug() << QLatin1String("Unplugging Sync actions") << (*listIt)->objectName(); + mSyncActions->removeAction( *listIt ); + } + } + removeChildClient( plugin ); + + if ( mCurrentPlugin == plugin ) { + mCurrentPlugin = 0; + createGUI( 0 ); + } + + plugin->deleteLater(); // removes the part automatically + mPlugins.erase( it ); + if ( plugin->showInSideBar() ) { + QAction *q = mPluginAction[plugin]; // remove KAction, to free the shortcut for later use + mActionPlugins.removeAll( q ); + mPluginAction.remove(plugin); + delete q; + } + + if ( mCurrentPlugin == 0 ) { + PluginList::Iterator it; + PluginList::Iterator pluginEnd( mPlugins.end() ); + for ( it = mPlugins.begin(); it != pluginEnd; ++it ) { + if ( (*it)->showInSideBar() ) { + selectPlugin( *it ); + return true; + } + } + } return true; - } } - } - return true; - } - } + } - return false; + return false; } void MainWindow::addPlugin( KontactInterface::Plugin *plugin ) { - kDebug(); + kDebug(); - mPlugins.append( plugin ); + mPlugins.append( plugin ); - if ( plugin->showInSideBar() ) { - KAction *action = new KAction( KIcon( plugin->icon() ), plugin->title(), this ); - action->setHelpText( - i18nc( "@info:status", "Plugin %1", plugin->title() ) ); - action->setWhatsThis( - i18nc( "@info:whatsthis", - "Switch to plugin %1", plugin->title() ) ); - action->setCheckable( true ); - action->setData( QVariant::fromValue( plugin ) ); // on the slot we can decode - // which action was triggered - connect( action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered()) ); - actionCollection()->addAction( plugin->title(), action ); - mActionPlugins.append( action ); - mPluginAction.insert( plugin, action ); - } - - // merge the plugins GUI into the main window - insertChildClient( plugin ); - - // sort the action plugins again and reset shortcuts. If we removed and then readded some plugins - // we need to take in count their weights for setting shortcuts again - qSort( mActionPlugins.begin(), mActionPlugins.end(), pluginActionWeightLessThan ); - qSort( mPlugins.begin(), mPlugins.end(), pluginWeightLessThan ); - int i = 0; - foreach ( QAction *qaction, mActionPlugins ) { - KAction *action = static_cast( qaction ); - QString shortcut = QString::fromLatin1( "Ctrl+%1" ).arg( mActionPlugins.count() - i ); - action->setShortcut( KShortcut( shortcut ) ); - ++i; - } + if ( plugin->showInSideBar() ) { + KAction *action = new KAction( KIcon( plugin->icon() ), plugin->title(), this ); + action->setHelpText( + i18nc( "@info:status", "Plugin %1", plugin->title() ) ); + action->setWhatsThis( + i18nc( "@info:whatsthis", + "Switch to plugin %1", plugin->title() ) ); + action->setCheckable( true ); + action->setData( QVariant::fromValue( plugin ) ); // on the slot we can decode + // which action was triggered + connect( action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered()) ); + actionCollection()->addAction( plugin->title(), action ); + mActionPlugins.append( action ); + mPluginAction.insert( plugin, action ); + } + + // merge the plugins GUI into the main window + insertChildClient( plugin ); + + // sort the action plugins again and reset shortcuts. If we removed and then readded some plugins + // we need to take in count their weights for setting shortcuts again + qSort( mActionPlugins.begin(), mActionPlugins.end(), pluginActionWeightLessThan ); + qSort( mPlugins.begin(), mPlugins.end(), pluginWeightLessThan ); + int i = 0; + foreach ( QAction *qaction, mActionPlugins ) { + KAction *action = static_cast( qaction ); + QString shortcut = QString::fromLatin1( "Ctrl+%1" ).arg( mActionPlugins.count() - i ); + action->setShortcut( KShortcut( shortcut ) ); + ++i; + } } void MainWindow::partLoaded( KontactInterface::Plugin *plugin, KParts::ReadOnlyPart *part ) { - Q_UNUSED( plugin ); + Q_UNUSED( plugin ); + + // See if we have this part already (e.g. due to two plugins sharing it) + if ( mPartsStack->indexOf( part->widget() ) != -1 ) { + return; + } + + mPartsStack->addWidget( part->widget() ); - // See if we have this part already (e.g. due to two plugins sharing it) - if ( mPartsStack->indexOf( part->widget() ) != -1 ) { - return; - } - - mPartsStack->addWidget( part->widget() ); - - mPartManager->addPart( part, false ); - // Workaround for KParts misbehavior: addPart calls show! - part->widget()->hide(); + mPartManager->addPart( part, false ); + // Workaround for KParts misbehavior: addPart calls show! + part->widget()->hide(); } void MainWindow::slotActivePartChanged( KParts::Part *part ) { - if ( !part ) { - createGUI( 0 ); - return; - } + if ( !part ) { + createGUI( 0 ); + return; + } - kDebug() << QLatin1String("Part activated:") << part - << QLatin1String("with stack id.")<< mPartsStack->indexOf( part->widget() ); + kDebug() << QLatin1String("Part activated:") << part + << QLatin1String("with stack id.")<< mPartsStack->indexOf( part->widget() ); - statusBar()->clearMessage(); + statusBar()->clearMessage(); } void MainWindow::slotNewClicked() { - if ( !mCurrentPlugin->newActions().isEmpty() ) { - mCurrentPlugin->newActions().first()->trigger(); - } else { - PluginList::Iterator it; - PluginList::Iterator end( mPlugins.end() ); - for ( it = mPlugins.begin(); it != end; ++it ) { - if ( !(*it)->newActions().isEmpty() ) { - (*it)->newActions().first()->trigger(); - return; - } + if ( !mCurrentPlugin->newActions().isEmpty() ) { + mCurrentPlugin->newActions().first()->trigger(); + } else { + PluginList::Iterator it; + PluginList::Iterator end( mPlugins.end() ); + for ( it = mPlugins.begin(); it != end; ++it ) { + if ( !(*it)->newActions().isEmpty() ) { + (*it)->newActions().first()->trigger(); + return; + } + } } - } } void MainWindow::slotSyncClicked() { - if ( !mCurrentPlugin->syncActions().isEmpty() ) { - mCurrentPlugin->syncActions().first()->trigger(); - } else { - PluginList::Iterator it; - PluginList::Iterator end( mPlugins.end() ); - for ( it = mPlugins.begin(); it != end; ++it ) { - if ( !(*it)->syncActions().isEmpty() ) { - (*it)->syncActions().first()->trigger(); - return; - } + if ( !mCurrentPlugin->syncActions().isEmpty() ) { + mCurrentPlugin->syncActions().first()->trigger(); + } else { + PluginList::Iterator it; + PluginList::Iterator end( mPlugins.end() ); + for ( it = mPlugins.begin(); it != end; ++it ) { + if ( !(*it)->syncActions().isEmpty() ) { + (*it)->syncActions().first()->trigger(); + return; + } + } } - } } KToolBar *MainWindow::findToolBar( const char *name ) { - // like KMainWindow::toolBar, but which doesn't create the toolbar if not found - return findChild( QLatin1String(name) ); + // like KMainWindow::toolBar, but which doesn't create the toolbar if not found + return findChild( QLatin1String(name) ); } void MainWindow::selectPlugin( KontactInterface::Plugin *plugin ) { - if ( !plugin ) { - return; - } - - if ( plugin->isRunningStandalone() ) { - statusBar()->showMessage( - i18nc( "@info:status", - "Application is running standalone. Foregrounding..." ), 1000 ); - plugin->bringToForeground(); - return; - } - - QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) ); - - if ( mCurrentPlugin ) { - saveMainWindowSettings( - KGlobal::config()->group( - QString::fromLatin1( "MainWindow%1" ).arg( mCurrentPlugin->identifier() ) ) ); - } - - KParts::Part *part = plugin->part(); - - if ( !part ) { - QApplication::restoreOverrideCursor(); - KMessageBox::error( - this, - i18nc( "@info", - "Cannot load part for %1.", - plugin->title() ) + QLatin1Char('\n') + lastErrorMessage() ); - plugin->setDisabled( true ); - mSidePane->updatePlugins(); - return; - } - - if ( mCurrentPlugin ) { - KAction *action = mPluginAction[ mCurrentPlugin ]; - if ( action ) { - action->setChecked( false ); - } - } - KAction *selectedPluginAction = mPluginAction[ plugin ]; - if ( selectedPluginAction ) { - selectedPluginAction->setChecked( true ); - } - - // store old focus widget - QWidget *focusWidget = kapp->focusWidget(); - if ( mCurrentPlugin && focusWidget ) { - // save the focus widget only when it belongs to the activated part - QWidget *parent = focusWidget->parentWidget(); - while ( parent ) { - if ( parent == mCurrentPlugin->part()->widget() ) { - mFocusWidgets.insert( mCurrentPlugin->identifier(), QPointer( focusWidget ) ); - } - parent = parent->parentWidget(); + if ( !plugin ) { + return; } - } - if ( mSidePane ) { - mSidePane->setCurrentPlugin( plugin->identifier() ); - } + if ( plugin->isRunningStandalone() ) { + statusBar()->showMessage( + i18nc( "@info:status", + "Application is running standalone. Foregrounding..." ), 1000 ); + plugin->bringToForeground(); + return; + } - plugin->aboutToSelect(); + QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) ); - mPartManager->setActivePart( part ); - QWidget *view = part->widget(); - Q_ASSERT( view ); - - if ( view ) { - mPartsStack->setCurrentWidget( view ); - view->show(); - - if ( !mFocusWidgets.isEmpty() && mFocusWidgets.contains( plugin->identifier() ) ) { - focusWidget = mFocusWidgets[ plugin->identifier() ]; - if ( focusWidget ) { - focusWidget->setFocus(); - } - } else { - view->setFocus(); + if ( mCurrentPlugin ) { + saveMainWindowSettings( + KGlobal::config()->group( + QString::fromLatin1( "MainWindow%1" ).arg( mCurrentPlugin->identifier() ) ) ); + } + + KParts::Part *part = plugin->part(); + + if ( !part ) { + QApplication::restoreOverrideCursor(); + KMessageBox::error( + this, + i18nc( "@info", + "Cannot load part for %1.", + plugin->title() ) + QLatin1Char('\n') + lastErrorMessage() ); + plugin->setDisabled( true ); + mSidePane->updatePlugins(); + return; } - mCurrentPlugin = plugin; + if ( mCurrentPlugin ) { + KAction *action = mPluginAction[ mCurrentPlugin ]; + if ( action ) { + action->setChecked( false ); + } + } + KAction *selectedPluginAction = mPluginAction[ plugin ]; + if ( selectedPluginAction ) { + selectedPluginAction->setChecked( true ); + } - QAction *newAction = 0; - if ( !plugin->newActions().isEmpty() ) { - newAction = plugin->newActions().first(); + // store old focus widget + QWidget *focusWidget = kapp->focusWidget(); + if ( mCurrentPlugin && focusWidget ) { + // save the focus widget only when it belongs to the activated part + QWidget *parent = focusWidget->parentWidget(); + while ( parent ) { + if ( parent == mCurrentPlugin->part()->widget() ) { + mFocusWidgets.insert( mCurrentPlugin->identifier(), QPointer( focusWidget ) ); + } + parent = parent->parentWidget(); + } } - QAction *syncAction = 0; - if ( !plugin->syncActions().isEmpty() ) { - syncAction = plugin->syncActions().first(); + if ( mSidePane ) { + mSidePane->setCurrentPlugin( plugin->identifier() ); } - createGUI( plugin->part() ); - plugin->shortcutChanged(); + plugin->aboutToSelect(); + mPartManager->setActivePart( part ); + QWidget *view = part->widget(); + Q_ASSERT( view ); + + if ( view ) { + mPartsStack->setCurrentWidget( view ); + view->show(); + + if ( !mFocusWidgets.isEmpty() && mFocusWidgets.contains( plugin->identifier() ) ) { + focusWidget = mFocusWidgets[ plugin->identifier() ]; + if ( focusWidget ) { + focusWidget->setFocus(); + } + } else { + view->setFocus(); + } + + mCurrentPlugin = plugin; - setCaption( i18nc( "@title:window Plugin dependent window title", - "%1 - Kontact", plugin->title() ) ); + QAction *newAction = 0; + if ( !plugin->newActions().isEmpty() ) { + newAction = plugin->newActions().first(); + } - if ( newAction ) { - mNewActions->setIcon( newAction->icon() ); - static_cast( mNewActions )->setText( newAction->text() ); - mNewActions->setWhatsThis( newAction->whatsThis() ); - } else { // we'll use the action of the first plugin which offers one - PluginList::Iterator it; - PluginList::Iterator end(mPlugins.end()); - for ( it = mPlugins.begin(); it != end; ++it ) { - if ( !(*it)->newActions().isEmpty() ) { - newAction = (*it)->newActions().first(); + QAction *syncAction = 0; + if ( !plugin->syncActions().isEmpty() ) { + syncAction = plugin->syncActions().first(); } + + createGUI( plugin->part() ); + plugin->shortcutChanged(); + + + setCaption( i18nc( "@title:window Plugin dependent window title", + "%1 - Kontact", plugin->title() ) ); + if ( newAction ) { - static_cast( mNewActions )->setIcon( newAction->icon() ); - mNewActions->setText( newAction->text() ); - mNewActions->setWhatsThis( newAction->whatsThis() ); - break; + mNewActions->setIcon( newAction->icon() ); + static_cast( mNewActions )->setText( newAction->text() ); + mNewActions->setWhatsThis( newAction->whatsThis() ); + } else { // we'll use the action of the first plugin which offers one + PluginList::Iterator it; + PluginList::Iterator end(mPlugins.end()); + for ( it = mPlugins.begin(); it != end; ++it ) { + if ( !(*it)->newActions().isEmpty() ) { + newAction = (*it)->newActions().first(); + } + if ( newAction ) { + static_cast( mNewActions )->setIcon( newAction->icon() ); + mNewActions->setText( newAction->text() ); + mNewActions->setWhatsThis( newAction->whatsThis() ); + break; + } + } + } + + if ( mSyncActionsEnabled ) { + if ( syncAction ) { + mSyncActions->setIcon( syncAction->icon() ); + static_cast( mSyncActions )->setText( syncAction->text() ); + } else { // we'll use the action of the first plugin which offers one + PluginList::Iterator it; + PluginList::Iterator end(mPlugins.end()); + for ( it = mPlugins.begin(); it != end; ++it ) { + if ( !(*it)->syncActions().isEmpty() ) { + syncAction = (*it)->syncActions().first(); + } + if ( syncAction ) { + static_cast( mSyncActions )->setIcon( syncAction->icon() ); + mSyncActions->setText( syncAction->text() ); + break; + } + } + } } - } } - if ( mSyncActionsEnabled ) { - if ( syncAction ) { - mSyncActions->setIcon( syncAction->icon() ); - static_cast( mSyncActions )->setText( syncAction->text() ); - } else { // we'll use the action of the first plugin which offers one - PluginList::Iterator it; - PluginList::Iterator end(mPlugins.end()); - for ( it = mPlugins.begin(); it != end; ++it ) { - if ( !(*it)->syncActions().isEmpty() ) { - syncAction = (*it)->syncActions().first(); - } - if ( syncAction ) { - static_cast( mSyncActions )->setIcon( syncAction->icon() ); - mSyncActions->setText( syncAction->text() ); - break; - } - } - } - } - } - - KToolBar *navigatorToolBar = findToolBar( "navigatorToolBar" ); - if ( navigatorToolBar && !navigatorToolBar->isHidden() && - ( toolBarArea( navigatorToolBar ) == Qt::TopToolBarArea || - toolBarArea( navigatorToolBar ) == Qt::BottomToolBarArea ) ) { - addToolBar( toolBarArea( navigatorToolBar ), navigatorToolBar ); - } + KToolBar *navigatorToolBar = findToolBar( "navigatorToolBar" ); + if ( navigatorToolBar && !navigatorToolBar->isHidden() && + ( toolBarArea( navigatorToolBar ) == Qt::TopToolBarArea || + toolBarArea( navigatorToolBar ) == Qt::BottomToolBarArea ) ) { + addToolBar( toolBarArea( navigatorToolBar ), navigatorToolBar ); + } - applyMainWindowSettings( KGlobal::config()->group( - QString::fromLatin1( "MainWindow%1" ).arg( plugin->identifier() ) ) ); + applyMainWindowSettings( KGlobal::config()->group( + QString::fromLatin1( "MainWindow%1" ).arg( plugin->identifier() ) ) ); - QApplication::restoreOverrideCursor(); + QApplication::restoreOverrideCursor(); } void MainWindow::slotActionTriggered() { - KAction *actionSender = static_cast( sender() ); - actionSender->setChecked( true ); - KontactInterface::Plugin *plugin = actionSender->data().value(); - if ( !plugin ) { - return; - } - mSidePane->setCurrentPlugin( plugin->identifier() ); + KAction *actionSender = static_cast( sender() ); + actionSender->setChecked( true ); + KontactInterface::Plugin *plugin = actionSender->data().value(); + if ( !plugin ) { + return; + } + mSidePane->setCurrentPlugin( plugin->identifier() ); } void MainWindow::selectPlugin( const QString &pluginName ) { - PluginList::ConstIterator end = mPlugins.constEnd(); - for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { - if ( ( *it )->identifier() == pluginName ) { - selectPlugin( *it ); - return; + PluginList::ConstIterator end = mPlugins.constEnd(); + for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { + if ( ( *it )->identifier() == pluginName ) { + selectPlugin( *it ); + return; + } } - } } void MainWindow::loadSettings() { - if ( mSplitter ) { - // if the preferences do not contain useful values, the side pane part of the splitter - // takes up the full width of the window, so leave the splitter sizing at the widget defaults - QList sizes = Prefs::self()->sidePaneSplitter(); - if ( sizes.count() == mSplitter->count() ) { - mSplitter->setSizes( sizes ); - } - } - - // Preload Plugins. This _must_ happen before the default part is loaded - PluginList::ConstIterator it; - PluginList::ConstIterator end( mDelayedPreload.constEnd() ); - for ( it = mDelayedPreload.constBegin(); it != end; ++it ) { - selectPlugin( *it ); - } - selectPlugin( Prefs::self()->mActivePlugin ); + if ( mSplitter ) { + // if the preferences do not contain useful values, the side pane part of the splitter + // takes up the full width of the window, so leave the splitter sizing at the widget defaults + QList sizes = Prefs::self()->sidePaneSplitter(); + if ( sizes.count() == mSplitter->count() ) { + mSplitter->setSizes( sizes ); + } + } + + // Preload Plugins. This _must_ happen before the default part is loaded + PluginList::ConstIterator it; + PluginList::ConstIterator end( mDelayedPreload.constEnd() ); + for ( it = mDelayedPreload.constBegin(); it != end; ++it ) { + selectPlugin( *it ); + } + selectPlugin( Prefs::self()->mActivePlugin ); } void MainWindow::saveSettings() { - if ( mSplitter ) { - Prefs::self()->mSidePaneSplitter = mSplitter->sizes(); - } - - if ( mCurrentPlugin ) { - Prefs::self()->mActivePlugin = mCurrentPlugin->identifier(); - } + if ( mSplitter ) { + Prefs::self()->mSidePaneSplitter = mSplitter->sizes(); + } + + if ( mCurrentPlugin ) { + Prefs::self()->mActivePlugin = mCurrentPlugin->identifier(); + } } void MainWindow::slotShowTip() { - showTip( true ); + showTip( true ); } void MainWindow::slotShowTipOnStart() { - showTip( false ); + showTip( false ); } void MainWindow::slotShowIntroduction() { - mPartsStack->setCurrentIndex( 0 ); + mPartsStack->setCurrentIndex( 0 ); } void MainWindow::showTip( bool force ) { - QStringList tips; - PluginList::ConstIterator end = mPlugins.constEnd(); - for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { - const QString file = (*it)->tipFile(); - if ( !file.isEmpty() ) { - tips.append( file ); + QStringList tips; + PluginList::ConstIterator end = mPlugins.constEnd(); + for ( PluginList::ConstIterator it = mPlugins.constBegin(); it != end; ++it ) { + const QString file = (*it)->tipFile(); + if ( !file.isEmpty() ) { + tips.append( file ); + } } - } - KTipDialog::showMultiTip( this, tips, force ); + KTipDialog::showMultiTip( this, tips, force ); } void MainWindow::slotQuit() { - mReallyClose = true; - close(); + mReallyClose = true; + close(); } void MainWindow::slotPreferences() { - static Kontact::KontactConfigureDialog *dlg = 0; - if ( !dlg ) { - dlg = new Kontact::KontactConfigureDialog( this ); - dlg->setAllowComponentSelection( true ); + static Kontact::KontactConfigureDialog *dlg = 0; + if ( !dlg ) { + dlg = new Kontact::KontactConfigureDialog( this ); + dlg->setAllowComponentSelection( true ); + + // do not show settings of components running standalone + KPluginInfo::List filteredPlugins = mPluginInfos; + PluginList::ConstIterator it; + PluginList::ConstIterator end(mPlugins.constEnd()); + for ( it = mPlugins.constBegin(); it != end; ++it ) { + if ( (*it)->isRunningStandalone() ) { + KPluginInfo::List::ConstIterator infoIt; + KPluginInfo::List::ConstIterator infoEnd(filteredPlugins.constEnd()); + for ( infoIt = filteredPlugins.constBegin(); + infoIt != infoEnd; ++infoIt ) { + if ( infoIt->pluginName() == (*it)->identifier() ) { + filteredPlugins.removeAll( *infoIt ); + break; + } + } + } + } - // do not show settings of components running standalone - KPluginInfo::List filteredPlugins = mPluginInfos; - PluginList::ConstIterator it; - PluginList::ConstIterator end(mPlugins.constEnd()); - for ( it = mPlugins.constBegin(); it != end; ++it ) { - if ( (*it)->isRunningStandalone() ) { - KPluginInfo::List::ConstIterator infoIt; - KPluginInfo::List::ConstIterator infoEnd(filteredPlugins.constEnd()); - for ( infoIt = filteredPlugins.constBegin(); - infoIt != infoEnd; ++infoIt ) { - if ( infoIt->pluginName() == (*it)->identifier() ) { - filteredPlugins.removeAll( *infoIt ); - break; - } - } - } - } - - dlg->setHelp( QLatin1String("main-config"), QLatin1String("kontact") ); - dlg->addPluginInfos( filteredPlugins ); - connect( dlg, SIGNAL(pluginSelectionChanged()), SLOT(pluginsChanged()) ); - } + dlg->setHelp( QLatin1String("main-config"), QLatin1String("kontact") ); + dlg->addPluginInfos( filteredPlugins ); + connect( dlg, SIGNAL(pluginSelectionChanged()), SLOT(pluginsChanged()) ); + } - dlg->show(); + dlg->show(); } void MainWindow::pluginsChanged() { - unplugActionList( QLatin1String("navigator_actionlist") ); - unloadPlugins(); - loadPlugins(); - mSidePane->updatePlugins(); - updateShortcuts(); + unplugActionList( QLatin1String("navigator_actionlist") ); + unloadPlugins(); + loadPlugins(); + mSidePane->updatePlugins(); + updateShortcuts(); } void MainWindow::updateConfig() { - kDebug(); + kDebug(); - saveSettings(); - loadSettings(); + saveSettings(); + loadSettings(); } void MainWindow::showAboutDialog() { - QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) ); + QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) ); - if ( !mAboutDialog ) { - mAboutDialog = new AboutDialog( this ); - } - - mAboutDialog->show(); - mAboutDialog->raise(); - QApplication::restoreOverrideCursor(); + if ( !mAboutDialog ) { + mAboutDialog = new AboutDialog( this ); + } + + mAboutDialog->show(); + mAboutDialog->raise(); + QApplication::restoreOverrideCursor(); } void MainWindow::configureShortcuts() { - KShortcutsDialog dialog( - KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this ); - dialog.addCollection( actionCollection() ); - - if ( mCurrentPlugin && mCurrentPlugin->part() ) { - dialog.addCollection( mCurrentPlugin->part()->actionCollection() ); - } - - dialog.configure(); - if ( mCurrentPlugin && mCurrentPlugin->part() ) { - mCurrentPlugin->shortcutChanged(); - } + KShortcutsDialog dialog( + KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this ); + dialog.addCollection( actionCollection() ); + + if ( mCurrentPlugin && mCurrentPlugin->part() ) { + dialog.addCollection( mCurrentPlugin->part()->actionCollection() ); + } + + dialog.configure(); + if ( mCurrentPlugin && mCurrentPlugin->part() ) { + mCurrentPlugin->shortcutChanged(); + } } void MainWindow::configureToolbars() { - if ( mCurrentPlugin ) { - saveMainWindowSettings( - KGlobal::config()->group( - QString::fromLatin1( "MainWindow%1" ).arg( mCurrentPlugin->identifier() ) ) ); - } - QPointer edit = new KEditToolBar( factory() ); - connect( edit, SIGNAL(newToolBarConfig()), this, SLOT(slotNewToolbarConfig()) ); - edit->exec(); - delete edit; + if ( mCurrentPlugin ) { + saveMainWindowSettings( + KGlobal::config()->group( + QString::fromLatin1( "MainWindow%1" ).arg( mCurrentPlugin->identifier() ) ) ); + } + QPointer edit = new KEditToolBar( factory() ); + connect( edit, SIGNAL(newToolBarConfig()), this, SLOT(slotNewToolbarConfig()) ); + edit->exec(); + delete edit; } void MainWindow::slotNewToolbarConfig() { - if ( mCurrentPlugin && mCurrentPlugin->part() ) { - createGUI( mCurrentPlugin->part() ); - } - if ( mCurrentPlugin ) { - applyMainWindowSettings( - KGlobal::config()->group( - QString::fromLatin1( "MainWindow%1" ).arg( mCurrentPlugin->identifier() ) ) ); - } - updateShortcuts(); // for the plugActionList call + if ( mCurrentPlugin && mCurrentPlugin->part() ) { + createGUI( mCurrentPlugin->part() ); + } + if ( mCurrentPlugin ) { + applyMainWindowSettings( + KGlobal::config()->group( + QString::fromLatin1( "MainWindow%1" ).arg( mCurrentPlugin->identifier() ) ) ); + } + updateShortcuts(); // for the plugActionList call } void MainWindow::slotOpenUrl( const QUrl &url ) { - slotOpenUrl( KUrl( url ) ); + slotOpenUrl( KUrl( url ) ); } void MainWindow::slotOpenUrl( const KUrl &url ) { - if ( url.protocol() == QLatin1String( "exec" ) ) { - const QString path( url.path() ); - if ( path == QLatin1String( "/switch" ) ) { - if ( mCurrentPlugin ) { - mPartsStack->setCurrentIndex( mPartsStack->indexOf( mCurrentPlugin->part()->widget() ) ); - } - } - else if ( path == QLatin1String( "/accountwizard" ) ) { - KRun::runCommand( QLatin1String( "accountwizard" ), this ); - slotQuit(); - } - else if ( path.startsWith( QLatin1String( "/help" ) ) ) { - QString app( QLatin1String("kontact") ); - if ( !url.query().isEmpty() ) { - app = url.query().mid( 1 ); - } - KToolInvocation::invokeHelp( QString(), app ); - } - } else { - new KRun( url, this ); - } + if ( url.protocol() == QLatin1String( "exec" ) ) { + const QString path( url.path() ); + if ( path == QLatin1String( "/switch" ) ) { + if ( mCurrentPlugin ) { + mPartsStack->setCurrentIndex( mPartsStack->indexOf( mCurrentPlugin->part()->widget() ) ); + } + } + else if ( path == QLatin1String( "/accountwizard" ) ) { + KRun::runCommand( QLatin1String( "accountwizard" ), this ); + slotQuit(); + } + else if ( path.startsWith( QLatin1String( "/help" ) ) ) { + QString app( QLatin1String("kontact") ); + if ( !url.query().isEmpty() ) { + app = url.query().mid( 1 ); + } + KToolInvocation::invokeHelp( QString(), app ); + } + } else { + new KRun( url, this ); + } } void MainWindow::readProperties( const KConfigGroup &config ) { - Core::readProperties( config ); + Core::readProperties( config ); - QSet activePlugins = - QSet::fromList( config.readEntry( "ActivePlugins", QStringList() ) ); + QSet activePlugins = + QSet::fromList( config.readEntry( "ActivePlugins", QStringList() ) ); - if ( !activePlugins.isEmpty() ) { - foreach ( KontactInterface::Plugin *plugin, mPlugins ) { - if ( !plugin->isRunningStandalone() && activePlugins.contains( plugin->identifier() ) ) { - plugin->readProperties( config ); - } + if ( !activePlugins.isEmpty() ) { + foreach ( KontactInterface::Plugin *plugin, mPlugins ) { + if ( !plugin->isRunningStandalone() && activePlugins.contains( plugin->identifier() ) ) { + plugin->readProperties( config ); + } + } } - } } void MainWindow::saveProperties( KConfigGroup &config ) { - Core::saveProperties( config ); + Core::saveProperties( config ); - QStringList activePlugins; + QStringList activePlugins; - foreach ( const KPluginInfo &pluginInfo, mPluginInfos ) { - if ( pluginInfo.isPluginEnabled() ) { - KontactInterface::Plugin *plugin = pluginFromInfo( pluginInfo ); - if ( plugin ) { - activePlugins.append( plugin->identifier() ); - plugin->saveProperties( config ); - } + foreach ( const KPluginInfo &pluginInfo, mPluginInfos ) { + if ( pluginInfo.isPluginEnabled() ) { + KontactInterface::Plugin *plugin = pluginFromInfo( pluginInfo ); + if ( plugin ) { + activePlugins.append( plugin->identifier() ); + plugin->saveProperties( config ); + } + } } - } - config.writeEntry( "ActivePlugins", activePlugins ); + config.writeEntry( "ActivePlugins", activePlugins ); } bool MainWindow::queryClose() { - if ( kapp->sessionSaving() || mReallyClose ) { - return true; - } + if ( kapp->sessionSaving() || mReallyClose ) { + return true; + } - foreach ( KontactInterface::Plugin *plugin, mPlugins ) { - if ( !plugin->isRunningStandalone() ) { - if ( !plugin->queryClose() ) { - return false; - } + foreach ( KontactInterface::Plugin *plugin, mPlugins ) { + if ( !plugin->isRunningStandalone() ) { + if ( !plugin->queryClose() ) { + return false; + } + } } - } - return true; + return true; } void MainWindow::slotShowStatusMsg( const QString &msg ) { - if ( !statusBar() || !mStatusMsgLabel ) { - return; - } + if ( !statusBar() || !mStatusMsgLabel ) { + return; + } - mStatusMsgLabel->setText( msg ); + mStatusMsgLabel->setText( msg ); } QString MainWindow::introductionString() { - KIconLoader *iconloader = KIconLoader::global(); - const int iconSize = iconloader->currentSize( KIconLoader::Desktop ); + KIconLoader *iconloader = KIconLoader::global(); + const int iconSize = iconloader->currentSize( KIconLoader::Desktop ); - const QString handbook_icon_path = iconloader->iconPath( QLatin1String("help-contents"), KIconLoader::Desktop ); - const QString html_icon_path = iconloader->iconPath( QLatin1String("kontact"), KIconLoader::Desktop ); - const QString wizard_icon_path = iconloader->iconPath( QLatin1String("tools-wizard"), KIconLoader::Desktop ); - - QString info = - ki18nc( - "@info", - "

    Welcome to Kontact %1

    " - "

    %2

    " - "" - "" - "" - "" - "" - "" - "" - "
    %8
    %9
    %15
    %16
    %22
    %23
    " - "

    Skip this introduction

    " ). - subs( KGlobal::mainComponent().aboutData()->version() ). - subs( i18nc( "@item:intext", - "Kontact handles your e-mail, address book, calendar, to-do list and more." ) ). - subs( QLatin1String("exec:/help?kontact") ). - subs( iconSize ). - subs( iconSize ). - subs( QLatin1String("file:") + handbook_icon_path ). - subs( QLatin1String("exec:/help?kontact") ). - subs( i18nc( "@item:intext", "Read Manual" ) ). - subs( i18nc( "@item:intext", "Learn more about Kontact and its components" ) ). - subs( QLatin1String("http://kontact.org") ). - subs( iconSize ). - subs( iconSize ). - subs( QLatin1String("file:") + html_icon_path ). - subs( QLatin1String("http://kontact.org") ). - subs( i18nc( "@item:intext", "Visit Kontact Website" ) ). - subs( i18nc( "@item:intext", "Access online resources and tutorials" ) ). - subs( QLatin1String("exec:/accountwizard") ). - subs( iconSize ). - subs( iconSize ). - subs( QLatin1String("file:") + wizard_icon_path ). - subs( QLatin1String("exec:/accountwizard") ). - subs( i18nc( "@item:intext", "Setup your Accounts" ) ). - subs( i18nc( "@item:intext", "Prepare Kontact for use" ) ). - subs( QLatin1String("exec:/switch") ). - toString(); - return info; + const QString handbook_icon_path = iconloader->iconPath( QLatin1String("help-contents"), KIconLoader::Desktop ); + const QString html_icon_path = iconloader->iconPath( QLatin1String("kontact"), KIconLoader::Desktop ); + const QString wizard_icon_path = iconloader->iconPath( QLatin1String("tools-wizard"), KIconLoader::Desktop ); + + QString info = + ki18nc( + "@info", + "

    Welcome to Kontact %1

    " + "

    %2

    " + "" + "" + "" + "" + "" + "" + "" + "
    %8
    %9
    %15
    %16
    %22
    %23
    " + "

    Skip this introduction

    " ). + subs( KGlobal::mainComponent().aboutData()->version() ). + subs( i18nc( "@item:intext", + "Kontact handles your e-mail, address book, calendar, to-do list and more." ) ). + subs( QLatin1String("exec:/help?kontact") ). + subs( iconSize ). + subs( iconSize ). + subs( QLatin1String("file:") + handbook_icon_path ). + subs( QLatin1String("exec:/help?kontact") ). + subs( i18nc( "@item:intext", "Read Manual" ) ). + subs( i18nc( "@item:intext", "Learn more about Kontact and its components" ) ). + subs( QLatin1String("http://kontact.org") ). + subs( iconSize ). + subs( iconSize ). + subs( QLatin1String("file:") + html_icon_path ). + subs( QLatin1String("http://kontact.org") ). + subs( i18nc( "@item:intext", "Visit Kontact Website" ) ). + subs( i18nc( "@item:intext", "Access online resources and tutorials" ) ). + subs( QLatin1String("exec:/accountwizard") ). + subs( iconSize ). + subs( iconSize ). + subs( QLatin1String("file:") + wizard_icon_path ). + subs( QLatin1String("exec:/accountwizard") ). + subs( i18nc( "@item:intext", "Setup your Accounts" ) ). + subs( i18nc( "@item:intext", "Prepare Kontact for use" ) ). + subs( QLatin1String("exec:/switch") ). + toString(); + return info; } void MainWindow::slotShowHideSideBar() diff -Nru kdepim-4.13.0/kontact/src/mainwindow.h kdepim-4.13.3/kontact/src/mainwindow.h --- kdepim-4.13.0/kontact/src/mainwindow.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/mainwindow.h 2014-07-09 12:18:50.000000000 +0000 @@ -28,7 +28,7 @@ #include namespace KontactInterface { - class Plugin; +class Plugin; } class KActionMenu; @@ -50,10 +50,10 @@ class KONTACT_EXPORT MainWindow : public KontactInterface::Core { - Q_OBJECT - Q_CLASSINFO( "D-Bus Interface", "org.kde.kontact.KontactInterface" ) + Q_OBJECT + Q_CLASSINFO( "D-Bus Interface", "org.kde.kontact.KontactInterface" ) - public: +public: MainWindow(); ~MainWindow(); @@ -64,14 +64,14 @@ static bool pluginWeightLessThan( const KontactInterface::Plugin *left, const KontactInterface::Plugin *right ); - public slots: +public slots: virtual void selectPlugin( KontactInterface::Plugin *plugin ); Q_SCRIPTABLE virtual void selectPlugin( const QString &pluginName ); void slotActionTriggered(); void updateConfig(); - protected slots: +protected slots: void initObject(); void initGUI(); void slotActivePartChanged( KParts::Part *part ); @@ -89,7 +89,7 @@ void slotOpenUrl( const KUrl &url ); void slotOpenUrl( const QUrl &url ); - private: +private: void initWidgets(); void initAboutScreen(); void loadSettings(); @@ -113,14 +113,14 @@ static QString introductionString(); KToolBar *findToolBar( const char *name ); - private slots: +private slots: void pluginsChanged(); void configureShortcuts(); void configureToolbars(); void slotShowHideSideBar(); - private: +private: QFrame *mTopWidget; QSplitter *mSplitter; diff -Nru kdepim-4.13.0/kontact/src/sidepanebase.cpp kdepim-4.13.3/kontact/src/sidepanebase.cpp --- kdepim-4.13.0/kontact/src/sidepanebase.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/sidepanebase.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -26,7 +26,7 @@ #include SidePaneBase::SidePaneBase( KontactInterface::Core *core, QWidget *parent ) - : KVBox( parent ), mCore( core ) + : KVBox( parent ), mCore( core ) { } @@ -36,6 +36,6 @@ KontactInterface::Core *SidePaneBase::core() const { - return mCore; + return mCore; } diff -Nru kdepim-4.13.0/kontact/src/sidepanebase.h kdepim-4.13.3/kontact/src/sidepanebase.h --- kdepim-4.13.0/kontact/src/sidepanebase.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kontact/src/sidepanebase.h 2014-07-09 12:18:50.000000000 +0000 @@ -25,8 +25,8 @@ #include namespace KontactInterface { - class Core; - class Plugin; +class Core; +class Plugin; } @@ -34,28 +34,28 @@ class SidePaneBase : public KVBox { - Q_OBJECT + Q_OBJECT - public: +public: SidePaneBase( KontactInterface::Core *core, QWidget *parent ); virtual ~SidePaneBase(); virtual void setCurrentPlugin( const QString & ) = 0; - signals: +signals: void pluginSelected( KontactInterface::Plugin * ); - public slots: +public slots: /** This method is called by the core whenever the count of plugins has changed. */ virtual void updatePlugins() = 0; - protected: +protected: KontactInterface::Core *core() const; - private: +private: KontactInterface::Core *mCore; }; diff -Nru kdepim-4.13.0/korgac/alarmdialog.h kdepim-4.13.3/korgac/alarmdialog.h --- kdepim-4.13.0/korgac/alarmdialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korgac/alarmdialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -125,7 +125,6 @@ void showDetails( QTreeWidgetItem *item ); Akonadi::ETMCalendar::Ptr mCalendar; - QVBoxLayout *mTopLayout; QTreeWidget *mIncidenceTree; CalendarSupport::IncidenceViewer *mDetailView; KPIMIdentities::IdentityManager *mIdentityManager; diff -Nru kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configcolorsandfonts.desktop kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configcolorsandfonts.desktop --- kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configcolorsandfonts.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configcolorsandfonts.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -120,6 +120,7 @@ X-KDE-Keywords[da]=korganizer,farver,skrifttyper X-KDE-Keywords[de]=KOrganizer,Farben,Schriftarten X-KDE-Keywords[el]=korganizer,χρώματα,γραμματοσειρές +X-KDE-Keywords[en_GB]=korganizer,colours,fonts X-KDE-Keywords[es]=korganizer,colores,tipos de letra X-KDE-Keywords[et]=korganizer,värvid,fondid X-KDE-Keywords[fi]=korganizer,colors,värit,fonts,kirjasimet,fontit diff -Nru kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configdesignerfields.desktop kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configdesignerfields.desktop --- kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configdesignerfields.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configdesignerfields.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -152,6 +152,7 @@ X-KDE-Keywords[da]=korganizer, indstil, indstillinger, brugertilpassede felter X-KDE-Keywords[de]=KOrganizer,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,benutzerdefinierte Felder X-KDE-Keywords[el]=korganizer, διαμόρφωση, ρυθμίσεις, προσαρμοσμένα πεδία +X-KDE-Keywords[en_GB]=korganizer, configure, settings, custom fields X-KDE-Keywords[es]=korganizer, configurar, preferencias, campos personalizados X-KDE-Keywords[et]=korganizer, seadistamine, seadistused, omaloodud väljad X-KDE-Keywords[fi]=korganizer, configure, settings, asetukset, custom fields, omat kentät diff -Nru kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configfreebusy.desktop kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configfreebusy.desktop --- kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configfreebusy.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configfreebusy.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -149,6 +149,7 @@ X-KDE-Keywords[da]=korganizer,freebusy,skemalægning X-KDE-Keywords[de]=KOrganizer,Frei/Beschäftigt,Frei/Belegt,Ablaufplanung X-KDE-Keywords[el]=korganizer,ελεύθερος-η απασχολημένος-η,προγραμματισμός +X-KDE-Keywords[en_GB]=korganizer,freebusy,scheduling X-KDE-Keywords[es]=korganizer,disponibilidad,agenda X-KDE-Keywords[et]=korganizer,vaba,hõivatud,ajakava X-KDE-Keywords[fi]=korganizer,freebusy,varaustiedot,vapaa/varattu,scheduling,aikataulut diff -Nru kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configgroupscheduling.desktop kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configgroupscheduling.desktop --- kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configgroupscheduling.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configgroupscheduling.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -146,6 +146,7 @@ X-KDE-Keywords[da]=korganizer,gruppe,skemalægning X-KDE-Keywords[de]=KOrganizer,Gruppe,Ablaufplanung X-KDE-Keywords[el]=korganizer,ομάδα,προγραμματισμός +X-KDE-Keywords[en_GB]=korganizer,group,scheduling X-KDE-Keywords[es]=korganizer,grupo,agenda X-KDE-Keywords[et]=korganizer,grupid,grupitöö,ajakavad X-KDE-Keywords[fi]=korganizer,group,ryhmä,scheduling,aikataulut diff -Nru kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configmain.desktop kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configmain.desktop --- kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configmain.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configmain.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -160,6 +160,7 @@ X-KDE-Keywords[da]=korganizer,hoved X-KDE-Keywords[de]=KOrganizer,allgemein X-KDE-Keywords[el]=korganizer,κύριο +X-KDE-Keywords[en_GB]=korganizer,main X-KDE-Keywords[es]=korganizer,principal X-KDE-Keywords[et]=korganizer,peamine X-KDE-Keywords[fi]=korganizer,main,yleiset diff -Nru kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configplugins.desktop kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configplugins.desktop --- kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configplugins.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configplugins.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -153,6 +153,7 @@ X-KDE-Keywords[da]=korganizer,plugin,modul X-KDE-Keywords[de]=KOrganizer,Modul,Modul X-KDE-Keywords[el]=korganizer,πρόσθετο,άρθρωμα +X-KDE-Keywords[en_GB]=korganizer,plugin,module X-KDE-Keywords[es]=korganizer,complemento,módulo X-KDE-Keywords[et]=korganizer,plugin,moodul X-KDE-Keywords[fi]=korganizer,plugin,liitännäinen,module,moduuli diff -Nru kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configtime.desktop kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configtime.desktop --- kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configtime.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configtime.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -125,6 +125,7 @@ X-KDE-Keywords[da]=korganizer,tid X-KDE-Keywords[de]=KOrganizer,Zeit X-KDE-Keywords[el]=korganizer,ώρα +X-KDE-Keywords[en_GB]=korganizer,time X-KDE-Keywords[es]=korganizer,hora X-KDE-Keywords[et]=korganizer,aeg X-KDE-Keywords[fi]=korganizer,time,aika diff -Nru kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configviews.desktop kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configviews.desktop --- kdepim-4.13.0/korganizer/kcmconfigs/korganizer_configviews.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/kcmconfigs/korganizer_configviews.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -156,6 +156,7 @@ X-KDE-Keywords[da]=korganizer,vis X-KDE-Keywords[de]=KOrganizer,Ansicht X-KDE-Keywords[el]=korganizer,προβολή +X-KDE-Keywords[en_GB]=korganizer,view X-KDE-Keywords[es]=korganizer,vista X-KDE-Keywords[et]=korganizer,vaade X-KDE-Keywords[fi]=korganizer,view,näkymä diff -Nru kdepim-4.13.0/korganizer/Mainpage.dox kdepim-4.13.3/korganizer/Mainpage.dox --- kdepim-4.13.0/korganizer/Mainpage.dox 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/Mainpage.dox 2014-07-09 12:18:50.000000000 +0000 @@ -1,2 +1,2 @@ -// DOXYGEN_REFERENCES = kdecore kdeui kparts kresources kcal kdgantt +// DOXYGEN_REFERENCES = kdecore kdeui kparts kresources kcal kdgantt2 akonadi // DOXYGEN_SET_IGNORE_PREFIX = KO K diff -Nru kdepim-4.13.0/korganizer/plugins/datenums/datenums.desktop kdepim-4.13.3/korganizer/plugins/datenums/datenums.desktop --- kdepim-4.13.0/korganizer/plugins/datenums/datenums.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/plugins/datenums/datenums.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -20,7 +20,7 @@ Name[fi]=Kalenterien päivänumeroliitännäinen Name[fr]=Module de numérotation des jours Name[fy]=Datumgetallenplugin foar aginda's -Name[gl]=Engadido para os números dos dí­as nos calendarios +Name[gl]=Engadido para os números dos días para os calendarios Name[he]=תוסף מספרי תאריכים ללוחות שנה Name[hu]=Dátumkezelő bővítőmodul naptárakhoz Name[ia]=Plug-in pro numero del die de calendarios diff -Nru kdepim-4.13.0/korganizer/plugins/picoftheday/picoftheday.desktop kdepim-4.13.3/korganizer/plugins/picoftheday/picoftheday.desktop --- kdepim-4.13.0/korganizer/plugins/picoftheday/picoftheday.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/plugins/picoftheday/picoftheday.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -16,7 +16,7 @@ Name[fa]=عکس ویکی پدیا از وصله روز برای تقویمها Name[fi]=Wikipedian päivän kuva -liitännäinen Name[fr]=Module externe « Image du jour » de Wikipédia -Name[gl]=Engadido para a Imaxe do Dí­a da Wikipedia nos Calendarios +Name[gl]=Engadido para a Imaxe do Día da Wikipedia nos Calendarios Name[hu]=Naptárbővítmény a Wikipedia „A nap képe” funkciójához Name[ia]=Plug-in del pictura del die de Wikipedia pro calendarios Name[it]=Estensione "foto del giorno" di Wikipedia per i calendari @@ -65,7 +65,7 @@ Comment[et]=See plugin näitab Wikipedia päevapilti Comment[fi]=Tämä liitännäinen tarjoaa Wikipedian päivän kuvan Comment[fr]=Ce module externe fournit l'image du jour de Wikipédia -Comment[gl]=Este engadido fornece a Imaxe do Dí­a da Wikipedia +Comment[gl]=Este engadido fornece a Imaxe do Día da Wikipedia Comment[hu]=Ez a bővítmény kezelni tudja a Wikipedia „A nap képe” szolgáltatását Comment[ia]=Iste plug-in provide le pictura del die de Wikipedia Comment[it]=Questa estensione fornisce la "foto del giorno" di Wikipedia diff -Nru kdepim-4.13.0/korganizer/plugins/thisdayinhistory/thisdayinhistory.desktop kdepim-4.13.3/korganizer/plugins/thisdayinhistory/thisdayinhistory.desktop --- kdepim-4.13.0/korganizer/plugins/thisdayinhistory/thisdayinhistory.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/korganizer/plugins/thisdayinhistory/thisdayinhistory.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -14,7 +14,7 @@ Name[et]=Wikipedia 'täna ajaloos' plugin Name[fi]=Wikipedian Tämä päivä historiassa -liitännäinen Name[fr]=Module externe « Ce jour dans l'histoire » d'après Wikipédia -Name[gl]=Engadido "Este Dí­a na Historia" da Wikipedia +Name[gl]=Engadido «Este Día na Historia» da Wikipedia Name[hu]=Wikipedia-bővítmény - „Történelmi események ezen a napon” Name[ia]=Plug-in pro 'Iste die in le historia' de Wikipedia Name[it]=Estensione "Questo giorno nella storia" di Wikipedia @@ -62,7 +62,7 @@ Comment[et]=See plugin näitab Wikipedia 'täna ajaloos' lehekülgi Comment[fi]=Tämä liitännäinen tarjoaa linkin Wikipedian Tämä päivä historiassa -sivuille Comment[fr]=Ce module externe fournit un lien vers la page « Ce jour dans l'histoire » de Wikipédia -Comment[gl]=Este engadido fornece ligazóns ás páxinas "Este Dí­a na Historia" da Wikipedia +Comment[gl]=Este engadido fornece ligazóns ás páxinas «Este Día na Historia» da Wikipedia Comment[hu]=Ez a bővítmény hozzáférést biztosít a Wikipedia „Történelmi események ezen a napon” oldalához Comment[ia]=Iste plug-in provide ligamines al paginas de Wikipedia super 'Iste die in le historia' Comment[it]=Questa estensione fornisce la pagina "Questo giorno nella storia" di Wikipedia diff -Nru kdepim-4.13.0/kresources/remote/remote.desktop kdepim-4.13.3/kresources/remote/remote.desktop --- kdepim-4.13.0/kresources/remote/remote.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/kresources/remote/remote.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -5,7 +5,7 @@ Name[bg]=Календар в отдалечен файл Name[br]=Deiziadur e restr a-bell Name[bs]=Kalendar u izdvojenoj datoteci -Name[ca]=Calendari a un fitxer remot +Name[ca]=Calendari en un fitxer remot Name[ca@valencia]=Calendari a un fitxer remot Name[cs]=Kalendář ve vzdáleném souboru Name[cy]=Calendr mewn Ffeil Pell @@ -65,7 +65,7 @@ Comment=Provides access to a calendar in a remote file using KDE's network framework KIO Comment[ar]=يوفر وصول للتقويم في ملف بعيد بإستخدام إطار شبكة كدي KIO Comment[bs]=Obezbjeđuje pristup kalendaru u izdvojenoj datoteci koristeći KDE-ovu mrežu okvira KIO -Comment[ca]=Proporciona l'accés a un calendari en un fitxer remot usant la infraestructura KIO de xarxa del KDE +Comment[ca]=Proporciona accés a un calendari en un fitxer remot usant la infraestructura KIO de xarxa del KDE Comment[ca@valencia]=Proporciona l'accés a un calendari en un fitxer remot usant la infraestructura KIO de xarxa del KDE Comment[da]=Giver adgang til en kalender i en ekstern fil med brug af KDE's netværks-framework KIO Comment[de]=Ermöglicht den Zugriff auf einen entfernten Kalender über KDEs Netzwerk-Zugriffsystem KIO. diff -Nru kdepim-4.13.0/ktimetracker/ktimetracker_config_behavior.desktop kdepim-4.13.3/ktimetracker/ktimetracker_config_behavior.desktop --- kdepim-4.13.0/ktimetracker/ktimetracker_config_behavior.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/ktimetracker/ktimetracker_config_behavior.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -119,6 +119,7 @@ X-KDE-Keywords[da]=ktimetracker, indstil, indstillinger X-KDE-Keywords[de]=KTimetracker,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=ktimetracker, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=ktimetracker, configure, settings X-KDE-Keywords[es]=ktimetracker, configurar, preferencias X-KDE-Keywords[et]=ktimetracker, seadistamine, seadistused X-KDE-Keywords[fi]=ktimetracker, configure, settings, asetukset diff -Nru kdepim-4.13.0/ktimetracker/ktimetracker_config_display.desktop kdepim-4.13.3/ktimetracker/ktimetracker_config_display.desktop --- kdepim-4.13.0/ktimetracker/ktimetracker_config_display.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/ktimetracker/ktimetracker_config_display.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -143,6 +143,7 @@ X-KDE-Keywords[da]=ktimetracker, indstil, indstillinger X-KDE-Keywords[de]=KTimetracker,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=ktimetracker, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=ktimetracker, configure, settings X-KDE-Keywords[es]=ktimetracker, configurar, preferencias X-KDE-Keywords[et]=ktimetracker, seadistamine, seadistused X-KDE-Keywords[fi]=ktimetracker, configure, settings, asetukset diff -Nru kdepim-4.13.0/ktimetracker/ktimetracker_config_storage.desktop kdepim-4.13.3/ktimetracker/ktimetracker_config_storage.desktop --- kdepim-4.13.0/ktimetracker/ktimetracker_config_storage.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/ktimetracker/ktimetracker_config_storage.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -118,6 +118,7 @@ X-KDE-Keywords[da]=ktimetracker, indstil, indstillinger X-KDE-Keywords[de]=KTimetracker,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen X-KDE-Keywords[el]=ktimetracker, διαμόρφωση, ρυθμίσεις +X-KDE-Keywords[en_GB]=ktimetracker, configure, settings X-KDE-Keywords[es]=ktimetracker, configurar, preferencias X-KDE-Keywords[et]=ktimetracker, seadistamine, seadistused X-KDE-Keywords[fi]=ktimetracker, configure, settings, asetukset diff -Nru kdepim-4.13.0/ktimetracker/taskview.cpp kdepim-4.13.3/ktimetracker/taskview.cpp --- kdepim-4.13.0/ktimetracker/taskview.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/ktimetracker/taskview.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -141,7 +141,7 @@ public: Private() : mStorage( new timetrackerstorage() ), - mFocusTrackingActive( false ) {} + mFocusTrackingActive( false ), mLastTaskWithFocus(0), mPopupPercentageMenu(0), mPopupPriorityMenu(0) {} ~Private() { diff -Nru kdepim-4.13.0/ktnef/ktnef.desktop kdepim-4.13.3/ktnef/ktnef.desktop --- kdepim-4.13.0/ktnef/ktnef.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/ktnef/ktnef.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -11,6 +11,7 @@ Name[da]=KTnef Name[de]=KTnef Name[el]=KTnef +Name[en_GB]=KTnef Name[es]=KTnef Name[et]=KTnef Name[fi]=KTnef @@ -22,6 +23,7 @@ Name[hu]=KTnef Name[ia]=KTnef Name[it]=KTnef +Name[ja]=KTnef Name[ka]=KTnef Name[kk]=KTnef Name[km]=KTnef @@ -59,7 +61,9 @@ GenericName[da]=TNEF-filfremviser (proprietært format som bruges af outlook) GenericName[de]=TNEF-Dateibetrachter (Proprietäres Format von Outlook) GenericName[el]=Προβολέας αρχείων TNEF (ιδιοταγής μορφή που χρησιμοποιείται από το outlook) +GenericName[en_GB]=TNEF File Viewer (proprietary format used by outlook) GenericName[es]=Visor de archivos TNEF (formato propietario usado por outlook) +GenericName[et]=TNEF-failide (Outlookis kasutatav omanduslik vorming) näitaja GenericName[fi]=TNEF-tiedostokatselin (Outlookin käyttämä suljettu tiedostomuoto) GenericName[fr]=Afficheur de fichier TNEF (format propriétaire utilisé par Outlook) GenericName[gl]=Visor de ficheiros de TNEF (formato privativo empregado por outlook) @@ -98,6 +102,7 @@ Comment[da]=En fremviser/udpakker til TNEF-filer Comment[de]=Betrachten und Extrahieren von TNEF-Dateien Comment[el]=Ένας προβολέας/εξαγωγέας για αρχεία TNEF +Comment[en_GB]=A viewer/extractor for TNEF files Comment[es]=Un visor/extractor para archivos TNEF Comment[et]=TNEF-failide näitaja/ekstraktija Comment[fa]=یک مشاهده‌گر/استخراج‌گر برای پرونده‌های TNEF @@ -108,6 +113,7 @@ Comment[hu]=Egy megjelenítő/kibontó a TNEF fájlokhoz Comment[ia]=Un visor/extractor de files TNEF Comment[it]=Un visualizzatore/estrattore di file TNEF +Comment[ja]=TNEF ファイルのためのビューア/展開ツール Comment[ka]= TNEF ფაილების ექსტრაქტორი/დამთვალიერებელი Comment[kk]=TNEF файдарды қарау/тарқату Comment[km]=កម្មវិធី​មើល/កម្មវិធី​ស្រង់​ចេញ​សម្រាប់​ឯកសារ TNEF diff -Nru kdepim-4.13.0/ktnef/ktnefmain.cpp kdepim-4.13.3/ktnef/ktnefmain.cpp --- kdepim-4.13.0/ktnef/ktnefmain.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/ktnef/ktnefmain.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -488,7 +488,7 @@ saveMainWindowSettings( KGlobal::config()->group( "MainWindow" ) ); KEditToolBar dlg( factory() ); - connect( &dlg, SIGNAL(newToolBarConfig()), this, SLOT(newToolbarConfig()) ); + connect( &dlg, SIGNAL(newToolBarConfig()), this, SLOT(slotNewToolbarConfig()) ); dlg.exec(); } diff -Nru kdepim-4.13.0/libkdepim/addressline/addresseelineedit.cpp kdepim-4.13.3/libkdepim/addressline/addresseelineedit.cpp --- kdepim-4.13.0/libkdepim/addressline/addresseelineedit.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkdepim/addressline/addresseelineedit.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -350,7 +350,7 @@ hashEmail.insert(email.toLower(), email); } } - return hashEmail.keys(); + return hashEmail.values(); } void AddresseeLineEdit::Private::searchInBaloo() diff -Nru kdepim-4.13.0/libkdepim/ldap/kcmldap.desktop kdepim-4.13.3/libkdepim/ldap/kcmldap.desktop --- kdepim-4.13.0/libkdepim/ldap/kcmldap.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkdepim/ldap/kcmldap.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -110,6 +110,7 @@ X-KDE-Keywords[da]=kaddressbook, indstil, indstillinger, LDAP X-KDE-Keywords[de]=KAddressbook,einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,LDAP X-KDE-Keywords[el]=kaddressbook, διαμόρφωση, ρυθμίσεις, LDAP +X-KDE-Keywords[en_GB]=kaddressbook, configure, settings, LDAP X-KDE-Keywords[es]=kaddressbook, configurar, preferencias, LDAP X-KDE-Keywords[et]=kde aadressiraamat, seadistamine, seadistused, LDAP X-KDE-Keywords[fi]=kaddressbook, configure, settings, asetukset, LDAP diff -Nru kdepim-4.13.0/libkdepim/tests/testldapclient.cpp kdepim-4.13.3/libkdepim/tests/testldapclient.cpp --- kdepim-4.13.0/libkdepim/tests/testldapclient.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkdepim/tests/testldapclient.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -42,6 +42,11 @@ return 0; } +TestLDAPClient::TestLDAPClient() + : mClient(0) +{ +} + void TestLDAPClient::setup() { } diff -Nru kdepim-4.13.0/libkdepim/tests/testldapclient.h kdepim-4.13.3/libkdepim/tests/testldapclient.h --- kdepim-4.13.0/libkdepim/tests/testldapclient.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkdepim/tests/testldapclient.h 2014-07-09 12:18:50.000000000 +0000 @@ -33,7 +33,7 @@ Q_OBJECT public: - TestLDAPClient() {} + TestLDAPClient(); void setup(); void runAll(); void cleanup(); diff -Nru kdepim-4.13.0/libkdepimdbusinterfaces/reminderclient.cpp kdepim-4.13.3/libkdepimdbusinterfaces/reminderclient.cpp --- kdepim-4.13.0/libkdepimdbusinterfaces/reminderclient.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkdepimdbusinterfaces/reminderclient.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -34,43 +34,43 @@ void ReminderClient::startDaemon() { - QDBusInterface iface( QLatin1String("org.kde.korgac"), QLatin1String("/") ); - if ( iface.isValid() ){ - // Reminder daemon already runs - return; - } + QDBusInterface iface( QLatin1String("org.kde.korgac"), QLatin1String("/") ); + if ( iface.isValid() ){ + // Reminder daemon already runs + return; + } - const QString desktopFile = KStandardDirs::locate( "autostart", QLatin1String("korgac.desktop") ); - if ( desktopFile.isEmpty() ) { - kWarning() << "Couldn't find autostart/korgac.desktop!"; - } else { - QString error; - if ( KToolInvocation::startServiceByDesktopPath( desktopFile, QStringList(), &error ) != 0 ) { - kWarning() << "Failure starting korgac:" << error; - // try harder... - const QString korgacExe = KStandardDirs::findExe( QLatin1String( "korgac" ) ); - QProcess::startDetached( korgacExe ); + const QString desktopFile = KStandardDirs::locate( "autostart", QLatin1String("korgac.desktop") ); + if ( desktopFile.isEmpty() ) { + kWarning() << "Couldn't find autostart/korgac.desktop!"; + } else { + QString error; + if ( KToolInvocation::startServiceByDesktopPath( desktopFile, QStringList(), &error ) != 0 ) { + kWarning() << "Failure starting korgac:" << error; + // try harder... + const QString korgacExe = KStandardDirs::findExe( QLatin1String( "korgac" ) ); + QProcess::startDetached( korgacExe ); + } } - } } void ReminderClient::stopDaemon() { - OrgKdeKorganizerKOrgacInterface interface( - QLatin1String("org.kde.korgac"), QLatin1String("/ac"), QDBusConnection::sessionBus() ); - interface.quit(); + OrgKdeKorganizerKOrgacInterface interface( + QLatin1String("org.kde.korgac"), QLatin1String("/ac"), QDBusConnection::sessionBus() ); + interface.quit(); } void ReminderClient::hideDaemon() { - OrgKdeKorganizerKOrgacInterface interface( - QLatin1String("org.kde.korgac"), QLatin1String("/ac"), QDBusConnection::sessionBus() ); - interface.hide(); + OrgKdeKorganizerKOrgacInterface interface( + QLatin1String("org.kde.korgac"), QLatin1String("/ac"), QDBusConnection::sessionBus() ); + interface.hide(); } void ReminderClient::showDaemon() { - OrgKdeKorganizerKOrgacInterface interface( - QLatin1String("org.kde.korgac"), QLatin1String("/ac"), QDBusConnection::sessionBus() ); - interface.show(); + OrgKdeKorganizerKOrgacInterface interface( + QLatin1String("org.kde.korgac"), QLatin1String("/ac"), QDBusConnection::sessionBus() ); + interface.show(); } diff -Nru kdepim-4.13.0/libkdepimdbusinterfaces/reminderclient.h kdepim-4.13.3/libkdepimdbusinterfaces/reminderclient.h --- kdepim-4.13.0/libkdepimdbusinterfaces/reminderclient.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkdepimdbusinterfaces/reminderclient.h 2014-07-09 12:18:50.000000000 +0000 @@ -30,25 +30,25 @@ */ namespace ReminderClient { - /** +/** Start reminder daemon. */ - KDEPIMDBUSINTERFACES_EXPORT void startDaemon(); +KDEPIMDBUSINTERFACES_EXPORT void startDaemon(); - /** +/** Stop reminder daemon. */ - KDEPIMDBUSINTERFACES_EXPORT void stopDaemon(); +KDEPIMDBUSINTERFACES_EXPORT void stopDaemon(); - /** +/** Hide the reminder daemon. */ - KDEPIMDBUSINTERFACES_EXPORT void hideDaemon(); +KDEPIMDBUSINTERFACES_EXPORT void hideDaemon(); - /** +/** Show the reminder daemon. */ - KDEPIMDBUSINTERFACES_EXPORT void showDaemon(); +KDEPIMDBUSINTERFACES_EXPORT void showDaemon(); } } diff -Nru kdepim-4.13.0/libkdepimdbusinterfaces/urihandler.cpp kdepim-4.13.3/libkdepimdbusinterfaces/urihandler.cpp --- kdepim-4.13.0/libkdepimdbusinterfaces/urihandler.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkdepimdbusinterfaces/urihandler.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -40,67 +40,67 @@ bool UriHandler::process( const QString &uri, const Akonadi::Item& item ) { - kDebug() << uri; + kDebug() << uri; - if ( uri.startsWith( QLatin1String( "kmail:" ) ) ) { - // make sure kmail is running or the part is shown - KToolInvocation::startServiceByDesktopPath( QLatin1String("kmail") ); - - // parse string, show - int colon = uri.indexOf( QLatin1Char(':') ); - // extract 'number' from 'kmail:/' - QString serialNumberStr = uri.mid( colon + 1 ); - serialNumberStr = serialNumberStr.left( serialNumberStr.indexOf( QLatin1Char('/') ) ); - - org::kde::kmail::kmail kmail( - QLatin1String("org.kde.kmail"), QLatin1String("/KMail"), QDBusConnection::sessionBus() ); - kmail.showMail( serialNumberStr.toLongLong() ); - return true; - } else if ( uri.startsWith( QLatin1String( "mailto:" ) ) ) { - KToolInvocation::invokeMailer( uri.mid(7), QString() ); - return true; - } else if ( uri.startsWith( QLatin1String( "uid:" ) ) ) { - - Akonadi::ContactEditorDialog *dlg = new Akonadi::ContactEditorDialog( Akonadi::ContactEditorDialog::EditMode, ( QWidget* )0 ); - if ( item.isValid() ) { - dlg->setContact( item ); - dlg->show(); - return true; - } else { - kDebug()<<"Item is not valid."; - return false; + if ( uri.startsWith( QLatin1String( "kmail:" ) ) ) { + // make sure kmail is running or the part is shown + KToolInvocation::startServiceByDesktopPath( QLatin1String("kmail") ); + + // parse string, show + int colon = uri.indexOf( QLatin1Char(':') ); + // extract 'number' from 'kmail:/' + QString serialNumberStr = uri.mid( colon + 1 ); + serialNumberStr = serialNumberStr.left( serialNumberStr.indexOf( QLatin1Char('/') ) ); + + org::kde::kmail::kmail kmail( + QLatin1String("org.kde.kmail"), QLatin1String("/KMail"), QDBusConnection::sessionBus() ); + kmail.showMail( serialNumberStr.toLongLong() ); + return true; + } else if ( uri.startsWith( QLatin1String( "mailto:" ) ) ) { + KToolInvocation::invokeMailer( uri.mid(7), QString() ); + return true; + } else if ( uri.startsWith( QLatin1String( "uid:" ) ) ) { + + Akonadi::ContactEditorDialog *dlg = new Akonadi::ContactEditorDialog( Akonadi::ContactEditorDialog::EditMode, ( QWidget* )0 ); + if ( item.isValid() ) { + dlg->setContact( item ); + dlg->show(); + return true; + } else { + kDebug()<<"Item is not valid."; + return false; + } + } else if ( uri.startsWith( QLatin1String( "urn:x-ical" ) ) ) { + // make sure korganizer is running or the part is shown + KToolInvocation::startServiceByDesktopPath( QLatin1String("korganizer") ); + + // we must work around KUrl breakage (it doesn't know about URNs) + const QString uid = KUrl::fromPercentEncoding( uri.toLatin1() ).mid( 11 ); + OrgKdeKorganizerKorganizerInterface korganizerIface( + QLatin1String("org.kde.korganizer"), QLatin1String("/Korganizer"), QDBusConnection::sessionBus() ); + + return korganizerIface.showIncidence( uid ); + } else if ( uri.startsWith( QLatin1String( "news:" ) ) ) { + KToolInvocation::startServiceByDesktopPath( QLatin1String("knode") ); + org::kde::knode knode( + QLatin1String("org.kde.knode"), QLatin1String("/KNode"), QDBusConnection::sessionBus() ); + knode.openURL( uri ); + } else if ( uri.startsWith( QLatin1String( "akonadi:" ) ) ) { + const KUrl url( uri ); + const QString mimeType = url.queryItem( QLatin1String( "type" ) ); + if ( mimeType.toLower() == QLatin1String( "message/rfc822" ) ) { + // make sure kmail is running or the part is shown + KToolInvocation::startServiceByDesktopPath( QLatin1String("kmail") ); + + org::kde::kmail::kmail kmail( + QLatin1String("org.kde.kmail"), QLatin1String("/KMail"), QDBusConnection::sessionBus() ); + kmail.viewMessage( uri ); + return true; + } + } else { // no special URI, let KDE handle it + new KRun( KUrl( uri ), 0 ); } - } else if ( uri.startsWith( QLatin1String( "urn:x-ical" ) ) ) { - // make sure korganizer is running or the part is shown - KToolInvocation::startServiceByDesktopPath( QLatin1String("korganizer") ); - - // we must work around KUrl breakage (it doesn't know about URNs) - const QString uid = KUrl::fromPercentEncoding( uri.toLatin1() ).mid( 11 ); - OrgKdeKorganizerKorganizerInterface korganizerIface( - QLatin1String("org.kde.korganizer"), QLatin1String("/Korganizer"), QDBusConnection::sessionBus() ); - - return korganizerIface.showIncidence( uid ); - } else if ( uri.startsWith( QLatin1String( "news:" ) ) ) { - KToolInvocation::startServiceByDesktopPath( QLatin1String("knode") ); - org::kde::knode knode( - QLatin1String("org.kde.knode"), QLatin1String("/KNode"), QDBusConnection::sessionBus() ); - knode.openURL( uri ); - } else if ( uri.startsWith( QLatin1String( "akonadi:" ) ) ) { - const KUrl url( uri ); - const QString mimeType = url.queryItem( QLatin1String( "type" ) ); - if ( mimeType.toLower() == QLatin1String( "message/rfc822" ) ) { - // make sure kmail is running or the part is shown - KToolInvocation::startServiceByDesktopPath( QLatin1String("kmail") ); - - org::kde::kmail::kmail kmail( - QLatin1String("org.kde.kmail"), QLatin1String("/KMail"), QDBusConnection::sessionBus() ); - kmail.viewMessage( uri ); - return true; - } - } else { // no special URI, let KDE handle it - new KRun( KUrl( uri ), 0 ); - } - return false; + return false; } diff -Nru kdepim-4.13.0/libkdepimdbusinterfaces/urihandler.h kdepim-4.13.3/libkdepimdbusinterfaces/urihandler.h --- kdepim-4.13.0/libkdepimdbusinterfaces/urihandler.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkdepimdbusinterfaces/urihandler.h 2014-07-09 12:18:50.000000000 +0000 @@ -30,7 +30,7 @@ class KDEPIMDBUSINTERFACES_EXPORT UriHandler { - public: +public: /** Process URI (e.g. open mailer, open browser, open incidence viewer etc.). @return true if handler handled the URI, otherwise false. diff -Nru kdepim-4.13.0/libkleo/libkleopatrarc.desktop kdepim-4.13.3/libkleo/libkleopatrarc.desktop --- kdepim-4.13.0/libkleo/libkleopatrarc.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkleo/libkleopatrarc.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -597,7 +597,7 @@ Name[et]=Kvalifitseeritud allkirjade võtmed Name[fi]=Hyväksyttyjen allekirjoitusten avaimet Name[fr]=Clés pour les signatures qualifiées -Name[gl]=Chaves para asinaturas cualificadas +Name[gl]=Chaves para sinaturas cualificadas Name[hu]=Kulcsok minősített aláírásokhoz Name[ia]=Claves pro signaturas qualificate Name[it]=Chiavi per le firme qualificate diff -Nru kdepim-4.13.0/libkleo/libkleopatrarc-win32.desktop kdepim-4.13.3/libkleo/libkleopatrarc-win32.desktop --- kdepim-4.13.0/libkleo/libkleopatrarc-win32.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libkleo/libkleopatrarc-win32.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -558,7 +558,7 @@ Name[et]=Kvalifitseeritud allkirjade võtmed Name[fi]=Hyväksyttyjen allekirjoitusten avaimet Name[fr]=Clés pour les signatures qualifiées -Name[gl]=Chaves para asinaturas cualificadas +Name[gl]=Chaves para sinaturas cualificadas Name[hu]=Kulcsok minősített aláírásokhoz Name[ia]=Claves pro signaturas qualificate Name[it]=Chiavi per le firme qualificate diff -Nru kdepim-4.13.0/libksieve/kmanagesieve/sasl-common.h kdepim-4.13.3/libksieve/kmanagesieve/sasl-common.h --- kdepim-4.13.0/libksieve/kmanagesieve/sasl-common.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/kmanagesieve/sasl-common.h 2014-07-09 12:18:50.000000000 +0000 @@ -26,13 +26,17 @@ #include #include +#ifdef Q_OS_WIN +#include +#endif + extern "C" { #include } inline bool initSASL() { -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN QByteArray libInstallPath( QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("lib")+QLatin1String("sasl2"))) ); QByteArray configPath( QFile::encodeName(QDir::toNativeSeparators(KGlobal::dirs()->installPath("config")+QLatin1String("sasl2"))) ); if ( sasl_set_path(SASL_PATH_TYPE_PLUGIN, libInstallPath.data()) != SASL_OK diff -Nru kdepim-4.13.0/libksieve/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp kdepim-4.13.3/libksieve/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp --- kdepim-4.13.0/libksieve/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/autocreatescripts/sieveactions/sieveactionconvert.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -41,33 +41,33 @@ QWidget *SieveActionConvert::createParamWidget( QWidget *parent ) const { QWidget *w = new QWidget(parent); - QHBoxLayout *lay = new QHBoxLayout; + QGridLayout *lay = new QGridLayout; lay->setMargin(0); w->setLayout(lay); QLabel *lab = new QLabel(i18n("From:")); - lay->addWidget(lab); + lay->addWidget(lab, 0, 0); SelectMimeTypeComboBox *fromMimeType = new SelectMimeTypeComboBox; connect(fromMimeType, SIGNAL(valueChanged()), this, SIGNAL(valueChanged())); fromMimeType->setObjectName(QLatin1String("from")); - lay->addWidget(fromMimeType); + lay->addWidget(fromMimeType, 0, 1); lab = new QLabel(i18n("To:")); - lay->addWidget(lab); + lay->addWidget(lab, 0, 2); SelectMimeTypeComboBox *toMimeType = new SelectMimeTypeComboBox; connect(toMimeType, SIGNAL(valueChanged()), this, SIGNAL(valueChanged())); toMimeType->setObjectName(QLatin1String("to")); - lay->addWidget(toMimeType); + lay->addWidget(toMimeType, 0, 3); lab = new QLabel(i18n("Parameters:")); - lay->addWidget(lab); + lay->addWidget(lab, 1, 0); SelectConvertParameterWidget *params = new SelectConvertParameterWidget; connect(params, SIGNAL(valueChanged()), this, SIGNAL(valueChanged())); params->setObjectName(QLatin1String("params")); - lay->addWidget(params); + lay->addWidget(params, 1, 1, 2, 3); return w; } @@ -130,7 +130,7 @@ } -QStringList SieveActionConvert::needRequires(QWidget *parent) const +QStringList SieveActionConvert::needRequires(QWidget *) const { return QStringList() << QLatin1String("convert"); } diff -Nru kdepim-4.13.0/libksieve/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp kdepim-4.13.3/libksieve/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp --- kdepim-4.13.0/libksieve/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/autocreatescripts/sieveactionwidgetlister.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -46,12 +46,10 @@ : QWidget(parent) { initWidget(); - qDebug()<<"SieveActionWidget::SieveActionWidget "<setMargin(0); lay->addLayout(grid); - QLabel *lab = new QLabel(i18n("Variable name\n (if empty it uses internal variable):")); - grid->addWidget(lab, 0, 0); - + int row = 0; if (hasVariableSupport) { + QLabel *lab = new QLabel(i18n("Variable name\n (if empty it uses internal variable):")); + grid->addWidget(lab, row, 0); + KLineEdit *variableName = new KLineEdit; variableName->setObjectName(QLatin1String("variablename")); connect(variableName, SIGNAL(textChanged(QString)), this, SIGNAL(valueChanged())); - grid->addWidget(variableName, 0, 1); + grid->addWidget(variableName, row, 1); + ++row; } - lab = new QLabel(i18n("Value:")); - grid->addWidget(lab, 1, 0); + QLabel *lab = new QLabel(i18n("Value:")); + grid->addWidget(lab, row, 0); KLineEdit *value = new KLineEdit; connect(value, SIGNAL(textChanged(QString)), this, SIGNAL(valueChanged())); value->setObjectName(QLatin1String("value")); - grid->addWidget(value, 1, 1); + grid->addWidget(value, row, 1); return w; } diff -Nru kdepim-4.13.0/libksieve/ksieveui/autocreatescripts/sieveconditions/widgets/selectheadertypecombobox.cpp kdepim-4.13.3/libksieve/ksieveui/autocreatescripts/sieveconditions/widgets/selectheadertypecombobox.cpp --- kdepim-4.13.0/libksieve/ksieveui/autocreatescripts/sieveconditions/widgets/selectheadertypecombobox.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/autocreatescripts/sieveconditions/widgets/selectheadertypecombobox.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -49,6 +49,8 @@ QHBoxLayout *hbox = new QHBoxLayout; mNewHeader = new KLineEdit; + mNewHeader->setTrapReturnKey(true); + connect(mNewHeader,SIGNAL(returnPressed()), SLOT(slotAddNewHeader())); mNewHeader->setClearButtonShown(true); hbox->addWidget(mNewHeader); @@ -64,13 +66,32 @@ lay->addLayout(hbox); setMainWidget(w); - resize(400,300); + readConfig(); } SelectHeadersDialog::~SelectHeadersDialog() { + writeConfig(); } +void SelectHeadersDialog::readConfig() +{ + KConfigGroup group( KGlobal::config(), "SelectHeadersDialog" ); + const QSize size = group.readEntry( "Size", QSize(400,300) ); + if ( size.isValid() ) { + resize( size ); + } +} + +void SelectHeadersDialog::writeConfig() +{ + KConfigGroup group( KGlobal::config(), "SelectHeadersDialog" ); + group.writeEntry( "Size", size() ); + group.sync(); +} + + + void SelectHeadersDialog::slotNewHeaderTextChanged(const QString &text) { mAddNewHeader->setEnabled(!text.trimmed().isEmpty()); @@ -79,8 +100,10 @@ void SelectHeadersDialog::slotAddNewHeader() { const QString headerText = mNewHeader->text().trimmed(); - if (!headerText.isEmpty()) + if (!headerText.isEmpty()) { mListWidget->addNewHeader(headerText); + mNewHeader->clear(); + } } void SelectHeadersDialog::setListHeaders(const QMap &lst, const QStringList &selectedHeaders) @@ -104,9 +127,18 @@ void SelectHeadersWidget::addNewHeader(const QString &header) { + const int numberOfItem = count(); + for (int i = 0; i < numberOfItem; ++i) { + QListWidgetItem *it = item(i); + if (it->data(HeaderId).toString() == header) { + return; + } + } + QListWidgetItem *item = new QListWidgetItem(header, this); item->setData(HeaderId, header); - item->setCheckState(Qt::Unchecked); + item->setCheckState(Qt::Checked); + scrollToItem(item); } void SelectHeadersWidget::setListHeaders(const QMap &lst, const QStringList &selectedHeaders) @@ -214,7 +246,7 @@ QString SelectHeaderTypeComboBox::code() const { - QString str = mCode.isEmpty() ? itemData(currentIndex()).toString() : mCode; + QString str = (currentIndex()> -1) ? itemData(currentIndex()).toString() : QString(); if (str.isEmpty()) { str = currentText(); if (str == i18n(selectMultipleHeaders)) { @@ -229,7 +261,23 @@ void SelectHeaderTypeComboBox::setCode(const QString &code) { - lineEdit()->setText(code); + QMapIterator i(mHeaderMap); + bool foundHeaders = false; + while (i.hasNext()) { + i.next(); + if (i.key() == code) { + const int index = findData(i.key()); + setCurrentIndex(index); + lineEdit()->setText(i.value()); + foundHeaders = true; + break; + } + } + //If not found select last combobox item + if (!foundHeaders) { + setCurrentIndex(count()-1); + lineEdit()->setText(code); + } mCode = code; } diff -Nru kdepim-4.13.0/libksieve/ksieveui/autocreatescripts/sieveconditions/widgets/selectheadertypecombobox.h kdepim-4.13.3/libksieve/ksieveui/autocreatescripts/sieveconditions/widgets/selectheadertypecombobox.h --- kdepim-4.13.0/libksieve/ksieveui/autocreatescripts/sieveconditions/widgets/selectheadertypecombobox.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/autocreatescripts/sieveconditions/widgets/selectheadertypecombobox.h 2014-07-09 12:18:50.000000000 +0000 @@ -60,6 +60,8 @@ void slotAddNewHeader(); private: + void readConfig(); + void writeConfig(); SelectHeadersWidget *mListWidget; KLineEdit *mNewHeader; KPushButton *mAddNewHeader; diff -Nru kdepim-4.13.0/libksieve/ksieveui/CMakeLists.txt kdepim-4.13.3/libksieve/ksieveui/CMakeLists.txt --- kdepim-4.13.0/libksieve/ksieveui/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/CMakeLists.txt 2014-07-09 12:18:50.000000000 +0000 @@ -51,6 +51,7 @@ editor/sieveeditortabwidget.cpp editor/sieveeditorutil.cpp editor/sieveeditorloadprogressindicator.cpp + editor/sieveeditorwebview.cpp ) set(ksieveui_autocreatescripts_LIB_SRCS diff -Nru kdepim-4.13.0/libksieve/ksieveui/data/scripts/copy/template.desktop kdepim-4.13.3/libksieve/ksieveui/data/scripts/copy/template.desktop --- kdepim-4.13.0/libksieve/ksieveui/data/scripts/copy/template.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/data/scripts/copy/template.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=Flyt til mappe Name[de]=In Ordner schieben Name[el]=Μετακίνηση στον κατάλογο +Name[en_GB]=Move to directory Name[es]=Mover a directorio +Name[et]=Kataloogi liigutamine Name[fi]=Siirrä kansioon Name[fr]=Déplacer dans le dossier Name[gl]=Mover para o directorio diff -Nru kdepim-4.13.0/libksieve/ksieveui/editor/sieveeditorhelphtmlwidget.cpp kdepim-4.13.3/libksieve/ksieveui/editor/sieveeditorhelphtmlwidget.cpp --- kdepim-4.13.0/libksieve/ksieveui/editor/sieveeditorhelphtmlwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/editor/sieveeditorhelphtmlwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -17,7 +17,7 @@ #include "sieveeditorhelphtmlwidget.h" #include "sieveeditorloadprogressindicator.h" -#include +#include "sieveeditorwebview.h" #include using namespace KSieveUi; @@ -28,7 +28,7 @@ mProgressIndicator = new SieveEditorLoadProgressIndicator(this); connect(mProgressIndicator, SIGNAL(pixmapChanged(QPixmap)), this, SLOT(slotPixmapChanged(QPixmap))); connect(mProgressIndicator, SIGNAL(loadFinished(bool)), this, SLOT(slotLoadFinished(bool))); - mWebView = new QWebView; + mWebView = new SieveEditorWebView; connect(mWebView, SIGNAL(titleChanged(QString)), this, SLOT(slotTitleChanged(QString))); connect(mWebView, SIGNAL(loadStarted()), this, SLOT(slotLoadStarted())); connect(mWebView, SIGNAL(loadFinished(bool)), this, SLOT(slotFinished(bool))); diff -Nru kdepim-4.13.0/libksieve/ksieveui/editor/sieveeditorhelphtmlwidget.h kdepim-4.13.3/libksieve/ksieveui/editor/sieveeditorhelphtmlwidget.h --- kdepim-4.13.0/libksieve/ksieveui/editor/sieveeditorhelphtmlwidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/editor/sieveeditorhelphtmlwidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -19,9 +19,9 @@ #define SIEVEEDITORHELPHTMLWIDGET_H #include -class QWebView; namespace KSieveUi { +class SieveEditorWebView; class SieveEditorLoadProgressIndicator; class SieveEditorHelpHtmlWidget : public QWidget { @@ -46,7 +46,7 @@ void slotLoadFinished(bool success); private: QString mVariableName; - QWebView *mWebView; + SieveEditorWebView *mWebView; SieveEditorLoadProgressIndicator *mProgressIndicator; }; } diff -Nru kdepim-4.13.0/libksieve/ksieveui/editor/sieveeditorwebview.cpp kdepim-4.13.3/libksieve/ksieveui/editor/sieveeditorwebview.cpp --- kdepim-4.13.0/libksieve/ksieveui/editor/sieveeditorwebview.cpp 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/editor/sieveeditorwebview.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -0,0 +1,65 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 "sieveeditorwebview.h" +#include +#include +#include + +using namespace KSieveUi; + +SieveEditorWebView::SieveEditorWebView(QWidget *parent) + : QWebView(parent) +{ +} + +SieveEditorWebView::~SieveEditorWebView() +{ +} + +void SieveEditorWebView::contextMenuEvent(QContextMenuEvent *ev) +{ + QMenu menu; + QAction *act = pageAction(QWebPage::Back); + if (act->isEnabled()) + menu.addAction(act); + act = pageAction(QWebPage::Forward); + if (act->isEnabled()) + menu.addAction(act); + + if (menu.actions().count() > 0) { + QAction *separator = new QAction(&menu); + separator->setSeparator(true); + menu.addAction(separator); + } + + act = pageAction(QWebPage::CopyLinkToClipboard); + if (act->isEnabled()) + menu.addAction(act); + + if (menu.actions().count() > 0) { + QAction *separator = new QAction(&menu); + separator->setSeparator(true); + menu.addAction(separator); + } + act = pageAction(QWebPage::Reload); + if (act->isEnabled()) + menu.addAction(act); + menu.exec(ev->globalPos()); +} + diff -Nru kdepim-4.13.0/libksieve/ksieveui/editor/sieveeditorwebview.h kdepim-4.13.3/libksieve/ksieveui/editor/sieveeditorwebview.h --- kdepim-4.13.0/libksieve/ksieveui/editor/sieveeditorwebview.h 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/editor/sieveeditorwebview.h 2014-07-09 12:18:50.000000000 +0000 @@ -0,0 +1,36 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 SIEVEEDITORWEBVIEW_H +#define SIEVEEDITORWEBVIEW_H + +#include + +namespace KSieveUi { +class SieveEditorWebView : public QWebView +{ + Q_OBJECT +public: + explicit SieveEditorWebView(QWidget *parent=0); + ~SieveEditorWebView(); + +protected: + void contextMenuEvent( QContextMenuEvent * ev ); +}; +} + +#endif // SIEVEEDITORWEBVIEW_H diff -Nru kdepim-4.13.0/libksieve/ksieveui/editor/sievetextedit.cpp kdepim-4.13.3/libksieve/ksieveui/editor/sievetextedit.cpp --- kdepim-4.13.0/libksieve/ksieveui/editor/sievetextedit.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/editor/sievetextedit.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -38,7 +38,8 @@ using namespace KSieveUi; SieveTextEdit::SieveTextEdit( QWidget *parent ) - : PimCommon::PlainTextEditor( parent ) + : PimCommon::PlainTextEditor( parent ), + mShowHelpMenu(true) { setWordWrapMode ( QTextOption::NoWrap ); setFont( KGlobalSettings::fixedFont() ); @@ -237,8 +238,16 @@ setCompleterList(completerList() + capabilities); } +void SieveTextEdit::setShowHelpMenu(bool b) +{ + mShowHelpMenu = b; +} + void SieveTextEdit::addExtraMenuEntry(QMenu *menu, const QPoint &pos) { + if (!mShowHelpMenu) + return; + if (!textCursor().hasSelection()) { const QString word = selectedWord(pos); const KSieveUi::SieveEditorUtil::HelpVariableName type = KSieveUi::SieveEditorUtil::strToVariableName(word); diff -Nru kdepim-4.13.0/libksieve/ksieveui/editor/sievetextedit.h kdepim-4.13.3/libksieve/ksieveui/editor/sievetextedit.h --- kdepim-4.13.0/libksieve/ksieveui/editor/sievetextedit.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/editor/sievetextedit.h 2014-07-09 12:18:50.000000000 +0000 @@ -47,6 +47,8 @@ void setSieveCapabilities( const QStringList &capabilities ); + void setShowHelpMenu(bool b); + private Q_SLOTS: void slotInsertCompletion( const QString& ); void slotUpdateLineNumberAreaWidth(int newBlockCount); @@ -71,6 +73,7 @@ QCompleter *m_completer; SieveLineNumberArea *m_sieveLineNumberArea; PimCommon::SieveSyntaxHighlighter *m_syntaxHighlighter; + bool mShowHelpMenu; }; } diff -Nru kdepim-4.13.0/libksieve/ksieveui/editor/tests/CMakeLists.txt kdepim-4.13.3/libksieve/ksieveui/editor/tests/CMakeLists.txt --- kdepim-4.13.0/libksieve/ksieveui/editor/tests/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/editor/tests/CMakeLists.txt 2014-07-09 12:18:50.000000000 +0000 @@ -15,19 +15,3 @@ pimcommon ) -set(editor_gui_SRCS editorsieve_gui.cpp) -kde4_add_executable(editorsieve_gui TEST ${editorsieve_gui_SRCS}) -target_link_libraries(editorsieve_gui - ${QT_QTTEST_LIBRARY} - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY} - ${QT_QTXML_LIBRARY} - ${KDE4_KDECORE_LIBS} - ${KDE4_KDEUI_LIBS} - ${KDE4_KIO_LIBS} - ksieveui - ksieve - pimcommon -) - - diff -Nru kdepim-4.13.0/libksieve/ksieveui/managesievescriptsdialog.cpp kdepim-4.13.3/libksieve/ksieveui/managesievescriptsdialog.cpp --- kdepim-4.13.0/libksieve/ksieveui/managesievescriptsdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/managesievescriptsdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -60,8 +60,8 @@ if ( type.status() == Akonadi::AgentInstance::Broken ) continue; + QString serverName = type.name(); last = new SieveTreeWidgetItem( treeView(), last ); - last->setText( 0, type.name() ); last->setIcon( 0, SmallIcon( QLatin1String("network-server") ) ); const KUrl u = KSieveUi::Util::findSieveUrlForAccount( type.identifier() ); @@ -71,6 +71,7 @@ item->setFlags( item->flags() & ~Qt::ItemIsEnabled ); treeView()->expandItem( last ); } else { + serverName += QString::fromLatin1(" (%1)").arg(u.userName()); KManageSieve::SieveJob * job = KManageSieve::SieveJob::list( u ); connect( job, SIGNAL(gotList(KManageSieve::SieveJob*,bool,QStringList,QString)), this, SLOT(slotGotList(KManageSieve::SieveJob*,bool,QStringList,QString)) ); @@ -78,6 +79,7 @@ mUrls.insert( last, u ); last->startAnimation(); } + last->setText( 0, serverName ); noImapFound = false; } return noImapFound; diff -Nru kdepim-4.13.0/libksieve/ksieveui/templates/sievetemplateeditdialog.cpp kdepim-4.13.3/libksieve/ksieveui/templates/sievetemplateeditdialog.cpp --- kdepim-4.13.0/libksieve/ksieveui/templates/sievetemplateeditdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/templates/sievetemplateeditdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -51,11 +51,13 @@ mTemplateNameEdit = new KLineEdit; mTemplateNameEdit->setEnabled(!defaultTemplate); mTemplateNameEdit->setTrapReturnKey(true); + mTemplateNameEdit->setClearButtonShown(true); hbox->addWidget(mTemplateNameEdit); vbox->addLayout(hbox); mTextEdit = new KSieveUi::SieveTextEdit; + mTextEdit->setShowHelpMenu(false); mTextEdit->setReadOnly(defaultTemplate); vbox->addWidget(mTextEdit); @@ -71,7 +73,8 @@ setMainWidget(w); if (!defaultTemplate) { enableButtonOk(false); - connect(mTemplateNameEdit, SIGNAL(textChanged(QString)),SLOT(slotTemplateNameChanged(QString))); + connect(mTemplateNameEdit, SIGNAL(textChanged(QString)),SLOT(slotTemplateChanged())); + connect(mTextEdit, SIGNAL(textChanged()),SLOT(slotTemplateChanged())); mTemplateNameEdit->setFocus(); } readConfig(); @@ -107,9 +110,9 @@ } } -void SieveTemplateEditDialog::slotTemplateNameChanged(const QString &text) +void SieveTemplateEditDialog::slotTemplateChanged() { - enableButtonOk(!text.trimmed().isEmpty()); + enableButtonOk(!mTemplateNameEdit->text().trimmed().isEmpty() && !mTextEdit->toPlainText().trimmed().isEmpty()); } void SieveTemplateEditDialog::setScript(const QString &text) diff -Nru kdepim-4.13.0/libksieve/ksieveui/templates/sievetemplateeditdialog.h kdepim-4.13.3/libksieve/ksieveui/templates/sievetemplateeditdialog.h --- kdepim-4.13.0/libksieve/ksieveui/templates/sievetemplateeditdialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/templates/sievetemplateeditdialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -43,7 +43,7 @@ QString script() const; private Q_SLOTS: - void slotTemplateNameChanged(const QString &); + void slotTemplateChanged(); void slotFind(); private: diff -Nru kdepim-4.13.0/libksieve/ksieveui/vacation/multiimapvacationdialog.cpp kdepim-4.13.3/libksieve/ksieveui/vacation/multiimapvacationdialog.cpp --- kdepim-4.13.0/libksieve/ksieveui/vacation/multiimapvacationdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/libksieve/ksieveui/vacation/multiimapvacationdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -114,7 +114,7 @@ VacationPageWidget *page = new VacationPageWidget; page->setServerUrl(url); page->setServerName(serverName); - mTabWidget->addTab(page,serverName); + mTabWidget->addTab(page, serverName + QString::fromLatin1(" (%1)").arg(url.userName())); } void MultiImapVacationDialog::readConfig() diff -Nru kdepim-4.13.0/mailcommon/filter/dialog/selectthunderbirdfilterfilesdialog.cpp kdepim-4.13.3/mailcommon/filter/dialog/selectthunderbirdfilterfilesdialog.cpp --- kdepim-4.13.0/mailcommon/filter/dialog/selectthunderbirdfilterfilesdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/filter/dialog/selectthunderbirdfilterfilesdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -38,8 +38,10 @@ setMainWidget( mainWidget ); mSelectFilterFilesWidget = new SelectThunderbirdFilterFilesWidget(mainWidget); + connect(mSelectFilterFilesWidget, SIGNAL(enableOkButton(bool)), this, SLOT(enableButtonOk(bool))); mainLayout->addWidget(mSelectFilterFilesWidget); readConfig(); + enableButtonOk(false); } SelectThunderbirdFilterFilesDialog::~SelectThunderbirdFilterFilesDialog() diff -Nru kdepim-4.13.0/mailcommon/filter/dialog/selectthunderbirdfilterfileswidget.cpp kdepim-4.13.3/mailcommon/filter/dialog/selectthunderbirdfilterfileswidget.cpp --- kdepim-4.13.0/mailcommon/filter/dialog/selectthunderbirdfilterfileswidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/filter/dialog/selectthunderbirdfilterfileswidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -45,6 +45,9 @@ ui->profiles->setEnabled(false); ui->listFiles->setEnabled(false); slotProfileChanged(0); + connect(ui->fileUrl, SIGNAL(textChanged(QString)), SLOT(slotUrlChanged(QString))); + connect(ui->listFiles, SIGNAL(itemSelectionChanged()), SLOT(slotItemSelectionChanged())); + Q_EMIT enableOkButton(false); } SelectThunderbirdFilterFilesWidget::~SelectThunderbirdFilterFilesWidget() @@ -52,16 +55,28 @@ delete ui; } +void SelectThunderbirdFilterFilesWidget::slotItemSelectionChanged() +{ + Q_EMIT enableOkButton(!ui->listFiles->selectedItems().isEmpty()); +} + +void SelectThunderbirdFilterFilesWidget::slotUrlChanged(const QString &path) +{ + Q_EMIT enableOkButton(!path.isEmpty()); +} + void SelectThunderbirdFilterFilesWidget::slotButtonClicked(QAbstractButton*button) { if (button == ui->selectFile) { ui->fileUrl->setEnabled(true); ui->profiles->setEnabled(false); ui->listFiles->setEnabled(false); + Q_EMIT enableOkButton(!ui->fileUrl->text().isEmpty()); } else { ui->fileUrl->setEnabled(false); ui->profiles->setEnabled(true); ui->listFiles->setEnabled(true); + slotItemSelectionChanged(); } } diff -Nru kdepim-4.13.0/mailcommon/filter/dialog/selectthunderbirdfilterfileswidget.h kdepim-4.13.3/mailcommon/filter/dialog/selectthunderbirdfilterfileswidget.h --- kdepim-4.13.0/mailcommon/filter/dialog/selectthunderbirdfilterfileswidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/filter/dialog/selectthunderbirdfilterfileswidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -37,10 +37,15 @@ void setStartDir(const KUrl&); +Q_SIGNALS: + void enableOkButton(bool); + private Q_SLOTS: void slotButtonClicked(QAbstractButton*button); void slotProfileChanged(int); + void slotUrlChanged(const QString &path); + void slotItemSelectionChanged(); private: Ui::SelectThunderbirdFilterFilesWidget *ui; }; diff -Nru kdepim-4.13.0/mailcommon/filter/filteractionaddtag.cpp kdepim-4.13.3/mailcommon/filter/filteractionaddtag.cpp --- kdepim-4.13.0/mailcommon/filter/filteractionaddtag.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/filter/filteractionaddtag.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -138,11 +138,7 @@ QString FilterActionAddTag::argsAsString() const { - if (!mList.contains(mParameter)) { - return QString(); - } - - return mList.value(mParameter); + return mParameter; } QString FilterActionAddTag::displayString() const diff -Nru kdepim-4.13.0/mailcommon/folder/entitycollectionorderproxymodel.cpp kdepim-4.13.3/mailcommon/folder/entitycollectionorderproxymodel.cpp --- kdepim-4.13.0/mailcommon/folder/entitycollectionorderproxymodel.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/entitycollectionorderproxymodel.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -29,52 +29,52 @@ class EntityCollectionOrderProxyModel::EntityCollectionOrderProxyModelPrivate { - public: +public: EntityCollectionOrderProxyModelPrivate() - : manualSortingActive( false ) + : manualSortingActive( false ) { } int collectionRank( const Akonadi::Collection &collection ) { - const Akonadi::Collection::Id id = collection.id(); - if ( collectionRanks.contains( id ) ) { - return collectionRanks[id]; - } - - int rank = 100; - if ( Kernel::folderIsInbox( collection, true ) ) { - rank = 1; - } else if ( Kernel::self()->folderIsDraftOrOutbox( collection ) ) { - if ( Kernel::self()->folderIsDrafts( collection ) ) { - rank = 5; - } else { - rank = 2; + const Akonadi::Collection::Id id = collection.id(); + if ( collectionRanks.contains( id ) ) { + return collectionRanks[id]; } - } else if ( Kernel::self()->folderIsSentMailFolder( collection ) ) { - rank = 3; - } else if ( Kernel::self()->folderIsTrash( collection ) ) { - rank = 4; - } else if ( Kernel::self()->folderIsTemplates( collection ) ) { - rank = 6; - } else if ( MailCommon::Util::isVirtualCollection( collection ) ) { - rank = 200; - } else if ( !topLevelOrder.isEmpty() ) { - if ( collection.parentCollection() == Akonadi::Collection::root()) { - const QString resource = collection.resource(); - if (resource.isEmpty()) { - qDebug()<<" collection has not resource: "< pb. - return rank; - } - const int order = topLevelOrder.indexOf(resource); - if ( order != -1 ) { - rank = order; - } - } - } - collectionRanks.insert( id, rank ); - return rank; + + int rank = 100; + if ( Kernel::folderIsInbox( collection, true ) ) { + rank = 1; + } else if ( Kernel::self()->folderIsDraftOrOutbox( collection ) ) { + if ( Kernel::self()->folderIsDrafts( collection ) ) { + rank = 5; + } else { + rank = 2; + } + } else if ( Kernel::self()->folderIsSentMailFolder( collection ) ) { + rank = 3; + } else if ( Kernel::self()->folderIsTrash( collection ) ) { + rank = 4; + } else if ( Kernel::self()->folderIsTemplates( collection ) ) { + rank = 6; + } else if ( MailCommon::Util::isVirtualCollection( collection ) ) { + rank = 200; + } else if ( !topLevelOrder.isEmpty() ) { + if ( collection.parentCollection() == Akonadi::Collection::root()) { + const QString resource = collection.resource(); + if (resource.isEmpty()) { + qDebug()<<" collection has not resource: "< pb. + return rank; + } + const int order = topLevelOrder.indexOf(resource); + if ( order != -1 ) { + rank = order; + } + } + } + collectionRanks.insert( id, rank ); + return rank; } bool manualSortingActive; @@ -83,30 +83,30 @@ }; EntityCollectionOrderProxyModel::EntityCollectionOrderProxyModel( QObject *parent ) - : EntityOrderProxyModel( parent ), d( new EntityCollectionOrderProxyModelPrivate() ) + : EntityOrderProxyModel( parent ), d( new EntityCollectionOrderProxyModelPrivate() ) { - setDynamicSortFilter( true ); - setSortCaseSensitivity( Qt::CaseInsensitive ); - connect( Akonadi::SpecialMailCollections::self(), SIGNAL(defaultCollectionsChanged()), - this, SLOT(slotSpecialCollectionsChanged()) ); - connect( Akonadi::SpecialMailCollections::self(), SIGNAL(collectionsChanged(Akonadi::AgentInstance)), - this, SLOT(slotSpecialCollectionsChanged()) ); + setDynamicSortFilter( true ); + setSortCaseSensitivity( Qt::CaseInsensitive ); + connect( Akonadi::SpecialMailCollections::self(), SIGNAL(defaultCollectionsChanged()), + this, SLOT(slotSpecialCollectionsChanged()) ); + connect( Akonadi::SpecialMailCollections::self(), SIGNAL(collectionsChanged(Akonadi::AgentInstance)), + this, SLOT(slotSpecialCollectionsChanged()) ); } EntityCollectionOrderProxyModel::~EntityCollectionOrderProxyModel() { - if ( d->manualSortingActive ) { - saveOrder(); - } - delete d; + if ( d->manualSortingActive ) { + saveOrder(); + } + delete d; } void EntityCollectionOrderProxyModel::slotSpecialCollectionsChanged() { - if ( !d->manualSortingActive ) { - d->collectionRanks.clear(); - invalidate(); - } + if ( !d->manualSortingActive ) { + d->collectionRanks.clear(); + invalidate(); + } } void EntityCollectionOrderProxyModel::setTopLevelOrder(const QStringList& list) @@ -124,41 +124,41 @@ bool EntityCollectionOrderProxyModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const { - if ( !d->manualSortingActive ) { - - Akonadi::Collection leftData = - left.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - Akonadi::Collection rightData = - right.data( Akonadi::EntityTreeModel::CollectionRole ).value(); + if ( !d->manualSortingActive ) { - const int rankLeft = d->collectionRank( leftData ); - const int rankRight = d->collectionRank( rightData ); + Akonadi::Collection leftData = + left.data( Akonadi::EntityTreeModel::CollectionRole ).value(); + Akonadi::Collection rightData = + right.data( Akonadi::EntityTreeModel::CollectionRole ).value(); + + const int rankLeft = d->collectionRank( leftData ); + const int rankRight = d->collectionRank( rightData ); + + if ( rankLeft < rankRight ) { + return true; + } else if ( rankLeft > rankRight ) { + return false; + } - if ( rankLeft < rankRight ) { - return true; - } else if ( rankLeft > rankRight ) { - return false; + return QSortFilterProxyModel::lessThan( left, right ); } - - return QSortFilterProxyModel::lessThan( left, right ); - } - return EntityOrderProxyModel::lessThan( left, right ); + return EntityOrderProxyModel::lessThan( left, right ); } void EntityCollectionOrderProxyModel::setManualSortingActive( bool active ) { - if ( d->manualSortingActive == active ) { - return; - } - - d->manualSortingActive = active; - d->collectionRanks.clear(); - invalidate(); + if ( d->manualSortingActive == active ) { + return; + } + + d->manualSortingActive = active; + d->collectionRanks.clear(); + invalidate(); } bool EntityCollectionOrderProxyModel::isManualSortingActive() const { - return d->manualSortingActive; + return d->manualSortingActive; } } diff -Nru kdepim-4.13.0/mailcommon/folder/entitycollectionorderproxymodel.h kdepim-4.13.3/mailcommon/folder/entitycollectionorderproxymodel.h --- kdepim-4.13.0/mailcommon/folder/entitycollectionorderproxymodel.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/entitycollectionorderproxymodel.h 2014-07-09 12:18:50.000000000 +0000 @@ -25,8 +25,8 @@ class EntityCollectionOrderProxyModel : public Akonadi::EntityOrderProxyModel { - Q_OBJECT - public: + Q_OBJECT +public: explicit EntityCollectionOrderProxyModel( QObject *parent = 0 ); virtual ~EntityCollectionOrderProxyModel(); @@ -39,10 +39,10 @@ void clearRanks(); void setTopLevelOrder(const QStringList& list); - public slots: +public slots: void slotSpecialCollectionsChanged(); - private: +private: class EntityCollectionOrderProxyModelPrivate; EntityCollectionOrderProxyModelPrivate *const d; }; diff -Nru kdepim-4.13.0/mailcommon/folder/foldercollection.cpp kdepim-4.13.3/mailcommon/folder/foldercollection.cpp --- kdepim-4.13.0/mailcommon/folder/foldercollection.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldercollection.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -44,311 +44,311 @@ static QMap > fcMap; QSharedPointer FolderCollection::forCollection( - const Akonadi::Collection &coll, bool writeConfig ) + const Akonadi::Collection &coll, bool writeConfig ) { - QMutexLocker lock( &mapMutex ); + QMutexLocker lock( &mapMutex ); - QSharedPointer sptr = fcMap.value( coll.id() ); + QSharedPointer sptr = fcMap.value( coll.id() ); - if ( !sptr ) { - sptr = QSharedPointer( new FolderCollection( coll, writeConfig ) ); - fcMap.insert( coll.id(), sptr ); - } else { - sptr->setCollection( coll ); - if ( !sptr->isWriteConfig() && writeConfig ) { - sptr->setWriteConfig( true ); + if ( !sptr ) { + sptr = QSharedPointer( new FolderCollection( coll, writeConfig ) ); + fcMap.insert( coll.id(), sptr ); + } else { + sptr->setCollection( coll ); + if ( !sptr->isWriteConfig() && writeConfig ) { + sptr->setWriteConfig( true ); + } } - } - return sptr; + return sptr; } FolderCollection::FolderCollection( const Akonadi::Collection & col, bool writeconfig ) - : mCollection( col ), - mPutRepliesInSameFolder( false ), - mHideInSelectionDialog( false ), - mWriteConfig( writeconfig ) -{ - Q_ASSERT( col.isValid() ); - mIdentity = KernelIf->identityManager()->defaultIdentity().uoid(); - - readConfig(); - connect( KernelIf->identityManager(), SIGNAL(changed()), - this, SLOT(slotIdentitiesChanged()) ); + : mCollection( col ), + mPutRepliesInSameFolder( false ), + mHideInSelectionDialog( false ), + mWriteConfig( writeconfig ) +{ + Q_ASSERT( col.isValid() ); + mIdentity = KernelIf->identityManager()->defaultIdentity().uoid(); + + readConfig(); + connect( KernelIf->identityManager(), SIGNAL(changed()), + this, SLOT(slotIdentitiesChanged()) ); } FolderCollection::~FolderCollection() { - //kDebug()<<" FolderCollection::~FolderCollection"<isSystemFolderCollection( mCollection ); + return Kernel::self()->isSystemFolderCollection( mCollection ); } bool FolderCollection::isStructural() const { - return mCollection.contentMimeTypes().isEmpty(); + return mCollection.contentMimeTypes().isEmpty(); } bool FolderCollection::isReadOnly() const { - return mCollection.rights() & Akonadi::Collection::ReadOnly; + return mCollection.rights() & Akonadi::Collection::ReadOnly; } bool FolderCollection::canDeleteMessages() const { - return mCollection.rights() & Akonadi::Collection::CanDeleteItem; + return mCollection.rights() & Akonadi::Collection::CanDeleteItem; } bool FolderCollection::canCreateMessages() const { - return mCollection.rights() & Akonadi::Collection::CanCreateItem; + return mCollection.rights() & Akonadi::Collection::CanCreateItem; } qint64 FolderCollection::count() const { - return mCollection.statistics().count(); + return mCollection.statistics().count(); } Akonadi::Collection::Rights FolderCollection::rights() const { - return mCollection.rights(); + return mCollection.rights(); } Akonadi::CollectionStatistics FolderCollection::statistics() const { - return mCollection.statistics(); + return mCollection.statistics(); } Akonadi::Collection FolderCollection::collection() const { - return mCollection; + return mCollection; } void FolderCollection::setCollection( const Akonadi::Collection &collection ) { - mCollection = collection; + mCollection = collection; } void FolderCollection::slotIdentitiesChanged() { - uint defaultIdentity = KernelIf->identityManager()->defaultIdentity().uoid(); - // The default identity may have changed, therefore set it again if necessary - if ( mUseDefaultIdentity ) { - mIdentity = defaultIdentity; - } - - // Fall back to the default identity if the one used currently is invalid - if ( KernelIf->identityManager()->identityForUoid( mIdentity ).isNull() ) { - mIdentity = defaultIdentity; - mUseDefaultIdentity = true; - } + uint defaultIdentity = KernelIf->identityManager()->defaultIdentity().uoid(); + // The default identity may have changed, therefore set it again if necessary + if ( mUseDefaultIdentity ) { + mIdentity = defaultIdentity; + } + + // Fall back to the default identity if the one used currently is invalid + if ( KernelIf->identityManager()->identityForUoid( mIdentity ).isNull() ) { + mIdentity = defaultIdentity; + mUseDefaultIdentity = true; + } } QString FolderCollection::configGroupName( const Akonadi::Collection &col ) { - return QString::fromLatin1( "Folder-%1" ).arg( QString::number( col.id() ) ); + return QString::fromLatin1( "Folder-%1" ).arg( QString::number( col.id() ) ); } void FolderCollection::readConfig() { - KConfigGroup configGroup( KernelIf->config(), configGroupName( mCollection ) ); - mMailingListEnabled = configGroup.readEntry( "MailingListEnabled", false ); - mMailingList.readConfig( configGroup ); - - mUseDefaultIdentity = configGroup.readEntry( "UseDefaultIdentity", true ); - uint defaultIdentity = KernelIf->identityManager()->defaultIdentity().uoid(); - mIdentity = configGroup.readEntry( "Identity", defaultIdentity ); - slotIdentitiesChanged(); - - mPutRepliesInSameFolder = configGroup.readEntry( "PutRepliesInSameFolder", false ); - mHideInSelectionDialog = configGroup.readEntry( "HideInSelectionDialog", false ); - - if (configGroup.hasKey(QLatin1String("IgnoreNewMail"))) { - if ( configGroup.readEntry( QLatin1String("IgnoreNewMail"), false ) ) { - //migrate config. - MailCommon::NewMailNotifierAttribute *newMailNotifierAttr = mCollection.attribute( Akonadi::Entity::AddIfMissing ); - newMailNotifierAttr->setIgnoreNewMail(true); - new Akonadi::CollectionModifyJob( mCollection, this ); - //TODO verify if it works; - } - configGroup.deleteEntry("IgnoreNewMail"); - } - - const QString shortcut( configGroup.readEntry( "Shortcut" ) ); - if ( !shortcut.isEmpty() ) { - KShortcut sc( shortcut ); - setShortcut( sc ); - } + KConfigGroup configGroup( KernelIf->config(), configGroupName( mCollection ) ); + mMailingListEnabled = configGroup.readEntry( "MailingListEnabled", false ); + mMailingList.readConfig( configGroup ); + + mUseDefaultIdentity = configGroup.readEntry( "UseDefaultIdentity", true ); + uint defaultIdentity = KernelIf->identityManager()->defaultIdentity().uoid(); + mIdentity = configGroup.readEntry( "Identity", defaultIdentity ); + slotIdentitiesChanged(); + + mPutRepliesInSameFolder = configGroup.readEntry( "PutRepliesInSameFolder", false ); + mHideInSelectionDialog = configGroup.readEntry( "HideInSelectionDialog", false ); + + if (configGroup.hasKey(QLatin1String("IgnoreNewMail"))) { + if ( configGroup.readEntry( QLatin1String("IgnoreNewMail"), false ) ) { + //migrate config. + MailCommon::NewMailNotifierAttribute *newMailNotifierAttr = mCollection.attribute( Akonadi::Entity::AddIfMissing ); + newMailNotifierAttr->setIgnoreNewMail(true); + new Akonadi::CollectionModifyJob( mCollection, this ); + //TODO verify if it works; + } + configGroup.deleteEntry("IgnoreNewMail"); + } + + const QString shortcut( configGroup.readEntry( "Shortcut" ) ); + if ( !shortcut.isEmpty() ) { + KShortcut sc( shortcut ); + setShortcut( sc ); + } } bool FolderCollection::isValid() const { - return mCollection.isValid(); + return mCollection.isValid(); } void FolderCollection::writeConfig() const { - KConfigGroup configGroup( KernelIf->config(), configGroupName( mCollection ) ); - - configGroup.writeEntry( "MailingListEnabled", mMailingListEnabled ); - mMailingList.writeConfig( configGroup ); + KConfigGroup configGroup( KernelIf->config(), configGroupName( mCollection ) ); - configGroup.writeEntry( "UseDefaultIdentity", mUseDefaultIdentity ); + configGroup.writeEntry( "MailingListEnabled", mMailingListEnabled ); + mMailingList.writeConfig( configGroup ); - if ( !mUseDefaultIdentity ) { - uint defaultIdentityId = -1; + configGroup.writeEntry( "UseDefaultIdentity", mUseDefaultIdentity ); - if ( mCollection.resource().contains( IMAP_RESOURCE_IDENTIFIER ) ) { - OrgKdeAkonadiImapSettingsInterface *imapSettingsInterface = - PimCommon::Util::createImapSettingsInterface( mCollection.resource() ); + if ( !mUseDefaultIdentity ) { + uint defaultIdentityId = -1; + + if ( mCollection.resource().contains( IMAP_RESOURCE_IDENTIFIER ) ) { + OrgKdeAkonadiImapSettingsInterface *imapSettingsInterface = + PimCommon::Util::createImapSettingsInterface( mCollection.resource() ); + + if ( imapSettingsInterface->isValid() ) { + QDBusReply reply = imapSettingsInterface->accountIdentity(); + if ( reply.isValid() ) { + defaultIdentityId = static_cast( reply ); + } + } + delete imapSettingsInterface; + } else { + defaultIdentityId = KernelIf->identityManager()->defaultIdentity().uoid(); + } - if ( imapSettingsInterface->isValid() ) { - QDBusReply reply = imapSettingsInterface->accountIdentity(); - if ( reply.isValid() ) { - defaultIdentityId = static_cast( reply ); + if ( mIdentity != defaultIdentityId ) { + configGroup.writeEntry( "Identity", mIdentity ); + } else { + configGroup.deleteEntry( "Identity" ); } - } - delete imapSettingsInterface; } else { - defaultIdentityId = KernelIf->identityManager()->defaultIdentity().uoid(); + configGroup.deleteEntry( "Identity" ); } - if ( mIdentity != defaultIdentityId ) { - configGroup.writeEntry( "Identity", mIdentity ); + configGroup.writeEntry( "PutRepliesInSameFolder", mPutRepliesInSameFolder ); + if (mHideInSelectionDialog) + configGroup.writeEntry( "HideInSelectionDialog", mHideInSelectionDialog ); + else + configGroup.deleteEntry("HideInSelectionDialog"); + + if ( !mShortcut.isEmpty() ) { + configGroup.writeEntry( "Shortcut", mShortcut.toString() ); } else { - configGroup.deleteEntry( "Identity" ); + configGroup.deleteEntry( "Shortcut" ); } - } else { - configGroup.deleteEntry( "Identity" ); - } - - configGroup.writeEntry( "PutRepliesInSameFolder", mPutRepliesInSameFolder ); - if (mHideInSelectionDialog) - configGroup.writeEntry( "HideInSelectionDialog", mHideInSelectionDialog ); - else - configGroup.deleteEntry("HideInSelectionDialog"); - - if ( !mShortcut.isEmpty() ) { - configGroup.writeEntry( "Shortcut", mShortcut.toString() ); - } else { - configGroup.deleteEntry( "Shortcut" ); - } } void FolderCollection::setShortcut( const KShortcut &sc ) { - if ( mShortcut != sc ) { - mShortcut = sc; - } + if ( mShortcut != sc ) { + mShortcut = sc; + } } void FolderCollection::setUseDefaultIdentity( bool useDefaultIdentity ) { - if ( mUseDefaultIdentity != useDefaultIdentity ) { - mUseDefaultIdentity = useDefaultIdentity; - if ( mUseDefaultIdentity ) { - mIdentity = KernelIf->identityManager()->defaultIdentity().uoid(); + if ( mUseDefaultIdentity != useDefaultIdentity ) { + mUseDefaultIdentity = useDefaultIdentity; + if ( mUseDefaultIdentity ) { + mIdentity = KernelIf->identityManager()->defaultIdentity().uoid(); + } + KernelIf->syncConfig(); } - KernelIf->syncConfig(); - } } void FolderCollection::setIdentity( uint identity ) { - if ( mIdentity != identity ) { - mIdentity = identity; - KernelIf->syncConfig(); - } + if ( mIdentity != identity ) { + mIdentity = identity; + KernelIf->syncConfig(); + } } uint FolderCollection::identity() const { - if ( mUseDefaultIdentity ) { - int identityId = -1; - OrgKdeAkonadiImapSettingsInterface *imapSettingsInterface = - PimCommon::Util::createImapSettingsInterface( mCollection.resource() ); - - if ( imapSettingsInterface->isValid() ) { - QDBusReply useDefault = imapSettingsInterface->useDefaultIdentity(); - if ( useDefault.isValid() && useDefault.value() ) { + if ( mUseDefaultIdentity ) { + int identityId = -1; + OrgKdeAkonadiImapSettingsInterface *imapSettingsInterface = + PimCommon::Util::createImapSettingsInterface( mCollection.resource() ); + + if ( imapSettingsInterface->isValid() ) { + QDBusReply useDefault = imapSettingsInterface->useDefaultIdentity(); + if ( useDefault.isValid() && useDefault.value() ) { + delete imapSettingsInterface; + return mIdentity; + } + + QDBusReply remoteAccountIdent = imapSettingsInterface->accountIdentity(); + if ( remoteAccountIdent.isValid() && remoteAccountIdent.value() > 0 ) { + identityId = remoteAccountIdent; + } + } delete imapSettingsInterface; - return mIdentity; - } - - QDBusReply remoteAccountIdent = imapSettingsInterface->accountIdentity(); - if ( remoteAccountIdent.isValid() && remoteAccountIdent.value() > 0 ) { - identityId = remoteAccountIdent; - } - } - delete imapSettingsInterface; - if ( identityId != -1 && - !KernelIf->identityManager()->identityForUoid( identityId ).isNull() ) { - return identityId; + if ( identityId != -1 && + !KernelIf->identityManager()->identityForUoid( identityId ).isNull() ) { + return identityId; + } } - } - return mIdentity; + return mIdentity; } QString FolderCollection::mailingListPostAddress() const { - if ( mMailingList.features() & MailingList::Post ) { - KUrl::List post = mMailingList.postUrls(); - KUrl::List::const_iterator end( post.constEnd() ); - for ( KUrl::List::const_iterator it = post.constBegin(); it != end; ++it ) { - // We check for isEmpty because before 3.3 postAddress was just an - // email@kde.org and that leaves protocol() field in the kurl class - const QString protocol = (*it).protocol(); - if ( protocol == QLatin1String( "mailto" ) || protocol.isEmpty() ) { - return (*it).path(); - } + if ( mMailingList.features() & MailingList::Post ) { + KUrl::List post = mMailingList.postUrls(); + KUrl::List::const_iterator end( post.constEnd() ); + for ( KUrl::List::const_iterator it = post.constBegin(); it != end; ++it ) { + // We check for isEmpty because before 3.3 postAddress was just an + // email@kde.org and that leaves protocol() field in the kurl class + const QString protocol = (*it).protocol(); + if ( protocol == QLatin1String( "mailto" ) || protocol.isEmpty() ) { + return (*it).path(); + } + } } - } - return QString(); + return QString(); } void FolderCollection::setMailingListEnabled( bool enabled ) { - if ( mMailingListEnabled != enabled ) { - mMailingListEnabled = enabled; - writeConfig(); - } + if ( mMailingListEnabled != enabled ) { + mMailingListEnabled = enabled; + writeConfig(); + } } void FolderCollection::setMailingList( const MailingList &mlist ) { - if ( mMailingList == mlist ) { - return; - } + if ( mMailingList == mlist ) { + return; + } - mMailingList = mlist; - writeConfig(); + mMailingList = mlist; + writeConfig(); } } diff -Nru kdepim-4.13.0/mailcommon/folder/foldercollection.h kdepim-4.13.3/mailcommon/folder/foldercollection.h --- kdepim-4.13.0/mailcommon/folder/foldercollection.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldercollection.h 2014-07-09 12:18:50.000000000 +0000 @@ -34,11 +34,11 @@ class MAILCOMMON_EXPORT FolderCollection : public QObject { - Q_OBJECT + Q_OBJECT - public: +public: static QSharedPointer forCollection( - const Akonadi::Collection &coll, bool writeConfig = true ); + const Akonadi::Collection &coll, bool writeConfig = true ); ~FolderCollection(); @@ -77,7 +77,7 @@ void setShortcut( const KShortcut & ); const KShortcut &shortcut() const { - return mShortcut; + return mShortcut; } /** @@ -87,7 +87,7 @@ void setUseDefaultIdentity( bool useDefaultIdentity ); bool useDefaultIdentity() const { - return mUseDefaultIdentity; + return mUseDefaultIdentity; } void setIdentity( uint identity ); @@ -99,14 +99,14 @@ void setMailingListEnabled( bool enabled ); bool isMailingListEnabled() const { - return mMailingListEnabled; + return mMailingListEnabled; } void setMailingList( const MailingList &mlist ); MailingList mailingList() const { - return mMailingList; + return mMailingList; } /** @@ -115,11 +115,11 @@ */ bool putRepliesInSameFolder() const { - return mPutRepliesInSameFolder; + return mPutRepliesInSameFolder; } void setPutRepliesInSameFolder( bool b ) { - mPutRepliesInSameFolder = b; + mPutRepliesInSameFolder = b; } /** @@ -127,19 +127,19 @@ */ bool hideInSelectionDialog() const { - return mHideInSelectionDialog; + return mHideInSelectionDialog; } void setHideInSelectionDialog( bool hide ) { - mHideInSelectionDialog = hide; + mHideInSelectionDialog = hide; } QString mailingListPostAddress() const; - protected slots: +protected slots: void slotIdentitiesChanged(); - private: +private: explicit FolderCollection( const Akonadi::Collection &col, bool writeconfig ); Akonadi::Collection mCollection; diff -Nru kdepim-4.13.0/mailcommon/folder/foldercollectionmonitor.cpp kdepim-4.13.3/mailcommon/folder/foldercollectionmonitor.cpp --- kdepim-4.13.0/mailcommon/folder/foldercollectionmonitor.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldercollectionmonitor.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -37,26 +37,26 @@ namespace MailCommon { FolderCollectionMonitor::FolderCollectionMonitor( Akonadi::Session *session, QObject *parent ) - : QObject( parent ) + : QObject( parent ) { - // monitor collection changes - mMonitor = new Akonadi::ChangeRecorder( this ); - mMonitor->setSession(session); - mMonitor->setCollectionMonitored( Akonadi::Collection::root() ); - mMonitor->fetchCollectionStatistics( true ); - mMonitor->collectionFetchScope().setIncludeStatistics( true ); - mMonitor->fetchCollection( true ); - mMonitor->setAllMonitored( true ); - mMonitor->setMimeTypeMonitored( KMime::Message::mimeType() ); + // monitor collection changes + mMonitor = new Akonadi::ChangeRecorder( this ); + mMonitor->setSession(session); + mMonitor->setCollectionMonitored( Akonadi::Collection::root() ); + mMonitor->fetchCollectionStatistics( true ); + mMonitor->collectionFetchScope().setIncludeStatistics( true ); + mMonitor->fetchCollection( true ); + mMonitor->setAllMonitored( true ); + mMonitor->setMimeTypeMonitored( KMime::Message::mimeType() ); #ifdef MERGE_KNODE_IN_KMAIL - mMonitor->setMimeTypeMonitored( QString::fromLatin1("message/news") ); + mMonitor->setMimeTypeMonitored( QString::fromLatin1("message/news") ); #endif - mMonitor->setResourceMonitored( "akonadi_search_resource", true ); - mMonitor->itemFetchScope().fetchPayloadPart( Akonadi::MessagePart::Envelope ); - mMonitor->itemFetchScope().setFetchModificationTime( false ); - mMonitor->itemFetchScope().setFetchRemoteIdentification( false ); - mMonitor->itemFetchScope().setFetchTags( true ); - mMonitor->itemFetchScope().fetchAttribute( true ); + mMonitor->setResourceMonitored( "akonadi_search_resource", true ); + mMonitor->itemFetchScope().fetchPayloadPart( Akonadi::MessagePart::Envelope ); + mMonitor->itemFetchScope().setFetchModificationTime( false ); + mMonitor->itemFetchScope().setFetchRemoteIdentification( false ); + mMonitor->itemFetchScope().setFetchTags( true ); + mMonitor->itemFetchScope().fetchAttribute( true ); } FolderCollectionMonitor::~FolderCollectionMonitor() @@ -65,67 +65,67 @@ Akonadi::ChangeRecorder *FolderCollectionMonitor::monitor() const { - return mMonitor; + return mMonitor; } void FolderCollectionMonitor::expireAllFolders( bool immediate, QAbstractItemModel *collectionModel ) { - if ( collectionModel ) { - expireAllCollection( collectionModel, immediate ); - } + if ( collectionModel ) { + expireAllCollection( collectionModel, immediate ); + } } void FolderCollectionMonitor::expireAllCollection( const QAbstractItemModel *model, bool immediate, const QModelIndex &parentIndex ) { - const int rowCount = model->rowCount( parentIndex ); - for ( int row = 0; row < rowCount; ++row ) { - const QModelIndex index = model->index( row, 0, parentIndex ); - const Akonadi::Collection collection = - model->data( - index, Akonadi::CollectionModel::CollectionRole ).value(); - - if ( !collection.isValid() || Util::isVirtualCollection( collection ) ) { - continue; - } - - bool mustDeleteExpirationAttribute = false; - MailCommon::ExpireCollectionAttribute *attr = - MailCommon::ExpireCollectionAttribute::expirationCollectionAttribute( - collection, mustDeleteExpirationAttribute ); - - if ( attr->isAutoExpire() ) { - MailCommon::Util::expireOldMessages( collection, immediate ); - } - - if ( model->rowCount( index ) > 0 ) { - expireAllCollection( model, immediate, index ); - } - - if ( mustDeleteExpirationAttribute ) { - delete attr; + const int rowCount = model->rowCount( parentIndex ); + for ( int row = 0; row < rowCount; ++row ) { + const QModelIndex index = model->index( row, 0, parentIndex ); + const Akonadi::Collection collection = + model->data( + index, Akonadi::CollectionModel::CollectionRole ).value(); + + if ( !collection.isValid() || Util::isVirtualCollection( collection ) ) { + continue; + } + + bool mustDeleteExpirationAttribute = false; + MailCommon::ExpireCollectionAttribute *attr = + MailCommon::ExpireCollectionAttribute::expirationCollectionAttribute( + collection, mustDeleteExpirationAttribute ); + + if ( attr->isAutoExpire() ) { + MailCommon::Util::expireOldMessages( collection, immediate ); + } + + if ( model->rowCount( index ) > 0 ) { + expireAllCollection( model, immediate, index ); + } + + if ( mustDeleteExpirationAttribute ) { + delete attr; + } } - } } void FolderCollectionMonitor::expunge( const Akonadi::Collection & col, bool sync ) { - if ( col.isValid() ) { - Akonadi::ItemDeleteJob *job = new Akonadi::ItemDeleteJob( col, this ); - connect( job, SIGNAL(result(KJob*)), this, SLOT(slotDeleteJob(KJob*)) ); - if ( sync ) { - job->exec(); + if ( col.isValid() ) { + Akonadi::ItemDeleteJob *job = new Akonadi::ItemDeleteJob( col, this ); + connect( job, SIGNAL(result(KJob*)), this, SLOT(slotDeleteJob(KJob*)) ); + if ( sync ) { + job->exec(); + } + } else { + kDebug() << " Try to expunge an invalid collection :" << col; } - } else { - kDebug() << " Try to expunge an invalid collection :" << col; - } } void FolderCollectionMonitor::slotDeleteJob( KJob *job ) { - Util::showJobErrorMessage( job ); + Util::showJobErrorMessage( job ); } } diff -Nru kdepim-4.13.0/mailcommon/folder/foldercollectionmonitor.h kdepim-4.13.3/mailcommon/folder/foldercollectionmonitor.h --- kdepim-4.13.0/mailcommon/folder/foldercollectionmonitor.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldercollectionmonitor.h 2014-07-09 12:18:50.000000000 +0000 @@ -29,18 +29,18 @@ class QAbstractItemModel; namespace Akonadi { - class ChangeRecorder; - class Collection; - class Session; +class ChangeRecorder; +class Collection; +class Session; } namespace MailCommon { class MAILCOMMON_EXPORT FolderCollectionMonitor : public QObject { - Q_OBJECT + Q_OBJECT - public: +public: explicit FolderCollectionMonitor(Akonadi::Session *session, QObject *parent = 0 ); ~FolderCollectionMonitor(); @@ -48,14 +48,14 @@ void expireAllFolders( bool immediate, QAbstractItemModel *collectionModel ); void expunge( const Akonadi::Collection &, bool sync = false ); - private slots: +private slots: void slotDeleteJob( KJob *job ); - protected: +protected: void expireAllCollection( const QAbstractItemModel *model, bool immediate, const QModelIndex &parentIndex = QModelIndex() ); - private: +private: Akonadi::ChangeRecorder *mMonitor; }; diff -Nru kdepim-4.13.0/mailcommon/folder/folderrequester.cpp kdepim-4.13.3/mailcommon/folder/folderrequester.cpp --- kdepim-4.13.0/mailcommon/folder/folderrequester.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/folderrequester.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -48,53 +48,53 @@ namespace MailCommon { FolderRequester::FolderRequester( QWidget *parent ) - : QWidget( parent ), - mMustBeReadWrite( true ), mShowOutbox( true ), mNotCreateNewFolder( false ) + : QWidget( parent ), + mMustBeReadWrite( true ), mShowOutbox( true ), mNotCreateNewFolder( false ) { - QHBoxLayout *hlay = new QHBoxLayout( this ); - hlay->setSpacing( KDialog::spacingHint() ); - hlay->setContentsMargins( 0, 0, 0, 0 ); - - mEdit = new KLineEdit( this ); - mEdit->setClickMessage( i18n( "Select Folder" ) ); - mEdit->setTrapReturnKey(true); - mEdit->setReadOnly( true ); - hlay->addWidget( mEdit ); - - QToolButton *button = new QToolButton( this ); - button->setIcon( KIcon( QLatin1String("folder") ) ); - button->setIconSize( QSize( KIconLoader::SizeSmall, KIconLoader::SizeSmall ) ); - hlay->addWidget( button ); - connect( button, SIGNAL(clicked()), this, SLOT(slotOpenDialog()) ); - - setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, - QSizePolicy::Fixed ) ); - setFocusPolicy( Qt::StrongFocus ); + QHBoxLayout *hlay = new QHBoxLayout( this ); + hlay->setSpacing( KDialog::spacingHint() ); + hlay->setContentsMargins( 0, 0, 0, 0 ); + + mEdit = new KLineEdit( this ); + mEdit->setClickMessage( i18n( "Select Folder" ) ); + mEdit->setTrapReturnKey(true); + mEdit->setReadOnly( true ); + hlay->addWidget( mEdit ); + + QToolButton *button = new QToolButton( this ); + button->setIcon( KIcon( QLatin1String("folder") ) ); + button->setIconSize( QSize( KIconLoader::SizeSmall, KIconLoader::SizeSmall ) ); + hlay->addWidget( button ); + connect( button, SIGNAL(clicked()), this, SLOT(slotOpenDialog()) ); + + setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, + QSizePolicy::Fixed ) ); + setFocusPolicy( Qt::StrongFocus ); } //----------------------------------------------------------------------------- void FolderRequester::slotOpenDialog() { - FolderSelectionDialog::SelectionFolderOptions options = FolderSelectionDialog::EnableCheck ; - options |= FolderSelectionDialog::HideVirtualFolder; - options |= FolderSelectionDialog::NotUseGlobalSettings; - if ( mNotCreateNewFolder ) { - options |= FolderSelectionDialog::NotAllowToCreateNewFolder; - } - if ( !mShowOutbox ) { - options |= FolderSelectionDialog::HideOutboxFolder; - } - - MessageViewer::AutoQPointer dlg( - new FolderSelectionDialog( this, options ) ); - - dlg->setCaption( i18n( "Select Folder" ) ); - dlg->setModal( false ); - dlg->setSelectedCollection( mCollection ); - - if ( dlg->exec() && dlg ) { - setCollection( dlg->selectedCollection(), false ); - } + FolderSelectionDialog::SelectionFolderOptions options = FolderSelectionDialog::EnableCheck ; + options |= FolderSelectionDialog::HideVirtualFolder; + options |= FolderSelectionDialog::NotUseGlobalSettings; + if ( mNotCreateNewFolder ) { + options |= FolderSelectionDialog::NotAllowToCreateNewFolder; + } + if ( !mShowOutbox ) { + options |= FolderSelectionDialog::HideOutboxFolder; + } + + MessageViewer::AutoQPointer dlg( + new FolderSelectionDialog( this, options ) ); + + dlg->setCaption( i18n( "Select Folder" ) ); + dlg->setModal( false ); + dlg->setSelectedCollection( mCollection ); + + if ( dlg->exec() && dlg ) { + setCollection( dlg->selectedCollection(), false ); + } } //----------------------------------------------------------------------------- @@ -104,92 +104,92 @@ Akonadi::Collection FolderRequester::collection() const { - return mCollection; + return mCollection; } void FolderRequester::setCollectionFullPath( const Akonadi::Collection &col ) { - if ( KernelIf->collectionModel() ) { - mEdit->setText( Util::fullCollectionPath( col ) ); - } else { - mEdit->clear(); - } + if ( KernelIf->collectionModel() ) { + mEdit->setText( Util::fullCollectionPath( col ) ); + } else { + mEdit->clear(); + } } //----------------------------------------------------------------------------- void FolderRequester::setCollection( const Akonadi::Collection &collection, bool fetchCollection ) { - mCollection = collection; - if ( mCollection.isValid() ) { - if ( fetchCollection ) { - Akonadi::CollectionFetchJob *job = - new Akonadi::CollectionFetchJob( mCollection, Akonadi::CollectionFetchJob::Base, this ); - - connect( job, SIGNAL(result(KJob*)), - this, SLOT(slotCollectionsReceived(KJob*)) ); - } else { - setCollectionFullPath( mCollection ); + mCollection = collection; + if ( mCollection.isValid() ) { + if ( fetchCollection ) { + Akonadi::CollectionFetchJob *job = + new Akonadi::CollectionFetchJob( mCollection, Akonadi::CollectionFetchJob::Base, this ); + + connect( job, SIGNAL(result(KJob*)), + this, SLOT(slotCollectionsReceived(KJob*)) ); + } else { + setCollectionFullPath( mCollection ); + } + } else if ( !mMustBeReadWrite ) { // the Local Folders root node was selected + mEdit->setText( i18n( "Local Folders" ) ); } - } else if ( !mMustBeReadWrite ) { // the Local Folders root node was selected - mEdit->setText( i18n( "Local Folders" ) ); - } - emit folderChanged( mCollection ); + emit folderChanged( mCollection ); } void FolderRequester::slotCollectionsReceived( KJob *job ) { - if ( job->error() ) { - mCollection = Akonadi::Collection(); - mEdit->setText( i18n( "Please select a folder" ) ); - return; - } - - const Akonadi::CollectionFetchJob *fetchJob = qobject_cast( job ); - const Akonadi::Collection::List collections = fetchJob->collections(); - - if ( !collections.isEmpty() ) { - const Akonadi::Collection collection = collections.first(); - // in case this is still the collection we are interested in, update - if ( collection.id() == mCollection.id() ) { - mCollection = collection; - setCollectionFullPath( collection ); - } - } else { - // the requested collection doesn't exists anymore - mCollection = Akonadi::Collection(); - mEdit->setText( i18n( "Please select a folder" ) ); - } + if ( job->error() ) { + mCollection = Akonadi::Collection(); + mEdit->setText( i18n( "Please select a folder" ) ); + return; + } + + const Akonadi::CollectionFetchJob *fetchJob = qobject_cast( job ); + const Akonadi::Collection::List collections = fetchJob->collections(); + + if ( !collections.isEmpty() ) { + const Akonadi::Collection collection = collections.first(); + // in case this is still the collection we are interested in, update + if ( collection.id() == mCollection.id() ) { + mCollection = collection; + setCollectionFullPath( collection ); + } + } else { + // the requested collection doesn't exists anymore + mCollection = Akonadi::Collection(); + mEdit->setText( i18n( "Please select a folder" ) ); + } } bool FolderRequester::hasCollection() const { - return mCollection.isValid(); + return mCollection.isValid(); } //----------------------------------------------------------------------------- void FolderRequester::keyPressEvent( QKeyEvent *e ) { - if ( e->key() == Qt::Key_Space ) { - slotOpenDialog(); - } else { - e->ignore(); - } + if ( e->key() == Qt::Key_Space ) { + slotOpenDialog(); + } else { + e->ignore(); + } } void FolderRequester::setMustBeReadWrite( bool readwrite ) { - mMustBeReadWrite = readwrite; + mMustBeReadWrite = readwrite; } void FolderRequester::setShowOutbox( bool show ) { - mShowOutbox = show; + mShowOutbox = show; } void FolderRequester::setNotAllowToCreateNewFolder( bool notCreateNewFolder ) { - mNotCreateNewFolder = notCreateNewFolder; + mNotCreateNewFolder = notCreateNewFolder; } diff -Nru kdepim-4.13.0/mailcommon/folder/folderrequester.h kdepim-4.13.3/mailcommon/folder/folderrequester.h --- kdepim-4.13.0/mailcommon/folder/folderrequester.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/folderrequester.h 2014-07-09 12:18:50.000000000 +0000 @@ -58,9 +58,9 @@ */ class MAILCOMMON_EXPORT FolderRequester: public QWidget { - Q_OBJECT + Q_OBJECT - public: +public: /** * Constructor * @param parent the parent widget @@ -95,7 +95,7 @@ void setNotAllowToCreateNewFolder( bool notCreateNewFolder ); - protected slots: +protected slots: /** * Opens the folder dialog. */ @@ -106,18 +106,18 @@ */ void slotCollectionsReceived( KJob * ); - signals: +signals: /** * Emitted when the folder changed. */ void folderChanged( const Akonadi::Collection & ); - protected: +protected: /** Capture space key to open the dialog */ void keyPressEvent( QKeyEvent *e ); void setCollectionFullPath( const Akonadi::Collection &col ); - protected: +protected: Akonadi::Collection mCollection; KLineEdit *mEdit; bool mMustBeReadWrite; diff -Nru kdepim-4.13.0/mailcommon/folder/folderselectiondialog.cpp kdepim-4.13.3/mailcommon/folder/folderselectiondialog.cpp --- kdepim-4.13.0/mailcommon/folder/folderselectiondialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/folderselectiondialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -41,11 +41,11 @@ class FolderSelectionDialog::FolderSelectionDialogPrivate { - public: +public: FolderSelectionDialogPrivate() - : folderTreeWidget( 0 ), - mNotAllowToCreateNewFolder( false ), - mUseGlobalSettings( true ) + : folderTreeWidget( 0 ), + mNotAllowToCreateNewFolder( false ), + mUseGlobalSettings( true ) { } FolderTreeWidget *folderTreeWidget; @@ -54,87 +54,87 @@ }; FolderSelectionDialog::FolderSelectionDialog( QWidget *parent, SelectionFolderOptions options ) - :KDialog( parent ), d( new FolderSelectionDialogPrivate() ) + :KDialog( parent ), d( new FolderSelectionDialogPrivate() ) { - setObjectName( QLatin1String("folder dialog") ); + setObjectName( QLatin1String("folder dialog") ); - d->mNotAllowToCreateNewFolder = ( options & FolderSelectionDialog::NotAllowToCreateNewFolder ); + d->mNotAllowToCreateNewFolder = ( options & FolderSelectionDialog::NotAllowToCreateNewFolder ); - if ( d->mNotAllowToCreateNewFolder ) { - setButtons( Ok | Cancel ); - } else { - setButtons( Ok | Cancel | User1 ); - setButtonGuiItem( - User1, - KGuiItem( i18n( "&New Subfolder..." ), QLatin1String("folder-new"), - i18n( "Create a new subfolder under the currently selected folder" ) ) ); - } - - QWidget *widget = mainWidget(); - QVBoxLayout *layout = new QVBoxLayout( widget ); - layout->setMargin( 0 ); - - FolderTreeWidget::TreeViewOptions opt = FolderTreeWidget::None; - if ( options & FolderSelectionDialog::ShowUnreadCount ) { - opt |= FolderTreeWidget::ShowUnreadCount; - } - opt |= FolderTreeWidget::UseDistinctSelectionModel; - - FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy = - FolderTreeWidgetProxyModel::None; - - if ( options & FolderSelectionDialog::HideVirtualFolder ) { - optReadableProxy |= FolderTreeWidgetProxyModel::HideVirtualFolder; - } - - optReadableProxy |= FolderTreeWidgetProxyModel::HideSpecificFolder; - - if ( options & FolderSelectionDialog::HideOutboxFolder ) { - optReadableProxy |= FolderTreeWidgetProxyModel::HideOutboxFolder; - } - - d->folderTreeWidget = new FolderTreeWidget( this, 0, opt, optReadableProxy ); - d->folderTreeWidget->readConfig(); - d->folderTreeWidget->disableContextMenuAndExtraColumn(); - d->folderTreeWidget->folderTreeWidgetProxyModel()->setEnabledCheck( ( options & EnableCheck ) ); - //Necessary otherwise we overwrite tooltip config for all application - d->folderTreeWidget->folderTreeView()->disableSaveConfig(); - d->folderTreeWidget->folderTreeView()->setTooltipsPolicy( FolderTreeWidget::DisplayNever ); + if ( d->mNotAllowToCreateNewFolder ) { + setButtons( Ok | Cancel ); + } else { + setButtons( Ok | Cancel | User1 ); + setButtonGuiItem( + User1, + KGuiItem( i18n( "&New Subfolder..." ), QLatin1String("folder-new"), + i18n( "Create a new subfolder under the currently selected folder" ) ) ); + } + + QWidget *widget = mainWidget(); + QVBoxLayout *layout = new QVBoxLayout( widget ); + layout->setMargin( 0 ); + + FolderTreeWidget::TreeViewOptions opt = FolderTreeWidget::None; + if ( options & FolderSelectionDialog::ShowUnreadCount ) { + opt |= FolderTreeWidget::ShowUnreadCount; + } + opt |= FolderTreeWidget::UseDistinctSelectionModel; + + FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy = + FolderTreeWidgetProxyModel::None; + + if ( options & FolderSelectionDialog::HideVirtualFolder ) { + optReadableProxy |= FolderTreeWidgetProxyModel::HideVirtualFolder; + } + + optReadableProxy |= FolderTreeWidgetProxyModel::HideSpecificFolder; + + if ( options & FolderSelectionDialog::HideOutboxFolder ) { + optReadableProxy |= FolderTreeWidgetProxyModel::HideOutboxFolder; + } + + d->folderTreeWidget = new FolderTreeWidget( this, 0, opt, optReadableProxy ); + d->folderTreeWidget->readConfig(); + d->folderTreeWidget->disableContextMenuAndExtraColumn(); + d->folderTreeWidget->folderTreeWidgetProxyModel()->setEnabledCheck( ( options & EnableCheck ) ); + //Necessary otherwise we overwrite tooltip config for all application + d->folderTreeWidget->folderTreeView()->disableSaveConfig(); + d->folderTreeWidget->folderTreeView()->setTooltipsPolicy( FolderTreeWidget::DisplayNever ); #ifndef QT_NO_DRAGANDDROP - d->folderTreeWidget->folderTreeView()->setDragDropMode( QAbstractItemView::NoDragDrop ); + d->folderTreeWidget->folderTreeView()->setDragDropMode( QAbstractItemView::NoDragDrop ); #endif - layout->addWidget( d->folderTreeWidget ); + layout->addWidget( d->folderTreeWidget ); + + enableButton( KDialog::Ok, false ); + if ( !d->mNotAllowToCreateNewFolder ) { + enableButton( KDialog::User1, false ); + connect( this, SIGNAL(user1Clicked()), this, SLOT(slotAddChildFolder()) ); + d->folderTreeWidget->folderTreeView()->setContextMenuPolicy(Qt::CustomContextMenu); + connect( d->folderTreeWidget->folderTreeView(), SIGNAL(customContextMenuRequested(QPoint)), + SLOT(slotFolderTreeWidgetContextMenuRequested(QPoint)) ); - enableButton( KDialog::Ok, false ); - if ( !d->mNotAllowToCreateNewFolder ) { - enableButton( KDialog::User1, false ); - connect( this, SIGNAL(user1Clicked()), this, SLOT(slotAddChildFolder()) ); - d->folderTreeWidget->folderTreeView()->setContextMenuPolicy(Qt::CustomContextMenu); - connect( d->folderTreeWidget->folderTreeView(), SIGNAL(customContextMenuRequested(QPoint)), - SLOT(slotFolderTreeWidgetContextMenuRequested(QPoint)) ); - - } - - connect( d->folderTreeWidget->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(slotSelectionChanged()) ); - connect( d->folderTreeWidget->folderTreeWidgetProxyModel(), - SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(rowsInserted(QModelIndex,int,int)) ); - - connect( d->folderTreeWidget->folderTreeView(), - SIGNAL(doubleClicked(QModelIndex)), - this, SLOT(slotDoubleClick(QModelIndex)) ); + } + + connect( d->folderTreeWidget->selectionModel(), + SIGNAL(selectionChanged(QItemSelection,QItemSelection)), + this, SLOT(slotSelectionChanged()) ); + connect( d->folderTreeWidget->folderTreeWidgetProxyModel(), + SIGNAL(rowsInserted(QModelIndex,int,int)), + this, SLOT(rowsInserted(QModelIndex,int,int)) ); + + connect( d->folderTreeWidget->folderTreeView(), + SIGNAL(doubleClicked(QModelIndex)), + this, SLOT(slotDoubleClick(QModelIndex)) ); - d->mUseGlobalSettings = !( options & NotUseGlobalSettings ); - readConfig(); + d->mUseGlobalSettings = !( options & NotUseGlobalSettings ); + readConfig(); } FolderSelectionDialog::~FolderSelectionDialog() { - writeConfig(); - delete d; + writeConfig(); + delete d; } void FolderSelectionDialog::slotFolderTreeWidgetContextMenuRequested(const QPoint& pos) @@ -149,156 +149,156 @@ void FolderSelectionDialog::slotDoubleClick(const QModelIndex& index) { - Q_UNUSED( index ); - const bool hasSelectedCollection = - ( d->folderTreeWidget->selectionModel()->selectedIndexes().count() > 0 ); - if (hasSelectedCollection) { - accept(); - } + Q_UNUSED( index ); + const bool hasSelectedCollection = + ( d->folderTreeWidget->selectionModel()->selectedIndexes().count() > 0 ); + if (hasSelectedCollection) { + accept(); + } } void FolderSelectionDialog::focusTreeView() { - d->folderTreeWidget->folderTreeView()->expandAll(); - d->folderTreeWidget->folderTreeView()->setFocus(); + d->folderTreeWidget->folderTreeView()->expandAll(); + d->folderTreeWidget->folderTreeView()->setFocus(); } void FolderSelectionDialog::showEvent( QShowEvent *event ) { - if ( !event->spontaneous () ) { - focusTreeView(); - FolderTreeView *view = d->folderTreeWidget->folderTreeView(); - view->scrollTo( view->currentIndex() ); - } - KDialog::showEvent( event ); + if ( !event->spontaneous () ) { + focusTreeView(); + FolderTreeView *view = d->folderTreeWidget->folderTreeView(); + view->scrollTo( view->currentIndex() ); + } + KDialog::showEvent( event ); } void FolderSelectionDialog::rowsInserted( const QModelIndex &, int, int ) { - d->folderTreeWidget->folderTreeView()->expandAll(); + d->folderTreeWidget->folderTreeView()->expandAll(); } bool FolderSelectionDialog::canCreateCollection( Akonadi::Collection &parentCol ) { - parentCol = selectedCollection(); - if ( !parentCol.isValid() ) { - return false; - } + parentCol = selectedCollection(); + if ( !parentCol.isValid() ) { + return false; + } - if ( ( parentCol.rights() & Akonadi::Collection::CanCreateCollection ) && - parentCol.contentMimeTypes().contains( Akonadi::Collection::mimeType() ) ) { - return true; - } - return false; + if ( ( parentCol.rights() & Akonadi::Collection::CanCreateCollection ) && + parentCol.contentMimeTypes().contains( Akonadi::Collection::mimeType() ) ) { + return true; + } + return false; } void FolderSelectionDialog::slotAddChildFolder() { - Akonadi::Collection parentCol; - if ( canCreateCollection( parentCol ) ) { - const QString name = KInputDialog::getText( - i18nc( "@title:window", "New Folder" ), - i18nc( "@label:textbox, name of a thing", "Name" ), - QString(), 0, this ); - - if ( name.isEmpty() ) { - return; - } - - Akonadi::Collection col; - col.setName( name ); - col.parentCollection().setId( parentCol.id() ); - Akonadi::CollectionCreateJob *job = new Akonadi::CollectionCreateJob( col ); - connect( job, SIGNAL(result(KJob*)), this, SLOT(collectionCreationResult(KJob*)) ); - } + Akonadi::Collection parentCol; + if ( canCreateCollection( parentCol ) ) { + const QString name = KInputDialog::getText( + i18nc( "@title:window", "New Folder" ), + i18nc( "@label:textbox, name of a thing", "Name" ), + QString(), 0, this ); + + if ( name.isEmpty() ) { + return; + } + + Akonadi::Collection col; + col.setName( name ); + col.parentCollection().setId( parentCol.id() ); + Akonadi::CollectionCreateJob *job = new Akonadi::CollectionCreateJob( col ); + connect( job, SIGNAL(result(KJob*)), this, SLOT(collectionCreationResult(KJob*)) ); + } } void FolderSelectionDialog::collectionCreationResult( KJob *job ) { - if ( job->error() ) { - KMessageBox::error( - this, - i18n( "Could not create folder: %1", job->errorString() ), - i18n( "Folder creation failed" ) ); - } + if ( job->error() ) { + KMessageBox::error( + this, + i18n( "Could not create folder: %1", job->errorString() ), + i18n( "Folder creation failed" ) ); + } } void FolderSelectionDialog::slotSelectionChanged() { - const bool enablebuttons = - ( d->folderTreeWidget->selectionModel()->selectedIndexes().count() > 0 ); - enableButton( KDialog::Ok, enablebuttons ); - - if ( !d->mNotAllowToCreateNewFolder ) { - Akonadi::Collection parent; - enableButton( KDialog::User1, canCreateCollection( parent ) ); - if ( parent.isValid() ) { - const QSharedPointer fd( FolderCollection::forCollection( parent, false ) ); - enableButton( KDialog::Ok, fd->canCreateMessages() ); + const bool enablebuttons = + ( d->folderTreeWidget->selectionModel()->selectedIndexes().count() > 0 ); + enableButton( KDialog::Ok, enablebuttons ); + + if ( !d->mNotAllowToCreateNewFolder ) { + Akonadi::Collection parent; + enableButton( KDialog::User1, canCreateCollection( parent ) ); + if ( parent.isValid() ) { + const QSharedPointer fd( FolderCollection::forCollection( parent, false ) ); + enableButton( KDialog::Ok, fd->canCreateMessages() ); + } } - } } void FolderSelectionDialog::setSelectionMode( QAbstractItemView::SelectionMode mode ) { - d->folderTreeWidget->setSelectionMode( mode ); + d->folderTreeWidget->setSelectionMode( mode ); } QAbstractItemView::SelectionMode FolderSelectionDialog::selectionMode() const { - return d->folderTreeWidget->selectionMode(); + return d->folderTreeWidget->selectionMode(); } Akonadi::Collection FolderSelectionDialog::selectedCollection() const { - return d->folderTreeWidget->selectedCollection(); + return d->folderTreeWidget->selectedCollection(); } void FolderSelectionDialog::setSelectedCollection( const Akonadi::Collection &collection ) { - d->folderTreeWidget->selectCollectionFolder( collection ); + d->folderTreeWidget->selectCollectionFolder( collection ); } Akonadi::Collection::List FolderSelectionDialog::selectedCollections() const { - return d->folderTreeWidget->selectedCollections(); + return d->folderTreeWidget->selectedCollections(); } static const char *myConfigGroupName = "FolderSelectionDialog"; void FolderSelectionDialog::readConfig() { - KConfigGroup group( KernelIf->config(), myConfigGroupName ); + KConfigGroup group( KernelIf->config(), myConfigGroupName ); - const QSize size = group.readEntry( "Size", QSize(500, 300) ); - if ( size.isValid() ) { - resize( size ); - } - if ( d->mUseGlobalSettings ) { - const Akonadi::Collection::Id id = SettingsIf->lastSelectedFolder(); - if ( id > -1 ) { - const Akonadi::Collection col = Kernel::self()->collectionFromId( id ); - d->folderTreeWidget->selectCollectionFolder( col ); + const QSize size = group.readEntry( "Size", QSize(500, 300) ); + if ( size.isValid() ) { + resize( size ); + } + if ( d->mUseGlobalSettings ) { + const Akonadi::Collection::Id id = SettingsIf->lastSelectedFolder(); + if ( id > -1 ) { + const Akonadi::Collection col = Kernel::self()->collectionFromId( id ); + d->folderTreeWidget->selectCollectionFolder( col ); + } } - } } void FolderSelectionDialog::writeConfig() { - KConfigGroup group( KernelIf->config(), myConfigGroupName ); - group.writeEntry( "Size", size() ); + KConfigGroup group( KernelIf->config(), myConfigGroupName ); + group.writeEntry( "Size", size() ); - if ( d->mUseGlobalSettings ) { - Akonadi::Collection col = selectedCollection(); - if ( col.isValid() ) { - SettingsIf->setLastSelectedFolder( col.id() ); + if ( d->mUseGlobalSettings ) { + Akonadi::Collection col = selectedCollection(); + if ( col.isValid() ) { + SettingsIf->setLastSelectedFolder( col.id() ); + } } - } } void FolderSelectionDialog::hideEvent( QHideEvent * ) { - d->folderTreeWidget->clearFilter(); + d->folderTreeWidget->clearFilter(); } } diff -Nru kdepim-4.13.0/mailcommon/folder/folderselectiondialog.h kdepim-4.13.3/mailcommon/folder/folderselectiondialog.h --- kdepim-4.13.0/mailcommon/folder/folderselectiondialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/folderselectiondialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -37,17 +37,17 @@ */ class MAILCOMMON_EXPORT FolderSelectionDialog : public KDialog { - Q_OBJECT + Q_OBJECT - public: +public: enum SelectionFolderOption { - None = 0, - EnableCheck = 1, - ShowUnreadCount = 2, - HideVirtualFolder = 4, - NotAllowToCreateNewFolder = 8, - HideOutboxFolder = 16, - NotUseGlobalSettings = 64 + None = 0, + EnableCheck = 1, + ShowUnreadCount = 2, + HideVirtualFolder = 4, + NotAllowToCreateNewFolder = 8, + HideOutboxFolder = 16, + NotUseGlobalSettings = 64 }; Q_DECLARE_FLAGS( SelectionFolderOptions, SelectionFolderOption ) @@ -62,7 +62,7 @@ Akonadi::Collection::List selectedCollections() const; - private slots: +private slots: void slotSelectionChanged(); void slotAddChildFolder(); void collectionCreationResult( KJob * ); @@ -70,7 +70,7 @@ void slotDoubleClick(const QModelIndex&); void slotFolderTreeWidgetContextMenuRequested(const QPoint&); - protected: +protected: void focusTreeView(); void readConfig(); void writeConfig(); @@ -82,7 +82,7 @@ /*reimp*/ void showEvent( QShowEvent * ); - private: +private: class FolderSelectionDialogPrivate; FolderSelectionDialogPrivate *const d; }; diff -Nru kdepim-4.13.0/mailcommon/folder/foldertreeview.cpp kdepim-4.13.3/mailcommon/folder/foldertreeview.cpp --- kdepim-4.13.0/mailcommon/folder/foldertreeview.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldertreeview.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -36,19 +36,19 @@ namespace MailCommon { FolderTreeView::FolderTreeView( QWidget *parent, bool showUnreadCount ) - : Akonadi::EntityTreeView( parent ), - mbDisableContextMenuAndExtraColumn( false ), - mbDisableSaveConfig( false ) + : Akonadi::EntityTreeView( parent ), + mbDisableContextMenuAndExtraColumn( false ), + mbDisableSaveConfig( false ) { - init(showUnreadCount); + init(showUnreadCount); } FolderTreeView::FolderTreeView( KXMLGUIClient *xmlGuiClient, QWidget *parent, bool showUnreadCount ) - : Akonadi::EntityTreeView( xmlGuiClient, parent ), - mbDisableContextMenuAndExtraColumn( false ), - mbDisableSaveConfig( false ) + : Akonadi::EntityTreeView( xmlGuiClient, parent ), + mbDisableContextMenuAndExtraColumn( false ), + mbDisableSaveConfig( false ) { - init( showUnreadCount ); + init( showUnreadCount ); } FolderTreeView::~FolderTreeView() @@ -57,580 +57,580 @@ void FolderTreeView::disableSaveConfig() { - mbDisableSaveConfig = true; + mbDisableSaveConfig = true; } void FolderTreeView::setTooltipsPolicy( FolderTreeWidget::ToolTipDisplayPolicy policy ) { - if ( mToolTipDisplayPolicy == policy ) { - return; - } - - mToolTipDisplayPolicy = policy; - emit changeTooltipsPolicy( mToolTipDisplayPolicy ); - writeConfig(); + if ( mToolTipDisplayPolicy == policy ) { + return; + } + + mToolTipDisplayPolicy = policy; + emit changeTooltipsPolicy( mToolTipDisplayPolicy ); + writeConfig(); } void FolderTreeView::disableContextMenuAndExtraColumn() { - mbDisableContextMenuAndExtraColumn = true; - const int nbColumn = header()->count(); - for ( int i = 1; i count(); + for ( int i = 1; i setContextMenuPolicy( Qt::CustomContextMenu ); - connect( header(), SIGNAL(customContextMenuRequested(QPoint)), - SLOT(slotHeaderContextMenuRequested(QPoint)) ); - - mCollectionStatisticsDelegate = new Akonadi::CollectionStatisticsDelegate( this ); - mCollectionStatisticsDelegate->setProgressAnimationEnabled( true ); - setItemDelegate(mCollectionStatisticsDelegate); - mCollectionStatisticsDelegate->setUnreadCountShown( - showUnreadCount && !header()->isSectionHidden( 1 ) ); + setIconSize( QSize( 22, 22 ) ); + setUniformRowHeights( true ); + mSortingPolicy = FolderTreeWidget::SortByCurrentColumn; + mToolTipDisplayPolicy = FolderTreeWidget::DisplayAlways; + + header()->setContextMenuPolicy( Qt::CustomContextMenu ); + connect( header(), SIGNAL(customContextMenuRequested(QPoint)), + SLOT(slotHeaderContextMenuRequested(QPoint)) ); + + mCollectionStatisticsDelegate = new Akonadi::CollectionStatisticsDelegate( this ); + mCollectionStatisticsDelegate->setProgressAnimationEnabled( true ); + setItemDelegate(mCollectionStatisticsDelegate); + mCollectionStatisticsDelegate->setUnreadCountShown( + showUnreadCount && !header()->isSectionHidden( 1 ) ); } void FolderTreeView::showStatisticAnimation( bool anim ) { - mCollectionStatisticsDelegate->setProgressAnimationEnabled( anim ); + mCollectionStatisticsDelegate->setProgressAnimationEnabled( anim ); } void FolderTreeView::writeConfig() { - if ( mbDisableSaveConfig ) { - return; - } - - KConfigGroup myGroup( KernelIf->config(), "MainFolderView" ); - myGroup.writeEntry( "IconSize", iconSize().width() ); - myGroup.writeEntry( "ToolTipDisplayPolicy", (int)mToolTipDisplayPolicy ); - myGroup.writeEntry( "SortingPolicy", (int)mSortingPolicy ); + if ( mbDisableSaveConfig ) { + return; + } + + KConfigGroup myGroup( KernelIf->config(), "MainFolderView" ); + myGroup.writeEntry( "IconSize", iconSize().width() ); + myGroup.writeEntry( "ToolTipDisplayPolicy", (int)mToolTipDisplayPolicy ); + myGroup.writeEntry( "SortingPolicy", (int)mSortingPolicy ); } void FolderTreeView::readConfig() { - KConfigGroup myGroup( KernelIf->config(), "MainFolderView" ); - int iIconSize = myGroup.readEntry( "IconSize", iconSize().width() ); - if ( iIconSize < 16 || iIconSize > 32 ) { - iIconSize = 22; - } - setIconSize( QSize( iIconSize, iIconSize ) ); - mToolTipDisplayPolicy = - static_cast( - myGroup.readEntry( "ToolTipDisplayPolicy", - static_cast( FolderTreeWidget::DisplayAlways ) ) ); - - emit changeTooltipsPolicy( mToolTipDisplayPolicy ); - - setSortingPolicy( - ( FolderTreeWidget::SortingPolicy )myGroup.readEntry( - "SortingPolicy", (int)FolderTreeWidget::SortByCurrentColumn ), false ); + KConfigGroup myGroup( KernelIf->config(), "MainFolderView" ); + int iIconSize = myGroup.readEntry( "IconSize", iconSize().width() ); + if ( iIconSize < 16 || iIconSize > 32 ) { + iIconSize = 22; + } + setIconSize( QSize( iIconSize, iIconSize ) ); + mToolTipDisplayPolicy = + static_cast( + myGroup.readEntry( "ToolTipDisplayPolicy", + static_cast( FolderTreeWidget::DisplayAlways ) ) ); + + emit changeTooltipsPolicy( mToolTipDisplayPolicy ); + + setSortingPolicy( + ( FolderTreeWidget::SortingPolicy )myGroup.readEntry( + "SortingPolicy", (int)FolderTreeWidget::SortByCurrentColumn ), false ); } void FolderTreeView::slotHeaderContextMenuRequested( const QPoint &pnt ) { - if ( mbDisableContextMenuAndExtraColumn ) { - readConfig(); - return; - } - - // the menu for the columns - KMenu menu; - QAction *act; - menu.addTitle( i18n( "View Columns" ) ); - const int nbColumn = header()->count(); - for ( int i = 1; i headerData( i, Qt::Horizontal ).toString() ); + if ( mbDisableContextMenuAndExtraColumn ) { + readConfig(); + return; + } + + // the menu for the columns + KMenu menu; + QAction *act; + menu.addTitle( i18n( "View Columns" ) ); + const int nbColumn = header()->count(); + for ( int i = 1; i headerData( i, Qt::Horizontal ).toString() ); + act->setCheckable( true ); + act->setChecked( !header()->isSectionHidden( i ) ); + act->setData( QVariant( i ) ); + connect( act, SIGNAL(triggered(bool)), + SLOT(slotHeaderContextMenuChangeHeader(bool)) ); + } + + menu.addTitle( i18n( "Icon Size" ) ); + + static int icon_sizes[] = { 16, 22, 32 /*, 48, 64, 128 */ }; + + QActionGroup *grp = new QActionGroup( &menu ); + const int nbElement( (int)( sizeof( icon_sizes ) / sizeof( int ) ) ); + for ( int i = 0; i < nbElement; ++i ) { + act = menu.addAction( QString::fromLatin1( "%1x%2" ).arg( icon_sizes[ i ] ).arg( icon_sizes[ i ] ) ); + act->setCheckable( true ); + grp->addAction( act ); + if ( iconSize().width() == icon_sizes[ i ] ) { + act->setChecked( true ); + } + act->setData( QVariant( icon_sizes[ i ] ) ); + + connect( act, SIGNAL(triggered(bool)), + SLOT(slotHeaderContextMenuChangeIconSize(bool)) ); + } + menu.addTitle( i18n( "Display Tooltips" ) ); + + grp = new QActionGroup( &menu ); + + act = menu.addAction( i18nc( "@action:inmenu Always display tooltips", "Always" ) ); act->setCheckable( true ); - act->setChecked( !header()->isSectionHidden( i ) ); - act->setData( QVariant( i ) ); - connect( act, SIGNAL(triggered(bool)), - SLOT(slotHeaderContextMenuChangeHeader(bool)) ); - } - - menu.addTitle( i18n( "Icon Size" ) ); - - static int icon_sizes[] = { 16, 22, 32 /*, 48, 64, 128 */ }; - - QActionGroup *grp = new QActionGroup( &menu ); - const int nbElement( (int)( sizeof( icon_sizes ) / sizeof( int ) ) ); - for ( int i = 0; i < nbElement; ++i ) { - act = menu.addAction( QString::fromLatin1( "%1x%2" ).arg( icon_sizes[ i ] ).arg( icon_sizes[ i ] ) ); + grp->addAction( act ); + act->setChecked( mToolTipDisplayPolicy == FolderTreeWidget::DisplayAlways ); + act->setData( QVariant( (int)FolderTreeWidget::DisplayAlways ) ); + connect( act, SIGNAL(triggered(bool)), + SLOT(slotHeaderContextMenuChangeToolTipDisplayPolicy(bool)) ); + + act = menu.addAction( i18nc( "@action:inmenu Never display tooltips.", "Never" ) ); act->setCheckable( true ); grp->addAction( act ); - if ( iconSize().width() == icon_sizes[ i ] ) { - act->setChecked( true ); - } - act->setData( QVariant( icon_sizes[ i ] ) ); + act->setChecked( mToolTipDisplayPolicy == FolderTreeWidget::DisplayNever ); + act->setData( QVariant( (int)FolderTreeWidget::DisplayNever ) ); + connect( act, SIGNAL(triggered(bool)), + SLOT(slotHeaderContextMenuChangeToolTipDisplayPolicy(bool)) ); + + menu.addTitle( i18nc( "@action:inmenu", "Sort Items" ) ); + grp = new QActionGroup( &menu ); + + act = menu.addAction( i18nc( "@action:inmenu", "Automatically, by Current Column" ) ); + act->setCheckable( true ); + grp->addAction( act ); + act->setChecked( mSortingPolicy == FolderTreeWidget::SortByCurrentColumn ); + act->setData( QVariant( (int)FolderTreeWidget::SortByCurrentColumn ) ); connect( act, SIGNAL(triggered(bool)), - SLOT(slotHeaderContextMenuChangeIconSize(bool)) ); - } - menu.addTitle( i18n( "Display Tooltips" ) ); - - grp = new QActionGroup( &menu ); - - act = menu.addAction( i18nc( "@action:inmenu Always display tooltips", "Always" ) ); - act->setCheckable( true ); - grp->addAction( act ); - act->setChecked( mToolTipDisplayPolicy == FolderTreeWidget::DisplayAlways ); - act->setData( QVariant( (int)FolderTreeWidget::DisplayAlways ) ); - connect( act, SIGNAL(triggered(bool)), - SLOT(slotHeaderContextMenuChangeToolTipDisplayPolicy(bool)) ); - - act = menu.addAction( i18nc( "@action:inmenu Never display tooltips.", "Never" ) ); - act->setCheckable( true ); - grp->addAction( act ); - act->setChecked( mToolTipDisplayPolicy == FolderTreeWidget::DisplayNever ); - act->setData( QVariant( (int)FolderTreeWidget::DisplayNever ) ); - connect( act, SIGNAL(triggered(bool)), - SLOT(slotHeaderContextMenuChangeToolTipDisplayPolicy(bool)) ); - - menu.addTitle( i18nc( "@action:inmenu", "Sort Items" ) ); - - grp = new QActionGroup( &menu ); - - act = menu.addAction( i18nc( "@action:inmenu", "Automatically, by Current Column" ) ); - act->setCheckable( true ); - grp->addAction( act ); - act->setChecked( mSortingPolicy == FolderTreeWidget::SortByCurrentColumn ); - act->setData( QVariant( (int)FolderTreeWidget::SortByCurrentColumn ) ); - connect( act, SIGNAL(triggered(bool)), - SLOT(slotHeaderContextMenuChangeSortingPolicy(bool)) ); - - act = menu.addAction( i18nc( "@action:inmenu", "Manually, by Drag And Drop" ) ); - act->setCheckable( true ); - grp->addAction( act ); - act->setChecked( mSortingPolicy == FolderTreeWidget::SortByDragAndDropKey ); - act->setData( QVariant( (int)FolderTreeWidget::SortByDragAndDropKey ) ); - connect( act, SIGNAL(triggered(bool)), - SLOT(slotHeaderContextMenuChangeSortingPolicy(bool)) ); + SLOT(slotHeaderContextMenuChangeSortingPolicy(bool)) ); - menu.exec( header()->mapToGlobal( pnt ) ); + act = menu.addAction( i18nc( "@action:inmenu", "Manually, by Drag And Drop" ) ); + act->setCheckable( true ); + grp->addAction( act ); + act->setChecked( mSortingPolicy == FolderTreeWidget::SortByDragAndDropKey ); + act->setData( QVariant( (int)FolderTreeWidget::SortByDragAndDropKey ) ); + connect( act, SIGNAL(triggered(bool)), + SLOT(slotHeaderContextMenuChangeSortingPolicy(bool)) ); + + menu.exec( header()->mapToGlobal( pnt ) ); } void FolderTreeView::slotHeaderContextMenuChangeSortingPolicy( bool ) { - QAction *act = dynamic_cast< QAction * >( sender() ); - if ( !act ) { - return; - } - - QVariant data = act->data(); - - bool ok; - int policy = data.toInt( &ok ); - if ( !ok ) { - return; - } + QAction *act = dynamic_cast< QAction * >( sender() ); + if ( !act ) { + return; + } + + QVariant data = act->data(); + + bool ok; + int policy = data.toInt( &ok ); + if ( !ok ) { + return; + } - setSortingPolicy( ( FolderTreeWidget::SortingPolicy )policy, true ); + setSortingPolicy( ( FolderTreeWidget::SortingPolicy )policy, true ); } void FolderTreeView::setSortingPolicy( FolderTreeWidget::SortingPolicy policy, bool writeInConfig ) { - if ( mSortingPolicy == policy ) { - return; - } - - mSortingPolicy = policy; - switch ( mSortingPolicy ) { - case FolderTreeWidget::SortByCurrentColumn: - header()->setClickable( true ); - header()->setSortIndicatorShown( true ); - setSortingEnabled( true ); - emit manualSortingChanged( false ); - break; - - case FolderTreeWidget::SortByDragAndDropKey: - header()->setClickable( false ); - header()->setSortIndicatorShown( false ); + if ( mSortingPolicy == policy ) { + return; + } + + mSortingPolicy = policy; + switch ( mSortingPolicy ) { + case FolderTreeWidget::SortByCurrentColumn: + header()->setClickable( true ); + header()->setSortIndicatorShown( true ); + setSortingEnabled( true ); + emit manualSortingChanged( false ); + break; + + case FolderTreeWidget::SortByDragAndDropKey: + header()->setClickable( false ); + header()->setSortIndicatorShown( false ); #if 0 - // - // Qt 4.5 introduced a nasty bug here: - // Sorting must be enabled in order to sortByColumn() to work. - // If sorting is disabled it disconnects some internal signal/slot pairs - // and calling sortByColumn() silently has no effect. - // This is a bug as we actually DON'T want automatic sorting to be - // performed by the view whenever it wants. We want to control sorting. - // - setSortingEnabled( true ); // hack for qutie bug: the param here should be false - header()->setSortIndicator( 0, Qt::AscendingOrder ); + // + // Qt 4.5 introduced a nasty bug here: + // Sorting must be enabled in order to sortByColumn() to work. + // If sorting is disabled it disconnects some internal signal/slot pairs + // and calling sortByColumn() silently has no effect. + // This is a bug as we actually DON'T want automatic sorting to be + // performed by the view whenever it wants. We want to control sorting. + // + setSortingEnabled( true ); // hack for qutie bug: the param here should be false + header()->setSortIndicator( 0, Qt::AscendingOrder ); #endif - setSortingEnabled( false ); // hack for qutie bug: this call shouldn't be here at all - emit manualSortingChanged( true ); + setSortingEnabled( false ); // hack for qutie bug: this call shouldn't be here at all + emit manualSortingChanged( true ); - break; - default: - // should never happen - break; - } - if ( writeInConfig ) { - writeConfig(); - } + break; + default: + // should never happen + break; + } + if ( writeInConfig ) { + writeConfig(); + } } void FolderTreeView::slotHeaderContextMenuChangeToolTipDisplayPolicy( bool ) { - QAction *act = dynamic_cast< QAction * >( sender() ); - if ( !act ) { - return; - } - - QVariant data = act->data(); - - bool ok; - const int id = data.toInt( &ok ); - if ( !ok ) { - return; - } - emit changeTooltipsPolicy( ( FolderTreeWidget::ToolTipDisplayPolicy )id ); + QAction *act = dynamic_cast< QAction * >( sender() ); + if ( !act ) { + return; + } + + QVariant data = act->data(); + + bool ok; + const int id = data.toInt( &ok ); + if ( !ok ) { + return; + } + emit changeTooltipsPolicy( ( FolderTreeWidget::ToolTipDisplayPolicy )id ); } void FolderTreeView::slotHeaderContextMenuChangeHeader( bool ) { - QAction *act = dynamic_cast< QAction * >( sender() ); - if ( !act ) { - return; - } - - QVariant data = act->data(); - - bool ok; - const int id = data.toInt( &ok ); - if ( !ok ) { - return; - } - - if ( id > header()->count() ) { - return; - } - - if ( id == 1 ) { - mCollectionStatisticsDelegate->setUnreadCountShown( !act->isChecked() ); - } + QAction *act = dynamic_cast< QAction * >( sender() ); + if ( !act ) { + return; + } + + QVariant data = act->data(); - setColumnHidden( id, !act->isChecked() ); + bool ok; + const int id = data.toInt( &ok ); + if ( !ok ) { + return; + } + + if ( id > header()->count() ) { + return; + } + + if ( id == 1 ) { + mCollectionStatisticsDelegate->setUnreadCountShown( !act->isChecked() ); + } + + setColumnHidden( id, !act->isChecked() ); } void FolderTreeView::slotHeaderContextMenuChangeIconSize( bool ) { - QAction *act = dynamic_cast< QAction * >( sender() ); - if ( !act ) { - return; - } - - QVariant data = act->data(); - - bool ok; - const int size = data.toInt( &ok ); - if ( !ok ) { - return; - } - - const QSize newIconSize( QSize( size, size ) ); - if ( newIconSize == iconSize() ) { - return; - } - setIconSize( newIconSize ); + QAction *act = dynamic_cast< QAction * >( sender() ); + if ( !act ) { + return; + } + + QVariant data = act->data(); - writeConfig(); + bool ok; + const int size = data.toInt( &ok ); + if ( !ok ) { + return; + } + + const QSize newIconSize( QSize( size, size ) ); + if ( newIconSize == iconSize() ) { + return; + } + setIconSize( newIconSize ); + + writeConfig(); } void FolderTreeView::setCurrentModelIndex( const QModelIndex & index ) { - if ( index.isValid() ) { - clearSelection(); - scrollTo( index ); - selectionModel()->setCurrentIndex( index, QItemSelectionModel::Rows ); - } + if ( index.isValid() ) { + clearSelection(); + scrollTo( index ); + selectionModel()->setCurrentIndex( index, QItemSelectionModel::Rows ); + } } void FolderTreeView::selectModelIndex( const QModelIndex & index ) { - if ( index.isValid() ) { - scrollTo( index ); - selectionModel()->select( - index, - QItemSelectionModel::Rows | QItemSelectionModel::Select | - QItemSelectionModel::Current | QItemSelectionModel::Clear ); - } + if ( index.isValid() ) { + scrollTo( index ); + selectionModel()->select( + index, + QItemSelectionModel::Rows | QItemSelectionModel::Select | + QItemSelectionModel::Current | QItemSelectionModel::Clear ); + } } void FolderTreeView::slotSelectFocusFolder() { - const QModelIndex index = currentIndex(); - if ( index.isValid() ) { - setCurrentIndex( index ); - } + const QModelIndex index = currentIndex(); + if ( index.isValid() ) { + setCurrentIndex( index ); + } } void FolderTreeView::slotFocusNextFolder() { - const QModelIndex nextFolder = selectNextFolder( currentIndex() ); + const QModelIndex nextFolder = selectNextFolder( currentIndex() ); - if ( nextFolder.isValid() ) { - expand( nextFolder ); - setCurrentModelIndex( nextFolder ); - } + if ( nextFolder.isValid() ) { + expand( nextFolder ); + setCurrentModelIndex( nextFolder ); + } } QModelIndex FolderTreeView::selectNextFolder( const QModelIndex & current ) { - QModelIndex below; - if ( current.isValid() ) { - model()->fetchMore( current ); - if ( model()->hasChildren( current ) ) { - expand( current ); - below = indexBelow( current ); - } else if ( current.row() < model()->rowCount( model()->parent( current ) ) -1 ) { - below = model()->index( current.row()+1, current.column(), model()->parent( current ) ); - } else { - below = indexBelow( current ); + QModelIndex below; + if ( current.isValid() ) { + model()->fetchMore( current ); + if ( model()->hasChildren( current ) ) { + expand( current ); + below = indexBelow( current ); + } else if ( current.row() < model()->rowCount( model()->parent( current ) ) -1 ) { + below = model()->index( current.row()+1, current.column(), model()->parent( current ) ); + } else { + below = indexBelow( current ); + } } - } - return below; + return below; } void FolderTreeView::slotFocusPrevFolder() { - const QModelIndex current = currentIndex(); - if ( current.isValid() ) { - QModelIndex above = indexAbove( current ); - setCurrentModelIndex( above ); - } + const QModelIndex current = currentIndex(); + if ( current.isValid() ) { + QModelIndex above = indexAbove( current ); + setCurrentModelIndex( above ); + } } void FolderTreeView::slotFocusFirstFolder() { - const QModelIndex first = moveCursor( QAbstractItemView::MoveHome, 0 ); - if ( first.isValid() ) { - setCurrentModelIndex( first ); - } + const QModelIndex first = moveCursor( QAbstractItemView::MoveHome, 0 ); + if ( first.isValid() ) { + setCurrentModelIndex( first ); + } } void FolderTreeView::slotFocusLastFolder() { - const QModelIndex last = moveCursor( QAbstractItemView::MoveEnd, 0 ); - if ( last.isValid() ) { - setCurrentModelIndex( last ); - } + const QModelIndex last = moveCursor( QAbstractItemView::MoveEnd, 0 ); + if ( last.isValid() ) { + setCurrentModelIndex( last ); + } } void FolderTreeView::selectNextUnreadFolder( bool confirm ) { - // find next unread collection starting from current position - if ( !trySelectNextUnreadFolder( currentIndex(), MailCommon::Util::ForwardSearch, confirm ) ) { - // if there is none, jump to the last collection and try again - trySelectNextUnreadFolder( model()->index( 0, 0 ), MailCommon::Util::ForwardSearch, confirm ); - } + // find next unread collection starting from current position + if ( !trySelectNextUnreadFolder( currentIndex(), MailCommon::Util::ForwardSearch, confirm ) ) { + // if there is none, jump to the last collection and try again + trySelectNextUnreadFolder( model()->index( 0, 0 ), MailCommon::Util::ForwardSearch, confirm ); + } } // helper method to find last item in the model tree static QModelIndex lastChildOf( QAbstractItemModel *model, const QModelIndex ¤t ) { - if ( model->rowCount( current ) == 0 ) { - return current; - } + if ( model->rowCount( current ) == 0 ) { + return current; + } - return lastChildOf( model, model->index( model->rowCount( current ) - 1, 0, current ) ); + return lastChildOf( model, model->index( model->rowCount( current ) - 1, 0, current ) ); } void FolderTreeView::selectPrevUnreadFolder( bool confirm ) { - // find next unread collection starting from current position - if ( !trySelectNextUnreadFolder( currentIndex(), MailCommon::Util::BackwardSearch, confirm ) ) { - // if there is none, jump to top and try again - const QModelIndex index = lastChildOf( model(), QModelIndex() ); - trySelectNextUnreadFolder( index, MailCommon::Util::BackwardSearch, confirm ); - } + // find next unread collection starting from current position + if ( !trySelectNextUnreadFolder( currentIndex(), MailCommon::Util::BackwardSearch, confirm ) ) { + // if there is none, jump to top and try again + const QModelIndex index = lastChildOf( model(), QModelIndex() ); + trySelectNextUnreadFolder( index, MailCommon::Util::BackwardSearch, confirm ); + } } bool FolderTreeView::trySelectNextUnreadFolder( const QModelIndex ¤t, MailCommon::Util::SearchDirection direction, bool confirm ) { - QModelIndex index = current; - while ( true ) { - index = MailCommon::Util::nextUnreadCollection( model(), index, direction ); + QModelIndex index = current; + while ( true ) { + index = MailCommon::Util::nextUnreadCollection( model(), index, direction ); - if ( !index.isValid() ) { - return false; - } + if ( !index.isValid() ) { + return false; + } - const Akonadi::Collection collection = - index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection == Kernel::self()->trashCollectionFolder() || - collection == Kernel::self()->outboxCollectionFolder() ) - continue; + const Akonadi::Collection collection = + index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); + if ( collection == Kernel::self()->trashCollectionFolder() || + collection == Kernel::self()->outboxCollectionFolder() ) + continue; - if ( ignoreUnreadFolder( collection, confirm ) ) { - continue; - } + if ( ignoreUnreadFolder( collection, confirm ) ) { + continue; + } - if ( allowedToEnterFolder( collection, confirm ) ) { - expand( index ); - setCurrentIndex( index ); - selectModelIndex( index ); - return true; - } else { - return false; + if ( allowedToEnterFolder( collection, confirm ) ) { + expand( index ); + setCurrentIndex( index ); + selectModelIndex( index ); + return true; + } else { + return false; + } } - } - return false; + return false; } bool FolderTreeView::ignoreUnreadFolder( const Akonadi::Collection &collection, bool confirm ) const { - if ( !confirm ) { - return false; - } + if ( !confirm ) { + return false; + } - // Skip drafts, sent mail and templates as well, when reading mail with the - // space bar - but not when changing into the next folder with unread mail - // via ctrl+ or ctrl- so we do this only if (confirm == true), which means - // we are doing readOn. - - return ( collection == Kernel::self()->draftsCollectionFolder() || - collection == Kernel::self()->templatesCollectionFolder() || - collection == Kernel::self()->sentCollectionFolder() ); + // Skip drafts, sent mail and templates as well, when reading mail with the + // space bar - but not when changing into the next folder with unread mail + // via ctrl+ or ctrl- so we do this only if (confirm == true), which means + // we are doing readOn. + + return ( collection == Kernel::self()->draftsCollectionFolder() || + collection == Kernel::self()->templatesCollectionFolder() || + collection == Kernel::self()->sentCollectionFolder() ); } bool FolderTreeView::allowedToEnterFolder( const Akonadi::Collection &collection, bool confirm ) const { - if ( !confirm ) { - return true; - } - - // warn user that going to next folder - but keep track of - // whether he wishes to be notified again in "AskNextFolder" - // parameter (kept in the config file for kmail) - const int result = - KMessageBox::questionYesNo( - const_cast( this ), - i18n( "Go to the next unread message in folder %1?", collection.name() ), - i18n( "Go to Next Unread Message" ), - KGuiItem( i18n( "Go To" ) ), - KGuiItem( i18n( "Do Not Go To" ) ), // defaults - QLatin1String(":kmail_AskNextFolder"), 0 ); + if ( !confirm ) { + return true; + } + + // warn user that going to next folder - but keep track of + // whether he wishes to be notified again in "AskNextFolder" + // parameter (kept in the config file for kmail) + const int result = + KMessageBox::questionYesNo( + const_cast( this ), + i18n( "Go to the next unread message in folder %1?", collection.name() ), + i18n( "Go to Next Unread Message" ), + KGuiItem( i18n( "Go To" ) ), + KGuiItem( i18n( "Do Not Go To" ) ), // defaults + QLatin1String(":kmail_AskNextFolder"), 0 ); - return ( result == KMessageBox::Yes ); + return ( result == KMessageBox::Yes ); } bool FolderTreeView::isUnreadFolder( const QModelIndex ¤t, QModelIndex &index, FolderTreeView::Move move, bool confirm ) { - if ( current.isValid() ) { + if ( current.isValid() ) { - if ( move == FolderTreeView::Next ) { - index = selectNextFolder( current ); - } else if ( move == FolderTreeView::Previous ) { - index = indexAbove( current ); - } - - if ( index.isValid() ) { - const Akonadi::Collection collection = - index.model()->data( - current, Akonadi::EntityTreeModel::CollectionRole ).value(); - - if ( collection.isValid() ) { - if ( collection.statistics().unreadCount() > 0 ) { - if ( !confirm ) { - selectModelIndex( current ); - return true; - } else { - // Skip drafts, sent mail and templates as well, when reading mail with the - // space bar - but not when changing into the next folder with unread mail - // via ctrl+ or ctrl- so we do this only if (confirm == true), which means - // we are doing readOn. - - if ( collection == Kernel::self()->draftsCollectionFolder() || - collection == Kernel::self()->templatesCollectionFolder() || - collection == Kernel::self()->sentCollectionFolder() ) { - return false; - } + if ( move == FolderTreeView::Next ) { + index = selectNextFolder( current ); + } else if ( move == FolderTreeView::Previous ) { + index = indexAbove( current ); + } - // warn user that going to next folder - but keep track of - // whether he wishes to be notified again in "AskNextFolder" - // parameter (kept in the config file for kmail) - if ( KMessageBox::questionYesNo( - this, - i18n( "Go to the next unread message in folder %1?", - collection.name() ), - i18n( "Go to Next Unread Message" ), - KGuiItem( i18n( "Go To" ) ), - KGuiItem( i18n( "Do Not Go To" ) ), // defaults - QLatin1String(":kmail_AskNextFolder"), - 0 ) == KMessageBox::No ) { - return true; // assume selected (do not continue looping) + if ( index.isValid() ) { + const Akonadi::Collection collection = + index.model()->data( + current, Akonadi::EntityTreeModel::CollectionRole ).value(); + + if ( collection.isValid() ) { + if ( collection.statistics().unreadCount() > 0 ) { + if ( !confirm ) { + selectModelIndex( current ); + return true; + } else { + // Skip drafts, sent mail and templates as well, when reading mail with the + // space bar - but not when changing into the next folder with unread mail + // via ctrl+ or ctrl- so we do this only if (confirm == true), which means + // we are doing readOn. + + if ( collection == Kernel::self()->draftsCollectionFolder() || + collection == Kernel::self()->templatesCollectionFolder() || + collection == Kernel::self()->sentCollectionFolder() ) { + return false; + } + + // warn user that going to next folder - but keep track of + // whether he wishes to be notified again in "AskNextFolder" + // parameter (kept in the config file for kmail) + if ( KMessageBox::questionYesNo( + this, + i18n( "Go to the next unread message in folder %1?", + collection.name() ), + i18n( "Go to Next Unread Message" ), + KGuiItem( i18n( "Go To" ) ), + KGuiItem( i18n( "Do Not Go To" ) ), // defaults + QLatin1String(":kmail_AskNextFolder"), + 0 ) == KMessageBox::No ) { + return true; // assume selected (do not continue looping) + } + + selectModelIndex( current ); + return true; + } + } } - - selectModelIndex( current ); - return true; - } } - } } - } - return false; + return false; } Akonadi::Collection FolderTreeView::currentFolder() const { - const QModelIndex current = currentIndex(); - if ( current.isValid() ) { - const Akonadi::Collection collection = - current.model()->data( - current, - Akonadi::EntityTreeModel::CollectionRole ).value(); - return collection; - } - return Akonadi::Collection(); + const QModelIndex current = currentIndex(); + if ( current.isValid() ) { + const Akonadi::Collection collection = + current.model()->data( + current, + Akonadi::EntityTreeModel::CollectionRole ).value(); + return collection; + } + return Akonadi::Collection(); } void FolderTreeView::mousePressEvent( QMouseEvent *e ) { - const bool buttonPressedIsMiddle = ( e->button() == Qt::MidButton ); - emit prefereCreateNewTab( buttonPressedIsMiddle ); - EntityTreeView::mousePressEvent( e ); + const bool buttonPressedIsMiddle = ( e->button() == Qt::MidButton ); + emit prefereCreateNewTab( buttonPressedIsMiddle ); + EntityTreeView::mousePressEvent( e ); } void FolderTreeView::restoreHeaderState( const QByteArray &data ) { - if (data.isEmpty()) { - const int nbColumn = header()->count(); - for ( int i = 1; i count(); + for ( int i = 1; i restoreState( data ); - mCollectionStatisticsDelegate->setUnreadCountShown( header()->isSectionHidden( 1 ) ); + else + header()->restoreState( data ); + mCollectionStatisticsDelegate->setUnreadCountShown( header()->isSectionHidden( 1 ) ); } void FolderTreeView::updatePalette() { - mCollectionStatisticsDelegate->updatePalette(); + mCollectionStatisticsDelegate->updatePalette(); } void FolderTreeView::keyboardSearch( const QString & ) { - // Disable keyboardSearch: it interfers with filtering in the - // FolderSelectionDialog. We don't want it in KMail main window - // either because KMail has one-letter keyboard shortcuts. + // Disable keyboardSearch: it interfers with filtering in the + // FolderSelectionDialog. We don't want it in KMail main window + // either because KMail has one-letter keyboard shortcuts. } } diff -Nru kdepim-4.13.0/mailcommon/folder/foldertreeview.h kdepim-4.13.3/mailcommon/folder/foldertreeview.h --- kdepim-4.13.0/mailcommon/folder/foldertreeview.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldertreeview.h 2014-07-09 12:18:50.000000000 +0000 @@ -29,7 +29,7 @@ class QMouseEvent; namespace Akonadi { - class CollectionStatisticsDelegate; +class CollectionStatisticsDelegate; } namespace MailCommon { @@ -40,9 +40,9 @@ */ class MAILCOMMON_EXPORT FolderTreeView : public Akonadi::EntityTreeView { - Q_OBJECT + Q_OBJECT - public: +public: explicit FolderTreeView( QWidget *parent = 0, bool showUnreadCount = true ); explicit FolderTreeView( KXMLGUIClient *xmlGuiClient, QWidget *parent = 0, @@ -69,10 +69,10 @@ void updatePalette(); void keyboardSearch( const QString & ); // reimp - protected: +protected: enum Move { - Next = 0, - Previous = 1 + Next = 0, + Previous = 1 }; void init( bool showUnreadCount ); @@ -88,26 +88,26 @@ virtual void mousePressEvent( QMouseEvent *e ); - public slots: +public slots: void slotFocusNextFolder(); void slotFocusPrevFolder(); void slotSelectFocusFolder(); void slotFocusFirstFolder(); void slotFocusLastFolder(); - protected slots: +protected slots: void slotHeaderContextMenuRequested( const QPoint & ); void slotHeaderContextMenuChangeIconSize( bool ); void slotHeaderContextMenuChangeHeader( bool ); void slotHeaderContextMenuChangeToolTipDisplayPolicy( bool ); void slotHeaderContextMenuChangeSortingPolicy( bool ); - signals: +signals: void changeTooltipsPolicy( FolderTreeWidget::ToolTipDisplayPolicy ); void manualSortingChanged( bool actif ); void prefereCreateNewTab( bool ); - private: +private: bool ignoreUnreadFolder( const Akonadi::Collection &, bool ) const; bool allowedToEnterFolder( const Akonadi::Collection &, bool ) const; bool trySelectNextUnreadFolder( const QModelIndex &, MailCommon::Util::SearchDirection, bool ); diff -Nru kdepim-4.13.0/mailcommon/folder/foldertreewidget.cpp kdepim-4.13.3/mailcommon/folder/foldertreewidget.cpp --- kdepim-4.13.0/mailcommon/folder/foldertreewidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldertreewidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -53,17 +53,17 @@ class FolderTreeWidget::FolderTreeWidgetPrivate { - public: +public: FolderTreeWidgetPrivate() - : filterModel( 0 ), - folderTreeView( 0 ), - quotaModel( 0 ), - readableproxy( 0 ), - entityOrderProxy( 0 ), - filterFolderLineEdit( 0 ), - saver( 0 ), - label( 0 ), - dontKeyFilter( false ) + : filterModel( 0 ), + folderTreeView( 0 ), + quotaModel( 0 ), + readableproxy( 0 ), + entityOrderProxy( 0 ), + filterFolderLineEdit( 0 ), + saver( 0 ), + label( 0 ), + dontKeyFilter( false ) { } @@ -83,355 +83,355 @@ }; FolderTreeWidget::FolderTreeWidget( - QWidget *parent, KXMLGUIClient *xmlGuiClient, - FolderTreeWidget::TreeViewOptions options, - FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy ) - : QWidget( parent ), d( new FolderTreeWidgetPrivate() ) -{ - Akonadi::AttributeFactory::registerAttribute(); - - d->folderTreeView = new FolderTreeView( xmlGuiClient, this, options & ShowUnreadCount ); - d->folderTreeView->showStatisticAnimation( options & ShowCollectionStatisticAnimation ); - - connect( d->folderTreeView, SIGNAL(manualSortingChanged(bool)), - this, SLOT(slotManualSortingChanged(bool)) ); - - QVBoxLayout *lay = new QVBoxLayout( this ); - lay->setMargin( 0 ); - - d->label = new QLabel( i18n( "You can start typing to filter the list of folders." ), this ); - lay->addWidget( d->label ); - - d->filterFolderLineEdit = new KLineEdit( this ); - d->filterFolderLineEdit->setClearButtonShown( true ); - d->filterFolderLineEdit->setClickMessage( - i18nc( "@info/plain Displayed grayed-out inside the textbox, verb to search", - "Search" ) ); - lay->addWidget( d->filterFolderLineEdit ); - - // ... with statistics... - d->quotaModel = new Akonadi::QuotaColorProxyModel( this ); - d->quotaModel->setSourceModel( KernelIf->collectionModel() ); - - d->filterModel = new KPIM::StatisticsProxyModel( this ); - d->filterModel->setSourceModel( d->quotaModel ); - - d->readableproxy = new FolderTreeWidgetProxyModel( this, optReadableProxy ); - d->readableproxy->setSourceModel( d->filterModel ); - d->readableproxy->addContentMimeTypeInclusionFilter( KMime::Message::mimeType() ); - - connect( d->folderTreeView, SIGNAL(changeTooltipsPolicy(FolderTreeWidget::ToolTipDisplayPolicy)), - this, SLOT(slotChangeTooltipsPolicy(FolderTreeWidget::ToolTipDisplayPolicy)) ); - - d->folderTreeView->setSelectionMode( QAbstractItemView::SingleSelection ); - d->folderTreeView->setEditTriggers( QAbstractItemView::NoEditTriggers ); - d->folderTreeView->installEventFilter( this ); - - //Order proxy - d->entityOrderProxy = new EntityCollectionOrderProxyModel( this ); - d->entityOrderProxy->setSourceModel( d->readableproxy ); - KConfigGroup grp( KernelIf->config(), "CollectionTreeOrder" ); - d->entityOrderProxy->setOrderConfig( grp ); - d->folderTreeView->setModel( d->entityOrderProxy ); - - if ( options & UseDistinctSelectionModel ) { - d->folderTreeView->setSelectionModel( new QItemSelectionModel( d->entityOrderProxy, this ) ); - } - - lay->addWidget( d->folderTreeView ); - - d->dontKeyFilter = ( options & DontKeyFilter ); - - if ( ( options & UseLineEditForFiltering ) ) { - connect( d->filterFolderLineEdit, SIGNAL(textChanged(QString)), - this, SLOT(slotFilterFixedString(QString)) ); - d->label->hide(); - } else { - d->filterFolderLineEdit->hide(); - } - - connect( KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()), - this, SLOT(slotGeneralFontChanged())); - connect( KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), - this, SLOT(slotGeneralPaletteChanged())); + QWidget *parent, KXMLGUIClient *xmlGuiClient, + FolderTreeWidget::TreeViewOptions options, + FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy ) + : QWidget( parent ), d( new FolderTreeWidgetPrivate() ) +{ + Akonadi::AttributeFactory::registerAttribute(); + + d->folderTreeView = new FolderTreeView( xmlGuiClient, this, options & ShowUnreadCount ); + d->folderTreeView->showStatisticAnimation( options & ShowCollectionStatisticAnimation ); + + connect( d->folderTreeView, SIGNAL(manualSortingChanged(bool)), + this, SLOT(slotManualSortingChanged(bool)) ); + + QVBoxLayout *lay = new QVBoxLayout( this ); + lay->setMargin( 0 ); + + d->label = new QLabel( i18n( "You can start typing to filter the list of folders." ), this ); + lay->addWidget( d->label ); + + d->filterFolderLineEdit = new KLineEdit( this ); + d->filterFolderLineEdit->setClearButtonShown( true ); + d->filterFolderLineEdit->setClickMessage( + i18nc( "@info/plain Displayed grayed-out inside the textbox, verb to search", + "Search" ) ); + lay->addWidget( d->filterFolderLineEdit ); + + // ... with statistics... + d->quotaModel = new Akonadi::QuotaColorProxyModel( this ); + d->quotaModel->setSourceModel( KernelIf->collectionModel() ); + + d->filterModel = new KPIM::StatisticsProxyModel( this ); + d->filterModel->setSourceModel( d->quotaModel ); + + d->readableproxy = new FolderTreeWidgetProxyModel( this, optReadableProxy ); + d->readableproxy->setSourceModel( d->filterModel ); + d->readableproxy->addContentMimeTypeInclusionFilter( KMime::Message::mimeType() ); + + connect( d->folderTreeView, SIGNAL(changeTooltipsPolicy(FolderTreeWidget::ToolTipDisplayPolicy)), + this, SLOT(slotChangeTooltipsPolicy(FolderTreeWidget::ToolTipDisplayPolicy)) ); + + d->folderTreeView->setSelectionMode( QAbstractItemView::SingleSelection ); + d->folderTreeView->setEditTriggers( QAbstractItemView::NoEditTriggers ); + d->folderTreeView->installEventFilter( this ); + + //Order proxy + d->entityOrderProxy = new EntityCollectionOrderProxyModel( this ); + d->entityOrderProxy->setSourceModel( d->readableproxy ); + KConfigGroup grp( KernelIf->config(), "CollectionTreeOrder" ); + d->entityOrderProxy->setOrderConfig( grp ); + d->folderTreeView->setModel( d->entityOrderProxy ); + + if ( options & UseDistinctSelectionModel ) { + d->folderTreeView->setSelectionModel( new QItemSelectionModel( d->entityOrderProxy, this ) ); + } + + lay->addWidget( d->folderTreeView ); + + d->dontKeyFilter = ( options & DontKeyFilter ); + + if ( ( options & UseLineEditForFiltering ) ) { + connect( d->filterFolderLineEdit, SIGNAL(textChanged(QString)), + this, SLOT(slotFilterFixedString(QString)) ); + d->label->hide(); + } else { + d->filterFolderLineEdit->hide(); + } + + connect( KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()), + this, SLOT(slotGeneralFontChanged())); + connect( KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), + this, SLOT(slotGeneralPaletteChanged())); } FolderTreeWidget::~FolderTreeWidget() { - delete d; + delete d; } void FolderTreeWidget::slotFilterFixedString( const QString &text ) { - delete d->saver; - if ( d->oldFilterStr.isEmpty() ) { - //Save it. - Akonadi::ETMViewStateSaver saver; - saver.setView( folderTreeView() ); - d->expandedItems = saver.expansionKeys(); - d->currentItem = saver.currentIndexKey(); - } else if ( text.isEmpty() ) { - d->saver = new Akonadi::ETMViewStateSaver; - d->saver->setView( folderTreeView() ); - QString currentIndex = d->saver->currentIndexKey(); - if ( d->saver->selectionKeys().isEmpty() ) { - currentIndex = d->currentItem; - } else if ( !currentIndex.isEmpty() ) { - d->expandedItems << currentIndex; - } - d->saver->restoreExpanded( d->expandedItems ); - d->saver->restoreCurrentItem( currentIndex ); - } else { - d->folderTreeView->expandAll(); - } - d->oldFilterStr = text; - d->readableproxy->setFilterFolder( text ); + delete d->saver; + if ( d->oldFilterStr.isEmpty() ) { + //Save it. + Akonadi::ETMViewStateSaver saver; + saver.setView( folderTreeView() ); + d->expandedItems = saver.expansionKeys(); + d->currentItem = saver.currentIndexKey(); + } else if ( text.isEmpty() ) { + d->saver = new Akonadi::ETMViewStateSaver; + d->saver->setView( folderTreeView() ); + QString currentIndex = d->saver->currentIndexKey(); + if ( d->saver->selectionKeys().isEmpty() ) { + currentIndex = d->currentItem; + } else if ( !currentIndex.isEmpty() ) { + d->expandedItems << currentIndex; + } + d->saver->restoreExpanded( d->expandedItems ); + d->saver->restoreCurrentItem( currentIndex ); + } else { + d->folderTreeView->expandAll(); + } + d->oldFilterStr = text; + d->readableproxy->setFilterFolder( text ); } void FolderTreeWidget::disableContextMenuAndExtraColumn() { - d->folderTreeView->disableContextMenuAndExtraColumn(); + d->folderTreeView->disableContextMenuAndExtraColumn(); } void FolderTreeWidget::selectCollectionFolder( const Akonadi::Collection &collection ) { - const QModelIndex index = - Akonadi::EntityTreeModel::modelIndexForCollection( d->folderTreeView->model(), collection ); + const QModelIndex index = + Akonadi::EntityTreeModel::modelIndexForCollection( d->folderTreeView->model(), collection ); - d->folderTreeView->setCurrentIndex( index ); - d->folderTreeView->setExpanded( index, true ); - d->folderTreeView->scrollTo( index ); + d->folderTreeView->setCurrentIndex( index ); + d->folderTreeView->setExpanded( index, true ); + d->folderTreeView->scrollTo( index ); } void FolderTreeWidget::setSelectionMode( QAbstractItemView::SelectionMode mode ) { - d->folderTreeView->setSelectionMode( mode ); + d->folderTreeView->setSelectionMode( mode ); } QAbstractItemView::SelectionMode FolderTreeWidget::selectionMode() const { - return d->folderTreeView->selectionMode(); + return d->folderTreeView->selectionMode(); } QItemSelectionModel * FolderTreeWidget::selectionModel () const { - return d->folderTreeView->selectionModel(); + return d->folderTreeView->selectionModel(); } QModelIndex FolderTreeWidget::currentIndex() const { - return d->folderTreeView->currentIndex(); + return d->folderTreeView->currentIndex(); } Akonadi::Collection FolderTreeWidget::selectedCollection() const { - if ( d->folderTreeView->selectionMode() == QAbstractItemView::SingleSelection ) { - Akonadi::Collection::List lstCollection = selectedCollections(); - if ( lstCollection.isEmpty() ) { - return Akonadi::Collection(); - } else { - return lstCollection.at( 0 ); + if ( d->folderTreeView->selectionMode() == QAbstractItemView::SingleSelection ) { + Akonadi::Collection::List lstCollection = selectedCollections(); + if ( lstCollection.isEmpty() ) { + return Akonadi::Collection(); + } else { + return lstCollection.at( 0 ); + } } - } - return Akonadi::Collection(); + return Akonadi::Collection(); } Akonadi::Collection::List FolderTreeWidget::selectedCollections() const { - Akonadi::Collection::List collections; - const QItemSelectionModel *selectionModel = d->folderTreeView->selectionModel(); - const QModelIndexList selectedIndexes = selectionModel->selectedIndexes(); - foreach ( const QModelIndex &index, selectedIndexes ) { - if ( index.isValid() ) { - const Akonadi::Collection collection = - index.model()->data( - index, Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() ) { - collections.append( collection ); - } + Akonadi::Collection::List collections; + const QItemSelectionModel *selectionModel = d->folderTreeView->selectionModel(); + const QModelIndexList selectedIndexes = selectionModel->selectedIndexes(); + foreach ( const QModelIndex &index, selectedIndexes ) { + if ( index.isValid() ) { + const Akonadi::Collection collection = + index.model()->data( + index, Akonadi::EntityTreeModel::CollectionRole ).value(); + if ( collection.isValid() ) { + collections.append( collection ); + } + } } - } - return collections; + return collections; } FolderTreeView *FolderTreeWidget::folderTreeView() const { - return d->folderTreeView; + return d->folderTreeView; } void FolderTreeWidget::slotGeneralFontChanged() { - // Custom/System font support - if ( MessageCore::GlobalSettings::self()->useDefaultFonts() ) { - setFont( KGlobalSettings::generalFont() ); - } + // Custom/System font support + if ( MessageCore::GlobalSettings::self()->useDefaultFonts() ) { + setFont( KGlobalSettings::generalFont() ); + } } void FolderTreeWidget::slotGeneralPaletteChanged() { - d->readableproxy->updatePalette(); - d->folderTreeView->updatePalette(); + d->readableproxy->updatePalette(); + d->folderTreeView->updatePalette(); } void FolderTreeWidget::readConfig() { - // Custom/System font support - if ( !MessageCore::GlobalSettings::self()->useDefaultFonts() ) { - KConfigGroup fontConfig( KernelIf->config(), "Fonts" ); - setFont( fontConfig.readEntry( "folder-font", KGlobalSettings::generalFont() ) ); - } else { - setFont( KGlobalSettings::generalFont() ); - } - - d->folderTreeView->readConfig(); - d->folderTreeView->setDropActionMenuEnabled( SettingsIf->showPopupAfterDnD() ); - d->readableproxy->readConfig(); - - KConfigGroup readerConfig( KernelIf->config(), "AccountOrder" ); - const QStringList listOrder = readerConfig.readEntry( "order", QStringList() ); - d->entityOrderProxy->setTopLevelOrder(listOrder); + // Custom/System font support + if ( !MessageCore::GlobalSettings::self()->useDefaultFonts() ) { + KConfigGroup fontConfig( KernelIf->config(), "Fonts" ); + setFont( fontConfig.readEntry( "folder-font", KGlobalSettings::generalFont() ) ); + } else { + setFont( KGlobalSettings::generalFont() ); + } + + d->folderTreeView->readConfig(); + d->folderTreeView->setDropActionMenuEnabled( SettingsIf->showPopupAfterDnD() ); + d->readableproxy->readConfig(); + + KConfigGroup readerConfig( KernelIf->config(), "AccountOrder" ); + const QStringList listOrder = readerConfig.readEntry( "order", QStringList() ); + d->entityOrderProxy->setTopLevelOrder(listOrder); - readQuotaConfig(); + readQuotaConfig(); } void FolderTreeWidget::restoreHeaderState( const QByteArray &data ) { - d->folderTreeView->restoreHeaderState( data ); + d->folderTreeView->restoreHeaderState( data ); } void FolderTreeWidget::slotChangeTooltipsPolicy( FolderTreeWidget::ToolTipDisplayPolicy policy ) { - changeToolTipsPolicyConfig( policy ); + changeToolTipsPolicyConfig( policy ); } void FolderTreeWidget::changeToolTipsPolicyConfig( ToolTipDisplayPolicy policy ) { - switch( policy ){ - case DisplayAlways: - case DisplayWhenTextElided: //Need to implement in the future - d->filterModel->setToolTipEnabled( true ); - break; - case DisplayNever: - d->filterModel->setToolTipEnabled( false ); - } - d->folderTreeView->setTooltipsPolicy( policy ); + switch( policy ){ + case DisplayAlways: + case DisplayWhenTextElided: //Need to implement in the future + d->filterModel->setToolTipEnabled( true ); + break; + case DisplayNever: + d->filterModel->setToolTipEnabled( false ); + } + d->folderTreeView->setTooltipsPolicy( policy ); } void FolderTreeWidget::quotaWarningParameters( const QColor &color, qreal threshold ) { - d->quotaModel->setWarningThreshold( threshold ); - d->quotaModel->setWarningColor( color ); + d->quotaModel->setWarningThreshold( threshold ); + d->quotaModel->setWarningColor( color ); } void FolderTreeWidget::readQuotaConfig() { - QColor quotaColor = MailCommon::Util::defaultQuotaColor(); - qreal threshold = 100; - if ( !MessageCore::GlobalSettings::self()->useDefaultColors() ) { - KConfigGroup readerConfig( KernelIf->config(), "Reader" ); - quotaColor = readerConfig.readEntry( "CloseToQuotaColor", quotaColor ); - } - threshold = SettingsIf->closeToQuotaThreshold(); - quotaWarningParameters( quotaColor, threshold ); + QColor quotaColor = MailCommon::Util::defaultQuotaColor(); + qreal threshold = 100; + if ( !MessageCore::GlobalSettings::self()->useDefaultColors() ) { + KConfigGroup readerConfig( KernelIf->config(), "Reader" ); + quotaColor = readerConfig.readEntry( "CloseToQuotaColor", quotaColor ); + } + threshold = SettingsIf->closeToQuotaThreshold(); + quotaWarningParameters( quotaColor, threshold ); } KPIM::StatisticsProxyModel *FolderTreeWidget::statisticsProxyModel() const { - return d->filterModel; + return d->filterModel; } FolderTreeWidgetProxyModel *FolderTreeWidget::folderTreeWidgetProxyModel() const { - return d->readableproxy; + return d->readableproxy; } EntityCollectionOrderProxyModel *FolderTreeWidget::entityOrderProxy() const { - return d->entityOrderProxy; + return d->entityOrderProxy; } KLineEdit *FolderTreeWidget::filterFolderLineEdit() const { - return d->filterFolderLineEdit; + return d->filterFolderLineEdit; } void FolderTreeWidget::applyFilter( const QString &filter ) { - d->label->setText( - filter.isEmpty() ? - i18n( "You can start typing to filter the list of folders." ) : - i18n( "Path: (%1)", filter ) ); - - d->readableproxy->setFilterFolder( filter ); - d->folderTreeView->expandAll(); - QAbstractItemModel *model = d->folderTreeView->model(); - QModelIndex current = d->folderTreeView->currentIndex(); - QModelIndex start = current.isValid() ? current : model->index(0, 0); - QModelIndexList list = model->match( start, Qt::DisplayRole, d->filter, 1 /* stop at first hit */, - Qt::MatchContains | Qt::MatchWrap | Qt::MatchRecursive ); - if ( !list.isEmpty() ) { - current = list.first(); - d->folderTreeView->setCurrentIndex( current ); - d->folderTreeView->scrollTo( current ); - } + d->label->setText( + filter.isEmpty() ? + i18n( "You can start typing to filter the list of folders." ) : + i18n( "Path: (%1)", filter ) ); + + d->readableproxy->setFilterFolder( filter ); + d->folderTreeView->expandAll(); + QAbstractItemModel *model = d->folderTreeView->model(); + QModelIndex current = d->folderTreeView->currentIndex(); + QModelIndex start = current.isValid() ? current : model->index(0, 0); + QModelIndexList list = model->match( start, Qt::DisplayRole, d->filter, 1 /* stop at first hit */, + Qt::MatchContains | Qt::MatchWrap | Qt::MatchRecursive ); + if ( !list.isEmpty() ) { + current = list.first(); + d->folderTreeView->setCurrentIndex( current ); + d->folderTreeView->scrollTo( current ); + } } void FolderTreeWidget::clearFilter() { - d->filter.clear(); - applyFilter( d->filter ); - const QModelIndexList lst = d->folderTreeView->selectionModel()->selectedIndexes(); - if ( !lst.isEmpty() ) { - d->folderTreeView->scrollTo( lst.first() ); - } + d->filter.clear(); + applyFilter( d->filter ); + const QModelIndexList lst = d->folderTreeView->selectionModel()->selectedIndexes(); + if ( !lst.isEmpty() ) { + d->folderTreeView->scrollTo( lst.first() ); + } } void FolderTreeWidget::slotManualSortingChanged( bool active ) { - d->entityOrderProxy->setManualSortingActive( active ); - d->folderTreeView->setManualSortingActive( active ); + d->entityOrderProxy->setManualSortingActive( active ); + d->folderTreeView->setManualSortingActive( active ); } bool FolderTreeWidget::eventFilter( QObject *o, QEvent *e ) { - Q_UNUSED( o ); - if ( d->dontKeyFilter ) { - return false; - } - - if ( e->type() == QEvent::KeyPress ) { - const QKeyEvent* const ke = static_cast( e ); - switch( ke->key() ) { - case Qt::Key_Backspace: - { - const int filterLength( d->filter.length() ); - if ( filterLength > 0 ) { - d->filter.truncate( filterLength-1 ); - } - applyFilter( d->filter ); - return false; - } - break; - case Qt::Key_Delete: - d->filter.clear(); - applyFilter( d->filter ); - return false; - break; - default: - { - const QString s = ke->text(); - if ( !s.isEmpty() && s.at( 0 ).isPrint() ) { - d->filter += s; - applyFilter( d->filter ); + Q_UNUSED( o ); + if ( d->dontKeyFilter ) { return false; - } } - break; + + if ( e->type() == QEvent::KeyPress ) { + const QKeyEvent* const ke = static_cast( e ); + switch( ke->key() ) { + case Qt::Key_Backspace: + { + const int filterLength( d->filter.length() ); + if ( filterLength > 0 ) { + d->filter.truncate( filterLength-1 ); + } + applyFilter( d->filter ); + return false; + } + break; + case Qt::Key_Delete: + d->filter.clear(); + applyFilter( d->filter ); + return false; + break; + default: + { + const QString s = ke->text(); + if ( !s.isEmpty() && s.at( 0 ).isPrint() ) { + d->filter += s; + applyFilter( d->filter ); + return false; + } + } + break; + } } - } - return false; + return false; } } diff -Nru kdepim-4.13.0/mailcommon/folder/foldertreewidget.h kdepim-4.13.3/mailcommon/folder/foldertreewidget.h --- kdepim-4.13.0/mailcommon/folder/foldertreewidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldertreewidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -28,7 +28,7 @@ #include namespace KPIM { - class StatisticsProxyModel; +class StatisticsProxyModel; } class KLineEdit; @@ -49,42 +49,42 @@ */ class MAILCOMMON_EXPORT FolderTreeWidget : public QWidget { - Q_OBJECT + Q_OBJECT - public: +public: enum TreeViewOption { - None = 0, - ShowUnreadCount = 1, - UseLineEditForFiltering = 2, - UseDistinctSelectionModel = 4, - ShowCollectionStatisticAnimation = 8, - DontKeyFilter = 16 + None = 0, + ShowUnreadCount = 1, + UseLineEditForFiltering = 2, + UseDistinctSelectionModel = 4, + ShowCollectionStatisticAnimation = 8, + DontKeyFilter = 16 }; Q_DECLARE_FLAGS( TreeViewOptions, TreeViewOption ) explicit FolderTreeWidget( - QWidget *parent = 0, - KXMLGUIClient *xmlGuiClient = 0, - TreeViewOptions options = (TreeViewOptions)( ShowUnreadCount | - ShowCollectionStatisticAnimation ), - FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy = FolderTreeWidgetProxyModel::None ); + QWidget *parent = 0, + KXMLGUIClient *xmlGuiClient = 0, + TreeViewOptions options = (TreeViewOptions)( ShowUnreadCount | + ShowCollectionStatisticAnimation ), + FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy = FolderTreeWidgetProxyModel::None ); ~FolderTreeWidget(); /** * The possible tooltip display policies. */ enum ToolTipDisplayPolicy { - DisplayAlways, ///< Always display a tooltip when hovering over an item - DisplayWhenTextElided, ///< Display the tooltip if the item text is actually elided - DisplayNever ///< Nevery display tooltips + DisplayAlways, ///< Always display a tooltip when hovering over an item + DisplayWhenTextElided, ///< Display the tooltip if the item text is actually elided + DisplayNever ///< Nevery display tooltips }; /** * The available sorting policies. */ enum SortingPolicy { - SortByCurrentColumn, ///< Columns are clickable, sorting is by the current column - SortByDragAndDropKey ///< Columns are NOT clickable, sorting is done by drag and drop + SortByCurrentColumn, ///< Columns are clickable, sorting is by the current column + SortByDragAndDropKey ///< Columns are NOT clickable, sorting is done by drag and drop }; void selectCollectionFolder( const Akonadi::Collection & col ); @@ -122,17 +122,17 @@ void restoreHeaderState( const QByteArray &data ); - protected: +protected: void changeToolTipsPolicyConfig( ToolTipDisplayPolicy ); - protected slots: +protected slots: void slotChangeTooltipsPolicy( FolderTreeWidget::ToolTipDisplayPolicy ); void slotManualSortingChanged( bool ); void slotFilterFixedString( const QString & ); void slotGeneralFontChanged(); void slotGeneralPaletteChanged(); - private: +private: virtual bool eventFilter( QObject *o, QEvent *e ); class FolderTreeWidgetPrivate; FolderTreeWidgetPrivate *const d; diff -Nru kdepim-4.13.0/mailcommon/folder/foldertreewidgetproxymodel.cpp kdepim-4.13.3/mailcommon/folder/foldertreewidgetproxymodel.cpp --- kdepim-4.13.0/mailcommon/folder/foldertreewidgetproxymodel.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldertreewidgetproxymodel.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -41,12 +41,12 @@ class FolderTreeWidgetProxyModel::Private { - public: +public: Private() - : enableCheck( false ), - hideVirtualFolder( false ), - hideSpecificFolder( false ), - hideOutboxFolder( false ) + : enableCheck( false ), + hideVirtualFolder( false ), + hideSpecificFolder( false ), + hideOutboxFolder( false ) { } @@ -63,206 +63,206 @@ FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModel( QObject *parent, FolderTreeWidgetProxyModelOptions option ) - : Akonadi::EntityRightsFilterModel( parent ), - d( new Private ) + : Akonadi::EntityRightsFilterModel( parent ), + d( new Private ) { - setDynamicSortFilter( true ); - setFilterCaseSensitivity( Qt::CaseInsensitive ); + setDynamicSortFilter( true ); + setFilterCaseSensitivity( Qt::CaseInsensitive ); - if ( option & HideVirtualFolder ) { - d->hideVirtualFolder = true; - } - if ( option & HideSpecificFolder ) { - d->hideSpecificFolder = true; - } - if ( option & HideOutboxFolder ) { - d->hideOutboxFolder = true; - } - readConfig(); + if ( option & HideVirtualFolder ) { + d->hideVirtualFolder = true; + } + if ( option & HideSpecificFolder ) { + d->hideSpecificFolder = true; + } + if ( option & HideOutboxFolder ) { + d->hideOutboxFolder = true; + } + readConfig(); } FolderTreeWidgetProxyModel::~FolderTreeWidgetProxyModel() { - delete d; + delete d; } void FolderTreeWidgetProxyModel::readConfig() { - KConfigGroup collectionFolderView( KernelIf->config(), "CollectionFolderView" ); - KColorScheme scheme( QPalette::Active, KColorScheme::View ); - if ( MessageCore::GlobalSettings::self()->useDefaultColors() ) { - d->brokenAccountColor = scheme.foreground( KColorScheme::NegativeText ).color(); - } else { - d->brokenAccountColor = - collectionFolderView.readEntry( "BrokenAccountColor", - scheme.foreground( KColorScheme::NegativeText ).color() ); - } - invalidate(); + KConfigGroup collectionFolderView( KernelIf->config(), "CollectionFolderView" ); + KColorScheme scheme( QPalette::Active, KColorScheme::View ); + if ( MessageCore::GlobalSettings::self()->useDefaultColors() ) { + d->brokenAccountColor = scheme.foreground( KColorScheme::NegativeText ).color(); + } else { + d->brokenAccountColor = + collectionFolderView.readEntry( "BrokenAccountColor", + scheme.foreground( KColorScheme::NegativeText ).color() ); + } + invalidate(); } Qt::ItemFlags FolderTreeWidgetProxyModel::flags( const QModelIndex &index ) const { - if ( d->enableCheck ) { - const QModelIndex sourceIndex = mapToSource( index ); - const QModelIndex rowIndex = sourceIndex.sibling( sourceIndex.row(), 0 ); - const Akonadi::Collection collection = sourceModel()->data( rowIndex, Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( !MailCommon::Util::isVirtualCollection( collection ) ) { - const Akonadi::AgentInstance instance = Akonadi::AgentManager::self()->instance( collection.resource() ); - if ( instance.status() == Akonadi::AgentInstance::Broken ) { - return KRecursiveFilterProxyModel::flags( sourceIndex ) & ~( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); - } - } - return Akonadi::EntityRightsFilterModel::flags( index ); - } - return QSortFilterProxyModel::flags( index ); + if ( d->enableCheck ) { + const QModelIndex sourceIndex = mapToSource( index ); + const QModelIndex rowIndex = sourceIndex.sibling( sourceIndex.row(), 0 ); + const Akonadi::Collection collection = sourceModel()->data( rowIndex, Akonadi::EntityTreeModel::CollectionRole ).value(); + if ( !MailCommon::Util::isVirtualCollection( collection ) ) { + const Akonadi::AgentInstance instance = Akonadi::AgentManager::self()->instance( collection.resource() ); + if ( instance.status() == Akonadi::AgentInstance::Broken ) { + return KRecursiveFilterProxyModel::flags( sourceIndex ) & ~( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); + } + } + return Akonadi::EntityRightsFilterModel::flags( index ); + } + return QSortFilterProxyModel::flags( index ); } void FolderTreeWidgetProxyModel::setEnabledCheck( bool enable ) { - if ( d->enableCheck == enable ) { - return; - } - - d->enableCheck = enable; - if ( enable ) { - setAccessRights( Akonadi::Collection::CanCreateItem | Akonadi::Collection::CanCreateCollection ); - } + if ( d->enableCheck == enable ) { + return; + } + + d->enableCheck = enable; + if ( enable ) { + setAccessRights( Akonadi::Collection::CanCreateItem | Akonadi::Collection::CanCreateCollection ); + } } bool FolderTreeWidgetProxyModel::enabledCheck() const { - return d->enableCheck; + return d->enableCheck; } void FolderTreeWidgetProxyModel::setHideVirtualFolder( bool exclude ) { - d->hideVirtualFolder = exclude; - invalidate(); + d->hideVirtualFolder = exclude; + invalidate(); } bool FolderTreeWidgetProxyModel::hideVirtualFolder() const { - return d->hideVirtualFolder; + return d->hideVirtualFolder; } void FolderTreeWidgetProxyModel::setHideSpecificFolder( bool hide ) { - d->hideSpecificFolder = hide; - invalidate(); + d->hideSpecificFolder = hide; + invalidate(); } bool FolderTreeWidgetProxyModel::hideSpecificFolder() const { - return d->hideSpecificFolder; + return d->hideSpecificFolder; } void FolderTreeWidgetProxyModel::setHideOutboxFolder( bool hide ) { - d->hideOutboxFolder = hide; - invalidate(); + d->hideOutboxFolder = hide; + invalidate(); } bool FolderTreeWidgetProxyModel::hideOutboxFolder() const { - return d->hideOutboxFolder; + return d->hideOutboxFolder; } bool FolderTreeWidgetProxyModel::acceptRow( int sourceRow, const QModelIndex &sourceParent ) const { - const QModelIndex modelIndex = sourceModel()->index( sourceRow, 0, sourceParent ); + const QModelIndex modelIndex = sourceModel()->index( sourceRow, 0, sourceParent ); - const Akonadi::Collection collection = - sourceModel()->data( - modelIndex, Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( !d->checker.isWantedCollection( collection ) ) { - return false; - } + const Akonadi::Collection collection = + sourceModel()->data( + modelIndex, Akonadi::EntityTreeModel::CollectionRole ).value(); + if ( !d->checker.isWantedCollection( collection ) ) { + return false; + } - if ( d->hideVirtualFolder ) { - if ( Util::isVirtualCollection( collection ) ) { - return false; + if ( d->hideVirtualFolder ) { + if ( Util::isVirtualCollection( collection ) ) { + return false; + } } - } - if ( d->hideSpecificFolder ) { - const QSharedPointer col = - FolderCollection::forCollection( collection, false ); - if ( col && col->hideInSelectionDialog() ) { - return false; + if ( d->hideSpecificFolder ) { + const QSharedPointer col = + FolderCollection::forCollection( collection, false ); + if ( col && col->hideInSelectionDialog() ) { + return false; + } } - } - if ( d->hideOutboxFolder ) { - if ( collection == Kernel::self()->outboxCollectionFolder() ) { - return false; + if ( d->hideOutboxFolder ) { + if ( collection == Kernel::self()->outboxCollectionFolder() ) { + return false; + } } - } - if ( d->filterStr.isEmpty() ) { - return Akonadi::EntityRightsFilterModel::acceptRow( sourceRow, sourceParent ); - } + if ( d->filterStr.isEmpty() ) { + return Akonadi::EntityRightsFilterModel::acceptRow( sourceRow, sourceParent ); + } - return KRecursiveFilterProxyModel::acceptRow( sourceRow, sourceParent ); + return KRecursiveFilterProxyModel::acceptRow( sourceRow, sourceParent ); } void FolderTreeWidgetProxyModel::setFilterFolder( const QString &filter ) { - d->filterStr = filter; - setFilterWildcard( filter ); + d->filterStr = filter; + setFilterWildcard( filter ); } QVariant FolderTreeWidgetProxyModel::data( const QModelIndex &index, int role ) const { - if ( role == Qt::TextColorRole ) { - const QModelIndex sourceIndex = mapToSource( index ); - const QModelIndex rowIndex = sourceIndex.sibling( sourceIndex.row(), 0 ); - const Akonadi::Collection collection = - sourceModel()->data( - rowIndex, Akonadi::EntityTreeModel::CollectionRole ).value(); - - if ( !MailCommon::Util::isVirtualCollection( collection ) ) { - - const Akonadi::AgentInstance instance = - Akonadi::AgentManager::self()->instance( collection.resource() ); - - if ( instance.status() == Akonadi::AgentInstance::Broken ) { - return d->brokenAccountColor; - } - } - } else if ( role == Qt::DisplayRole) { - const QModelIndex sourceIndex = mapToSource( index ); - const QModelIndex rowIndex = sourceIndex.sibling( sourceIndex.row(), 0 ); - const Akonadi::Collection collection = - sourceModel()->data( - rowIndex, Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( !MailCommon::Util::isVirtualCollection( collection ) ) { - - const Akonadi::AgentInstance instance = - Akonadi::AgentManager::self()->instance( collection.resource() ); - if (collection.parentCollection() == Akonadi::Collection::root()) { - if (!instance.isOnline()) { - return i18n("%1 (Offline)",Akonadi::EntityRightsFilterModel::data(index,role).toString()); - } - } + if ( role == Qt::TextColorRole ) { + const QModelIndex sourceIndex = mapToSource( index ); + const QModelIndex rowIndex = sourceIndex.sibling( sourceIndex.row(), 0 ); + const Akonadi::Collection collection = + sourceModel()->data( + rowIndex, Akonadi::EntityTreeModel::CollectionRole ).value(); + + if ( !MailCommon::Util::isVirtualCollection( collection ) ) { + + const Akonadi::AgentInstance instance = + Akonadi::AgentManager::self()->instance( collection.resource() ); + + if ( instance.status() == Akonadi::AgentInstance::Broken ) { + return d->brokenAccountColor; + } + } + } else if ( role == Qt::DisplayRole) { + const QModelIndex sourceIndex = mapToSource( index ); + const QModelIndex rowIndex = sourceIndex.sibling( sourceIndex.row(), 0 ); + const Akonadi::Collection collection = + sourceModel()->data( + rowIndex, Akonadi::EntityTreeModel::CollectionRole ).value(); + if ( !MailCommon::Util::isVirtualCollection( collection ) ) { + + const Akonadi::AgentInstance instance = + Akonadi::AgentManager::self()->instance( collection.resource() ); + if (collection.parentCollection() == Akonadi::Collection::root()) { + if (!instance.isOnline()) { + return i18n("%1 (Offline)",Akonadi::EntityRightsFilterModel::data(index,role).toString()); + } + } + } } - } - return Akonadi::EntityRightsFilterModel::data( index, role ); + return Akonadi::EntityRightsFilterModel::data( index, role ); } void FolderTreeWidgetProxyModel::updatePalette() { - if ( MessageCore::GlobalSettings::self()->useDefaultColors() ) { - KColorScheme scheme( QPalette::Active, KColorScheme::View ); - d->brokenAccountColor = scheme.foreground( KColorScheme::NegativeText ).color(); - invalidate(); - } + if ( MessageCore::GlobalSettings::self()->useDefaultColors() ) { + KColorScheme scheme( QPalette::Active, KColorScheme::View ); + d->brokenAccountColor = scheme.foreground( KColorScheme::NegativeText ).color(); + invalidate(); + } } void FolderTreeWidgetProxyModel::addContentMimeTypeInclusionFilter( const QString &mimeType ) { - d->includedMimeTypes << mimeType; - d->checker.setWantedMimeTypes( d->includedMimeTypes.toList() ); - invalidateFilter(); + d->includedMimeTypes << mimeType; + d->checker.setWantedMimeTypes( d->includedMimeTypes.toList() ); + invalidateFilter(); } } diff -Nru kdepim-4.13.0/mailcommon/folder/foldertreewidgetproxymodel.h kdepim-4.13.3/mailcommon/folder/foldertreewidgetproxymodel.h --- kdepim-4.13.0/mailcommon/folder/foldertreewidgetproxymodel.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/folder/foldertreewidgetproxymodel.h 2014-07-09 12:18:50.000000000 +0000 @@ -27,20 +27,20 @@ class FolderTreeWidgetProxyModel : public Akonadi::EntityRightsFilterModel { - Q_OBJECT + Q_OBJECT - public: +public: enum FolderTreeWidgetProxyModelOption { - None = 0, - HideVirtualFolder = 1, - HideSpecificFolder = 2, - HideOutboxFolder = 4 + None = 0, + HideVirtualFolder = 1, + HideSpecificFolder = 2, + HideOutboxFolder = 4 }; Q_DECLARE_FLAGS( FolderTreeWidgetProxyModelOptions, FolderTreeWidgetProxyModelOption ) explicit FolderTreeWidgetProxyModel( - QObject *parent = 0, - FolderTreeWidgetProxyModelOptions = FolderTreeWidgetProxyModel::None ); + QObject *parent = 0, + FolderTreeWidgetProxyModelOptions = FolderTreeWidgetProxyModel::None ); virtual ~FolderTreeWidgetProxyModel(); @@ -66,10 +66,10 @@ void updatePalette(); void readConfig(); - protected: +protected: virtual bool acceptRow( int sourceRow, const QModelIndex &sourceParent ) const; - private: +private: class Private; Private *const d; }; diff -Nru kdepim-4.13.0/mailcommon/snippets/snippetdialog.cpp kdepim-4.13.3/mailcommon/snippets/snippetdialog.cpp --- kdepim-4.13.0/mailcommon/snippets/snippetdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/snippets/snippetdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -19,6 +19,8 @@ #include #include +using namespace MailCommon; + SnippetDialog::SnippetDialog( KActionCollection *actionCollection, bool inGroupMode, QWidget *parent ) : KDialog( parent ), mActionCollection( actionCollection ) { diff -Nru kdepim-4.13.0/mailcommon/snippets/snippetdialog_p.h kdepim-4.13.3/mailcommon/snippets/snippetdialog_p.h --- kdepim-4.13.0/mailcommon/snippets/snippetdialog_p.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/snippets/snippetdialog_p.h 2014-07-09 12:18:50.000000000 +0000 @@ -25,6 +25,8 @@ class QAbstractItemModel; class QModelIndex; +namespace MailCommon { + class SnippetDialog : public KDialog { Q_OBJECT @@ -57,5 +59,5 @@ KActionCollection *mActionCollection; Ui::SnippetDialog *mUi; }; - +} #endif diff -Nru kdepim-4.13.0/mailcommon/util/mailutil.cpp kdepim-4.13.3/mailcommon/util/mailutil.cpp --- kdepim-4.13.0/mailcommon/util/mailutil.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/util/mailutil.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -100,9 +100,7 @@ bool MailCommon::Util::isVirtualCollection( const QString &resource ) { - return - ( - resource == QLatin1String( "akonadi_search_resource" ) ); + return resource == QLatin1String( "akonadi_search_resource" ); } bool MailCommon::Util::isLocalCollection( const QString &resource ) diff -Nru kdepim-4.13.0/mailcommon/widgets/favoritecollectionwidget.cpp kdepim-4.13.3/mailcommon/widgets/favoritecollectionwidget.cpp --- kdepim-4.13.0/mailcommon/widgets/favoritecollectionwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/widgets/favoritecollectionwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -146,10 +146,10 @@ switch(mode) { case MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::IconMode: - setViewMode(IconMode); + changeViewMode(IconMode); break; case MailCommon::MailCommonSettings::EnumFavoriteCollectionViewMode::ListMode: - setViewMode(ListMode); + changeViewMode(ListMode); break; } @@ -157,6 +157,13 @@ MailCommon::MailCommonSettings::self()->writeConfig(); } +void FavoriteCollectionWidget::changeViewMode(QListView::ViewMode mode) +{ + setViewMode(mode); + setDragEnabled(true); + setAcceptDrops(true); +} + void FavoriteCollectionWidget::slotChangeIconSize(bool ) { QAction *act = dynamic_cast< QAction * >( sender() ); diff -Nru kdepim-4.13.0/mailcommon/widgets/favoritecollectionwidget.h kdepim-4.13.3/mailcommon/widgets/favoritecollectionwidget.h --- kdepim-4.13.0/mailcommon/widgets/favoritecollectionwidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailcommon/widgets/favoritecollectionwidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -38,6 +38,8 @@ void readConfig(); void updateMode(); + void changeViewMode(QListView::ViewMode mode); + protected slots: void slotGeneralFontChanged(); void slotGeneralPaletteChanged(); diff -Nru kdepim-4.13.0/mailimporter/filterbalsa.cpp kdepim-4.13.3/mailimporter/filterbalsa.cpp --- kdepim-4.13.0/mailimporter/filterbalsa.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailimporter/filterbalsa.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -80,7 +80,7 @@ if(!(*filename == QLatin1String( "." ) || *filename == QLatin1String( ".." ))) { filterInfo()->setCurrent(0); importDirContents(dir.filePath(*filename)); - filterInfo()->setOverall((int) ((float) mImportDirDone / mTotalDir * 100)); + filterInfo()->setOverall( (mTotalDir > 0) ? (int) ((float) mImportDirDone / mTotalDir * 100) : 0); filterInfo()->setCurrent(100); } } diff -Nru kdepim-4.13.0/mailimporter/filter_evolution_v3.cpp kdepim-4.13.3/mailimporter/filter_evolution_v3.cpp --- kdepim-4.13.0/mailimporter/filter_evolution_v3.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailimporter/filter_evolution_v3.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -78,7 +78,7 @@ if(!(*filename == QLatin1String( "." ) || *filename == QLatin1String( ".." ))) { filterInfo()->setCurrent(0); importDirContents(dir.filePath(*filename)); - filterInfo()->setOverall((int) ((float) mImportDirDone / mTotalDir * 100)); + filterInfo()->setOverall( (mTotalDir > 0 ) ? (int) ((float) mImportDirDone / mTotalDir * 100) : 0); filterInfo()->setCurrent(100); } } diff -Nru kdepim-4.13.0/mailimporter/filter_kmail_maildir.cpp kdepim-4.13.3/mailimporter/filter_kmail_maildir.cpp --- kdepim-4.13.0/mailimporter/filter_kmail_maildir.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailimporter/filter_kmail_maildir.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -74,9 +74,9 @@ if(!(*filename == QLatin1String( "." ) || *filename == QLatin1String( ".." ))) { filterInfo()->setCurrent(0); importDirContents(dir.filePath(*filename)); - filterInfo()->setOverall((int) ((float) mImportDirDone / mTotalDir * 100)); + filterInfo()->setOverall( (mTotalDir > 0) ? (int) ((float) mImportDirDone / mTotalDir * 100) : 0); filterInfo()->setCurrent(100); - mImportDirDone++; + ++mImportDirDone; } } } diff -Nru kdepim-4.13.0/mailimporter/filter_sylpheed.cpp kdepim-4.13.3/mailimporter/filter_sylpheed.cpp --- kdepim-4.13.0/mailimporter/filter_sylpheed.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailimporter/filter_sylpheed.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -107,8 +107,8 @@ if(filterInfo()->shouldTerminate()) break; importDirContents(dir.filePath(*filename)); - filterInfo()->setOverall((int) ((float) mImportDirDone / mTotalDir * 100)); - mImportDirDone++; + filterInfo()->setOverall( (mTotalDir > 0) ? (int) ((float) mImportDirDone / mTotalDir * 100) : 0); + ++mImportDirDone; } } diff -Nru kdepim-4.13.0/mailimporter/filter_thebat.cpp kdepim-4.13.3/mailimporter/filter_thebat.cpp --- kdepim-4.13.0/mailimporter/filter_thebat.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mailimporter/filter_thebat.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -70,8 +70,8 @@ if(filterInfo()->shouldTerminate()) break; importDirContents(dir.filePath(*filename)); - filterInfo()->setOverall((int) ((float) mImportDirDone / mTotalDir * 100)); - mImportDirDone++; + filterInfo()->setOverall((mTotalDir > 0) ? (int) ((float) mImportDirDone / mTotalDir * 100) : 0); + ++mImportDirDone; } } diff -Nru kdepim-4.13.0/MAINTAINERS kdepim-4.13.3/MAINTAINERS --- kdepim-4.13.0/MAINTAINERS 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/MAINTAINERS 2014-07-09 12:18:50.000000000 +0000 @@ -9,7 +9,6 @@ calendarviews Sérgio Martins contactthemeeditor Laurent Montel composereditor-ng Laurent Montel -grammar Laurent Montel grantleethemeeditor Laurent Montel headerthemeeditor Laurent Montel importwizard Laurent Montel @@ -26,7 +25,7 @@ knode Olivier Trichet knotes Laurent Montel konsolekalendar Allen Winter -kontact ? +kontact Laurent Montel korganizer Allen Winter and Sérgio Martins korgac Allen Winter kresources DEPRECATED @@ -44,7 +43,6 @@ mboximporter Laurent Montel notesagent Laurent Montel pimsettingexporter Laurent Montel -pimactivity Laurent Montel messagecomposer Laurent Montel messagecore Laurent Montel messagelist Laurent Montel diff -Nru kdepim-4.13.0/mboximporter/mboximporter.desktop kdepim-4.13.3/mboximporter/mboximporter.desktop --- kdepim-4.13.0/mboximporter/mboximporter.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mboximporter/mboximporter.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=MBoxImporter Name[de]=MBoxImporter Name[el]=MBoxImporter +Name[en_GB]=MBoxImporter Name[es]=MBoxImporter +Name[et]=MBoxImporter Name[fi]=MBoxImporter Name[fr]=MBoxImporter Name[gl]=MBoxImporter diff -Nru kdepim-4.13.0/messagecomposer/composer/keyresolver.cpp kdepim-4.13.3/messagecomposer/composer/keyresolver.cpp --- kdepim-4.13.0/messagecomposer/composer/keyresolver.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagecomposer/composer/keyresolver.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -460,7 +460,6 @@ #undef make_int_accessor private: EncryptionPreference mDefaultPreference; - bool mNoOps; unsigned int mTotal; unsigned int mNoKey; unsigned int mNeverEncrypt, mUnknownPreference, mAlwaysEncrypt, diff -Nru kdepim-4.13.0/messagecomposer/composer/kmeditor.cpp kdepim-4.13.3/messagecomposer/composer/kmeditor.cpp --- kdepim-4.13.0/messagecomposer/composer/kmeditor.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagecomposer/composer/kmeditor.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -249,7 +249,7 @@ emit focusUp(); } else { if((e->key() == Qt::Key_Space) || (e->key() == Qt::Key_Enter) || (e->key() == Qt::Key_Return)) { - if(d->mAutoCorrection && !isLineQuoted(textCursor().block().text())) { + if(d->mAutoCorrection && !isLineQuoted(textCursor().block().text()) && !textCursor().hasSelection()) { const QTextCharFormat initialTextFormat = textCursor().charFormat(); const bool richText = (textMode() == KRichTextEdit::Rich); int position = textCursor().position(); diff -Nru kdepim-4.13.0/messagecomposer/helper/messagefactory.cpp kdepim-4.13.3/messagecomposer/helper/messagefactory.cpp --- kdepim-4.13.0/messagecomposer/helper/messagefactory.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagecomposer/helper/messagefactory.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -316,7 +316,7 @@ } if ( m_origMsg->hasHeader( "X-KMail-EncryptActionEnabled" ) && - m_origMsg->headerByType( "X-KMail-EncryptActionEnabled" )->as7BitString() == "true" ) { + m_origMsg->headerByType( "X-KMail-EncryptActionEnabled" )->as7BitString().contains( "true" ) ) { msg->setHeader( new KMime::Headers::Generic( "X-KMail-EncryptActionEnabled", msg.get(), QLatin1String( "true" ), "utf-8" ) ); } msg->assemble(); diff -Nru kdepim-4.13.0/messagecomposer/job/skeletonmessagejob.cpp kdepim-4.13.3/messagecomposer/job/skeletonmessagejob.cpp --- kdepim-4.13.0/messagecomposer/job/skeletonmessagejob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagecomposer/job/skeletonmessagejob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -135,6 +135,18 @@ message->setHeader( date ); } + // Fcc: + if (!infoPart->fcc().isEmpty()) { + KMime::Headers::Generic *header = new KMime::Headers::Generic( "X-KMail-Fcc", message, infoPart->fcc(), "utf-8" ); + message->setHeader( header ); + } + + //Transport: + if (infoPart->transportId() > -1) { + KMime::Headers::Generic *header = new KMime::Headers::Generic( "X-KMail-Transport", message, QString::number( infoPart->transportId() ), "utf-8" ); + message->setHeader( header ); + } + // Message-ID { KMime::Headers::MessageID *messageId = new KMime::Headers::MessageID(); diff -Nru kdepim-4.13.0/messagecomposer/tests/messagefactorytest.cpp kdepim-4.13.3/messagecomposer/tests/messagefactorytest.cpp --- kdepim-4.13.0/messagecomposer/tests/messagefactorytest.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagecomposer/tests/messagefactorytest.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -206,6 +206,7 @@ "Subject: Fwd: Test Email Subject\n" "Date: %2\n" "User-Agent: %3\n" + "X-KMail-Transport: 0\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=\"ISO-8859-1\"\n" "Content-Transfer-Encoding: 8Bit\n" @@ -265,6 +266,7 @@ "Bcc: bcc@bcc.bcc\n" "Subject: Test Email Subject\n" "Date: %1\n" + "X-KMail-Transport: 0\n" "Message-ID: %2\n" "Disposition-Notification-To: me@me.me\n" "MIME-Version: 1.0\n" @@ -322,6 +324,7 @@ "Bcc: bcc@bcc.bcc\n" "Subject: Test Email Subject\n" "Date: %2\n" + "X-KMail-Transport: 0\n" "Message-ID: %3\n" "Disposition-Notification-To: me@me.me\n" "MIME-Version: 1.0\n" diff -Nru kdepim-4.13.0/messagelist/core/filter.cpp kdepim-4.13.3/messagelist/core/filter.cpp --- kdepim-4.13.0/messagelist/core/filter.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/core/filter.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -30,6 +30,20 @@ { } +bool Filter::containString(const QString &searchInString) const +{ + bool found = false; + Q_FOREACH(const QString &str, mSearchList) { + if(searchInString.contains(str,Qt::CaseInsensitive)) { + found = true; + } else { + found = false; + break; + } + } + return found; +} + bool Filter::match( const MessageItem * item ) const { if ( !mStatus.isEmpty() ) { @@ -43,7 +57,15 @@ if ( !mSearchString.isEmpty() ) { if ( mMatchingItemIds.contains( item->itemId() ) ) return true; - else + bool searchMatches = false; + if ( containString(item->subject()) ) { + searchMatches = true; + } else if ( containString(item->sender()) ) { + searchMatches = true; + } else if ( containString(item->receiver()) ) { + searchMatches = true; + } + if ( !searchMatches ) return false; } @@ -77,6 +99,7 @@ mSearchString.clear(); mTagId.clear(); mMatchingItemIds.clear(); + mSearchList.clear(); } void Filter::setCurrentFolder( const Akonadi::Collection &folder ) @@ -90,13 +113,13 @@ if ((mSearchString == trimStr) && (mOptions == options)) { return; } - mSearchString = trimStr; mMatchingItemIds.clear(); if (mSearchString.isEmpty()) { return; } + mSearchList = mSearchString.split(QLatin1Char(' '), QString::SkipEmptyParts); Baloo::PIM::EmailQuery query; if (options & QuickSearchLine::SearchEveryWhere) { diff -Nru kdepim-4.13.0/messagelist/core/filter.h kdepim-4.13.3/messagelist/core/filter.h --- kdepim-4.13.0/messagelist/core/filter.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/core/filter.h 2014-07-09 12:18:50.000000000 +0000 @@ -110,12 +110,14 @@ void finished(); private: + bool containString(const QString &searchInString) const; QList mStatus; ///< Messages must match theses status, if non 0 QString mSearchString; ///< Messages must match this search string, if not empty QString mTagId; ///< Messages must have this tag, if not empty. Contains a tag url. Akonadi::Collection mCurrentFolder; QSet mMatchingItemIds; QuickSearchLine::SearchOptions mOptions; + QStringList mSearchList; }; } // namespace Core diff -Nru kdepim-4.13.0/messagelist/core/quicksearchline.cpp kdepim-4.13.3/messagelist/core/quicksearchline.cpp --- kdepim-4.13.0/messagelist/core/quicksearchline.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/core/quicksearchline.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -67,7 +67,6 @@ "locked when moving to other folders or when narrowing the search " "by message status." ) ); slotLockSearchClicked(false); - mLockSearch->setVisible( Settings::self()->showQuickSearch() ); connect( mLockSearch, SIGNAL(toggled(bool)), SLOT(slotLockSearchClicked(bool))); hbox->addWidget( mLockSearch ); @@ -87,7 +86,6 @@ mSearchEdit->setClickMessage( i18nc( "Search for messages.", "Search" ) ); mSearchEdit->setObjectName( QLatin1String( "quicksearch" ) ); mSearchEdit->setClearButtonShown( true ); - mSearchEdit->setVisible( Settings::self()->showQuickSearch() ); connect( mSearchEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSearchEditTextEdited(QString))); connect( mSearchEdit, SIGNAL(clearButtonClicked()), this, SLOT(slotClearButtonClicked())); @@ -175,6 +173,7 @@ mSearchAgainstBcc->installEventFilter(this); mQuickSearchFilterWidget->installEventFilter(this); mExtraOption->installEventFilter(this); + changeQuicksearchVisibility(Settings::self()->showQuickSearch()); } QuickSearchLine::~QuickSearchLine() @@ -415,7 +414,7 @@ void QuickSearchLine::updateComboboxVisibility() { - mTagFilterCombo->setVisible(mTagFilterCombo->count()); + mTagFilterCombo->setVisible(mSearchEdit->isVisible() && mTagFilterCombo->count()); } bool QuickSearchLine::eventFilter(QObject *object, QEvent *e) @@ -427,3 +426,11 @@ } return QWidget::eventFilter(object,e); } + +void QuickSearchLine::changeQuicksearchVisibility(bool show) +{ + mSearchEdit->setVisible( show ); + mTagFilterCombo->setVisible( show && mTagFilterCombo->count()); + mLockSearch->setVisible( show ); + mMoreOptions->setVisible( show ); +} diff -Nru kdepim-4.13.0/messagelist/core/quicksearchline.h kdepim-4.13.3/messagelist/core/quicksearchline.h --- kdepim-4.13.0/messagelist/core/quicksearchline.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/core/quicksearchline.h 2014-07-09 12:18:50.000000000 +0000 @@ -68,6 +68,8 @@ bool containsOutboundMessages() const; void setContainsOutboundMessages(bool containsOutboundMessages); + void changeQuicksearchVisibility(bool show); + Q_SIGNALS: void clearButtonClicked(); void searchEditTextEdited(const QString &); diff -Nru kdepim-4.13.0/messagelist/core/widgetbase.cpp kdepim-4.13.3/messagelist/core/widgetbase.cpp --- kdepim-4.13.0/messagelist/core/widgetbase.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/core/widgetbase.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -174,7 +174,6 @@ void Widget::changeQuicksearchVisibility(bool show) { KLineEdit * const lineEdit = d->quickSearchLine->searchEdit(); - QWidget * const comboBox = d->quickSearchLine->tagFilterComboBox(); if ( !show ) { //if we hide it we do not want to apply the filter, //otherwise someone is maybe stuck with x new emails @@ -191,9 +190,7 @@ resetFilter(); } } - lineEdit->setVisible( show ); - comboBox->setVisible( show ); - d->quickSearchLine->lockSearch()->setVisible( show ); + d->quickSearchLine->changeQuicksearchVisibility(show); Settings::self()->setShowQuickSearch( show ); } @@ -984,6 +981,10 @@ d->mFilter = new Filter(); const QString text = d->quickSearchLine->searchEdit()->text(); + if (!text.isEmpty()) { + KCompletion *comp = d->quickSearchLine->searchEdit()->completionObject(); + comp->addItem(text); + } d->mFilter->setCurrentFolder( d->mCurrentFolder ); d->mFilter->setSearchString( text, d->quickSearchLine->searchOptions() ); diff -Nru kdepim-4.13.0/messagelist/tests/quicksearchlinetest.cpp kdepim-4.13.3/messagelist/tests/quicksearchlinetest.cpp --- kdepim-4.13.0/messagelist/tests/quicksearchlinetest.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/tests/quicksearchlinetest.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -231,4 +231,53 @@ QCOMPARE(searchLine.searchOptions(), options); } +void QuickSearchLineTest::shouldHideShowWidgetWhenWeChangeVisibility() +{ + QuickSearchLine searchLine; + searchLine.show(); + + QWidget *widget = qFindChild(&searchLine, QLatin1String("extraoptions")); + + KPushButton *moreButton = qFindChild(&searchLine, QLatin1String("moreoptions")); + QWidget *quickSearchFilterWidget = qFindChild(&searchLine, QLatin1String("quicksearchfilterwidget")); + searchLine.changeQuicksearchVisibility(false); + QCOMPARE(quickSearchFilterWidget->isVisible(), false); + QCOMPARE(moreButton->isVisible(), false); + QCOMPARE(widget->isVisible(), false); + QCOMPARE(searchLine.searchEdit()->isVisible(), false); + QCOMPARE(searchLine.tagFilterComboBox()->isVisible(), false); + + + searchLine.changeQuicksearchVisibility(true); + QCOMPARE(quickSearchFilterWidget->isVisible(), false); + QCOMPARE(moreButton->isVisible(), true); + QCOMPARE(widget->isVisible(), false); + QCOMPARE(searchLine.searchEdit()->isVisible(), true); + QCOMPARE(searchLine.tagFilterComboBox()->isVisible(), false); + + //Fill Combobox + searchLine.tagFilterComboBox()->addItems(QStringList()<isVisible(), false); + + searchLine.changeQuicksearchVisibility(true); + QCOMPARE(searchLine.tagFilterComboBox()->isVisible(), true); +} + +void QuickSearchLineTest::shouldNotShowComboboxWhenWeAddNewItemWhenWeHiddedQuickSearchBarWidget() +{ + QuickSearchLine searchLine; + searchLine.show(); + searchLine.tagFilterComboBox()->addItems(QStringList()<isVisible(), true); + + searchLine.changeQuicksearchVisibility(false); + searchLine.tagFilterComboBox()->addItems(QStringList()<isVisible(), false); + +} + + QTEST_KDEMAIN( QuickSearchLineTest, GUI ) diff -Nru kdepim-4.13.0/messagelist/tests/quicksearchlinetest.h kdepim-4.13.3/messagelist/tests/quicksearchlinetest.h --- kdepim-4.13.0/messagelist/tests/quicksearchlinetest.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/tests/quicksearchlinetest.h 2014-07-09 12:18:50.000000000 +0000 @@ -45,6 +45,8 @@ void shouldChangeFromButtonLabelWhenChangeOutboundMessagesValue(); void shouldSearchToOrFrom(); void shouldEmitSearchOptionChangedWhenUseTabPress(); + void shouldHideShowWidgetWhenWeChangeVisibility(); + void shouldNotShowComboboxWhenWeAddNewItemWhenWeHiddedQuickSearchBarWidget(); }; #endif // QUICKSEARCHLINETEST_H diff -Nru kdepim-4.13.0/messagelist/utils/aggregationcombobox.cpp kdepim-4.13.3/messagelist/utils/aggregationcombobox.cpp --- kdepim-4.13.0/messagelist/utils/aggregationcombobox.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/utils/aggregationcombobox.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -54,7 +54,8 @@ const QString aggregationID = currentAggregation(); group.writeEntry( QLatin1String( "DefaultSet" ), aggregationID ); - Manager::instance()->aggregationsConfigurationCompleted(); + if (Manager::instance()) + Manager::instance()->aggregationsConfigurationCompleted(); } void AggregationComboBox::writeStorageModelConfig( MessageList::Core::StorageModel *storageModel, bool isPrivateSetting ) const @@ -64,15 +65,17 @@ void AggregationComboBox::writeStorageModelConfig( const QString &id, bool isPrivateSetting ) const { - // message list aggregation - QString aggregationID; - if ( isPrivateSetting ) { - aggregationID = currentAggregation(); - } else { // explicitly use default aggregation id when using default aggregation. - aggregationID = Manager::instance()->defaultAggregation()->id(); + if (Manager::instance()) { + // message list aggregation + QString aggregationID; + if ( isPrivateSetting ) { + aggregationID = currentAggregation(); + } else { // explicitly use default aggregation id when using default aggregation. + aggregationID = Manager::instance()->defaultAggregation()->id(); + } + Manager::instance()->saveAggregationForStorageModel( id, aggregationID, isPrivateSetting ); + Manager::instance()->aggregationsConfigurationCompleted(); } - Manager::instance()->saveAggregationForStorageModel( id, aggregationID, isPrivateSetting ); - Manager::instance()->aggregationsConfigurationCompleted(); } void AggregationComboBox::writeStorageModelConfig( const Akonadi::Collection&col, bool isPrivateSetting ) const @@ -82,8 +85,10 @@ void AggregationComboBox::readStorageModelConfig( const QString & id, bool &isPrivateSetting ) { - const Aggregation *aggregation = Manager::instance()->aggregationForStorageModel( id, &isPrivateSetting ); - d->setCurrentAggregation( aggregation ); + if (Manager::instance()) { + const Aggregation *aggregation = Manager::instance()->aggregationForStorageModel( id, &isPrivateSetting ); + d->setCurrentAggregation( aggregation ); + } } void AggregationComboBox::readStorageModelConfig( MessageList::Core::StorageModel *storageModel, bool &isPrivateSetting ) @@ -99,12 +104,16 @@ void AggregationComboBox::selectDefault() { - const Aggregation *defaultAggregation = Manager::instance()->defaultAggregation(); - d->setCurrentAggregation( defaultAggregation ); + if (Manager::instance()) { + const Aggregation *defaultAggregation = Manager::instance()->defaultAggregation(); + d->setCurrentAggregation( defaultAggregation ); + } } void AggregationComboBoxPrivate::slotLoadAggregations() { + if (!Manager::instance()) + return; q->clear(); // Get all message list aggregations and sort them into alphabetical order. diff -Nru kdepim-4.13.0/messagelist/utils/aggregationconfigbutton.cpp kdepim-4.13.3/messagelist/utils/aggregationconfigbutton.cpp --- kdepim-4.13.0/messagelist/utils/aggregationconfigbutton.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/utils/aggregationconfigbutton.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -52,6 +52,7 @@ if ( d->mAggregationComboBox != 0 ) connect( this, SIGNAL(configureDialogCompleted()), d->mAggregationComboBox, SLOT(slotLoadAggregations()) ); + setEnabled(Manager::instance()); } AggregationConfigButton::~AggregationConfigButton() diff -Nru kdepim-4.13.0/messagelist/utils/configureaggregationsdialog.cpp kdepim-4.13.3/messagelist/utils/configureaggregationsdialog.cpp --- kdepim-4.13.0/messagelist/utils/configureaggregationsdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/utils/configureaggregationsdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -190,24 +190,26 @@ void ConfigureAggregationsDialog::Private::okButtonClicked() { - commitEditor(); + if (Manager::instance()) { + commitEditor(); - Manager::instance()->removeAllAggregations(); + Manager::instance()->removeAllAggregations(); - const int c = mAggregationList->count(); - int i = 0; - while ( i < c ) - { - AggregationListWidgetItem * item = dynamic_cast< AggregationListWidgetItem * >( mAggregationList->item( i ) ); - if ( item ) + const int c = mAggregationList->count(); + int i = 0; + while ( i < c ) { - Manager::instance()->addAggregation( item->aggregation() ); - item->forgetAggregation(); + AggregationListWidgetItem * item = dynamic_cast< AggregationListWidgetItem * >( mAggregationList->item( i ) ); + if ( item ) + { + Manager::instance()->addAggregation( item->aggregation() ); + item->forgetAggregation(); + } + ++i; } - ++i; - } - Manager::instance()->aggregationsConfigurationCompleted(); + Manager::instance()->aggregationsConfigurationCompleted(); + } q->close(); // this will delete too } @@ -245,6 +247,8 @@ void ConfigureAggregationsDialog::Private::fillAggregationList() { + if (!Manager::instance()) + return; const QHash< QString, Aggregation * > & sets = Manager::instance()->aggregations(); QHash< QString, Aggregation * >::ConstIterator end( sets.constEnd() ); for( QHash< QString, Aggregation * >::ConstIterator it = sets.constBegin(); it != end; ++it ) diff -Nru kdepim-4.13.0/messagelist/utils/themecombobox.cpp kdepim-4.13.3/messagelist/utils/themecombobox.cpp --- kdepim-4.13.0/messagelist/utils/themecombobox.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/utils/themecombobox.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -55,8 +55,8 @@ const QString themeID = currentTheme(); group.writeEntry( QLatin1String( "DefaultSet" ), themeID ); - - Manager::instance()->themesConfigurationCompleted(); + if (Manager::instance()) + Manager::instance()->themesConfigurationCompleted(); } void ThemeComboBox::writeStorageModelConfig( const Akonadi::Collection &col, bool isPrivateSetting ) const @@ -72,38 +72,47 @@ void ThemeComboBox::writeStorageModelConfig( const QString &id, bool isPrivateSetting )const { - QString themeID; - if ( isPrivateSetting ) { - themeID = currentTheme(); - } else { // explicitly use default theme id when using default theme. - themeID = Manager::instance()->defaultTheme()->id(); + if (Manager::instance()) { + QString themeID; + if ( isPrivateSetting ) { + themeID = currentTheme(); + } else { // explicitly use default theme id when using default theme. + themeID = Manager::instance()->defaultTheme()->id(); + } + Manager::instance()->saveThemeForStorageModel( id, themeID, isPrivateSetting ); + Manager::instance()->themesConfigurationCompleted(); } - Manager::instance()->saveThemeForStorageModel( id, themeID, isPrivateSetting ); - Manager::instance()->themesConfigurationCompleted(); } void ThemeComboBox::readStorageModelConfig( const Akonadi::Collection& col, bool &isPrivateSetting ) { - const Theme *theme = Manager::instance()->themeForStorageModel( col, &isPrivateSetting ); - d->setCurrentTheme( theme ); - + if (Manager::instance()) { + const Theme *theme = Manager::instance()->themeForStorageModel( col, &isPrivateSetting ); + d->setCurrentTheme( theme ); + } } void ThemeComboBox::readStorageModelConfig( MessageList::Core::StorageModel *storageModel, bool &isPrivateSetting ) { - const Theme *theme = Manager::instance()->themeForStorageModel( storageModel, &isPrivateSetting ); - d->setCurrentTheme( theme ); + if (Manager::instance()) { + const Theme *theme = Manager::instance()->themeForStorageModel( storageModel, &isPrivateSetting ); + d->setCurrentTheme( theme ); + } } void ThemeComboBox::selectDefault() { - const Theme *defaultTheme = Manager::instance()->defaultTheme(); - d->setCurrentTheme( defaultTheme ); + if (Manager::instance()) { + const Theme *defaultTheme = Manager::instance()->defaultTheme(); + d->setCurrentTheme( defaultTheme ); + } } void ThemeComboBoxPrivate::slotLoadThemes() { + if (!Manager::instance()) + return; q->clear(); // Get all message list themes and sort them into alphabetical order. diff -Nru kdepim-4.13.0/messagelist/utils/themeconfigbutton.cpp kdepim-4.13.3/messagelist/utils/themeconfigbutton.cpp --- kdepim-4.13.0/messagelist/utils/themeconfigbutton.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/utils/themeconfigbutton.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -69,6 +69,7 @@ if ( d->mThemeComboBox != 0 ) connect( this, SIGNAL(configureDialogCompleted()), d->mThemeComboBox, SLOT(slotLoadThemes()) ); + setEnabled(Manager::instance()); } ThemeConfigButton::~ThemeConfigButton() diff -Nru kdepim-4.13.0/messagelist/widget.cpp kdepim-4.13.3/messagelist/widget.cpp --- kdepim-4.13.0/messagelist/widget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messagelist/widget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -62,7 +62,7 @@ { public: Private( Widget *owner ) - : q( owner ), mLastSelectedMessage(-1), mXmlGuiClient( 0 ) { } + : q( owner ), mLastSelectedMessage(-1), mXmlGuiClient( 0 ), mMonitor( 0 ) { } Akonadi::Item::List selectionAsItems() const; Akonadi::Item itemForRow( int row ) const; diff -Nru kdepim-4.13.0/messageviewer/adblock/adblockmanager.cpp kdepim-4.13.3/messageviewer/adblock/adblockmanager.cpp --- kdepim-4.13.0/messageviewer/adblock/adblockmanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/adblock/adblockmanager.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -29,6 +29,7 @@ #include "adblockmanager.h" #include "settings/globalsettings.h" +#include "adblock/adblockutil.h" #include "webpage.h" @@ -139,7 +140,7 @@ } // load local rules - const QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QLatin1String("adblockrules_local")); + const QString localRulesFilePath = MessageViewer::AdBlockUtil::localFilterPath(); loadRules(localRulesFilePath); } @@ -148,7 +149,7 @@ { QFile ruleFile(rulesFilePath); if (!ruleFile.open(QFile::ReadOnly | QFile::Text)) { - kDebug() << "Unable to open rule file" << rulesFilePath; + qDebug() << "Unable to open rule file" << rulesFilePath; return; } @@ -320,14 +321,14 @@ { const QString n = QString::number(i + 1); - QString rulesFilePath = KStandardDirs::locateLocal("appdata" , QLatin1String("adblockrules_") + n); + const QString rulesFilePath = KStandardDirs::locateLocal("data" , QLatin1String("kmail2/adblockrules_") + n); return QFile::exists(rulesFilePath); } void AdBlockManager::addCustomRule(const QString &stringRule, bool reloadPage) { // save rule in local filters - const QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QLatin1String("adblockrules_local")); + const QString localRulesFilePath = MessageViewer::AdBlockUtil::localFilterPath(); QFile ruleFile(localRulesFilePath); if (!ruleFile.open(QFile::ReadOnly)) { diff -Nru kdepim-4.13.0/messageviewer/adblock/adblocksettingwidget.cpp kdepim-4.13.3/messageviewer/adblock/adblocksettingwidget.cpp --- kdepim-4.13.0/messageviewer/adblock/adblocksettingwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/adblock/adblocksettingwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -32,6 +32,7 @@ #include "adblockaddsubscriptiondialog.h" #include "adblockmanager.h" #include "adblockshowlistdialog.h" +#include "adblock/adblockutil.h" #include "pimcommon/widgets/configureimmutablewidgetutils.h" using namespace PimCommon::ConfigureImmutableWidgetUtils; @@ -226,7 +227,7 @@ // ------------------------------------------------------------------------------ // local filters - const QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QLatin1String("adblockrules_local")); + const QString localRulesFilePath = MessageViewer::AdBlockUtil::localFilterPath(); QFile ruleFile(localRulesFilePath); if (!ruleFile.open(QFile::ReadOnly | QFile::Text)) { @@ -270,14 +271,14 @@ grp.writeEntry(QLatin1String("lastUpdate"), subItem->data(LastUpdateList).toDateTime()); QString path = subItem->data(PathList).toString(); if (path.isEmpty()) { - path = KStandardDirs::locateLocal("appdata", QString::fromLatin1("adblockrules-%1").arg(i)); + path = KStandardDirs::locateLocal("data", QString::fromLatin1("kmail2/adblockrules-%1").arg(i)); } grp.writeEntry(QLatin1String("path"), path); } config.sync(); // local filters - const QString localRulesFilePath = KStandardDirs::locateLocal("appdata" , QLatin1String("adblockrules_local")); + const QString localRulesFilePath = MessageViewer::AdBlockUtil::localFilterPath(); QFile ruleFile(localRulesFilePath); if (!ruleFile.open(QFile::WriteOnly | QFile::Text)) { diff -Nru kdepim-4.13.0/messageviewer/adblock/adblockshowlistdialog.cpp kdepim-4.13.3/messageviewer/adblock/adblockshowlistdialog.cpp --- kdepim-4.13.0/messageviewer/adblock/adblockshowlistdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/adblock/adblockshowlistdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -115,16 +115,12 @@ { mProgress->stop(); if (job->error()) { - mTemporaryFile->close(); - delete mTemporaryFile; - mTemporaryFile = 0; mTextEdit->editor()->setPlainText(i18n("An error occurs during download list: \"%1\"", job->errorString())); - return; - } - - QFile f(mTemporaryFile->fileName()); - if (f.open(QIODevice::ReadOnly|QIODevice::Text)) { - mTextEdit->editor()->setPlainText(QString::fromUtf8(f.readAll())); + } else { + QFile f(mTemporaryFile->fileName()); + if (f.open(QIODevice::ReadOnly|QIODevice::Text)) { + mTextEdit->editor()->setPlainText(QString::fromUtf8(f.readAll())); + } } mTemporaryFile->close(); delete mTemporaryFile; diff -Nru kdepim-4.13.0/messageviewer/adblock/adblockutil.cpp kdepim-4.13.3/messageviewer/adblock/adblockutil.cpp --- kdepim-4.13.0/messageviewer/adblock/adblockutil.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/adblock/adblockutil.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -17,6 +17,8 @@ #include "adblockutil.h" +#include + QMap MessageViewer::AdBlockUtil::listSubscriptions() { QMap lst; @@ -36,7 +38,7 @@ lst.insert(QString::fromUtf8("EasyPrivacy+Cédrics Liste"), QLatin1String("https://easylist-downloads.adblockplus.org/easyprivacy+cedrics.txt")); lst.insert(QString::fromUtf8("EasyPrivacy"), QLatin1String("https://easylist-downloads.adblockplus.org/easyprivacy.txt")); lst.insert(QString::fromUtf8("void.gr"), QLatin1String("http://www.void.gr/kargig/void-gr-filters.txt")); - lst.insert(QString::fromUtf8("Wiltteri"), QLatin1String("http://www.wiltteri.net/wiltteri.txt")); + //lst.insert(QString::fromUtf8("Wiltteri"), QLatin1String("http://www.wiltteri.net/wiltteri.txt")); lst.insert(QString::fromUtf8("ChinaList"), QLatin1String("http://adblock-chinalist.googlecode.com/svn/trunk/adblock.txt")); lst.insert(QString::fromUtf8("Filter von Dr.Evil"), QLatin1String("http://adblock.maltekraus.de/adblock.txt")); lst.insert(QString::fromUtf8("RuAdList"), QLatin1String("http://ruadlist.googlecode.com/svn/trunk/adblock.txt")); @@ -62,3 +64,9 @@ lst.insert(QString::fromUtf8("Corset+EasyList"), QLatin1String("https://easylist-downloads.adblockplus.org/corset+easylist.txt")); return lst; } + + +QString MessageViewer::AdBlockUtil::localFilterPath() +{ + return KStandardDirs::locateLocal("data" , QLatin1String("kmail2/adblockrules_local")); +} diff -Nru kdepim-4.13.0/messageviewer/adblock/adblockutil.h kdepim-4.13.3/messageviewer/adblock/adblockutil.h --- kdepim-4.13.0/messageviewer/adblock/adblockutil.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/adblock/adblockutil.h 2014-07-09 12:18:50.000000000 +0000 @@ -24,6 +24,9 @@ namespace MessageViewer { namespace AdBlockUtil { QMap listSubscriptions(); + +QString localFilterPath(); + } } diff -Nru kdepim-4.13.0/messageviewer/CMakeLists.txt kdepim-4.13.3/messageviewer/CMakeLists.txt --- kdepim-4.13.0/messageviewer/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/CMakeLists.txt 2014-07-09 12:18:50.000000000 +0000 @@ -91,6 +91,7 @@ ) set(libmessageviewer_widgets_SRCS + widgets/customheadersettingdialog.cpp widgets/attachmentdialog.cpp widgets/configurewidget.cpp diff -Nru kdepim-4.13.0/messageviewer/header/contactdisplaymessagememento.cpp kdepim-4.13.3/messageviewer/header/contactdisplaymessagememento.cpp --- kdepim-4.13.0/messageviewer/header/contactdisplaymessagememento.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/header/contactdisplaymessagememento.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2012,2013 Laurent Montel +/* Copyright (C) 2012,2013,2014 Laurent Montel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -30,7 +30,7 @@ { if( !emailAddress.isEmpty() ) { Akonadi::ContactSearchJob *searchJob = new Akonadi::ContactSearchJob(); - searchJob->setQuery( Akonadi::ContactSearchJob::Email, emailAddress.toLower() ); + searchJob->setQuery( Akonadi::ContactSearchJob::Email, emailAddress.toLower(), Akonadi::ContactSearchJob::ExactMatch ); connect( searchJob, SIGNAL(result(KJob*)), this, SLOT(slotSearchJobFinished(KJob*)) ); } else { @@ -79,16 +79,6 @@ return mMailAllowToRemoteContent; } -bool ContactDisplayMessageMemento::forceToHtml() const -{ - return ( mForceDisplayTo == Viewer::Html ); -} - -bool ContactDisplayMessageMemento::forceToText() const -{ - return ( mForceDisplayTo == Viewer::Text ); -} - void ContactDisplayMessageMemento::searchPhoto(const KABC::AddresseeList &list) { Q_FOREACH (const KABC::Addressee &addressee, list) { diff -Nru kdepim-4.13.0/messageviewer/header/contactdisplaymessagememento.h kdepim-4.13.3/messageviewer/header/contactdisplaymessagememento.h --- kdepim-4.13.0/messageviewer/header/contactdisplaymessagememento.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/header/contactdisplaymessagememento.h 2014-07-09 12:18:50.000000000 +0000 @@ -40,8 +40,6 @@ ~ContactDisplayMessageMemento(); void processAddress( const KABC::Addressee& addressee ); bool allowToRemoteContent() const; - bool forceToHtml() const; - bool forceToText() const; KABC::Picture photo() const; bool finished() const; diff -Nru kdepim-4.13.0/messageviewer/header/fancyheaderstyle.cpp kdepim-4.13.3/messageviewer/header/fancyheaderstyle.cpp --- kdepim-4.13.0/messageviewer/header/fancyheaderstyle.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/header/fancyheaderstyle.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -186,7 +186,7 @@ headerStr.append(QString::fromLatin1("%1\n" "%2\n") .arg(i18n("User-Agent: ")) - .arg( MessageViewer::HeaderStyleUtil::strToHtml( QLatin1String(message->headerByType("User-Agent")->as7BitString() )) ) ); + .arg( MessageViewer::HeaderStyleUtil::strToHtml( message->headerByType("User-Agent")->asUnicodeString() ) ) ); } } @@ -195,7 +195,7 @@ headerStr.append(QString::fromLatin1("%1\n" "%2\n") .arg(i18n("X-Mailer: ")) - .arg( MessageViewer::HeaderStyleUtil::strToHtml( QLatin1String(message->headerByType("X-Mailer")->as7BitString() ) ) ) ); + .arg( MessageViewer::HeaderStyleUtil::strToHtml( message->headerByType("X-Mailer")->asUnicodeString() ) ) ); } } } diff -Nru kdepim-4.13.0/messageviewer/header/grantleeheaderformatter.cpp kdepim-4.13.3/messageviewer/header/grantleeheaderformatter.cpp --- kdepim-4.13.0/messageviewer/header/grantleeheaderformatter.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/header/grantleeheaderformatter.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -71,7 +71,6 @@ { d->templateLoader->setTemplateDirs( QStringList() << absolutPath ); Grantlee::Template headerTemplate = d->engine->loadByName( filename ); - qDebug()<<" absolutPath"<error() ) { return headerTemplate->errorString(); } @@ -150,11 +149,11 @@ if ( GlobalSettings::self()->showUserAgent() ) { if ( message->headerByType("User-Agent") ) { - headerObject.insert( QLatin1String( "useragent" ), MessageViewer::HeaderStyleUtil::strToHtml( QLatin1String(message->headerByType("User-Agent")->as7BitString() )) ); + headerObject.insert( QLatin1String( "useragent" ), MessageViewer::HeaderStyleUtil::strToHtml( message->headerByType("User-Agent")->asUnicodeString() ) ); } if ( message->headerByType("X-Mailer") ) { - headerObject.insert( QLatin1String( "xmailer" ), MessageViewer::HeaderStyleUtil::strToHtml( QLatin1String(message->headerByType("X-Mailer")->as7BitString() )) ); + headerObject.insert( QLatin1String( "xmailer" ), MessageViewer::HeaderStyleUtil::strToHtml( message->headerByType("X-Mailer")->asUnicodeString() ) ); } } diff -Nru kdepim-4.13.0/messageviewer/header/headerstyle_util.cpp kdepim-4.13.3/messageviewer/header/headerstyle_util.cpp --- kdepim-4.13.0/messageviewer/header/headerstyle_util.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/header/headerstyle_util.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -68,17 +68,18 @@ QString subjectString( KMime::Message *message, int flags ) { - QString subject; - if ( message->subject(false) ) { - subject = message->subject()->asUnicodeString(); - if ( subject.isEmpty() ) - subject = i18n("No Subject"); + QString subjectStr; + const KMime::Headers::Subject * const subject = message->subject(false); + if ( subject ) { + subjectStr = subject->asUnicodeString(); + if ( subjectStr.isEmpty() ) + subjectStr = i18n("No Subject"); else - subject = strToHtml( subject, flags ); + subjectStr = strToHtml( subjectStr, flags ); } else { - subject = i18n("No Subject"); + subjectStr = i18n("No Subject"); } - return subject; + return subjectStr; } QString subjectDirectionString( KMime::Message *message ) diff -Nru kdepim-4.13.0/messageviewer/job/createtodojob.cpp kdepim-4.13.3/messageviewer/job/createtodojob.cpp --- kdepim-4.13.0/messageviewer/job/createtodojob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/job/createtodojob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -83,7 +83,9 @@ KMime::Message::Ptr msg = mItem.payload(); KCalCore::Attachment::Ptr attachmentPtr(new KCalCore::Attachment( msg->encodedContent().toBase64(), KMime::Message::mimeType() )); - attachmentPtr->setLabel(msg->subject(false)->asUnicodeString()); + const KMime::Headers::Subject * const subject = msg->subject(false); + if (subject) + attachmentPtr->setLabel(subject->asUnicodeString()); mTodoPtr->addAttachment(attachmentPtr); Akonadi::Item newTodoItem; diff -Nru kdepim-4.13.0/messageviewer/notify/messageviewer.notifyrc kdepim-4.13.3/messageviewer/notify/messageviewer.notifyrc --- kdepim-4.13.0/messageviewer/notify/messageviewer.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/notify/messageviewer.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -7,9 +7,12 @@ Comment[da]=Brevfremviser Comment[de]=Nachrichtenanzeige Comment[el]=Προβολέας μηνυμάτων +Comment[en_GB]=Message Viewer Comment[es]=Visor de mensajes +Comment[et]=Kirjade näitaja Comment[fi]=Viestikatselin Comment[fr]=Afficheur de messages +Comment[gl]=Visor de mensaxes Comment[hu]=Üzenetmegjelenítő Comment[ia]=Visor de Message Comment[it]=Visualizzatore del messaggio @@ -33,12 +36,14 @@ [Event/adblock-list-download-done] Name=New Ad-Block list download done Name[bs]=Preuzimanje nove liste za blokiranje reklama završeno -Name[ca]=La baixada de la nova llista de bloqueig publicitari està completa +Name[ca]=La baixada de la nova llista de bloqueig publicitari ha finalitzat Name[ca@valencia]=La baixada de la nova llista de bloqueig publicitari està completa Name[da]=Download af ny Ad-Block-liste gennemført Name[de]=Das Herunterladen der neuen Werbefilterliste ist abgeschlossen Name[el]=Η λήψη νέας λίστας Ad-Block ολοκληρώθηκε +Name[en_GB]=New Ad-Block list download done Name[es]=Realizada la descarga de la nueva lista de Ad-Block +Name[et]=Uus Ad-Blocki loend on alla laaditud Name[fi]=Uuden mainosestoluettelon lataus valmis Name[fr]=Téléchargement de la nouvelle liste Ad-Block terminé Name[gl]=Rematou a descarga da lista nova de Ad-Block @@ -65,12 +70,14 @@ Name[zh_TW]=新增 Ad-Block 清單下載完成 Comment=New Ad-Block list download done Comment[bs]=Preuzimanje nove liste za blokiranje reklama završeno -Comment[ca]=La baixada de la nova llista de bloqueig publicitari està completa +Comment[ca]=La baixada de la nova llista de bloqueig publicitari ha finalitzat Comment[ca@valencia]=La baixada de la nova llista de bloqueig publicitari està completa Comment[da]=Download af ny Ad-Block-liste gennemført Comment[de]=Das Herunterladen der neuen Werbefilterliste ist abgeschlossen Comment[el]=Η λήψη νέας λίστας Ad-Block ολοκληρώθηκε +Comment[en_GB]=New Ad-Block list download done Comment[es]=Realizada la descarga de la nueva lista de Ad-Block +Comment[et]=Uus Ad-Blocki loend on alla laaditud Comment[fi]=Uuden mainosestoluettelon lataus valmis Comment[fr]=Téléchargement de la nouvelle liste Ad-Block terminé Comment[gl]=Rematou a descarga da lista nova de Ad-Block @@ -105,7 +112,9 @@ Name[da]=Download af ny Ad-Block-liste mislykkedes Name[de]=Das Herunterladen der neuen Werbefilterliste ist fehlgeschlagen Name[el]=Η λήψη νέας λίστας Ad-Block απέτυχε +Name[en_GB]=New Ad-Block list download failed Name[es]=Falló la descarga de la nueva lista de Ad-Block +Name[et]=Uue Ad-Blocki loendi allalaadimine nurjus Name[fi]=Uuden mainosestoluettelon lataus epäonnistui Name[fr]=Impossible de télécharger la nouvelle liste Ad-Block Name[gl]=Fallou a descarga da lista nova de Ad-Block @@ -137,7 +146,9 @@ Comment[da]=Download af ny Ad-Block-liste mislykkedes Comment[de]=Das Herunterladen der neuen Werbefilterliste ist fehlgeschlagen Comment[el]=Η λήψη νέας λίστας Ad-Block απέτυχε +Comment[en_GB]=New Ad-Block list download failed Comment[es]=Falló la descarga de la nueva lista de Ad-Block +Comment[et]=Uue Ad-Blocki loendi allalaadimine nurjus Comment[fi]=Uuden mainosestoluettelon lataus epäonnistui Comment[fr]=Impossible de télécharger la nouvelle liste Ad-Block Comment[gl]=Fallou a descarga da lista nova de Ad-Block diff -Nru kdepim-4.13.0/messageviewer/settings/messageviewer.kcfg.cmake kdepim-4.13.3/messageviewer/settings/messageviewer.kcfg.cmake --- kdepim-4.13.0/messageviewer/settings/messageviewer.kcfg.cmake 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/settings/messageviewer.kcfg.cmake 2014-07-09 12:18:50.000000000 +0000 @@ -186,6 +186,9 @@ + + false + diff -Nru kdepim-4.13.0/messageviewer/tests/htmlquotecolorertest.cpp kdepim-4.13.3/messageviewer/tests/htmlquotecolorertest.cpp --- kdepim-4.13.0/messageviewer/tests/htmlquotecolorertest.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/tests/htmlquotecolorertest.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -32,6 +32,7 @@ QFETCH( QString, expectedCode ); HTMLQuoteColorer colorer; + colorer.setEnableHtmlQuoteColorer(true); colorer.setQuoteColor( 0, QColor( "#FF0000" ) ); colorer.setQuoteColor( 1, QColor( "#00FF00" ) ); colorer.setQuoteColor( 2, QColor( "#0000FF" ) ); diff -Nru kdepim-4.13.0/messageviewer/tests/unencryptedmessagetest.cpp kdepim-4.13.3/messageviewer/tests/unencryptedmessagetest.cpp --- kdepim-4.13.0/messageviewer/tests/unencryptedmessagetest.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/tests/unencryptedmessagetest.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -38,6 +38,8 @@ void testForwardedOpenPGPSignedEncrypted(); void testSignedForwardedOpenPGPSignedEncrypted(); void testOpenPGPEncrypted(); + void testOpenPGPEncryptedNotDecrypted(); + void testInlinePGPEncryptedNotDecrypted(); }; QTEST_KDEMAIN( UnencryptedMessageTest, GUI ) @@ -192,4 +194,37 @@ QCOMPARE( unencryptedMessage->contents().size(), 0 ); } +void UnencryptedMessageTest::testOpenPGPEncryptedNotDecrypted() +{ + KMime::Message::Ptr originalMessage = readAndParseMail( QLatin1String("openpgp-encrypted.mbox") ); + + NodeHelper nodeHelper; + EmptySource emptySource; + emptySource.setAllowDecryption( false ); + ObjectTreeParser otp( &emptySource, &nodeHelper ); + otp.parseObjectTree( originalMessage.get() ); + + QCOMPARE( nodeHelper.overallEncryptionState( originalMessage.get() ), KMMsgFullyEncrypted ); + QCOMPARE( otp.plainTextContent().toLatin1().data(), "" ); + + KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage( originalMessage ); + QCOMPARE( (bool) unencryptedMessage, false ); +} + +void UnencryptedMessageTest::testInlinePGPEncryptedNotDecrypted() +{ + KMime::Message::Ptr originalMessage = readAndParseMail( QLatin1String("inlinepgpencrypted.mbox") ); + + NodeHelper nodeHelper; + EmptySource emptySource; + emptySource.setAllowDecryption( false ); + ObjectTreeParser otp( &emptySource, &nodeHelper ); + otp.parseObjectTree( originalMessage.get() ); + + QCOMPARE( otp.plainTextContent().toLatin1().data(), "" ); + + KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage( originalMessage ); + QCOMPARE( (bool) unencryptedMessage, false ); +} + #include "unencryptedmessagetest.moc" diff -Nru kdepim-4.13.0/messageviewer/themes/example/header.desktop kdepim-4.13.3/messageviewer/themes/example/header.desktop --- kdepim-4.13.0/messageviewer/themes/example/header.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/themes/example/header.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,7 +7,9 @@ Name[da]=Eksempel Name[de]=Beispiel Name[el]=Παράδειγμα +Name[en_GB]=Example Name[es]=Ejemplo +Name[et]=Näidis Name[fi]=Esimerkki Name[fr]=Exemple Name[gl]=Exemplo @@ -43,7 +45,9 @@ Description[da]=Eksempeltema på header. Description[de]=Beispieldesign für den Vorspann. Description[el]=Παράδειγμα θέματος για την επικεφαλίδα. +Description[en_GB]=Example theme for header. Description[es]=Tema o encabezado de ejemplo. +Description[et]=Päise näidisteema Description[fi]=Esimerkkiotsaketeema. Description[fr]=Thème exemple pour en-tête Description[gl]=Tema de exemplo para a cabeceira. diff -Nru kdepim-4.13.0/messageviewer/themes/example_fancy/header.desktop kdepim-4.13.3/messageviewer/themes/example_fancy/header.desktop --- kdepim-4.13.0/messageviewer/themes/example_fancy/header.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/themes/example_fancy/header.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -6,7 +6,9 @@ Name[da]=Eksempel på flot Name[de]=Dekoratives Beispiel Name[el]=Παράδειγμα φανταχτερού +Name[en_GB]=Example fancy Name[es]=Ejemplo elegante +Name[et]=Uhke näidis Name[fi]=Tyylikäs esimerkki Name[fr]=Exemple fantaisie Name[gl]=Exemplo elegante @@ -40,7 +42,9 @@ Description[da]=Opret flot tema med grantlee. Description[de]=Dekoratives mit Grantlee erstelltes Design Description[el]=Δημιουργία φανταχτερού θέματος με το grantlee. +Description[en_GB]=Create fancy theme with grantlee. Description[es]=Crear tema elegante con grantlee. +Description[et]=Vahva teema liimine grantleega Description[fi]=Luo tyylikäs teema grantleeta käyttäen. Description[fr]=Créer des thèmes fantaisies avec Grantlee Description[gl]=Crear un tema elegante con Grantlee. diff -Nru kdepim-4.13.0/messageviewer/viewer/htmlquotecolorer.cpp kdepim-4.13.3/messageviewer/viewer/htmlquotecolorer.cpp --- kdepim-4.13.0/messageviewer/viewer/htmlquotecolorer.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/viewer/htmlquotecolorer.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -19,6 +19,7 @@ */ #include "htmlquotecolorer.h" +#include "settings/globalsettings.h" #include @@ -31,9 +32,15 @@ using namespace MessageViewer; HTMLQuoteColorer::HTMLQuoteColorer() + : mEnableHtmlQuoteColorer(true) { } +void HTMLQuoteColorer::setEnableHtmlQuoteColorer(bool enabled) +{ + mEnableHtmlQuoteColorer = enabled; +} + QString HTMLQuoteColorer::process( const QString &htmlSource, QString&extraHead ) { #ifndef KDEPIM_NO_WEBKIT @@ -129,10 +136,11 @@ " return 0;\n" "}\n")); - page.settings()->setAttribute( QWebSettings::JavascriptEnabled, true ); - frame->evaluateJavaScript( script ); - page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); - + if (mEnableHtmlQuoteColorer) { + page.settings()->setAttribute( QWebSettings::JavascriptEnabled, true ); + frame->evaluateJavaScript( script ); + page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); + } const QWebElement body = frame->documentElement().findFirst(QLatin1String("body")); const QWebElement header = frame->documentElement().findFirst(QLatin1String("head")); diff -Nru kdepim-4.13.0/messageviewer/viewer/htmlquotecolorer.h kdepim-4.13.3/messageviewer/viewer/htmlquotecolorer.h --- kdepim-4.13.0/messageviewer/viewer/htmlquotecolorer.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/viewer/htmlquotecolorer.h 2014-07-09 12:18:50.000000000 +0000 @@ -51,8 +51,10 @@ */ QString process(const QString &htmlSource , QString &extraHead); + void setEnableHtmlQuoteColorer(bool enabled); private: QColor mQuoteColors[3]; + bool mEnableHtmlQuoteColorer; }; } diff -Nru kdepim-4.13.0/messageviewer/viewer/mailwebview_webkit.cpp kdepim-4.13.3/messageviewer/viewer/mailwebview_webkit.cpp --- kdepim-4.13.0/messageviewer/viewer/mailwebview_webkit.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/viewer/mailwebview_webkit.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -290,17 +290,7 @@ void MailWebView::scrollToAnchor( const QString & anchor ) { - QWebElement doc = page()->mainFrame()->documentElement(); - QWebElement link = doc.findFirst( QLatin1String("a[name=") + anchor +QLatin1Char(']') ); - if ( link.isNull() ) { - return; - } - - const int linkPos = link.geometry().bottom(); - const int viewerPos = page()->mainFrame()->scrollPosition().y(); - link.setFocus(); - page()->mainFrame()->scroll(0, linkPos - viewerPos ); - + page()->mainFrame()->scrollToAnchor(anchor); } bool MailWebView::removeAttachmentMarking( const QString & id ) diff -Nru kdepim-4.13.0/messageviewer/viewer/messagedisplayformatattribute.cpp kdepim-4.13.3/messageviewer/viewer/messagedisplayformatattribute.cpp --- kdepim-4.13.0/messageviewer/viewer/messagedisplayformatattribute.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/viewer/messagedisplayformatattribute.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -71,9 +71,9 @@ return result; } -void MessageDisplayFormatAttribute::setMessageFormat(Viewer::ForceDisplayTo html) +void MessageDisplayFormatAttribute::setMessageFormat(Viewer::ForceDisplayTo format) { - d->messageFormat = html; + d->messageFormat = format; } void MessageDisplayFormatAttribute::setRemoteContent(bool remote) diff -Nru kdepim-4.13.0/messageviewer/viewer/objecttreeparser.cpp kdepim-4.13.3/messageviewer/viewer/objecttreeparser.cpp --- kdepim-4.13.0/messageviewer/viewer/objecttreeparser.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/viewer/objecttreeparser.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -1223,6 +1223,7 @@ if ( mSource->htmlMail() ) { HTMLQuoteColorer colorer; + colorer.setEnableHtmlQuoteColorer(GlobalSettings::self()->htmlQuoteColorerEnabled()); QString extraHead; for ( int i = 0; i < 3; ++i ) colorer.setQuoteColor( i, cssHelper()->quoteColor( i ) ); @@ -2992,6 +2993,11 @@ QString text; if ( block.type() == Kpgp::PgpMessageBlock ) { + if ( !mSource->decryptMessage() ) { + writeDeferredDecryptionBlock(); + continue; + } + QByteArray decryptedData; bool signatureFound; bool actuallyEncrypted = true; diff -Nru kdepim-4.13.0/messageviewer/viewer/viewer.cpp kdepim-4.13.3/messageviewer/viewer/viewer.cpp --- kdepim-4.13.0/messageviewer/viewer/viewer.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/viewer/viewer.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -80,6 +80,8 @@ connect( d_ptr, SIGNAL(changeDisplayMail(Viewer::ForceDisplayTo,bool)), SLOT(slotChangeDisplayMail(Viewer::ForceDisplayTo,bool)) ); connect( d_ptr, SIGNAL(moveMessageToTrash()), SIGNAL(moveMessageToTrash())); + connect( KGlobalSettings::self(), SIGNAL(kdisplayFontChanged()), d_ptr, SLOT(slotGeneralFontChanged()) ); + setMessage( KMime::Message::Ptr(), Delayed ); } diff -Nru kdepim-4.13.0/messageviewer/viewer/viewer_p.cpp kdepim-4.13.3/messageviewer/viewer/viewer_p.cpp --- kdepim-4.13.0/messageviewer/viewer/viewer_p.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/viewer/viewer_p.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -225,7 +225,7 @@ } - mThemeManager = new GrantleeTheme::GrantleeThemeManager(QString::fromLatin1( "header.desktop" ), mActionCollection, QLatin1String("messageviewer/themes/")); + mThemeManager = new GrantleeTheme::GrantleeThemeManager(GrantleeTheme::GrantleeThemeManager::Mail, QString::fromLatin1( "header.desktop" ), mActionCollection, QLatin1String("messageviewer/themes/")); mThemeManager->setDownloadNewStuffConfigFile(QLatin1String("messageviewer_header_themes.knsrc")); connect(mThemeManager, SIGNAL(grantleeThemeSelected()), this, SLOT(slotGrantleeHeaders())); connect(mThemeManager, SIGNAL(updateThemes()), this, SLOT(slotGrantleeThemesUpdated())); @@ -1209,13 +1209,21 @@ mColorBar->update(); } +void ViewerPrivate::slotGeneralFontChanged() +{ + delete mCSSHelper; + mCSSHelper = new CSSHelper( mViewer ); + if ( mMessage ) + update(); +} + void ViewerPrivate::writeConfig( bool sync ) { GlobalSettings::self()->setUseFixedFont( mUseFixedFont ); if ( headerStyle() ) { GlobalSettings::self()->setHeaderStyle( QLatin1String(headerStyle()->name()) ); - GrantleeTheme::GrantleeSettings::self()->setGrantleeThemeName( headerStyle()->theme().dirName() ); + GrantleeTheme::GrantleeSettings::self()->setGrantleeMailThemeName( headerStyle()->theme().dirName() ); } if ( headerStrategy() ) GlobalSettings::self()->setHeaderSetDisplayed( QLatin1String(headerStrategy()->name()) ); @@ -2396,7 +2404,7 @@ void ViewerPrivate::initGrantleeThemeName() { - const QString themeName = GrantleeTheme::GrantleeSettings::self()->grantleeThemeName(); + const QString themeName = GrantleeTheme::GrantleeSettings::self()->grantleeMailThemeName(); headerStyle()->setTheme(mThemeManager->theme(themeName)); } diff -Nru kdepim-4.13.0/messageviewer/viewer/viewer_p.h kdepim-4.13.3/messageviewer/viewer/viewer_p.h --- kdepim-4.13.0/messageviewer/viewer/viewer_p.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/viewer/viewer_p.h 2014-07-09 12:18:50.000000000 +0000 @@ -611,6 +611,8 @@ void slotExpandShortUrl(); void slotShowCreateTodoWidget(); + void slotGeneralFontChanged(); + signals: void showStatusBarMessage( const QString &message ); void replaceMsgByUnencryptedVersion(); diff -Nru kdepim-4.13.0/messageviewer/widgets/configurewidget.cpp kdepim-4.13.3/messageviewer/widgets/configurewidget.cpp --- kdepim-4.13.0/messageviewer/widgets/configurewidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/widgets/configurewidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -18,14 +18,13 @@ */ #include "configurewidget.h" +#include "customheadersettingdialog.h" #include "ui_settings.h" #include "utils/util.h" #include "settings/globalsettings.h" #include "viewer/nodehelper.h" -#include "header/customheadersettingwidget.h" - #include "messagecore/settings/globalsettings.h" #include @@ -147,16 +146,11 @@ void ConfigureWidget::showCustomHeadersDialog() { - KDialog dialog( this ); - dialog.setButtons( KDialog::Default | KDialog::Ok | KDialog::Cancel ); - dialog.resize(500,250); - CustomHeaderSettingWidget *widget = new CustomHeaderSettingWidget(); - connect( &dialog, SIGNAL(defaultClicked()), widget, SLOT(resetToDefault()) ); - widget->readConfig(); - dialog.setMainWidget( widget ); - if ( dialog.exec() == QDialog::Accepted ) { - widget->writeConfig(); + QPointer dlg = new CustomHeaderSettingDialog(this); + if ( dlg->exec() ) { + dlg->writeSettings(); settingsChanged(); } + delete dlg; } diff -Nru kdepim-4.13.0/messageviewer/widgets/customheadersettingdialog.cpp kdepim-4.13.3/messageviewer/widgets/customheadersettingdialog.cpp --- kdepim-4.13.0/messageviewer/widgets/customheadersettingdialog.cpp 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/messageviewer/widgets/customheadersettingdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -0,0 +1,60 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 "customheadersettingdialog.h" +#include "header/customheadersettingwidget.h" +#include "settings/globalsettings.h" + +using namespace MessageViewer; + +CustomHeaderSettingDialog::CustomHeaderSettingDialog(QWidget *parent) + : KDialog(parent) +{ + setButtons( KDialog::Default | KDialog::Ok | KDialog::Cancel ); + mCustomHeaderWidget = new CustomHeaderSettingWidget(); + connect( this, SIGNAL(defaultClicked()), mCustomHeaderWidget, SLOT(resetToDefault()) ); + mCustomHeaderWidget->readConfig(); + setMainWidget( mCustomHeaderWidget ); + readConfig(); +} + +CustomHeaderSettingDialog::~CustomHeaderSettingDialog() +{ + writeConfig(); +} + +void CustomHeaderSettingDialog::readConfig() +{ + KConfigGroup group( MessageViewer::GlobalSettings::self()->config(), "CustomHeaderSettingDialog" ); + const QSize size = group.readEntry( "Size", QSize(500, 250) ); + if ( size.isValid() ) { + resize( size ); + } +} + +void CustomHeaderSettingDialog::writeConfig() +{ + KConfigGroup group( MessageViewer::GlobalSettings::self()->config(), "CustomHeaderSettingDialog" ); + group.writeEntry( "Size", size() ); + group.sync(); +} + +void CustomHeaderSettingDialog::writeSettings() +{ + mCustomHeaderWidget->writeConfig(); +} + diff -Nru kdepim-4.13.0/messageviewer/widgets/customheadersettingdialog.h kdepim-4.13.3/messageviewer/widgets/customheadersettingdialog.h --- kdepim-4.13.0/messageviewer/widgets/customheadersettingdialog.h 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/messageviewer/widgets/customheadersettingdialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -0,0 +1,42 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 CUSTOMHEADERSETTINGDIALOG_H +#define CUSTOMHEADERSETTINGDIALOG_H + +#include + +namespace MessageViewer { +class CustomHeaderSettingWidget; +class CustomHeaderSettingDialog : public KDialog +{ + Q_OBJECT +public: + explicit CustomHeaderSettingDialog(QWidget *parent=0); + ~CustomHeaderSettingDialog(); + + void writeSettings(); + +private: + void readConfig(); + void writeConfig(); + + CustomHeaderSettingWidget *mCustomHeaderWidget; +}; +} + +#endif // CUSTOMHEADERSETTINGDIALOG_H diff -Nru kdepim-4.13.0/messageviewer/widgets/todoedit.cpp kdepim-4.13.3/messageviewer/widgets/todoedit.cpp --- kdepim-4.13.0/messageviewer/widgets/todoedit.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/messageviewer/widgets/todoedit.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -99,8 +99,10 @@ void TodoEdit::writeConfig() { - MessageViewer::GlobalSettingsBase::self()->setLastSelectedFolder(mCollectionCombobox->currentCollection().id()); - MessageViewer::GlobalSettingsBase::self()->writeConfig(); + if (MessageViewer::GlobalSettingsBase::self()->lastSelectedFolder() != mCollectionCombobox->currentCollection().id()) { + MessageViewer::GlobalSettingsBase::self()->setLastSelectedFolder(mCollectionCombobox->currentCollection().id()); + MessageViewer::GlobalSettingsBase::self()->writeConfig(); + } } void TodoEdit::readConfig() diff -Nru kdepim-4.13.0/mobile/mail/kmail-mobile.notifyrc kdepim-4.13.3/mobile/mail/kmail-mobile.notifyrc --- kdepim-4.13.0/mobile/mail/kmail-mobile.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mobile/mail/kmail-mobile.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -7,6 +7,7 @@ Comment[da]=KDE Kontact Touch e-mail-klient Comment[de]=E-Mail-Programm für KDE Kontact Touch Comment[el]=KDE Kontact Touch πελάτης αλληλογραφίας +Comment[en_GB]=KDE Kontact Touch e-mail client Comment[es]=Cliente de correo KDE Kontact táctil Comment[et]=KDE Kontact Touchi e-posti klient Comment[fi]=KDE Kontact Touch -sähköpostiohjelma @@ -49,12 +50,13 @@ Name[da]=Kontact Touch E-mail Name[de]=Mail-Modul für Kontact Touch Name[el]=Αλληλογραφία Kontact Touch +Name[en_GB]=Kontact Touch Mail Name[es]=Correo Kontact táctil Name[et]=Kontact Touchi e-post Name[fi]=Kontact Touch Mail Name[fr]=Messagerie Kontact Touch Name[ga]=Ríomhphost Kontact Touch -Name[gl]=Correco Touch do Kontact +Name[gl]=Correo Touch do Kontact Name[hu]=Kontact Touch levelező Name[ia]=Posta de Touch de Kontact Name[it]=Kontact Touch Mail @@ -144,7 +146,7 @@ Comment[et]=Kirja saatmisel tekkis viga. Comment[fi]=Yritettäessä lähettää sähköpostia sattui virhe. Comment[fr]=Il y a eu une erreur lors de l'envoi du courriel. -Comment[gl]=Produciuse un erro cando se comprobaba o correo novo +Comment[gl]=Produciuse un erro ao comprobar o correo novo Comment[hu]=Hiba történt az e-mail küldése közben. Comment[ia]=Un error occurreva durante le expedition del e-posta. Comment[it]=Si è verificato un errore durante l'invio del messaggio di posta. diff -Nru kdepim-4.13.0/mobile/tasks/tasks-mobile.desktop kdepim-4.13.3/mobile/tasks/tasks-mobile.desktop --- kdepim-4.13.0/mobile/tasks/tasks-mobile.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/mobile/tasks/tasks-mobile.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -8,6 +8,7 @@ Name[da]=Opgaver Name[de]=Aufgaben Name[el]=Εργασίες +Name[en_GB]=Tasks Name[es]=Tareas Name[et]=Ülesanded Name[fi]=Tehtävät diff -Nru kdepim-4.13.0/noteshared/alarms/notealarmdialog.cpp kdepim-4.13.3/noteshared/alarms/notealarmdialog.cpp --- kdepim-4.13.0/noteshared/alarms/notealarmdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/noteshared/alarms/notealarmdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -63,6 +63,9 @@ QRadioButton *label_at = new QRadioButton( i18n( "Alarm &at:" ), at ); m_atDate = new KDateComboBox( at ); m_atTime = new KTimeComboBox( at ); + const QDateTime dateTime = QDateTime::currentDateTime(); + m_atDate->setMinimumDate(dateTime.date()); + m_atTime->setMinimumTime(dateTime.time()); at->setStretchFactor( m_atDate, 1 ); layout->addWidget( at ); m_buttons->addButton( label_at, 1 ); diff -Nru kdepim-4.13.0/noteshared/job/createnewnotejob.cpp kdepim-4.13.3/noteshared/job/createnewnotejob.cpp --- kdepim-4.13.0/noteshared/job/createnewnotejob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/noteshared/job/createnewnotejob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -69,6 +69,9 @@ QPointer dlg = new SelectedNotefolderDialog(mWidget); if (dlg->exec()) { col = dlg->selectedCollection(); + } else { + deleteLater(); + return; } if (dlg->useFolderByDefault()) { NoteShared::NoteSharedGlobalConfig::self()->setDefaultFolder(col.id()); @@ -85,7 +88,7 @@ void CreateNewNoteJob::slotFetchCollection(KJob* job) { if (job->error()) { - qDebug()<<" Error during fetch"; + qDebug()<<" Error during fetch: "<errorString(); deleteLater(); return; } diff -Nru kdepim-4.13.0/noteshared/noteshared_export.h kdepim-4.13.3/noteshared/noteshared_export.h --- kdepim-4.13.0/noteshared/noteshared_export.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/noteshared/noteshared_export.h 2014-07-09 12:18:50.000000000 +0000 @@ -27,7 +27,7 @@ # if defined(KDEPIM_STATIC_LIBS) /* No export/import for static libraries */ # define NOTESHARED_EXPORT -# elif defined(MAKE_PIMCOMMON_LIB) +# elif defined(MAKE_NOTESHARED_LIB) /* We are building this library */ # define NOTESHARED_EXPORT KDE_EXPORT # else diff -Nru kdepim-4.13.0/noteshared/noteutils.cpp kdepim-4.13.3/noteshared/noteutils.cpp --- kdepim-4.13.0/noteshared/noteutils.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/noteshared/noteutils.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -64,21 +64,19 @@ if ( hostDlg->exec() ) { const QString host = hostDlg->host(); + if ( host.isEmpty() ) { + KMessageBox::sorry( parent, i18n( "The host cannot be empty." ) ); + delete hostDlg; + return; + } quint16 port = hostDlg->port(); if ( !port ) { // not specified, use default port = NoteShared::NoteSharedGlobalConfig::port(); } - if ( host.isEmpty() ) { - KMessageBox::sorry( parent, i18n( "The host cannot be empty." ) ); - delete hostDlg; - return; - } // Send the note - - //TODO verify connectToHost NoteShared::NotesNetworkSender *sender = new NoteShared::NotesNetworkSender( KSocketFactory::connectToHost( QLatin1String("notes"), host, port ) ); sender->setSenderId( NoteShared::NoteSharedGlobalConfig::senderID() ); @@ -91,8 +89,12 @@ QString NoteShared::NoteUtils::createToolTip(const Akonadi::Item &item) { const KMime::Message::Ptr noteMessage = item.payload(); + if (!noteMessage) + return QString(); const QString description = QString::fromUtf8(noteMessage->mainBodyPart()->decodedContent()); - const QString realName = noteMessage->subject(false)->asUnicodeString(); + const KMime::Headers::Subject * const subject = noteMessage->subject(false); + + const QString realName = subject ? subject->asUnicodeString() : QString(); const bool isRichText = noteMessage->contentType()->isHTMLText(); QString tip; @@ -127,11 +129,7 @@ QString content = description; if ( !content.trimmed().isEmpty() ) { - if ( textIsLeftToRight ) { - tip += htmlCodeForStandardRow.arg(bckColorName).arg( txtColorName ).arg( isRichText ? content : content.replace( QLatin1Char( '\n' ), QLatin1String( "
    " ) ) ); - } else { - tip += htmlCodeForStandardRow.arg(bckColorName).arg( txtColorName ).arg( isRichText ? content : content.replace( QLatin1Char( '\n' ), QLatin1String( "
    " ) ) ); - } + tip += htmlCodeForStandardRow.arg(bckColorName).arg( txtColorName ).arg( isRichText ? content : content.replace( QLatin1Char( '\n' ), QLatin1String( "
    " ) ) ); } tip += QString::fromLatin1( diff -Nru kdepim-4.13.0/noteshared/widget/notelistwidget.cpp kdepim-4.13.3/noteshared/widget/notelistwidget.cpp --- kdepim-4.13.0/noteshared/widget/notelistwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/noteshared/widget/notelistwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -69,7 +69,10 @@ if (!noteMessage) return; QListWidgetItem *item =new QListWidgetItem(this); - item->setText(noteMessage->subject(false)->asUnicodeString()); + + const KMime::Headers::Subject * const subject = noteMessage->subject(false); + if (subject) + item->setText(subject->asUnicodeString()); item->setToolTip(NoteShared::NoteUtils::createToolTip(note)); item->setData(AkonadiId, note.id()); diff -Nru kdepim-4.13.0/pimactivity/activitymanager.cpp kdepim-4.13.3/pimactivity/activitymanager.cpp --- kdepim-4.13.0/pimactivity/activitymanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/activitymanager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,168 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "activitymanager.h" - -#include -#include - -#include - -namespace PimActivity { - -class ActivityManagerPrivate -{ -public: - ActivityManagerPrivate(ActivityManager *qq) - : isEnabled(false), - q(qq), - selectComponents(ActivityManager::None) - { - consumer = new KActivities::Consumer; - const QStringList activities = consumer->listActivities(); - Q_FOREACH (const QString &id, activities) { - insertActivity(id); - } - - q->connect(consumer,SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)),q,SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus))); - q->connect(consumer,SIGNAL(activityAdded(QString)),q,SLOT(slotActivityAdded(QString))); - q->connect(consumer,SIGNAL(activityRemoved(QString)),q,SLOT(slotActivityRemoved(QString))); - q->connect(consumer,SIGNAL(currentActivityChanged(QString)),q,SIGNAL(currentActivityChanged(QString))); - } - ~ActivityManagerPrivate() - { - delete consumer; - } - - void insertActivity(const QString &id) - { - KActivities::Info *activity = new KActivities::Info(id, q); - activities[id] = activity; - } - - void slotActivityRemoved(const QString &id) - { - KActivities::Info *activity = activities.take(id); - delete activity; - emit q->activityRemoved(id); - } - - void slotActivityAdded(const QString &id) - { - insertActivity(id); - emit q->activityAdded(id); - } - - QHash listActivitiesWithRealName() const - { - QHash result; - QHashIterator i(activities); - while (i.hasNext()) { - i.next(); - result.insert(i.key(), i.value()->name()); - } - return result; - } - - bool isEnabled; - QHash activities; - ActivityManager *q; - KActivities::Consumer *consumer; - ActivityManager::SelectComponents selectComponents; -}; - -ActivityManager::ActivityManager(QObject *parent) - : QObject(parent), d(new ActivityManagerPrivate(this)) -{ - if (KActivities::Consumer::serviceStatus() == KActivities::Consumer::NotRunning) { - qDebug()<<" kactivities is not running"; - } else { - const QString currentActivity = this->currentActivity(); - if (!currentActivity.isEmpty()) { - KSharedConfigPtr conf = ActivityManager::configFromActivity(currentActivity); - KConfigGroup grp = conf->group(QLatin1String("Global")); - d->isEnabled =grp.readEntry(QLatin1String("Enabled"), false); - } - } -} - -ActivityManager::~ActivityManager() -{ - delete d; -} - -void ActivityManager::setEnabledActivity(bool enabled) -{ - d->isEnabled = enabled; - Q_EMIT enabledActivityChanged(enabled); -} - -bool ActivityManager::isEnabledActivity() const -{ - return d->isEnabled; -} - -bool ActivityManager::isActive() const -{ - return (KActivities::Consumer::serviceStatus() == KActivities::Consumer::Running); -} - -QHash ActivityManager::listActivitiesWithRealName() const -{ - return d->listActivitiesWithRealName(); -} - -QStringList ActivityManager::listActivities() const -{ - if (isActive()) { - return d->consumer->listActivities(); - } - return QStringList(); -} - -QString ActivityManager::currentActivity() const -{ - if (isActive()) { - return d->consumer->currentActivity(); - } - return QString(); -} - -KSharedConfigPtr ActivityManager::configFromActivity(const QString &id) -{ - const QString configLocal = KStandardDirs::locateLocal( "data", QString::fromLatin1("activitymanager/activities/%1/config/pimactivityrc").arg(id) ); - return KSharedConfig::openConfig( configLocal ); -} - -void ActivityManager::setSelectComponents(ActivityManager::SelectComponents selection) -{ - d->selectComponents = selection; -} - -ActivityManager::SelectComponents ActivityManager::selectComponents() const -{ - return d->selectComponents; -} - - - -} - -#include "moc_activitymanager.cpp" diff -Nru kdepim-4.13.0/pimactivity/activitymanager.h kdepim-4.13.3/pimactivity/activitymanager.h --- kdepim-4.13.0/pimactivity/activitymanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/activitymanager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 ACTIVITYMANAGER_H -#define ACTIVITYMANAGER_H - -#include "pimactivity_export.h" -#include - -#include - -#include - -namespace PimActivity { -class ActivityManagerPrivate; -class PIMACTIVITY_EXPORT ActivityManager : public QObject -{ - Q_OBJECT -public: - explicit ActivityManager(QObject *parent = 0); - ~ActivityManager(); - - enum SelectComponent { - None = 0, - Identity = 1, - MailTransport = 2, - Collection = 4 - }; - Q_DECLARE_FLAGS( SelectComponents, SelectComponent ) - - void setSelectComponents(ActivityManager::SelectComponents selection); - ActivityManager::SelectComponents selectComponents() const; - - bool isActive() const; - - QStringList listActivities() const; - QHash listActivitiesWithRealName() const; - QString currentActivity() const; - - void setEnabledActivity(bool enabled); - bool isEnabledActivity() const; - - static KSharedConfigPtr configFromActivity(const QString &id); - -Q_SIGNALS: - void serviceStatusChanged(KActivities::Consumer::ServiceStatus); - void activityAdded(const QString &); - void activityRemoved(const QString &); - void currentActivityChanged(const QString &); - void enabledActivityChanged(bool enabled); - -private: - friend class ActivityManagerPrivate; - ActivityManagerPrivate * const d; - Q_PRIVATE_SLOT( d, void slotActivityAdded(const QString &)) - Q_PRIVATE_SLOT( d, void slotActivityRemoved(const QString &)) -}; -} - -#endif // ACTIVITYMANAGER_H diff -Nru kdepim-4.13.0/pimactivity/CMakeLists.txt kdepim-4.13.3/pimactivity/CMakeLists.txt --- kdepim-4.13.0/pimactivity/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -PROJECT( pimactivity ) - -find_package(KActivities 6.2.0 QUIET CONFIG) -set_package_properties(KActivities PROPERTIES DESCRIPTION "KActivities" URL "https://projects.kde.org/projects/kde/kdelibs/kactivities" TYPE RECOMMENDED PURPOSE "Required for Activities integration in kdepim." ) - - -if(KActivities_FOUND) - -include_directories(${KACTIVITIES_INCLUDE_DIRS} .) - -add_definitions( -DQT_NO_CAST_FROM_ASCII ) -add_definitions( -DQT_NO_CAST_TO_ASCII ) - - -set(libpimactivity_SRCS - widgets/comboboxactivity.cpp - widgets/configureidentity.cpp - activitymanager.cpp - configureactivitywidget.cpp - pimwidgets/mailtransport/transportcomboboxactivity.cpp - pimwidgets/identity/identitycomboboxactivity.cpp - pimwidgets/identity/identitymanageractivity.cpp - widgets/configurecollections.cpp - widgets/configuremailtransport.cpp - widgets/activitywarning.cpp - widgets/abstractconfigurewidget.cpp -) - -qt4_add_dbus_adaptor(libpimactivity_SRCS pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml pimwidgets/identity/identitymanageractivity.h PimActivity::IdentityManagerActivity ) - -kde4_add_library(pimactivity ${LIBRARY_TYPE} ${libpimactivity_SRCS}) - -set_target_properties(pimactivity PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION}) - -target_link_libraries(pimactivity - ${KDE4_KDEUI_LIBS} - ${KDE4_KIO_LIBS} - ${KACTIVITIES_LIBRARY} - ${KDEPIMLIBS_KPIMIDENTITIES_LIBS} - ${KDEPIMLIBS_MAILTRANSPORT_LIBS} - ${KDEPIMLIBS_KMIME_LIBS} - ${KDEPIMLIBS_AKONADI_LIBS} - ${KDEPIMLIBS_KPIMUTILS_LIBS} - akonadi_next -) - - -install(TARGETS pimactivity ${INSTALL_TARGETS_DEFAULT_ARGS}) - -add_subdirectory(kcm) -add_subdirectory(tests) -endif() diff -Nru kdepim-4.13.0/pimactivity/configureactivitywidget.cpp kdepim-4.13.3/pimactivity/configureactivitywidget.cpp --- kdepim-4.13.0/pimactivity/configureactivitywidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/configureactivitywidget.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,185 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "configureactivitywidget.h" -#include "activitymanager.h" -#include "widgets/configureidentity.h" -#include "widgets/comboboxactivity.h" -#include "widgets/configuremailtransport.h" -#include "widgets/configurecollections.h" -#include "widgets/activitywarning.h" - -#include -#include - -#include -#include -#include - -namespace PimActivity { - -class ConfigureActivityWidgetPrivate { -public: - ConfigureActivityWidgetPrivate(ActivityManager *activityManager, ConfigureActivityWidget *qq) - : q(qq), - activateActivity( 0 ), - tabWidget( 0 ), - manager( activityManager ), - identity( 0 ), - mailTransport( 0 ) - { - QVBoxLayout * lay = new QVBoxLayout; - activateActivity = new QCheckBox(i18n("Enable Support Activity")); - activateActivity->setChecked(true); - lay->addWidget(activateActivity); - - lay->addWidget(new ActivityWarning(manager)); - - QHBoxLayout *verticalLayout = new QHBoxLayout; - QLabel *lab = new QLabel(i18n("Activities:")); - verticalLayout->addWidget(lab); - - activities = new ComboBoxActivity(manager, q); - - verticalLayout->addWidget(activities); - - - lay->addLayout(verticalLayout); - tabWidget = new KTabWidget; - - lay->addWidget(tabWidget); - q->setLayout(lay); - q->connect(activateActivity, SIGNAL(toggled(bool)), activities, SLOT(setEnabled(bool))); - q->connect(activateActivity, SIGNAL(toggled(bool)), tabWidget, SLOT(setEnabled(bool))); - q->connect(activateActivity, SIGNAL(toggled(bool)), q, SLOT(slotModified())); - - addPages(); - q->connect(activities, SIGNAL(activityChanged(QString)), q, SLOT(slotActivityChanged(QString))); - } - ~ConfigureActivityWidgetPrivate() - { - } - - void slotActivityChanged(const QString &id) - { - identity->setActivity(id); - mailTransport->setActivity(id); - collections->setActivity(id); - } - - void slotModified() - { - emit q->changed(true); - } - - void readConfig() - { - const QString currentActivity = manager->currentActivity(); - if (!currentActivity.isEmpty()) { - - KSharedConfigPtr conf = ActivityManager::configFromActivity(currentActivity); - KConfigGroup grp = conf->group(QLatin1String("Global")); - activateActivity->setChecked(grp.readEntry(QLatin1String("Enabled"), false)); - - identity->setCurrentActivity(currentActivity); - mailTransport->setCurrentActivity(currentActivity); - collections->setCurrentActivity(currentActivity); - } - } - - void writeConfig() - { - const QString currentActivity = manager->currentActivity(); - bool activityEnabled = false; - if (!currentActivity.isEmpty()) { - KSharedConfigPtr conf = ActivityManager::configFromActivity(currentActivity); - KConfigGroup grp = conf->group(QLatin1String("Global")); - activityEnabled = activateActivity->isChecked(); - grp.writeEntry(QLatin1String("Enabled"), activityEnabled); - - identity->writeConfig(currentActivity); - mailTransport->writeConfig(currentActivity); - collections->writeConfig(currentActivity); - } - manager->setEnabledActivity(activityEnabled); - } - - void setDefault() - { - activateActivity->setChecked(false); - identity->setDefault(); - mailTransport->setDefault(); - collections->setDefault(); - } - - void addPages() - { - identity = new ConfigureIdentity(q); - tabWidget->addTab(identity, i18n("Identity")); - q->connect(identity, SIGNAL(changed(bool)), q, SIGNAL(changed(bool))); - - mailTransport = new ConfigureMailtransport; - tabWidget->addTab(mailTransport, i18n("Transport")); - q->connect(mailTransport, SIGNAL(changed(bool)), q, SIGNAL(changed(bool))); - - collections = new ConfigureCollections; - tabWidget->addTab(collections, i18n("Collections")); - q->connect(collections, SIGNAL(changed(bool)), q, SIGNAL(changed(bool))); - } - - ConfigureActivityWidget *q; - QCheckBox *activateActivity; - KTabWidget *tabWidget; - ActivityManager *manager; - ConfigureIdentity *identity; - ComboBoxActivity *activities; - ConfigureMailtransport *mailTransport; - ConfigureCollections *collections; -}; - -ConfigureActivityWidget::ConfigureActivityWidget(ActivityManager *manager, QWidget *parent) - : QWidget(parent), d(new ConfigureActivityWidgetPrivate(manager, this)) -{ -} - -ConfigureActivityWidget::~ConfigureActivityWidget() -{ - delete d; -} - -void ConfigureActivityWidget::readConfig() -{ - d->readConfig(); -} - -void ConfigureActivityWidget::writeConfig() -{ - d->writeConfig(); -} - -void ConfigureActivityWidget::defaults() -{ - d->setDefault(); -} - -} - - -#include "moc_configureactivitywidget.cpp" diff -Nru kdepim-4.13.0/pimactivity/configureactivitywidget.h kdepim-4.13.3/pimactivity/configureactivitywidget.h --- kdepim-4.13.0/pimactivity/configureactivitywidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/configureactivitywidget.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 CONFIGUREACTIVITYWIDGET_H -#define CONFIGUREACTIVITYWIDGET_H - -#include "pimactivity_export.h" - -#include - -class KTabWidget; - -namespace PimActivity { -class ConfigureActivityWidgetPrivate; -class ActivityManager; -class PIMACTIVITY_EXPORT ConfigureActivityWidget : public QWidget -{ - Q_OBJECT -public: - explicit ConfigureActivityWidget(PimActivity::ActivityManager *manager, QWidget *parent = 0); - ~ConfigureActivityWidget(); - - enum ConfigureType { - Identity, - MailTransport, - Collection - }; - void readConfig(); - void writeConfig(); - void defaults(); - -Q_SIGNALS: - void changed(bool); - -private: - friend class ConfigureActivityWidgetPrivate; - ConfigureActivityWidgetPrivate * const d; - Q_PRIVATE_SLOT( d, void slotActivityChanged(const QString &)) - Q_PRIVATE_SLOT( d, void slotModified()) -}; -} - -#endif // CONFIGUREACTIVITYWIDGET_H diff -Nru kdepim-4.13.0/pimactivity/kcm/CMakeLists.txt kdepim-4.13.3/pimactivity/kcm/CMakeLists.txt --- kdepim-4.13.0/pimactivity/kcm/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/kcm/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -set( kcm_activity_SRCS - kcmpimactivity.cpp -) - -kde4_add_plugin(kcm_pimactivity ${kcm_activity_SRCS}) - -target_link_libraries(kcm_pimactivity ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} pimactivity) - -install(TARGETS kcm_pimactivity DESTINATION ${PLUGIN_INSTALL_DIR}) -install(FILES kcmpimactivity.desktop DESTINATION ${SERVICES_INSTALL_DIR}) diff -Nru kdepim-4.13.0/pimactivity/kcm/kcmpimactivity.cpp kdepim-4.13.3/pimactivity/kcm/kcmpimactivity.cpp --- kdepim-4.13.0/pimactivity/kcm/kcmpimactivity.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/kcm/kcmpimactivity.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "kcmpimactivity.h" -#include "pimactivity/activitymanager.h" -#include "pimactivity/configureactivitywidget.h" - -#include -#include -#include - -#include - -K_PLUGIN_FACTORY( KCMPimActivityFactory, registerPlugin(); ) -K_EXPORT_PLUGIN( KCMPimActivityFactory( "kcmpimactivity" ) ) - - -KCMPimActivity::KCMPimActivity(QWidget *parent, const QVariantList &args) - : KCModule( KCMPimActivityFactory::componentData(), parent ) -{ - KAboutData *about = new KAboutData( I18N_NOOP( "kcmpimactivity" ), 0, - ki18n( "PIM Activity Settings" ), - 0, KLocalizedString(), KAboutData::License_LGPL, - ki18n( "(c) 2013 Laurent Montel" ) ); - - about->addAuthor( ki18n( "Laurent Montel" ), KLocalizedString(), "montel@kde.org" ); - KGlobal::locale()->insertCatalog(QLatin1String("libpimactivity")); - setAboutData( about ); - - initGUI(); -} - -KCMPimActivity::~KCMPimActivity() -{ -} - -void KCMPimActivity::initGUI() -{ - QVBoxLayout *layout = new QVBoxLayout; - layout->setSpacing( KDialog::spacingHint() ); - layout->setMargin( 0 ); - setLayout(layout); - mManager = new PimActivity::ActivityManager(this); - mConfigure = new PimActivity::ConfigureActivityWidget(mManager); - connect(mConfigure, SIGNAL(changed(bool)), this, SIGNAL(changed(bool))); - layout->addWidget(mConfigure); -} - -void KCMPimActivity::load() -{ - mConfigure->readConfig(); -} - -void KCMPimActivity::save() -{ - mConfigure->writeConfig(); -} - -void KCMPimActivity::defaults() -{ - mConfigure->defaults(); -} - diff -Nru kdepim-4.13.0/pimactivity/kcm/kcmpimactivity.desktop kdepim-4.13.3/pimactivity/kcm/kcmpimactivity.desktop --- kdepim-4.13.0/pimactivity/kcm/kcmpimactivity.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/kcm/kcmpimactivity.desktop 1970-01-01 00:00:00.000000000 +0000 @@ -1,115 +0,0 @@ -[Desktop Entry] -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kcm_pimactivity -X-KDE-Weight=200 - -Name=PIM Activity Settings -Name[bs]=Postavke PIM aktivnosti -Name[ca]=Arranjament de l'activitat PIM -Name[ca@valencia]=Arranjament de l'activitat PIM -Name[cs]=Nastavení činnosti PIM -Name[da]=Indstilling af PIM-aktivitet -Name[de]=Einstellungen für PIM-Aktivitäten -Name[el]=Ρυθμίσεις δραστηριότητας PIM -Name[es]=Preferencias de actividad de PIM -Name[fi]=PIM-aktiviteettiasetukset -Name[fr]=Configuration de l'activité PIM -Name[gl]=Configuración da actividade de PIM -Name[hu]=PIM tevékenység beállítások -Name[ia]=Preferentias de activitate de PIM -Name[it]=Impostazioni delle attività di PIM -Name[kk]=PIM белсендігін баптау -Name[ko]=PIM 활동 설정 -Name[lt]=Stiliaus nustatymai -Name[mr]=पीआयएम कार्यपध्दती संयोजना -Name[nb]=PIM aktivitetsinnstillinger -Name[nds]=PIM-Aktiviteetinstellen -Name[nl]=Activiteitsinstellingen van PIM -Name[pl]=Ustawienia działań ZIO -Name[pt]=Configuração da Actividade PIM -Name[pt_BR]=Configurações da atividade de PIM -Name[ru]=Настройка комнат для приложений PIM -Name[sk]=Nastavenia aktivít PIM -Name[sr]=Поставке ПИМ активности -Name[sr@ijekavian]=Поставке ПИМ активности -Name[sr@ijekavianlatin]=Postavke PIM aktivnosti -Name[sr@latin]=Postavke PIM aktivnosti -Name[sv]=Aktivitetsinställningar för personlig informationshantering -Name[tr]=PIM Etkinlik Ayarları -Name[uk]=Параметри простору дій керування особистими даними -Name[wa]=Apontiaedjes des activités PIM -Name[x-test]=xxPIM Activity Settingsxx -Name[zh_TW]=PIM 活動設定 -Comment=Configure the activity for pim application -Comment[bs]=Konfiguriši aktivnost za Pim aplikaciju -Comment[ca]=Configura l'activitat per a l'aplicació PIM -Comment[ca@valencia]=Configura l'activitat per a l'aplicació PIM -Comment[da]=Indstil aktiviteten til PIM-program -Comment[de]=Einrichtung der Aktivitäten für PIM-Anwendungen -Comment[el]=Διαμόρφωση της δραστηριότητας για εφαρμογές pim -Comment[es]=Configurar la actividad para una aplicación pim -Comment[fi]=Määrittää PIM-sovelluksen toiminnot. -Comment[fr]=Configurer l'activité pour l'application pim -Comment[gl]=Configurar a actividade de programas PIM. -Comment[hu]=Tevékenység beállítása a PIM alkalmazásokhoz -Comment[ia]=Configura le activitate pro application de pim -Comment[it]=Configura l'attività per l'applicazione di PIM -Comment[kk]=PIM қолданбаның белсендігін баптау -Comment[ko]=PIM 프로그램의 활동 설정 -Comment[lt]=Konfigūruoti pim programos veiklą -Comment[mr]=पीआयएम अनुप्रयोगाकरिता कार्यपध्दती संयोजीत करा -Comment[nb]=Sett opp aktiviteten for pim-program -Comment[nds]=De Aktiviteet för't PIM-Programm instellen -Comment[nl]=De activiteit voor de pim-toepassing instellen -Comment[pl]=Konfiguruj działania dla programu zio -Comment[pt]=Configura a actividade para uma aplicação PIM -Comment[pt_BR]=Configura a atividade para aplicativos de PIM -Comment[ru]=Настройте комнату для PIM-приложения -Comment[sk]=Nastaviť aktivitu pre aplikáciu pim -Comment[sr]=Подесите активност за ПИМ програме -Comment[sr@ijekavian]=Подесите активност за ПИМ програме -Comment[sr@ijekavianlatin]=Podesite aktivnost za PIM programe -Comment[sr@latin]=Podesite aktivnost za PIM programe -Comment[sv]=Anpassa aktiviteten för personlig informationshanteringsprogram -Comment[tr]=PIM uygulaması için etkinliği yapılandır -Comment[uk]=Налаштувати простір дій для програми керування особистими даними -Comment[wa]=Apontyîz l' activité pol programe pim -Comment[x-test]=xxConfigure the activity for pim applicationxx -Comment[zh_TW]=設定 PIM 應用程式的活動 -X-KDE-Keywords=configure, settings, activity -X-KDE-Keywords[bs]=konfigurisanje, postavkem, aktivnost -X-KDE-Keywords[ca]=configura, arranjament, activitat -X-KDE-Keywords[ca@valencia]=configura, arranjament, activitat -X-KDE-Keywords[da]=indstil, konfigurér, aktivitet -X-KDE-Keywords[de]=einstellen,konfigurieren,Konfiguration,Einrichtung,Einstellungen,Aktivität -X-KDE-Keywords[el]=διαμόρφωση, ρυθμίσεις, δραστηριότητα -X-KDE-Keywords[es]=configurar, preferencias, actividad -X-KDE-Keywords[fi]=configure, settings, activity, asetukset, aktiviteetti -X-KDE-Keywords[fr]=configurer, paramétrage, activité -X-KDE-Keywords[gl]=configurar, configuración, actividade -X-KDE-Keywords[hu]=beállítás, beállítások, tevékenység -X-KDE-Keywords[ia]=configura, preferentia, activitate -X-KDE-Keywords[it]=configurazione, impostazioni, attività -X-KDE-Keywords[kk]=configure, settings, activity -X-KDE-Keywords[lt]=akregator, konfigūruoti, nustatymai, išsamiau -X-KDE-Keywords[mr]=संयोजना, संयोजना, कार्यपध्दती -X-KDE-Keywords[nb]=sett opp, innstillinger, aktivitet -X-KDE-Keywords[nds]=instellen,inrichten,Aktiviteet -X-KDE-Keywords[nl]=configureren. instellingen, activiteit -X-KDE-Keywords[pl]=konfiguruj, ustawienia, działanie -X-KDE-Keywords[pt]=configurar, configuração, actividade -X-KDE-Keywords[pt_BR]=configurar, configurações, atividade -X-KDE-Keywords[ru]=configure,settings,activity,настроить,настройки,параметры,комната -X-KDE-Keywords[sk]=nastaviť, nastavenia, aktivita -X-KDE-Keywords[sr]=configure,settings,activity,подешавање,поставке,активност -X-KDE-Keywords[sr@ijekavian]=configure,settings,activity,подешавање,поставке,активност -X-KDE-Keywords[sr@ijekavianlatin]=configure,settings,activity,podešavanje,postavke,aktivnost -X-KDE-Keywords[sr@latin]=configure,settings,activity,podešavanje,postavke,aktivnost -X-KDE-Keywords[sv]=anpassa, inställningar, aktivitet -X-KDE-Keywords[tr]=yapılandır, ayarlar, etkinlik -X-KDE-Keywords[uk]=configure,settings,activity,налаштувати,налаштування,параметри,простір,дії,простір дій -X-KDE-Keywords[wa]=apontyî, tchuzes, apontiaedje, activité -X-KDE-Keywords[x-test]=xxconfigure, settings, activityxx -X-KDE-Keywords[zh_TW]=configure, settings, activity diff -Nru kdepim-4.13.0/pimactivity/kcm/kcmpimactivity.h kdepim-4.13.3/pimactivity/kcm/kcmpimactivity.h --- kdepim-4.13.0/pimactivity/kcm/kcmpimactivity.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/kcm/kcmpimactivity.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 KCMPIMACTIVITY_H -#define KCMPIMACTIVITY_H - -#include - -namespace PimActivity { -class ActivityManager; -class ConfigureActivityWidget; -} - -class KCMPimActivity : public KCModule -{ -public: - explicit KCMPimActivity(QWidget *parent, const QVariantList &args ); - ~KCMPimActivity(); - - void load(); - void save(); - void defaults(); -private: - void initGUI(); - PimActivity::ActivityManager *mManager; - PimActivity::ConfigureActivityWidget *mConfigure; -}; - -#endif // KCMPIMACTIVITY_H diff -Nru kdepim-4.13.0/pimactivity/kcm/Messages.sh kdepim-4.13.3/pimactivity/kcm/Messages.sh --- kdepim-4.13.0/pimactivity/kcm/Messages.sh 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/kcm/Messages.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -#! /bin/sh -$XGETTEXT `find . -name '*.h' -o -name '*.cpp' ` -o $podir/kcm_pimactivity.pot diff -Nru kdepim-4.13.0/pimactivity/Messages.sh kdepim-4.13.3/pimactivity/Messages.sh --- kdepim-4.13.0/pimactivity/Messages.sh 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/Messages.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -#! /bin/sh -$XGETTEXT `find . -name '*.h' -o -name '*.cpp' | grep -v '/tests/' |grep -v '/kcm/'` -o $podir/libpimactivity.pot -rm -f rc.cpp diff -Nru kdepim-4.13.0/pimactivity/pimactivity_export.h kdepim-4.13.3/pimactivity/pimactivity_export.h --- kdepim-4.13.0/pimactivity/pimactivity_export.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimactivity_export.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure - - 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 PIMACTIVITY_EXPORT_H -#define PIMACTIVITY_EXPORT_H - -/* needed for KDE_EXPORT and KDE_IMPORT macros */ -#include - -#ifndef PIMACTIVITY_EXPORT -# if defined(KDEPIM_STATIC_LIBS) - /* No export/import for static libraries */ -# define PIMACTIVITY_EXPORT -# elif defined(MAKE_PIMACTIVITY_LIB) - /* We are building this library */ -# define PIMACTIVITY_EXPORT KDE_EXPORT -# else - /* We are using this library */ -# define PIMACTIVITY_EXPORT KDE_IMPORT -# endif -#endif - -# ifndef PIMACTIVITY_EXPORT_DEPRECATED -# define PIMACTIVITY_EXPORT_DEPRECATED KDE_DEPRECATED PIMACTIVITY_EXPORT -# endif - -#endif diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/identity/identitycomboboxactivity.cpp kdepim-4.13.3/pimactivity/pimwidgets/identity/identitycomboboxactivity.cpp --- kdepim-4.13.0/pimactivity/pimwidgets/identity/identitycomboboxactivity.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/identity/identitycomboboxactivity.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "identitycomboboxactivity.h" -#include "activitymanager.h" -#include "identitymanageractivity.h" - -#include - -namespace PimActivity { -class IdentityComboboxActivityPrivate -{ -public: - IdentityComboboxActivityPrivate(IdentityManagerActivity *manager, IdentityComboboxActivity *qq) - : identityManagerActivity(manager), - q(qq) - { - } - - void connectSignals() - { - if (identityManagerActivity->activityManager()) { - q->connect(identityManagerActivity->activityManager(), SIGNAL(currentActivityChanged(QString)), q, SLOT(slotCurrentActivityChanged(QString))); - initializeActivity(); - } - } - - void initializeActivity() - { - slotCurrentActivityChanged(identityManagerActivity->activityManager()->currentActivity()); - } - - void slotCurrentActivityChanged(const QString &id) - { - //TODO - q->updateComboboxList(id); - } - - QList uoidList; - IdentityManagerActivity *identityManagerActivity; - IdentityComboboxActivity *q; -}; - - -IdentityComboboxActivity::IdentityComboboxActivity(IdentityManagerActivity *manager, QWidget *parent) - : KComboBox(parent), d(new IdentityComboboxActivityPrivate(manager, this)) -{ - d->connectSignals(); -} - -IdentityComboboxActivity::~IdentityComboboxActivity() -{ - delete d; -} - -void IdentityComboboxActivity::updateComboboxList(const QString &id) -{ - clear(); - if (id.isEmpty()) { - //not activity => show all identity - } else { - //Show current identity from id. - } - //TODO -} - -uint IdentityComboboxActivity::currentIdentity() const -{ - return d->uoidList[ currentIndex()]; -} - -void IdentityComboboxActivity::setCurrentIdentity( const QString &identityName ) -{ - -} - -void IdentityComboboxActivity::setCurrentIdentity( const KPIMIdentities::Identity &identity ) -{ - setCurrentIdentity( identity.uoid() ); -} - -void IdentityComboboxActivity::setCurrentIdentity( uint uoid ) -{ - -} - -} - -#include "moc_identitycomboboxactivity.cpp" diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/identity/identitycomboboxactivity.h kdepim-4.13.3/pimactivity/pimwidgets/identity/identitycomboboxactivity.h --- kdepim-4.13.0/pimactivity/pimwidgets/identity/identitycomboboxactivity.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/identity/identitycomboboxactivity.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 IDENTITYCOMBOBOXACTIVITY_H -#define IDENTITYCOMBOBOXACTIVITY_H - -#include "pimactivity_export.h" -#include - -namespace KPIMIdentities { -class Identity; -} - -namespace PimActivity { -class IdentityComboboxActivityPrivate; -class IdentityManagerActivity; -class PIMACTIVITY_EXPORT IdentityComboboxActivity : public KComboBox -{ - Q_OBJECT -public: - explicit IdentityComboboxActivity(IdentityManagerActivity *manager, QWidget *parent = 0); - ~IdentityComboboxActivity(); - QString currentIdentityName() const; - - uint currentIdentity() const; - void setCurrentIdentity( const QString &identityName ); - void setCurrentIdentity( const KPIMIdentities::Identity &identity ); - void setCurrentIdentity( uint uoid ); - -protected Q_SLOTS: - void updateComboboxList(const QString &id); - -private: - friend class IdentityComboboxActivityPrivate; - IdentityComboboxActivityPrivate * const d; - Q_PRIVATE_SLOT( d, void slotCurrentActivityChanged(const QString&)) -}; -} - -#endif // IDENTITYCOMBOBOXACTIVITY_H diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/identity/identitymanageractivity.cpp kdepim-4.13.3/pimactivity/pimwidgets/identity/identitymanageractivity.cpp --- kdepim-4.13.0/pimactivity/pimwidgets/identity/identitymanageractivity.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/identity/identitymanageractivity.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,658 +0,0 @@ -/* - Copyright (c) 2002 Marc Mutz - - 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. -*/ - -// config keys: -static const char configKeyDefaultIdentity[] = "Default Identity"; - -#include "identitymanageractivity.h" -#include // for IdentityList::{export,import}Data - -#include // for static helper functions - -#include // for IdentityEntry::fromControlCenter() -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include "identitymanageractivityadaptor.h" - -namespace PimActivity { - -class IdentityManagerActivityPrivate -{ -public: - IdentityManagerActivityPrivate(ActivityManager *manager, IdentityManagerActivity *qq) - : readOnly(false), - activityManager(manager), - q(qq) - { - config = new KConfig( QLatin1String("emailidentities") ); - } - ~IdentityManagerActivityPrivate() - { - delete config; - } - - QStringList groupList( KConfig *conf ) const - { - return conf->groupList().filter( QRegExp( QLatin1String("^Identity #\\d+$") ) ); - } - - void writeConfig() const - { - const QStringList identitiesList = groupList( config ); - QStringList::const_iterator groupEnd = identitiesList.constEnd(); - for ( QStringList::const_iterator group = identitiesList.constBegin(); - group != groupEnd; ++group ) { - config->deleteGroup( *group ); - } - int i = 0; - IdentityManagerActivity::ConstIterator end = identities.constEnd(); - for ( IdentityManagerActivity::ConstIterator it = identities.constBegin(); - it != end; ++it, ++i ) { - KConfigGroup cg( config, QString::fromLatin1( "Identity #%1" ).arg( i ) ); - ( *it ).writeConfig( cg ); - if ( ( *it ).isDefault() ) { - // remember which one is default: - KConfigGroup general( config, "General" ); - general.writeEntry( configKeyDefaultIdentity, ( *it ).uoid() ); - - // Also write the default identity to emailsettings - KEMailSettings es; - es.setSetting( KEMailSettings::RealName, ( *it ).fullName() ); - es.setSetting( KEMailSettings::EmailAddress, ( *it ).primaryEmailAddress() ); - es.setSetting( KEMailSettings::Organization, ( *it ).organization() ); - es.setSetting( KEMailSettings::ReplyToAddress, ( *it ).replyToAddr() ); - } - } - config->sync(); - } - - void readConfig( KConfig *conf ) - { - identities.clear(); - - const QStringList identitiesList = groupList( conf ); - if ( identitiesList.isEmpty() ) { - return; // nothing to be done... - } - - KConfigGroup general( conf, "General" ); - uint defaultIdentity = general.readEntry( configKeyDefaultIdentity, 0 ); - bool haveDefault = false; - QStringList::const_iterator groupEnd = identitiesList.constEnd(); - for ( QStringList::const_iterator group = identitiesList.constBegin(); - group != groupEnd; ++group ) { - KConfigGroup configGroup( conf, *group ); - identities << KPIMIdentities::Identity(); - identities.last().readConfig( configGroup ); - if ( !haveDefault && identities.last().uoid() == defaultIdentity ) { - haveDefault = true; - identities.last().setIsDefault( true ); - } - } - - if ( !haveDefault ) { - kWarning( 5325 ) << "IdentityManagerActivity: There was no default identity." - << "Marking first one as default."; - identities.first().setIsDefault( true ); - } - qSort( identities ); - - shadowIdentities = identities; - } - - - void createDefaultIdentity() - { - QString fullName, emailAddress; - bool done = false; - - // Check if the application has any settings - q->createDefaultIdentity( fullName, emailAddress ); - - // If not, then use the kcontrol settings - if ( fullName.isEmpty() && emailAddress.isEmpty() ) { - KEMailSettings emailSettings; - fullName = emailSettings.getSetting( KEMailSettings::RealName ); - emailAddress = emailSettings.getSetting( KEMailSettings::EmailAddress ); - - if ( !fullName.isEmpty() && !emailAddress.isEmpty() ) { - q->newFromControlCenter( i18nc( "use default address from control center", - "Default" ) ); - done = true; - } else { - // If KEmailSettings doesn't have name and address, generate something from KUser - KUser user; - if ( fullName.isEmpty() ) { - fullName = user.property( KUser::FullName ).toString(); - } - if ( emailAddress.isEmpty() ) { - emailAddress = user.loginName(); - if ( !emailAddress.isEmpty() ) { - KConfigGroup general( config, "General" ); - QString defaultdomain = general.readEntry( "Default domain" ); - if ( !defaultdomain.isEmpty() ) { - emailAddress += QLatin1Char('@') + defaultdomain; - } else { - emailAddress.clear(); - } - } - } - } - } - - if ( !done ) { - // Default identity name - QString name( i18nc( "Default name for new email accounts/identities.", "Unnamed" ) ); - - if ( !emailAddress.isEmpty() ) { - // If we have an email address, create a default identity name from it - QString idName = emailAddress; - int pos = idName.indexOf( QLatin1Char('@') ); - if ( pos != -1 ) { - name = idName.mid( pos + 1, -1 ); - } - - // Make the name a bit more human friendly - name.replace( QLatin1Char('.'), QLatin1Char(' ') ); - pos = name.indexOf( QLatin1Char(' ') ); - if ( pos != 0 ) { - name[pos + 1] = name[pos + 1].toUpper(); - } - name[0] = name[0].toUpper(); - } else if ( !fullName.isEmpty() ) { - // If we have a full name, create a default identity name from it - name = fullName; - } - shadowIdentities << KPIMIdentities::Identity( name, fullName, emailAddress ); - } - - shadowIdentities.last().setIsDefault( true ); - shadowIdentities.last().setUoid( newUoid() ); - if ( readOnly ) { // commit won't do it in readonly mode - identities = shadowIdentities; - } - } - - int newUoid() - { - int uoid; - - // determine the UOIDs of all saved identities - QList usedUOIDs; - QList::ConstIterator end( identities.constEnd() ); - for ( QList::ConstIterator it = identities.constBegin(); - it != end; ++it ) { - usedUOIDs << ( *it ).uoid(); - } - - if ( q->hasPendingChanges() ) { - // add UOIDs of all shadow identities. Yes, we will add a lot of duplicate - // UOIDs, but avoiding duplicate UOIDs isn't worth the effort. - QList::ConstIterator endShadow( shadowIdentities.constEnd() ); - for ( QList::ConstIterator it = shadowIdentities.constBegin(); - it != endShadow; ++it ) { - usedUOIDs << ( *it ).uoid(); - } - } - - usedUOIDs << 0; // no UOID must be 0 because this value always refers to the - // default identity - - do { - uoid = KRandom::random(); - } while ( usedUOIDs.indexOf( uoid ) != -1 ); - - return uoid; - } - - /** The list that will be seen by everyoe */ - QList identities; - /** The list that will be seen by the config dialog */ - QList shadowIdentities; - - KConfig *config; - bool readOnly; - ActivityManager *activityManager; - IdentityManagerActivity *q; -}; - - -static QString newDBusObjectName() -{ - static int s_count = 0; - QString name = QLatin1String( "/KPIMIDENTITIES_IdentityManagerActivity" ); - if ( s_count++ ) { - name += QLatin1Char('_'); - name += QString::number( s_count ); - } - return name; -} - -IdentityManagerActivity::IdentityManagerActivity(ActivityManager *manager, bool readonly, QObject *parent, - const char *name ) - : QObject( parent ), - d(new IdentityManagerActivityPrivate(manager, this)) -{ - setObjectName( QLatin1String(name) ); - KGlobal::locale()->insertCatalog( QLatin1String("libkpimidentities") ); - new IdentityManagerActivityAdaptor( this ); - QDBusConnection dbus = QDBusConnection::sessionBus(); - const QString dbusPath = newDBusObjectName(); - setProperty( "uniqueDBusPath", dbusPath ); - const QString dbusInterface = QLatin1String("org.kde.pim.IdentityManagerActivity"); - dbus.registerObject( dbusPath, this ); - dbus.connect( QString(), QString(), dbusInterface, QLatin1String("identitiesChanged"), this, - SLOT(slotIdentitiesChanged(QString)) ); - - d->readOnly = readonly; - - d->readConfig( d->config ); - if ( d->identities.isEmpty() ) { - kDebug( 5325 ) << "emailidentities is empty -> convert from kmailrc"; - // No emailidentities file, or an empty one due to broken conversion - // (kconf_update bug in kdelibs <= 3.2.2) - // => convert it, i.e. read settings from kmailrc - KConfig kmailConf( QLatin1String("kmailrc") ); - d->readConfig( &kmailConf ); - } - // we need at least a default identity: - if ( d->identities.isEmpty() ) { - kDebug( 5325 ) << "IdentityManagerActivity: No identity found. Creating default."; - d->createDefaultIdentity(); - commit(); - } - // Migration: people without settings in kemailsettings should get some - if ( KEMailSettings().getSetting( KEMailSettings::EmailAddress ).isEmpty() ) { - d->writeConfig(); - } -} - -IdentityManagerActivity::~IdentityManagerActivity() -{ - kWarning( hasPendingChanges(), 5325 ) - << "IdentityManagerActivity: There were uncommitted changes!"; - delete d; -} - -PimActivity::ActivityManager *IdentityManagerActivity::activityManager() const -{ - return d->activityManager; -} - - -QString IdentityManagerActivity::makeUnique( const QString &name ) const -{ - int suffix = 1; - QString result = name; - while ( identities().contains( result ) ) { - result = i18nc( "%1: name; %2: number appended to it to make it unique " - "among a list of names", "%1 #%2", - name, suffix ); - suffix++; - } - return result; -} - -bool IdentityManagerActivity::isUnique( const QString &name ) const -{ - return !identities().contains( name ); -} - -void IdentityManagerActivity::commit() -{ - // early out: - if ( !hasPendingChanges() || d->readOnly ) { - return; - } - - QList seenUOIDs; - QList::ConstIterator end = d->identities.constEnd(); - for ( QList::ConstIterator it = d->identities.constBegin(); - it != end; ++it ) { - seenUOIDs << ( *it ).uoid(); - } - - QList changedUOIDs; - // find added and changed identities: - for ( QList::ConstIterator it = d->shadowIdentities.constBegin(); - it != d->shadowIdentities.constEnd(); ++it ) { - int index = seenUOIDs.indexOf( ( *it ).uoid() ); - if ( index != -1 ) { - uint uoid = seenUOIDs.at( index ); - const KPIMIdentities::Identity &orig = identityForUoid( uoid ); // look up in identities - if ( *it != orig ) { - // changed identity - kDebug( 5325 ) << "emitting changed() for identity" << uoid; - emit changed( *it ); - changedUOIDs << uoid; - } - seenUOIDs.removeAll( uoid ); - } else { - // new identity - kDebug( 5325 ) << "emitting added() for identity" << ( *it ).uoid(); - emit added( *it ); - } - } - - // what's left are deleted identities: - for ( QList::ConstIterator it = seenUOIDs.constBegin(); - it != seenUOIDs.constEnd(); ++it ) { - kDebug( 5325 ) << "emitting deleted() for identity" << ( *it ); - emit deleted( *it ); - } - - d->identities = d->shadowIdentities; - d->writeConfig(); - - // now that identities has all the new info, we can emit the added/changed - // signals that ship a uoid. This is because the slots might use - // identityForUoid(uoid)... - QList::ConstIterator changedEnd( changedUOIDs.constEnd() ); - for ( QList::ConstIterator it = changedUOIDs.constBegin(); - it != changedEnd; ++it ) { - emit changed( *it ); - } - - emit changed(); // normal signal - - // DBus signal for other IdentityManagerActivity instances - const QString ourIdentifier = QString::fromLatin1( "%1/%2" ). - arg( QDBusConnection::sessionBus().baseService() ). - arg( property( "uniqueDBusPath" ).toString() ); - emit identitiesChanged( ourIdentifier ); -} - -void IdentityManagerActivity::rollback() -{ - d->shadowIdentities = d->identities; -} - -bool IdentityManagerActivity::hasPendingChanges() const -{ - return d->identities != d->shadowIdentities; -} - -QStringList IdentityManagerActivity::identities() const -{ - QStringList result; - ConstIterator end = d->identities.constEnd(); - for ( ConstIterator it = d->identities.constBegin(); - it != end; ++it ) { - result << ( *it ).identityName(); - } - return result; -} - -QStringList IdentityManagerActivity::shadowIdentities() const -{ - QStringList result; - ConstIterator end = d->shadowIdentities.constEnd(); - for ( ConstIterator it = d->shadowIdentities.constBegin(); - it != end; ++it ) { - result << ( *it ).identityName(); - } - return result; -} - -void IdentityManagerActivity::sort() -{ - qSort( d->shadowIdentities ); -} - -QList::ConstIterator IdentityManagerActivity::begin() const -{ - return d->identities.constBegin(); -} - -QList::ConstIterator IdentityManagerActivity::end() const -{ - return d->identities.constEnd(); -} - -IdentityManagerActivity::Iterator IdentityManagerActivity::modifyBegin() -{ - return d->shadowIdentities.begin(); -} - -IdentityManagerActivity::Iterator IdentityManagerActivity::modifyEnd() -{ - return d->shadowIdentities.end(); -} - -const KPIMIdentities::Identity &IdentityManagerActivity::identityForUoid( uint uoid ) const -{ - for ( ConstIterator it = begin(); it != end(); ++it ) { - if ( ( *it ).uoid() == uoid ) { - return ( *it ); - } - } - return KPIMIdentities::Identity::null(); -} - -const KPIMIdentities::Identity &IdentityManagerActivity::identityForUoidOrDefault( uint uoid ) const -{ - const KPIMIdentities::Identity &ident = identityForUoid( uoid ); - if ( ident.isNull() ) { - return defaultIdentity(); - } else { - return ident; - } -} - -const KPIMIdentities::Identity &IdentityManagerActivity::identityForAddress( const QString &addresses ) const -{ - const QStringList addressList = KPIMUtils::splitAddressList( addresses ); - foreach ( const QString &fullAddress, addressList ) { - const QString addrSpec = KPIMUtils::extractEmailAddress( fullAddress ).toLower(); - for ( ConstIterator it = begin(); it != end(); ++it ) { - const KPIMIdentities::Identity &identity = *it; - if ( identity.matchesEmailAddress( addrSpec ) ) { - return identity; - } - } - } - return KPIMIdentities::Identity::null(); -} - -bool IdentityManagerActivity::thatIsMe( const QString &addressList ) const -{ - return !identityForAddress( addressList ).isNull(); -} - -KPIMIdentities::Identity &IdentityManagerActivity::modifyIdentityForName( const QString &name ) -{ - for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { - if ( ( *it ).identityName() == name ) { - return ( *it ); - } - } - - kWarning( 5325 ) << "IdentityManagerActivity::modifyIdentityForName() used as" - << "newFromScratch() replacement!" - << endl << " name == \"" << name << "\""; - return newFromScratch( name ); -} - -KPIMIdentities::Identity &IdentityManagerActivity::modifyIdentityForUoid( uint uoid ) -{ - for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { - if ( ( *it ).uoid() == uoid ) { - return ( *it ); - } - } - - kWarning( 5325 ) << "IdentityManagerActivity::identityForUoid() used as" - << "newFromScratch() replacement!" - << endl << " uoid == \"" << uoid << "\""; - return newFromScratch( i18n( "Unnamed" ) ); -} - -const KPIMIdentities::Identity &IdentityManagerActivity::defaultIdentity() const -{ - for ( ConstIterator it = begin(); it != end(); ++it ) { - if ( ( *it ).isDefault() ) { - return ( *it ); - } - } - - if ( d->identities.isEmpty() ) { - kFatal( 5325 ) << "IdentityManagerActivity: No default identity found!"; - } else { - kWarning( 5325 ) << "IdentityManagerActivity: No default identity found!"; - } - return *begin(); -} - -bool IdentityManagerActivity::setAsDefault( uint uoid ) -{ - // First, check if the identity actually exists: - bool found = false; - for ( ConstIterator it = d->shadowIdentities.constBegin(); - it != d->shadowIdentities.constEnd(); ++it ) { - if ( ( *it ).uoid() == uoid ) { - found = true; - break; - } - } - - if ( !found ) { - return false; - } - - // Then, change the default as requested: - for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { - ( *it ).setIsDefault( ( *it ).uoid() == uoid ); - } - - // and re-sort: - sort(); - return true; -} - -bool IdentityManagerActivity::removeIdentity( const QString &name ) -{ - if ( d->shadowIdentities.size() <= 1 ) { - return false; - } - - for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { - if ( ( *it ).identityName() == name ) { - bool removedWasDefault = ( *it ).isDefault(); - d->shadowIdentities.erase( it ); - if ( removedWasDefault && !d->shadowIdentities.isEmpty() ) { - d->shadowIdentities.first().setIsDefault( true ); - } - return true; - } - } - return false; -} - -bool IdentityManagerActivity::removeIdentityForced( const QString &name ) -{ - for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) { - if ( ( *it ).identityName() == name ) { - bool removedWasDefault = ( *it ).isDefault(); - d->shadowIdentities.erase( it ); - if ( removedWasDefault && !d->shadowIdentities.isEmpty() ) { - d->shadowIdentities.first().setIsDefault( true ); - } - return true; - } - } - return false; -} - -KPIMIdentities::Identity &IdentityManagerActivity::newFromScratch( const QString &name ) -{ - return newFromExisting( KPIMIdentities::Identity( name ) ); -} - -KPIMIdentities::Identity &IdentityManagerActivity::newFromControlCenter( const QString &name ) -{ - KEMailSettings es; - es.setProfile( es.defaultProfileName() ); - - return - newFromExisting( KPIMIdentities::Identity( name, - es.getSetting( KEMailSettings::RealName ), - es.getSetting( KEMailSettings::EmailAddress ), - es.getSetting( KEMailSettings::Organization ), - es.getSetting( KEMailSettings::ReplyToAddress ) ) ); -} - -KPIMIdentities::Identity &IdentityManagerActivity::newFromExisting( const KPIMIdentities::Identity &other, const QString &name ) -{ - d->shadowIdentities << other; - KPIMIdentities::Identity &result = d->shadowIdentities.last(); - result.setIsDefault( false ); // we don't want two default identities! - result.setUoid( d->newUoid() ); // we don't want two identies w/ same UOID - if ( !name.isNull() ) { - result.setIdentityName( name ); - } - return result; -} - - -QStringList IdentityManagerActivity::allEmails() const -{ - QStringList lst; - for ( ConstIterator it = begin(); it != end(); ++it ) { - lst << ( *it ).primaryEmailAddress(); - if ( !( *it ).emailAliases().isEmpty() ) { - lst << ( *it ).emailAliases(); - } - } - return lst; -} - -void IdentityManagerActivity::slotRollback() -{ - rollback(); -} - -void IdentityManagerActivity::slotIdentitiesChanged( const QString &id ) -{ - kDebug( 5325 ) << " KPIMIdentities::IdentityManagerActivity::slotIdentitiesChanged :" << id; - const QString ourIdentifier = QString::fromLatin1( "%1/%2" ). - arg( QDBusConnection::sessionBus().baseService() ). - arg( property( "uniqueDBusPath" ).toString() ); - if ( id != ourIdentifier ) { - d->config->reparseConfiguration(); - Q_ASSERT( !hasPendingChanges() ); - d->readConfig( d->config ); - emit changed(); - } -} - -} - diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/identity/identitymanageractivity.h kdepim-4.13.3/pimactivity/pimwidgets/identity/identitymanageractivity.h --- kdepim-4.13.0/pimactivity/pimwidgets/identity/identitymanageractivity.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/identity/identitymanageractivity.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,238 +0,0 @@ -/* - Copyright (c) 2013 Laurent Montel - Copyright (c) 2002 Marc Mutz - - 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 IDENTITYMANAGERACTIVITY_H -#define IDENTITYMANAGERACTIVITY_H - -#include "pimactivity_export.h" - -#include - -class QStringList; - -namespace KPIMIdentities { -class Identity; -} - -namespace PimActivity -{ -/** - * @short Manages the list of identities. - * @author Marc Mutz - **/ -class ActivityManager; -class IdentityManagerActivityPrivate; -class PIMACTIVITY_EXPORT IdentityManagerActivity : public QObject -{ - Q_OBJECT -public: - /** - * Create an identity manager, which loads the emailidentities file - * to create identities. - * @param readonly if true, no changes can be made to the identity manager - * This means in particular that if there is no identity configured, - * the default identity created here will not be saved. - * It is assumed that a minimum of one identity is always present. - */ - explicit IdentityManagerActivity( ActivityManager *manager, bool readonly = false, QObject *parent=0, const char *name=0 ); - virtual ~IdentityManagerActivity(); - - PimActivity::ActivityManager *activityManager() const; - - typedef QList::Iterator Iterator; - typedef QList::ConstIterator ConstIterator; - - /** - * Typedef for STL style iterator - */ - typedef Iterator iterator; - - /** - * Typedef for STL style iterator - */ - typedef ConstIterator const_iterator; - - /** @return a unique name for a new identity based on @p name - * @param name the name of the base identity - */ - QString makeUnique( const QString &name ) const; - - /** @return whether the @p name is unique - * @param name the name to be examined - */ - bool isUnique( const QString &name ) const; - - /** Commit changes to disk and emit changed() if necessary. */ - void commit(); - - /** Re-read the config from disk and forget changes. */ - void rollback(); - - /** Check whether there are any unsaved changes. */ - bool hasPendingChanges() const; - - /** @return the list of identities */ - QStringList identities() const; - - /** Convenience method. - - @return the list of (shadow) identities, ie. the ones currently - under configuration. - */ - QStringList shadowIdentities() const; - - /** Sort the identities by name (the default is always first). This - operates on the @em shadow list, so you need to @ref commit for - the changes to take effect. - **/ - void sort(); - - /** @return an identity whose address matches any in @p addresses - or @ref Identity::null if no such identity exists. - @param addresses the string of addresses to scan for matches - **/ - const KPIMIdentities::Identity &identityForAddress( const QString &addresses ) const; - - /** @return true if @p addressList contains any of our addresses, - false otherwise. - @param addressList the addressList to examine - @see #identityForAddress - **/ - bool thatIsMe( const QString &addressList ) const; - - /** @return the identity with Unique Object Identifier (UOID) @p - uoid or @ref Identity::null if not found. - @param uoid the Unique Object Identifier to find identity with - **/ - const KPIMIdentities::Identity &identityForUoid( uint uoid ) const; - - /** Convenience menthod. - - @return the identity with Unique Object Identifier (UOID) @p - uoid or the default identity if not found. - @param uoid the Unique Object Identifier to find identity with - **/ - const KPIMIdentities::Identity &identityForUoidOrDefault( uint uoid ) const; - - /** @return the default identity */ - const KPIMIdentities::Identity &defaultIdentity() const; - - /** Sets the identity with Unique Object Identifier (UOID) @p uoid - to be new the default identity. As usual, use @ref commit to - make this permanent. - - @param uoid the default identity to set - @return false if an identity with UOID @p uoid was not found - **/ - bool setAsDefault( uint uoid ); - - /** @return the identity named @p identityName. This method returns a - reference to the identity that can be modified. To let others - see this change, use @ref commit. - @param identityName the identity name to return modifiable reference - **/ - KPIMIdentities::Identity &modifyIdentityForName( const QString &identityName ); - - /** @return the identity with Unique Object Identifier (UOID) @p uoid. - This method returns a reference to the identity that can - be modified. To let others see this change, use @ref commit. - **/ - KPIMIdentities::Identity &modifyIdentityForUoid( uint uoid ); - - /** Removes the identity with name @p identityName - Will return false if the identity is not found, - or when one tries to remove the last identity. - @param identityName the identity to remove - **/ - bool removeIdentity( const QString &identityName ); - - /** - * Removes the identity with name @p identityName - * Will return @c false if the identity is not found, @c true otherwise. - * - * @note In opposite to removeIdentity, this method allows to remove the - * last remaining identity. - * - * @since 4.6 - */ - bool removeIdentityForced( const QString &identityName ); - - QList::ConstIterator begin() const; - QList::ConstIterator end() const; - /// Iterator used by the configuration dialog, which works on a separate list - /// of identities, for modification. Changes are made effective by commit(). - Iterator modifyBegin(); - Iterator modifyEnd(); - - KPIMIdentities::Identity &newFromScratch( const QString &name ); - KPIMIdentities::Identity &newFromControlCenter( const QString &name ); - KPIMIdentities::Identity &newFromExisting( const KPIMIdentities::Identity &other, - const QString &name=QString() ); - - /** Returns the list of all email addresses (only name@host) from all - identities */ - QStringList allEmails() const; - -Q_SIGNALS: - /** Emitted whenever a commit changes any configure option */ - void changed(); - /** Emitted whenever the identity with Unique Object Identifier - (UOID) @p uoid changed. Useful for more fine-grained change - notifications than what is possible with the standard @ref - changed() signal. */ - void changed( uint uoid ); - /** Emitted whenever the identity @p ident changed. Useful for more - fine-grained change notifications than what is possible with the - standard @ref changed() signal. */ - void changed( const KPIMIdentities::Identity &ident ); - /** Emitted on @ref commit() for each deleted identity. At the time - this signal is emitted, the identity does still exist and can be - retrieved by @ref identityForUoid() if needed */ - void deleted( uint uoid ); - /** Emitted on @ref commit() for each new identity */ - void added( const KPIMIdentities::Identity &ident ); - - void identitiesChanged( const QString &id ); - -protected: - /** - * This is called when no identity has been defined, so we need to - * create a default one. The parameters are filled with some default - * values from KUser, but reimplementations of this method can give - * them another value. - */ - virtual void createDefaultIdentity( QString&/*fullName*/, - QString&/*emailAddress*/ ) {} - -protected Q_SLOTS: - void slotRollback(); - -private Q_SLOTS: - // Connected to the DBus signal - void slotIdentitiesChanged( const QString &id ); - -private: - friend class IdentityManagerActivityPrivate; - IdentityManagerActivityPrivate * const d; -}; - -} // namespace - -#endif // _KMAIL_IDENTITYMANAGER_H_ diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml kdepim-4.13.3/pimactivity/pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml --- kdepim-4.13.0/pimactivity/pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/identity/org.kde.pim.IdentityManagerActivity.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ - - - - - - - - diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/identity/TODO kdepim-4.13.3/pimactivity/pimwidgets/identity/TODO --- kdepim-4.13.0/pimactivity/pimwidgets/identity/TODO 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/identity/TODO 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -Add support for default identity for each activity - diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.cpp kdepim-4.13.3/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.cpp --- kdepim-4.13.0/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "transportcomboboxactivity.h" -#include "activitymanager.h" - -namespace PimActivity { - -class TransportComboboxActivityPrivate -{ -public: - TransportComboboxActivityPrivate(ActivityManager *manager, TransportComboboxActivity *qq) - : q(qq), - activityManager(manager) - { - } - - void connectSignals() - { - if (activityManager) { - q->connect(activityManager, SIGNAL(currentActivityChanged(QString)), q, SLOT(slotCurrentActivityChanged(QString))); - //Initialize it. - slotCurrentActivityChanged(activityManager->currentActivity()); - } - } - - void slotCurrentActivityChanged(const QString &id) - { - q->updateComboboxList(); - } - - TransportComboboxActivity *q; - ActivityManager *activityManager; -}; - -TransportComboboxActivity::TransportComboboxActivity(QWidget *parent) - : MailTransport::TransportComboBox(parent), d(new TransportComboboxActivityPrivate(0, this)) -{ -} - -TransportComboboxActivity::TransportComboboxActivity(ActivityManager *manager, QWidget *parent) - : MailTransport::TransportComboBox(parent), d(new TransportComboboxActivityPrivate(manager, this)) -{ - d->connectSignals(); -} - -TransportComboboxActivity::~TransportComboboxActivity() -{ - delete d; -} - -void TransportComboboxActivity::setActivityManager(ActivityManager *manager) -{ - d->activityManager = manager; - d->connectSignals(); -} - -void TransportComboboxActivity::updateComboboxList() -{ - //TODO -} - -} - -#include "moc_transportcomboboxactivity.cpp" diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h kdepim-4.13.3/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h --- kdepim-4.13.0/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 TRANSPORTCOMBOBOXACTIVITY_H -#define TRANSPORTCOMBOBOXACTIVITY_H - -#include "pimactivity_export.h" - -#include - -namespace PimActivity { -class ActivityManager; -class TransportComboboxActivityPrivate; -class PIMACTIVITY_EXPORT TransportComboboxActivity : public MailTransport::TransportComboBox -{ - Q_OBJECT -public: - explicit TransportComboboxActivity(QWidget *parent = 0); - explicit TransportComboboxActivity(ActivityManager *manager, QWidget *parent = 0); - ~TransportComboboxActivity(); - - void setActivityManager(ActivityManager *manager); - -protected Q_SLOTS: - void updateComboboxList(); - -private: - friend class TransportComboboxActivityPrivate; - TransportComboboxActivityPrivate * const d; - Q_PRIVATE_SLOT( d, void slotCurrentActivityChanged(const QString&)) -}; -} - -#endif // TRANSPORTCOMBOBOXACTIVITY_H diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/mailtransport/transportmanager.cpp kdepim-4.13.3/pimactivity/pimwidgets/mailtransport/transportmanager.cpp --- kdepim-4.13.0/pimactivity/pimwidgets/mailtransport/transportmanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/mailtransport/transportmanager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,776 +0,0 @@ -/* - Copyright (c) 2006 - 2007 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 "transportmanager.h" -#include "resourcesendjob_p.h" -#include "mailtransport_defs.h" -#include "sendmailjob.h" -#include "smtpjob.h" -#include "transport.h" -#include "transport_p.h" -#include "transportjob.h" -#include "transporttype.h" -#include "transporttype_p.h" -#include "addtransportdialog.h" -#include "transportconfigdialog.h" -#include "transportconfigwidget.h" -#include "sendmailconfigwidget.h" -#include "smtpconfigwidget.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace MailTransport; -using namespace KWallet; - -namespace MailTransport { -/** - * Private class that helps to provide binary compatibility between releases. - * @internal - */ -class TransportManagerPrivate -{ - public: - TransportManagerPrivate( TransportManager *parent ) - : q( parent ) - { - } - - ~TransportManagerPrivate() { - delete config; - qDeleteAll( transports ); - } - - KConfig *config; - QList transports; - TransportType::List types; - bool myOwnChange; - bool appliedChange; - KWallet::Wallet *wallet; - bool walletOpenFailed; - bool walletAsyncOpen; - int defaultTransportId; - bool isMainInstance; - QList walletQueue; - TransportManager *q; - - void readConfig(); - void writeConfig(); - void fillTypes(); - int createId() const; - void prepareWallet(); - void validateDefault(); - void migrateToWallet(); - - // Slots - void slotTransportsChanged(); - void slotWalletOpened( bool success ); - void dbusServiceUnregistered(); - void agentTypeAdded( const Akonadi::AgentType &atype ); - void agentTypeRemoved( const Akonadi::AgentType &atype ); - void jobResult( KJob *job ); -}; - -} - -class StaticTransportManager : public TransportManager -{ - public: - StaticTransportManager() : TransportManager() {} -}; - -StaticTransportManager *sSelf = 0; - -static void destroyStaticTransportManager() { - delete sSelf; -} - -TransportManager::TransportManager() - : QObject(), d( new TransportManagerPrivate( this ) ) -{ - KGlobal::locale()->insertCatalog( QLatin1String( "libmailtransport" ) ); - KGlobal::locale()->insertCatalog( QLatin1String( "libakonadi-kmime" ) ); - qAddPostRoutine( destroyStaticTransportManager ); - d->myOwnChange = false; - d->appliedChange = false; - d->wallet = 0; - d->walletOpenFailed = false; - d->walletAsyncOpen = false; - d->defaultTransportId = -1; - d->config = new KConfig( QLatin1String( "mailtransports" ) ); - - QDBusConnection::sessionBus().registerObject( DBUS_OBJECT_PATH, this, - QDBusConnection::ExportScriptableSlots | - QDBusConnection::ExportScriptableSignals ); - - QDBusServiceWatcher *watcher = - new QDBusServiceWatcher( DBUS_SERVICE_NAME, QDBusConnection::sessionBus(), - QDBusServiceWatcher::WatchForUnregistration, this ); - connect( watcher, SIGNAL(serviceUnregistered(QString)), - SLOT(dbusServiceUnregistered()) ); - - QDBusConnection::sessionBus().connect( QString(), QString(), - DBUS_INTERFACE_NAME, DBUS_CHANGE_SIGNAL, - this, SLOT(slotTransportsChanged()) ); - - d->isMainInstance = QDBusConnection::sessionBus().registerService( DBUS_SERVICE_NAME ); - - d->fillTypes(); -} - -TransportManager::~TransportManager() -{ - qRemovePostRoutine( destroyStaticTransportManager ); - delete d; -} - -TransportManager *TransportManager::self() -{ - if ( !sSelf ) { - sSelf = new StaticTransportManager; - sSelf->d->readConfig(); - } - return sSelf; -} - -Transport *TransportManager::transportById( int id, bool def ) const -{ - foreach ( Transport *t, d->transports ) { - if ( t->id() == id ) { - return t; - } - } - - if ( def || ( id == 0 && d->defaultTransportId != id ) ) { - return transportById( d->defaultTransportId, false ); - } - return 0; -} - -Transport *TransportManager::transportByName( const QString &name, bool def ) const -{ - foreach ( Transport *t, d->transports ) { - if ( t->name() == name ) { - return t; - } - } - if ( def ) { - return transportById( 0, false ); - } - return 0; -} - -QList< Transport * > TransportManager::transports() const -{ - return d->transports; -} - -TransportType::List TransportManager::types() const -{ - return d->types; -} - -Transport *TransportManager::createTransport() const -{ - int id = d->createId(); - Transport *t = new Transport( QString::number( id ) ); - t->setId( id ); - return t; -} - -void TransportManager::addTransport( Transport *transport ) -{ - if ( d->transports.contains( transport ) ) { - kDebug() << "Already have this transport."; - return; - } - - kDebug() << "Added transport" << transport; - d->transports.append( transport ); - d->validateDefault(); - emitChangesCommitted(); -} - -void TransportManager::schedule( TransportJob *job ) -{ - connect( job, SIGNAL(result(KJob*)), SLOT(jobResult(KJob*)) ); - - // check if the job is waiting for the wallet - if ( !job->transport()->isComplete() ) { - kDebug() << "job waits for wallet:" << job; - d->walletQueue << job; - loadPasswordsAsync(); - return; - } - - job->start(); -} - -void TransportManager::createDefaultTransport() -{ - KEMailSettings kes; - Transport *t = createTransport(); - t->setName( i18n( "Default Transport" ) ); - t->setHost( kes.getSetting( KEMailSettings::OutServer ) ); - if ( t->isValid() ) { - t->writeConfig(); - addTransport( t ); - } else { - kWarning() << "KEMailSettings does not contain a valid transport."; - } -} - -bool TransportManager::showTransportCreationDialog( QWidget *parent, - ShowCondition showCondition ) -{ - if ( showCondition == IfNoTransportExists ) { - if ( !isEmpty() ) { - return true; - } - - const int response = KMessageBox::messageBox( parent, - KMessageBox::WarningContinueCancel, - i18n( "You must create an outgoing account before sending." ), - i18n( "Create Account Now?" ), - KGuiItem( i18n( "Create Account Now" ) ) ); - if ( response != KMessageBox::Continue ) { - return false; - } - } - - QPointer dialog = new AddTransportDialog( parent ); - const bool accepted = ( dialog->exec() == QDialog::Accepted ); - delete dialog; - return accepted; -} - -bool TransportManager::configureTransport( Transport *transport, QWidget *parent ) -{ - if ( transport->type() == Transport::EnumType::Akonadi ) { - using namespace Akonadi; - AgentInstance instance = AgentManager::self()->instance( transport->host() ); - if ( !instance.isValid() ) { - kWarning() << "Invalid resource instance" << transport->host(); - } - instance.configure( parent ); // Async... - transport->writeConfig(); - return true; // No way to know here if the user cancelled or not. - } - - QPointer transportConfigDialog = - new TransportConfigDialog( transport, parent ); - transportConfigDialog->setCaption( i18n( "Configure account" ) ); - bool okClicked = ( transportConfigDialog->exec() == QDialog::Accepted ); - delete transportConfigDialog; - return okClicked; -} - -TransportJob *TransportManager::createTransportJob( int transportId ) -{ - Transport *t = transportById( transportId, false ); - if ( !t ) { - return 0; - } - t = t->clone(); // Jobs delete their transports. - t->updatePasswordState(); - switch ( t->type() ) { - case Transport::EnumType::SMTP: - return new SmtpJob( t, this ); - case Transport::EnumType::Sendmail: - return new SendmailJob( t, this ); - case Transport::EnumType::Akonadi: - return new ResourceSendJob( t, this ); - } - Q_ASSERT( false ); - return 0; -} - -TransportJob *TransportManager::createTransportJob( const QString &transport ) -{ - bool ok = false; - Transport *t = 0; - - int transportId = transport.toInt( &ok ); - if ( ok ) { - t = transportById( transportId ); - } - - if ( !t ) { - t = transportByName( transport, false ); - } - - if ( t ) { - return createTransportJob( t->id() ); - } - - return 0; -} - -bool TransportManager::isEmpty() const -{ - return d->transports.isEmpty(); -} - -QList TransportManager::transportIds() const -{ - QList rv; - foreach ( Transport *t, d->transports ) { - rv << t->id(); - } - return rv; -} - -QStringList TransportManager::transportNames() const -{ - QStringList rv; - foreach ( Transport *t, d->transports ) { - rv << t->name(); - } - return rv; -} - -QString TransportManager::defaultTransportName() const -{ - Transport *t = transportById( d->defaultTransportId, false ); - if ( t ) { - return t->name(); - } - return QString(); -} - -int TransportManager::defaultTransportId() const -{ - return d->defaultTransportId; -} - -void TransportManager::setDefaultTransport( int id ) -{ - if ( id == d->defaultTransportId || !transportById( id, false ) ) { - return; - } - d->defaultTransportId = id; - d->writeConfig(); -} - -void TransportManager::removeTransport( int id ) -{ - Transport *t = transportById( id, false ); - if ( !t ) { - return; - } - emit transportRemoved( t->id(), t->name() ); - - // Kill the resource, if Akonadi-type transport. - if ( t->type() == Transport::EnumType::Akonadi ) { - using namespace Akonadi; - const AgentInstance instance = AgentManager::self()->instance( t->host() ); - if ( !instance.isValid() ) { - kWarning() << "Could not find resource instance."; - } - AgentManager::self()->removeInstance( instance ); - } - - d->transports.removeAll( t ); - d->validateDefault(); - QString group = t->currentGroup(); - delete t; - d->config->deleteGroup( group ); - d->writeConfig(); - -} - -void TransportManagerPrivate::readConfig() -{ - QList oldTransports = transports; - transports.clear(); - - QRegExp re( QLatin1String( "^Transport (.+)$" ) ); - QStringList groups = config->groupList().filter( re ); - foreach ( const QString &s, groups ) { - re.indexIn( s ); - Transport *t = 0; - - // see if we happen to have that one already - foreach ( Transport *old, oldTransports ) { - if ( old->currentGroup() == QLatin1String( "Transport " ) + re.cap( 1 ) ) { - kDebug() << "reloading existing transport:" << s; - t = old; - t->d->passwordNeedsUpdateFromWallet = true; - t->readConfig(); - oldTransports.removeAll( old ); - break; - } - } - - if ( !t ) { - t = new Transport( re.cap( 1 ) ); - } - if ( t->id() <= 0 ) { - t->setId( createId() ); - t->writeConfig(); - } - transports.append( t ); - } - - qDeleteAll( oldTransports ); - oldTransports.clear(); - - // read default transport - KConfigGroup group( config, "General" ); - defaultTransportId = group.readEntry( "default-transport", 0 ); - if ( defaultTransportId == 0 ) { - // migrated default transport contains the name instead - QString name = group.readEntry( "default-transport", QString() ); - if ( !name.isEmpty() ) { - Transport *t = q->transportByName( name, false ); - if ( t ) { - defaultTransportId = t->id(); - writeConfig(); - } - } - } - validateDefault(); - migrateToWallet(); - q->loadPasswordsAsync(); -} - -void TransportManagerPrivate::writeConfig() -{ - KConfigGroup group( config, "General" ); - group.writeEntry( "default-transport", defaultTransportId ); - config->sync(); - q->emitChangesCommitted(); -} - -void TransportManagerPrivate::fillTypes() -{ - Q_ASSERT( types.isEmpty() ); - - // SMTP. - { - TransportType type; - type.d->mType = Transport::EnumType::SMTP; - type.d->mName = i18nc( "@option SMTP transport", "SMTP" ); - type.d->mDescription = i18n( "An SMTP server on the Internet" ); - types << type; - } - - // Sendmail. - { - TransportType type; - type.d->mType = Transport::EnumType::Sendmail; - type.d->mName = i18nc( "@option sendmail transport", "Sendmail" ); - type.d->mDescription = i18n( "A local sendmail installation" ); - types << type; - } - - // All Akonadi resources with MailTransport capability. - { - using namespace Akonadi; - foreach ( const AgentType &atype, AgentManager::self()->types() ) { - // TODO probably the string "MailTransport" should be #defined somewhere - // and used like that in the resources (?) - if ( atype.capabilities().contains( QLatin1String( "MailTransport" ) ) ) { - TransportType type; - type.d->mType = Transport::EnumType::Akonadi; - type.d->mAgentType = atype; - type.d->mName = atype.name(); - type.d->mDescription = atype.description(); - types << type; - kDebug() << "Found Akonadi type" << atype.name(); - } - } - - // Watch for appearing and disappearing types. - QObject::connect( AgentManager::self(), SIGNAL(typeAdded(Akonadi::AgentType)), - q, SLOT(agentTypeAdded(Akonadi::AgentType)) ); - QObject::connect( AgentManager::self(), SIGNAL(typeRemoved(Akonadi::AgentType)), - q, SLOT(agentTypeRemoved(Akonadi::AgentType)) ); - } - - kDebug() << "Have SMTP, Sendmail, and" << types.count() - 2 << "Akonadi types."; -} - -void TransportManager::emitChangesCommitted() -{ - d->myOwnChange = true; // prevent us from reading our changes again - d->appliedChange = false; // but we have to read them at least once - emit transportsChanged(); - emit changesCommitted(); -} - -void TransportManagerPrivate::slotTransportsChanged() -{ - if ( myOwnChange && appliedChange ) { - myOwnChange = false; - appliedChange = false; - return; - } - - kDebug(); - config->reparseConfiguration(); - // FIXME: this deletes existing transport objects! - readConfig(); - appliedChange = true; // to prevent recursion - emit q->transportsChanged(); -} - -int TransportManagerPrivate::createId() const -{ - QList usedIds; - foreach ( Transport *t, transports ) { - usedIds << t->id(); - } - usedIds << 0; // 0 is default for unknown - int newId; - do { - newId = KRandom::random(); - } while ( usedIds.contains( newId ) ); - return newId; -} - -KWallet::Wallet * TransportManager::wallet() -{ - if ( d->wallet && d->wallet->isOpen() ) { - return d->wallet; - } - - if ( !Wallet::isEnabled() || d->walletOpenFailed ) { - return 0; - } - - WId window = 0; - if ( qApp->activeWindow() ) { - window = qApp->activeWindow()->winId(); - } else if ( !QApplication::topLevelWidgets().isEmpty() ) { - window = qApp->topLevelWidgets().first()->winId(); - } - - delete d->wallet; - d->wallet = Wallet::openWallet( Wallet::NetworkWallet(), window ); - - if ( !d->wallet ) { - d->walletOpenFailed = true; - return 0; - } - - d->prepareWallet(); - return d->wallet; -} - -void TransportManagerPrivate::prepareWallet() -{ - if ( !wallet ) { - return; - } - if ( !wallet->hasFolder( WALLET_FOLDER ) ) { - wallet->createFolder( WALLET_FOLDER ); - } - wallet->setFolder( WALLET_FOLDER ); -} - -void TransportManager::loadPasswords() -{ - foreach ( Transport *t, d->transports ) { - t->readPassword(); - } - - // flush the wallet queue - const QList copy = d->walletQueue; - d->walletQueue.clear(); - foreach ( TransportJob *job, copy ) { - job->start(); - } - - emit passwordsChanged(); -} - -void TransportManager::loadPasswordsAsync() -{ - kDebug(); - - // check if there is anything to do at all - bool found = false; - foreach ( Transport *t, d->transports ) { - if ( !t->isComplete() ) { - found = true; - break; - } - } - if ( !found ) { - return; - } - - // async wallet opening - if ( !d->wallet && !d->walletOpenFailed ) { - WId window = 0; - if ( qApp->activeWindow() ) { - window = qApp->activeWindow()->winId(); - } else if ( !QApplication::topLevelWidgets().isEmpty() ) { - window = qApp->topLevelWidgets().first()->winId(); - } - - d->wallet = Wallet::openWallet( Wallet::NetworkWallet(), window, - Wallet::Asynchronous ); - if ( d->wallet ) { - connect( d->wallet, SIGNAL(walletOpened(bool)), SLOT(slotWalletOpened(bool)) ); - d->walletAsyncOpen = true; - } else { - d->walletOpenFailed = true; - loadPasswords(); - } - return; - } - if ( d->wallet && !d->walletAsyncOpen ) { - loadPasswords(); - } -} - -void TransportManagerPrivate::slotWalletOpened( bool success ) -{ - kDebug(); - walletAsyncOpen = false; - if ( !success ) { - walletOpenFailed = true; - delete wallet; - wallet = 0; - } else { - prepareWallet(); - } - q->loadPasswords(); -} - -void TransportManagerPrivate::validateDefault() -{ - if ( !q->transportById( defaultTransportId, false ) ) { - if ( q->isEmpty() ) { - defaultTransportId = -1; - } else { - defaultTransportId = transports.first()->id(); - writeConfig(); - } - } -} - -void TransportManagerPrivate::migrateToWallet() -{ - // check if we tried this already - static bool firstRun = true; - if ( !firstRun ) { - return; - } - firstRun = false; - - // check if we are the main instance - if ( !isMainInstance ) { - return; - } - - // check if migration is needed - QStringList names; - foreach ( Transport *t, transports ) { - if ( t->needsWalletMigration() ) { - names << t->name(); - } - } - if ( names.isEmpty() ) { - return; - } - - // ask user if he wants to migrate - int result = KMessageBox::questionYesNoList( - 0, - i18n( "The following mail transports store their passwords in an " - "unencrypted configuration file.\nFor security reasons, " - "please consider migrating these passwords to KWallet, the " - "KDE Wallet management tool,\nwhich stores sensitive data " - "for you in a strongly encrypted file.\n" - "Do you want to migrate your passwords to KWallet?" ), - names, i18n( "Question" ), - KGuiItem( i18n( "Migrate" ) ), KGuiItem( i18n( "Keep" ) ), - QString::fromLatin1( "WalletMigrate" ) ); - if ( result != KMessageBox::Yes ) { - return; - } - - // perform migration - foreach ( Transport *t, transports ) { - if ( t->needsWalletMigration() ) { - t->migrateToWallet(); - } - } -} - -void TransportManagerPrivate::dbusServiceUnregistered() -{ - QDBusConnection::sessionBus().registerService( DBUS_SERVICE_NAME ); -} - -void TransportManagerPrivate::agentTypeAdded( const Akonadi::AgentType &atype ) -{ - using namespace Akonadi; - if ( atype.capabilities().contains( QLatin1String( "MailTransport" ) ) ) { - TransportType type; - type.d->mType = Transport::EnumType::Akonadi; - type.d->mAgentType = atype; - type.d->mName = atype.name(); - type.d->mDescription = atype.description(); - types << type; - kDebug() << "Added new Akonadi type" << atype.name(); - } -} - -void TransportManagerPrivate::agentTypeRemoved( const Akonadi::AgentType &atype ) -{ - using namespace Akonadi; - foreach ( const TransportType &type, types ) { - if ( type.type() == Transport::EnumType::Akonadi && - type.agentType() == atype ) { - types.removeAll( type ); - kDebug() << "Removed Akonadi type" << atype.name(); - } - } -} - -void TransportManagerPrivate::jobResult( KJob *job ) -{ - walletQueue.removeAll( static_cast( job ) ); -} - -#include "moc_transportmanager.cpp" diff -Nru kdepim-4.13.0/pimactivity/pimwidgets/mailtransport/transportmanager.h kdepim-4.13.3/pimactivity/pimwidgets/mailtransport/transportmanager.h --- kdepim-4.13.0/pimactivity/pimwidgets/mailtransport/transportmanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/pimwidgets/mailtransport/transportmanager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,304 +0,0 @@ -/* - Copyright (c) 2006 - 2007 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 MAILTRANSPORT_TRANSPORTMANAGER_H -#define MAILTRANSPORT_TRANSPORTMANAGER_H - -#include -#include - -#include -#include - -#include - -class KJob; - -namespace KWallet { - class Wallet; -} - -namespace MailTransport { - -class Transport; -class TransportConfigWidget; -class TransportJob; -class TransportManagerPrivate; - -/** - @short Central transport management interface. - - This class manages the creation, configuration, and removal of mail - transports, as well as the loading and storing of mail transport settings. - - It also handles the creation of transport jobs, although that behaviour is - deprecated and you are encouraged to use MessageQueueJob. - - @see MessageQueueJob. -*/ -class MAILTRANSPORT_EXPORT TransportManager : public QObject -{ - Q_OBJECT - Q_CLASSINFO( "D-Bus Interface", "org.kde.pim.TransportManager" ) - - friend class Transport; - friend class TransportManagerPrivate; - - public: - - /** - Destructor. - */ - virtual ~TransportManager(); - - /** - Returns the TransportManager instance. - */ - static TransportManager *self(); - - /** - Tries to load passwords asynchronously from KWallet if needed. - The passwordsChanged() signal is emitted once the passwords have been loaded. - Nothing happens if the passwords were already available. - */ - void loadPasswordsAsync(); - - /** - Returns the Transport object with the given id. - @param id The identifier of the Transport. - @param def if set to true, the default transport will be returned if the - specified Transport object could not be found, 0 otherwise. - @returns A Transport object for immediate use. It might become invalid as - soon as the event loop is entered again due to remote changes. If you need - to store a Transport object, store the transport identifier instead. - */ - Transport *transportById( int id, bool def = true ) const; - - /** - Returns the transport object with the given name. - @param name The transport name. - @param def if set to true, the default transport will be returned if the - specified Transport object could not be found, 0 otherwise. - @returns A Transport object for immediate use, see transportById() for - limitations. - */ - Transport *transportByName( const QString &name, bool def = true ) const; - - /** - Returns a list of all available transports. - Note: The Transport objects become invalid as soon as a change occur, so - they are only suitable for immediate use. - */ - QListtransports() const; - - /** - Returns a list of all available transport types. - */ - TransportType::List types() const; - - /** - Creates a new, empty Transport object. The object is owned by the caller. - If you want to add the Transport permanently (eg. after configuring it) - call addTransport(). - */ - Transport *createTransport() const; - - /** - Adds the given transport. The object ownership is transferred to - TransportMananger, ie. you must not delete @p transport. - @param transport The Transport object to add. - */ - void addTransport( Transport *transport ); - - /** - Creates a mail transport job for the given transport identifier. - Returns 0 if the specified transport is invalid. - @param transportId The transport identifier. - - @deprecated use MessageQueueJob to queue messages - and rely on the Dispatcher Agent to send them. - */ - MAILTRANSPORT_DEPRECATED TransportJob *createTransportJob( int transportId ); - - /** - Creates a mail transport job for the given transport identifer, - or transport name. - Returns 0 if the specified transport is invalid. - @param transport A string defining a mail transport. - - @deprecated use MessageQueueJob to queue messages - and rely on the Dispatcher Agent to send them. - */ - MAILTRANSPORT_DEPRECATED TransportJob *createTransportJob( const QString &transport ); - - /** - Executes the given transport job. This is the preferred way to start - transport jobs. It takes care of asynchronously loading passwords from - KWallet if necessary. - @param job The completely configured transport job to execute. - - @deprecated use MessageQueueJob to queue messages - and rely on the Dispatcher Agent to send them. - */ - MAILTRANSPORT_DEPRECATED void schedule( TransportJob *job ); - - /** - Tries to create a transport based on KEMailSettings. - If the data in KEMailSettings is incomplete, no transport is created. - */ - void createDefaultTransport(); - - /// Describes when to show the transport creation dialog - enum ShowCondition { - Always, ///< Show the transport creation dialog unconditionally - IfNoTransportExists ///< Only show the transport creation dialog if no transport currently - /// exists. Ask the user if he wants to add a transport in - /// the other case. - }; - - /** - Shows a dialog for creating and configuring a new transport. - @param parent Parent widget of the dialog. - @param showCondition the condition under which the dialog is shown at all - @return True if a new transport has been created and configured. - @since 4.4 - */ - bool showTransportCreationDialog( QWidget *parent, ShowCondition showCondition = Always ); - - /** - Open a configuration dialog for an existing transport. - @param transport The transport to configure. It can be a new transport, - or one already managed by TransportManager. - @param parent The parent widget for the dialog. - @return True if the user clicked Ok, false if the user cancelled. - @since 4.4 - */ - bool configureTransport( Transport *transport, QWidget *parent ); - - public Q_SLOTS: - /** - Returns true if there are no mail transports at all. - */ - Q_SCRIPTABLE bool isEmpty() const; - - /** - Returns a list of transport identifiers. - */ - Q_SCRIPTABLE QList transportIds() const; - - /** - Returns a list of transport names. - */ - Q_SCRIPTABLE QStringList transportNames() const; - - /** - Returns the default transport name. - */ - Q_SCRIPTABLE QString defaultTransportName() const; - - /** - Returns the default transport identifier. - Invalid if there are no transports at all. - */ - Q_SCRIPTABLE int defaultTransportId() const; - - /** - Sets the default transport. The change will be in effect immediately. - @param id The identifier of the new default transport. - */ - Q_SCRIPTABLE void setDefaultTransport( int id ); - - /** - Deletes the specified transport. - @param id The identifier of the mail transport to remove. - */ - Q_SCRIPTABLE void removeTransport( int id ); - - Q_SIGNALS: - /** - Emitted when transport settings have changed (by this or any other - TransportManager instance). - */ - Q_SCRIPTABLE void transportsChanged(); - - /** - Internal signal to synchronize all TransportManager instances. - This signal is emitted by the instance writing the changes. - You probably want to use transportsChanged() instead. - */ - Q_SCRIPTABLE void changesCommitted(); - - /** - Emitted when passwords have been loaded from the wallet. - If you made a deep copy of a transport, you should call updatePasswordState() - for the cloned transport to ensure its password is updated as well. - */ - void passwordsChanged(); - - /** - Emitted when a transport is deleted. - @param id The identifier of the deleted transport. - @param name The name of the deleted transport. - */ - void transportRemoved( int id, const QString &name ); - - /** - Emitted when a transport has been renamed. - @param id The identifier of the renamed transport. - @param oldName The old name. - @param newName The new name. - */ - void transportRenamed( int id, const QString &oldName, const QString &newName ); - - protected: - /** - Returns a pointer to an open wallet if available, 0 otherwise. - The wallet is opened synchronously if necessary. - */ - KWallet::Wallet *wallet(); - - /** - Loads all passwords synchronously. - */ - void loadPasswords(); - - /** - Singleton class, the only instance resides in the static object sSelf. - */ - TransportManager(); - - private: - - // These are used by our friend, Transport - void emitChangesCommitted(); - - private: - TransportManagerPrivate *const d; - - Q_PRIVATE_SLOT( d, void slotTransportsChanged() ) - Q_PRIVATE_SLOT( d, void slotWalletOpened( bool success ) ) - Q_PRIVATE_SLOT( d, void dbusServiceUnregistered() ) - Q_PRIVATE_SLOT( d, void agentTypeAdded( const Akonadi::AgentType &atype ) ) - Q_PRIVATE_SLOT( d, void agentTypeRemoved( const Akonadi::AgentType &atype ) ) - Q_PRIVATE_SLOT( d, void jobResult( KJob *job ) ) -}; - -} // namespace MailTransport - -#endif // MAILTRANSPORT_TRANSPORTMANAGER_H diff -Nru kdepim-4.13.0/pimactivity/tests/CMakeLists.txt kdepim-4.13.3/pimactivity/tests/CMakeLists.txt --- kdepim-4.13.0/pimactivity/tests/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/tests/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -project( pimactivitytest ) - -set( pimactivitytest_SRCS - main.cpp - mainwindow.cpp -) - -kde4_add_executable(pimactivitytest TEST ${pimactivitytest_SRCS} ) -TARGET_LINK_LIBRARIES(pimactivitytest ${KDE4_KDEUI_LIBS} pimactivity ) - diff -Nru kdepim-4.13.0/pimactivity/tests/main.cpp kdepim-4.13.3/pimactivity/tests/main.cpp --- kdepim-4.13.0/pimactivity/tests/main.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/tests/main.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 -#include -#include - -#include "mainwindow.h" - -int main( int argc, char **argv ) -{ - const QByteArray& ba = QByteArray( "pimactivitytest_gui" ); - const KLocalizedString name = ki18n( "PimActivitytest_gui" ); - KAboutData aboutData( ba, ba, name, ba, name ); - KCmdLineArgs::init( argc, argv, &aboutData ); - KApplication app; - MainWindow* mw = new MainWindow; - mw->show(); - app.exec(); -} diff -Nru kdepim-4.13.0/pimactivity/tests/mainwindow.cpp kdepim-4.13.3/pimactivity/tests/mainwindow.cpp --- kdepim-4.13.0/pimactivity/tests/mainwindow.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/tests/mainwindow.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 "mainwindow.h" -#include "pimactivity/pimwidgets/identity/identitymanageractivity.h" -#include "pimactivity/pimwidgets/mailtransport/transportcomboboxactivity.h" -#include "pimactivity/pimwidgets/identity/identitycomboboxactivity.h" -#include "pimactivity/activitymanager.h" - -#include - -MainWindow::MainWindow() - : QMainWindow() -{ - QWidget *w = new QWidget; - QVBoxLayout *lay = new QVBoxLayout; - PimActivity::TransportComboboxActivity *combobox = new PimActivity::TransportComboboxActivity; - lay->addWidget(combobox); - - PimActivity::ActivityManager *manager = new PimActivity::ActivityManager(this); - - PimActivity::IdentityManagerActivity *identityManager = new PimActivity::IdentityManagerActivity(manager,false, this, "identitymanager"); - PimActivity::IdentityComboboxActivity *identityCombobox = new PimActivity::IdentityComboboxActivity(identityManager); - lay->addWidget(identityCombobox); - - w->setLayout(lay); - setCentralWidget(w); -} - diff -Nru kdepim-4.13.0/pimactivity/tests/mainwindow.h kdepim-4.13.3/pimactivity/tests/mainwindow.h --- kdepim-4.13.0/pimactivity/tests/mainwindow.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/tests/mainwindow.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License, version 2, as - published by the Free Software Foundation. - - 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 MAINWINDOW_H -#define MAINWINDOW_H - -#include - -class MainWindow : public QMainWindow -{ - Q_OBJECT -public: - MainWindow(); -}; - -#endif // MAINWINDOW_H diff -Nru kdepim-4.13.0/pimactivity/widgets/abstractconfigurewidget.cpp kdepim-4.13.3/pimactivity/widgets/abstractconfigurewidget.cpp --- kdepim-4.13.0/pimactivity/widgets/abstractconfigurewidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/abstractconfigurewidget.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "abstractconfigurewidget.h" - -#include -#include - -using namespace PimActivity; - -AbstractConfigureWidget::AbstractConfigureWidget() -{ -} - -AbstractConfigureWidget::~AbstractConfigureWidget() -{ -} - -void AbstractConfigureWidget::setCurrentActivity(const QString &id) -{ - if (mActivityId != id) { - mActivityId = id; - readConfig(id); - } -} - -void AbstractConfigureWidget::setActivity(const QString &id) -{ - if (mActivityId != id) { - //Save previous activity - writeConfig(mActivityId); - mActivityId = id; - //read new activity - readConfig(id); - } -} - -QString AbstractConfigureWidget::activity() const -{ - return mActivityId; -} diff -Nru kdepim-4.13.0/pimactivity/widgets/abstractconfigurewidget.h kdepim-4.13.3/pimactivity/widgets/abstractconfigurewidget.h --- kdepim-4.13.0/pimactivity/widgets/abstractconfigurewidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/abstractconfigurewidget.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 ABSTRACTCONFIGUREWIDGET_H -#define ABSTRACTCONFIGUREWIDGET_H - -#include - -namespace PimActivity { -class AbstractConfigureWidget -{ -public: - AbstractConfigureWidget(); - virtual ~AbstractConfigureWidget(); - - void setActivity(const QString &id); - QString activity() const; - - void setCurrentActivity(const QString &id); - - virtual void readConfig(const QString &id) = 0; - virtual void writeConfig(const QString &id) = 0; - -private: - QString mActivityId; -}; -} - -#endif // ABSTRACTCONFIGUREWIDGET_H diff -Nru kdepim-4.13.0/pimactivity/widgets/activitywarning.cpp kdepim-4.13.3/pimactivity/widgets/activitywarning.cpp --- kdepim-4.13.0/pimactivity/widgets/activitywarning.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/activitywarning.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "activitywarning.h" -#include "activitymanager.h" - -#include - -namespace PimActivity { -ActivityWarning::ActivityWarning(ActivityManager *activityManager, QWidget *parent) - : KMessageWidget(parent) -{ - setMessageType( Warning ); - setCloseButtonVisible( true ); - setWordWrap( true ); - setText( i18n( "Activities is not active on this computer." ) ); - connect(activityManager, SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)), this, SLOT(setServiceStatusChanged(KActivities::Consumer::ServiceStatus))); - setVisible(!activityManager->isActive()); -} - -ActivityWarning::~ActivityWarning() -{ - -} - -void ActivityWarning::setServiceStatusChanged(KActivities::Consumer::ServiceStatus status) -{ - setVisible(status == KActivities::Consumer::NotRunning); -} - -} - diff -Nru kdepim-4.13.0/pimactivity/widgets/activitywarning.h kdepim-4.13.3/pimactivity/widgets/activitywarning.h --- kdepim-4.13.0/pimactivity/widgets/activitywarning.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/activitywarning.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 ACTIVITYWARNING_H -#define ACTIVITYWARNING_H - -#include -#include - -namespace PimActivity { -class ActivityManager; -class ActivityWarning : public KMessageWidget -{ - Q_OBJECT -public: - explicit ActivityWarning(PimActivity::ActivityManager *activityManager, QWidget *parent = 0); - ~ActivityWarning(); - -private Q_SLOTS: - void setServiceStatusChanged(KActivities::Consumer::ServiceStatus status); -}; -} - -#endif // ACTIVITYWARNING_H diff -Nru kdepim-4.13.0/pimactivity/widgets/comboboxactivity.cpp kdepim-4.13.3/pimactivity/widgets/comboboxactivity.cpp --- kdepim-4.13.0/pimactivity/widgets/comboboxactivity.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/comboboxactivity.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "comboboxactivity.h" -#include "activitymanager.h" -#include - -namespace PimActivity { - -class ComboBoxActivityPrivate -{ -public: - ComboBoxActivityPrivate(ComboBoxActivity *qq, ActivityManager *manager) - : q(qq), - activityManager(manager) - { - const QHash list = activityManager->listActivitiesWithRealName(); - QHashIterator i(list); - while (i.hasNext()) { - i.next(); - q->addItem(i.value(), i.key()); - } - q->connect(manager, SIGNAL(activityAdded(QString)), q, SLOT(slotActivityAdded(QString))); - q->connect(manager, SIGNAL(activityRemoved(QString)), q, SLOT(slotActivityRemoved(QString))); - q->connect(manager, SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)), q, SLOT(slotActivityStatusChanged(KActivities::Consumer::ServiceStatus))); - q->connect(q, SIGNAL(activated(int)), q, SLOT(slotActivityChanged(int))); - q->setEnabled(activityManager->isActive()); - } - - void slotActivityAdded(const QString &name) - { - q->addItem(name); - } - - void slotActivityRemoved(const QString &name) - { - q->removeItem(q->findText(name)); - } - - void slotActivityStatusChanged(KActivities::Consumer::ServiceStatus status) - { - q->setEnabled(status == KActivities::Consumer::Running); - } - - void slotActivityChanged(int index) - { - Q_EMIT q->activityChanged(q->itemData(index).toString()); - } - - ComboBoxActivity *q; - ActivityManager *activityManager; -}; - -ComboBoxActivity::ComboBoxActivity(ActivityManager *activityManager, QWidget *parent) - : KComboBox(parent), d(new ComboBoxActivityPrivate(this, activityManager)) -{ -} - -ComboBoxActivity::~ComboBoxActivity() -{ - delete d; -} - -} - -#include "moc_comboboxactivity.cpp" diff -Nru kdepim-4.13.0/pimactivity/widgets/comboboxactivity.h kdepim-4.13.3/pimactivity/widgets/comboboxactivity.h --- kdepim-4.13.0/pimactivity/widgets/comboboxactivity.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/comboboxactivity.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 COMBOBOXACTIVITY_H -#define COMBOBOXACTIVITY_H - -#include - -namespace PimActivity { -class ActivityManager; -class ComboBoxActivityPrivate; -class ComboBoxActivity : public KComboBox -{ - Q_OBJECT -public: - explicit ComboBoxActivity(ActivityManager *activityManager, QWidget *parent = 0); - ~ComboBoxActivity(); - -Q_SIGNALS: - //Emit activity identity - void activityChanged(const QString &id); -private: - friend class ComboBoxActivityPrivate; - ComboBoxActivityPrivate * const d; - Q_PRIVATE_SLOT( d, void slotActivityAdded(const QString&) ) - Q_PRIVATE_SLOT( d, void slotActivityRemoved(const QString&) ) - Q_PRIVATE_SLOT( d, void slotActivityStatusChanged(KActivities::Consumer::ServiceStatus) ) - Q_PRIVATE_SLOT( d, void slotActivityChanged(int) ) -}; -} - -#endif // COMBOBOXACTIVITY_H diff -Nru kdepim-4.13.0/pimactivity/widgets/configurecollections.cpp kdepim-4.13.3/pimactivity/widgets/configurecollections.cpp --- kdepim-4.13.0/pimactivity/widgets/configurecollections.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/configurecollections.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "configurecollections.h" -#include "activitymanager.h" - -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - - -namespace PimActivity { - -ConfigureCollections::ConfigureCollections(QWidget *parent) - : QWidget(parent), mModelState(0) -{ - QVBoxLayout *layout = new QVBoxLayout; - layout->setSpacing( KDialog::spacingHint() ); - layout->setMargin( 0 ); - - mFolderView = new QTreeView( this ); - mFolderView->setEditTriggers( QAbstractItemView::NoEditTriggers ); - layout->addWidget( mFolderView ); - setLayout(layout); - initCollections(); -} - -ConfigureCollections::~ConfigureCollections() -{ - -} - -void ConfigureCollections::initCollections() -{ - // Create a new change recorder. - mChangeRecorder = new Akonadi::ChangeRecorder( this ); - mChangeRecorder->setMimeTypeMonitored( KMime::Message::mimeType() ); - - mModel = new Akonadi::EntityTreeModel( mChangeRecorder, this ); - - // Set the model to show only collections, not items. - mModel->setItemPopulationStrategy( Akonadi::EntityTreeModel::NoItemPopulation ); - - // Create the Check proxy model. - mSelectionModel = new QItemSelectionModel( mModel ); - mCheckProxy = new KCheckableProxyModel( this ); - mCheckProxy->setSelectionModel( mSelectionModel ); - mCheckProxy->setSourceModel( mModel ); - - connect(mCheckProxy, SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(slotDataChanged())); - mFolderView->setModel( mCheckProxy ); -} - -void ConfigureCollections::slotDataChanged() -{ - Q_EMIT(changed(true)); -} - -void ConfigureCollections::readConfig(const QString &id) -{ - KSharedConfigPtr conf = ActivityManager::configFromActivity(id); - if (!mModelState) { - mModelState = new KViewStateMaintainer( conf->group( "collections" ), this ); - mModelState->setSelectionModel( mSelectionModel ); - } - mModelState->restoreState(); -} - -void ConfigureCollections::writeConfig(const QString &id) -{ - KSharedConfigPtr conf = ActivityManager::configFromActivity(id); - KConfigGroup grp = conf->group(QLatin1String("collections")); - if (mModelState) { - delete mModelState; - mModelState = new KViewStateMaintainer( grp, this ); - mModelState->saveState(); - } - Q_EMIT(changed(false)); -} - -void ConfigureCollections::setDefault() -{ - //TODO -} - -} - diff -Nru kdepim-4.13.0/pimactivity/widgets/configurecollections.h kdepim-4.13.3/pimactivity/widgets/configurecollections.h --- kdepim-4.13.0/pimactivity/widgets/configurecollections.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/configurecollections.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 CONFIGURECOLLECTIONS_H -#define CONFIGURECOLLECTIONS_H - -#include "abstractconfigurewidget.h" - -#include - -#include - -namespace Akonadi { - class EntityTreeModel; - class ChangeRecorder; - class ETMViewStateSaver; -} - -class KCheckableProxyModel; -class QTreeView; - -namespace PimActivity { - -class ConfigureCollections : public QWidget, public AbstractConfigureWidget -{ - Q_OBJECT -public: - explicit ConfigureCollections(QWidget *parent = 0); - ~ConfigureCollections(); - - void setDefault(); - void writeConfig(const QString &id); - -private: - void readConfig(const QString &id); - -private Q_SLOTS: - void slotDataChanged(); - -Q_SIGNALS: - void changed(bool b = true); - -private: - void initCollections(); - QTreeView *mFolderView; - QItemSelectionModel *mSelectionModel; - Akonadi::EntityTreeModel *mModel; - Akonadi::ChangeRecorder *mChangeRecorder; - KCheckableProxyModel *mCheckProxy; - KViewStateMaintainer *mModelState; -}; -} - -#endif // CONFIGURECOLLECTIONS_H diff -Nru kdepim-4.13.0/pimactivity/widgets/configureidentity.cpp kdepim-4.13.3/pimactivity/widgets/configureidentity.cpp --- kdepim-4.13.0/pimactivity/widgets/configureidentity.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/configureidentity.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "configureidentity.h" -#include "activitymanager.h" - -#include -#include - - -#include -#include -#include - -namespace PimActivity { - -ConfigureIdentity::ConfigureIdentity(QWidget *parent) - : QWidget(parent) -{ - QVBoxLayout *lay = new QVBoxLayout; - mListIdentity = new QListWidget; - lay->addWidget(mListIdentity); - init(); - setLayout(lay); - connect(mListIdentity, SIGNAL(itemChanged(QListWidgetItem*)), SIGNAL(changed())); -} - -ConfigureIdentity::~ConfigureIdentity() -{ - delete mManager; -} - -void ConfigureIdentity::init() -{ - mManager = new KPIMIdentities::IdentityManager( false, this, "mIdentityManager" ); - KPIMIdentities::IdentityManager::Iterator end( mManager->modifyEnd() ); - - for ( KPIMIdentities::IdentityManager::Iterator it = mManager->modifyBegin(); it != end; ++it ) { - QListWidgetItem *item = new QListWidgetItem(mListIdentity); - item->setCheckState(Qt::Checked); - item->setData(IdentityID, (*it).uoid()); - item->setText((*it).identityName()); - } -} - -void ConfigureIdentity::readConfig(const QString &id) -{ - KSharedConfigPtr conf = ActivityManager::configFromActivity(id); - if (conf->hasGroup(QLatin1String("identity"))) { - KConfigGroup grp = conf->group(QLatin1String("identity")); - const QStringList list = grp.readEntry(QLatin1String("NoActiveIdentity"), QStringList()); - const int numberOfItems(mListIdentity->count()); - for (int i = 0; i < numberOfItems; ++i) { - QListWidgetItem *item = mListIdentity->item(i); - if (list.contains(item->data(IdentityID).toString())) { - item->setCheckState(Qt::Unchecked); - } else { - item->setCheckState(Qt::Checked); - } - } - } - emit changed(false); -} - -void ConfigureIdentity::writeConfig(const QString &id) -{ - KSharedConfigPtr conf = ActivityManager::configFromActivity(id); - KConfigGroup grp = conf->group(QLatin1String("identity")); - const int numberOfItems(mListIdentity->count()); - QStringList lst; - for (int i = 0; i < numberOfItems; ++i) { - QListWidgetItem *item = mListIdentity->item(i); - if (item->checkState() == Qt::Unchecked) { - lst << item->data(IdentityID).toString(); - } - } - grp.writeEntry(QLatin1String("NoActiveIdentity"), lst); -} - -void ConfigureIdentity::setDefault() -{ - const int numberOfItems(mListIdentity->count()); - for (int i = 0; i < numberOfItems; ++i) { - QListWidgetItem *item = mListIdentity->item(i); - item->setCheckState(Qt::Checked); - } -} - -} - diff -Nru kdepim-4.13.0/pimactivity/widgets/configureidentity.h kdepim-4.13.3/pimactivity/widgets/configureidentity.h --- kdepim-4.13.0/pimactivity/widgets/configureidentity.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/configureidentity.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,64 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 CONFIGUREIDENTITY_H -#define CONFIGUREIDENTITY_H - -#include "abstractconfigurewidget.h" -#include - -class QListWidget; -namespace KPIMIdentities { -class IdentityManager; -} - -namespace PimActivity { - -class ConfigureIdentity : public QWidget, public AbstractConfigureWidget -{ - Q_OBJECT -public: - explicit ConfigureIdentity(QWidget *parent); - ~ConfigureIdentity(); - - void writeConfig(const QString &id); - - void setDefault(); - -private: - void readConfig(const QString &id); - - -Q_SIGNALS: - void changed(bool b = true); - -private: - enum identityId { - IdentityID = Qt::UserRole +1 - }; - - void init(); - QListWidget *mListIdentity; - KPIMIdentities::IdentityManager *mManager; -}; - -} - -#endif // CONFIGUREIDENTITY_H diff -Nru kdepim-4.13.0/pimactivity/widgets/configuremailtransport.cpp kdepim-4.13.3/pimactivity/widgets/configuremailtransport.cpp --- kdepim-4.13.0/pimactivity/widgets/configuremailtransport.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/configuremailtransport.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 "configuremailtransport.h" -#include "activitymanager.h" - -#include "mailtransport/transportmanager.h" - -#include -#include -#include - -namespace PimActivity { -ConfigureMailtransport::ConfigureMailtransport(QWidget *parent) - : QWidget(parent) -{ - QVBoxLayout *lay = new QVBoxLayout; - mListTransport = new QListWidget; - lay->addWidget(mListTransport); - init(); - setLayout(lay); - connect(mListTransport, SIGNAL(itemChanged(QListWidgetItem*)), SIGNAL(changed())); -} - -ConfigureMailtransport::~ConfigureMailtransport() -{ -} - -void ConfigureMailtransport::init() -{ - QStringList listNames = MailTransport::TransportManager::self()->transportNames(); - QList listIds = MailTransport::TransportManager::self()->transportIds(); - int i = 0; - Q_FOREACH (const QString &name, listNames) { - QListWidgetItem *item = new QListWidgetItem(mListTransport); - item->setCheckState(Qt::Checked); - item->setText(name); - item->setData(TransportID, listIds.at(i)); - ++i; - } -} - -void ConfigureMailtransport::readConfig(const QString &id) -{ - KSharedConfigPtr conf = ActivityManager::configFromActivity(id); - if (conf->hasGroup(QLatin1String("mailtransport"))) { - KConfigGroup grp = conf->group(QLatin1String("mailtransport")); - const QStringList list = grp.readEntry(QLatin1String("NoActiveMailTransport"), QStringList()); - const int numberOfItems(mListTransport->count()); - for (int i = 0; i < numberOfItems; ++i) { - QListWidgetItem *item = mListTransport->item(i); - if (list.contains(item->data(TransportID).toString())) { - item->setCheckState(Qt::Unchecked); - } else { - item->setCheckState(Qt::Checked); - } - } - } -} - -void ConfigureMailtransport::writeConfig(const QString &id) -{ - KSharedConfigPtr conf = ActivityManager::configFromActivity(id); - KConfigGroup grp = conf->group(QLatin1String("mailtransport")); - const int numberOfItems(mListTransport->count()); - QStringList lst; - for (int i = 0; i < numberOfItems; ++i) { - QListWidgetItem *item = mListTransport->item(i); - if (item->checkState() == Qt::Unchecked) { - lst << item->data(TransportID).toString(); - } - } - grp.writeEntry(QLatin1String("NoActiveMailTransport"), lst); -} - -void ConfigureMailtransport::setDefault() -{ - const int numberOfItems(mListTransport->count()); - for (int i = 0; i < numberOfItems; ++i) { - QListWidgetItem *item = mListTransport->item(i); - item->setCheckState(Qt::Checked); - } -} - - -} - diff -Nru kdepim-4.13.0/pimactivity/widgets/configuremailtransport.h kdepim-4.13.3/pimactivity/widgets/configuremailtransport.h --- kdepim-4.13.0/pimactivity/widgets/configuremailtransport.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimactivity/widgets/configuremailtransport.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* - Copyright (c) 2013, 2014 Montel Laurent - - 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 CONFIGUREMAILTRANSPORT_H -#define CONFIGUREMAILTRANSPORT_H - -#include "abstractconfigurewidget.h" -#include -class QListWidget; - -namespace PimActivity { -class ConfigureMailtransport : public QWidget, public AbstractConfigureWidget -{ - Q_OBJECT -public: - explicit ConfigureMailtransport(QWidget *parent = 0); - ~ConfigureMailtransport(); - - void writeConfig(const QString &id); - void setDefault(); - -private: - void readConfig(const QString &id); - -Q_SIGNALS: - void changed(bool b = true); - -private: - enum transportId { - TransportID = Qt::UserRole +1 - }; - - void init(); - QListWidget *mListTransport; -}; -} - -#endif // CONFIGUREMAILTRANSPORT_H diff -Nru kdepim-4.13.0/pimcommon/acl/collectionaclpage.h kdepim-4.13.3/pimcommon/acl/collectionaclpage.h --- kdepim-4.13.0/pimcommon/acl/collectionaclpage.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/acl/collectionaclpage.h 2014-07-09 12:18:50.000000000 +0000 @@ -35,7 +35,6 @@ #include #include "pimcommon_export.h" -class KPushButton; class KHBox; namespace PimCommon { @@ -64,10 +63,6 @@ PimCommon::AclManager *mAclManager; // The widget containing the ACL widgets (listview and buttons) KHBox* mACLWidget; - - KPushButton* mAddACL; - KPushButton* mEditACL; - KPushButton* mRemoveACL; }; AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY( CollectionAclPageFactory, CollectionAclPage ) } diff -Nru kdepim-4.13.0/pimcommon/autocorrection/widgets/lineeditwithautocorrection.cpp kdepim-4.13.3/pimcommon/autocorrection/widgets/lineeditwithautocorrection.cpp --- kdepim-4.13.0/pimcommon/autocorrection/widgets/lineeditwithautocorrection.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/autocorrection/widgets/lineeditwithautocorrection.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -56,7 +56,7 @@ void LineEditWithAutoCorrection::keyPressEvent ( QKeyEvent *e ) { if ((e->key() == Qt::Key_Space) || (e->key() == Qt::Key_Enter) || (e->key() == Qt::Key_Return)) { - if (mAutoCorrection) { + if (mAutoCorrection && !textCursor().hasSelection()) { // no Html format in subject. int position = textCursor().position(); mAutoCorrection->autocorrect(false, *document(), position); diff -Nru kdepim-4.13.0/pimcommon/autocorrection/widgets/richtexteditwithautocorrection.cpp kdepim-4.13.3/pimcommon/autocorrection/widgets/richtexteditwithautocorrection.cpp --- kdepim-4.13.0/pimcommon/autocorrection/widgets/richtexteditwithautocorrection.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/autocorrection/widgets/richtexteditwithautocorrection.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -62,26 +62,28 @@ void RichTextEditWithAutoCorrection::keyPressEvent ( QKeyEvent *e ) { if ((e->key() == Qt::Key_Space) || (e->key() == Qt::Key_Enter) || (e->key() == Qt::Key_Return)) { - const QTextCharFormat initialTextFormat = textCursor().charFormat(); - const bool richText = acceptRichText(); - int position = textCursor().position(); - mAutoCorrection->autocorrect(richText, *document(), position); - QTextCursor cur = textCursor(); - cur.setPosition(position); - if (e->key() == Qt::Key_Space) { - if (richText && !isSpecial(initialTextFormat)) - cur.insertText(QLatin1String(" "), initialTextFormat); - else - cur.insertText(QLatin1String(" ")); - setTextCursor(cur); - return; - } else { - if (richText && !isSpecial(initialTextFormat)) - cur.insertText(QLatin1String("\n"), initialTextFormat); - else - cur.insertText(QLatin1String("\n")); - setTextCursor(cur); - return; + if (!textCursor().hasSelection()) { + const QTextCharFormat initialTextFormat = textCursor().charFormat(); + const bool richText = acceptRichText(); + int position = textCursor().position(); + mAutoCorrection->autocorrect(richText, *document(), position); + QTextCursor cur = textCursor(); + cur.setPosition(position); + if (e->key() == Qt::Key_Space) { + if (richText && !isSpecial(initialTextFormat)) + cur.insertText(QLatin1String(" "), initialTextFormat); + else + cur.insertText(QLatin1String(" ")); + setTextCursor(cur); + return; + } else { + if (richText && !isSpecial(initialTextFormat)) + cur.insertText(QLatin1String("\n"), initialTextFormat); + else + cur.insertText(QLatin1String("\n")); + setTextCursor(cur); + return; + } } } PimCommon::RichTextEditor::keyPressEvent( e ); diff -Nru kdepim-4.13.0/pimcommon/CMakeLists.txt kdepim-4.13.3/pimcommon/CMakeLists.txt --- kdepim-4.13.0/pimcommon/CMakeLists.txt 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/CMakeLists.txt 2014-07-09 12:18:50.000000000 +0000 @@ -50,6 +50,7 @@ storageservice/authdialog/storageauthviewwidget.cpp storageservice/authdialog/storageauthviewdialog.cpp storageservice/authdialog/logindialog.cpp + storageservice/authdialog/storageauthwebview.cpp storageservice/hubic/hubicstorageservice.cpp storageservice/hubic/hubicjob.cpp diff -Nru kdepim-4.13.0/pimcommon/storageservice/authdialog/storageauthviewwidget.cpp kdepim-4.13.3/pimcommon/storageservice/authdialog/storageauthviewwidget.cpp --- kdepim-4.13.0/pimcommon/storageservice/authdialog/storageauthviewwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/authdialog/storageauthviewwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -17,6 +17,7 @@ #include "storageauthviewwidget.h" +#include "storageauthwebview.h" #include #include @@ -30,7 +31,7 @@ { QVBoxLayout *lay = new QVBoxLayout; lay->setMargin(0); - mWebView = new QWebView; + mWebView = new StorageAuthWebView; mProgressBar = new QProgressBar; mProgressBar->hide(); connect(mWebView, SIGNAL(urlChanged(QUrl)), this, SIGNAL(urlChanged(QUrl))); diff -Nru kdepim-4.13.0/pimcommon/storageservice/authdialog/storageauthviewwidget.h kdepim-4.13.3/pimcommon/storageservice/authdialog/storageauthviewwidget.h --- kdepim-4.13.0/pimcommon/storageservice/authdialog/storageauthviewwidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/authdialog/storageauthviewwidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -21,9 +21,9 @@ #include #include -class QWebView; class QProgressBar; namespace PimCommon { +class StorageAuthWebView; class StorageAuthViewWidget : public QWidget { Q_OBJECT @@ -41,7 +41,7 @@ void slotLoadFinished(bool success); private: - QWebView *mWebView; + StorageAuthWebView *mWebView; QProgressBar *mProgressBar; }; } diff -Nru kdepim-4.13.0/pimcommon/storageservice/authdialog/storageauthwebview.cpp kdepim-4.13.3/pimcommon/storageservice/authdialog/storageauthwebview.cpp --- kdepim-4.13.0/pimcommon/storageservice/authdialog/storageauthwebview.cpp 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/authdialog/storageauthwebview.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -0,0 +1,36 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 "storageauthwebview.h" + +using namespace PimCommon; + +StorageAuthWebView::StorageAuthWebView(QWidget *parent) + : QWebView(parent) +{ +} + + +StorageAuthWebView::~StorageAuthWebView() +{ + +} + +void StorageAuthWebView::contextMenuEvent(QContextMenuEvent *) +{ + //Empty +} diff -Nru kdepim-4.13.0/pimcommon/storageservice/authdialog/storageauthwebview.h kdepim-4.13.3/pimcommon/storageservice/authdialog/storageauthwebview.h --- kdepim-4.13.0/pimcommon/storageservice/authdialog/storageauthwebview.h 1970-01-01 00:00:00.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/authdialog/storageauthwebview.h 2014-07-09 12:18:50.000000000 +0000 @@ -0,0 +1,35 @@ +/* + Copyright (c) 2014 Montel Laurent + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License, version 2, as + published by the Free Software Foundation. + + 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 STORAGEAUTHWEBVIEW_H +#define STORAGEAUTHWEBVIEW_H + +#include +namespace PimCommon { +class StorageAuthWebView : public QWebView +{ + Q_OBJECT +public: + explicit StorageAuthWebView(QWidget *parent=0); + ~StorageAuthWebView(); + +protected: + void contextMenuEvent( QContextMenuEvent *); +}; +} +#endif // STORAGEAUTHWEBVIEW_H diff -Nru kdepim-4.13.0/pimcommon/storageservice/box/boxjob.cpp kdepim-4.13.3/pimcommon/storageservice/box/boxjob.cpp --- kdepim-4.13.0/pimcommon/storageservice/box/boxjob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/box/boxjob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -63,7 +63,7 @@ void BoxJob::createServiceFolder() { - mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolderAction; mError = false; createFolderJob(PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder(), QLatin1String("0")); } @@ -71,7 +71,7 @@ void BoxJob::requestTokenAccess() { mError = false; - mActionType = PimCommon::StorageServiceAbstract::RequestToken; + mActionType = PimCommon::StorageServiceAbstract::RequestTokenAction; QUrl url(mServiceUrl + mAuthorizePath ); url.addQueryItem(QLatin1String("response_type"), QLatin1String("code")); url.addQueryItem(QLatin1String("client_id"), mClientId); @@ -132,7 +132,7 @@ void BoxJob::getTokenAccess(const QString &authorizeCode) { - mActionType = PimCommon::StorageServiceAbstract::AccessToken; + mActionType = PimCommon::StorageServiceAbstract::AccessTokenAction; mError = false; QNetworkRequest request(QUrl(mServiceUrl + mPathToken)); request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded")); @@ -168,37 +168,37 @@ case PimCommon::StorageServiceAbstract::NoneAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: Q_EMIT authorizationFailed(errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: Q_EMIT authorizationFailed(errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: Q_EMIT uploadFileFailed(errorStr); errorMessage(mActionType, errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: Q_EMIT downLoadFileFailed(errorStr); errorMessage(mActionType, errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::DeleteFile: - case PimCommon::StorageServiceAbstract::CreateFolder: - case PimCommon::StorageServiceAbstract::AccountInfo: - case PimCommon::StorageServiceAbstract::ListFolder: - case PimCommon::StorageServiceAbstract::CreateServiceFolder: - case PimCommon::StorageServiceAbstract::DeleteFolder: - case PimCommon::StorageServiceAbstract::RenameFolder: - case PimCommon::StorageServiceAbstract::RenameFile: - case PimCommon::StorageServiceAbstract::MoveFolder: - case PimCommon::StorageServiceAbstract::MoveFile: - case PimCommon::StorageServiceAbstract::CopyFile: - case PimCommon::StorageServiceAbstract::CopyFolder: - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::DeleteFileAction: + case PimCommon::StorageServiceAbstract::CreateFolderAction: + case PimCommon::StorageServiceAbstract::AccountInfoAction: + case PimCommon::StorageServiceAbstract::ListFolderAction: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: + case PimCommon::StorageServiceAbstract::RenameFolderAction: + case PimCommon::StorageServiceAbstract::RenameFileAction: + case PimCommon::StorageServiceAbstract::MoveFolderAction: + case PimCommon::StorageServiceAbstract::MoveFileAction: + case PimCommon::StorageServiceAbstract::CopyFileAction: + case PimCommon::StorageServiceAbstract::CopyFolderAction: + case PimCommon::StorageServiceAbstract::ShareLinkAction: errorMessage(mActionType, errorStr); deleteLater(); break; @@ -218,55 +218,55 @@ case PimCommon::StorageServiceAbstract::NoneAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: parseAccessToken(data); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: parseUploadFile(data); break; - case PimCommon::StorageServiceAbstract::CreateFolder: + case PimCommon::StorageServiceAbstract::CreateFolderAction: parseCreateFolder(data); break; - case PimCommon::StorageServiceAbstract::AccountInfo: + case PimCommon::StorageServiceAbstract::AccountInfoAction: parseAccountInfo(data); break; - case PimCommon::StorageServiceAbstract::ListFolder: + case PimCommon::StorageServiceAbstract::ListFolderAction: parseListFolder(data); break; - case PimCommon::StorageServiceAbstract::CreateServiceFolder: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: parseCreateServiceFolder(data); break; - case PimCommon::StorageServiceAbstract::DeleteFile: + case PimCommon::StorageServiceAbstract::DeleteFileAction: parseDeleteFile(data); break; - case PimCommon::StorageServiceAbstract::DeleteFolder: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: parseDeleteFolder(data); break; - case PimCommon::StorageServiceAbstract::CopyFile: + case PimCommon::StorageServiceAbstract::CopyFileAction: parseCopyFile(data); break; - case PimCommon::StorageServiceAbstract::CopyFolder: + case PimCommon::StorageServiceAbstract::CopyFolderAction: parseCopyFolder(data); break; - case PimCommon::StorageServiceAbstract::RenameFile: + case PimCommon::StorageServiceAbstract::RenameFileAction: parseRenameFile(data); break; - case PimCommon::StorageServiceAbstract::RenameFolder: + case PimCommon::StorageServiceAbstract::RenameFolderAction: parseRenameFolder(data); break; - case PimCommon::StorageServiceAbstract::MoveFolder: + case PimCommon::StorageServiceAbstract::MoveFolderAction: parseMoveFolder(data); break; - case PimCommon::StorageServiceAbstract::MoveFile: + case PimCommon::StorageServiceAbstract::MoveFileAction: parseMoveFile(data); break; - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::ShareLinkAction: parseShareLink(data); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: parseDownloadFile(data); break; } @@ -293,7 +293,7 @@ void BoxJob::refreshToken() { - mActionType = PimCommon::StorageServiceAbstract::AccessToken; + mActionType = PimCommon::StorageServiceAbstract::AccessTokenAction; QNetworkRequest request(QUrl(QLatin1String("https://www.box.com/api/oauth2/token"))); request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded")); QUrl postData; @@ -310,7 +310,7 @@ void BoxJob::deleteFile(const QString &filename) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFile; + mActionType = PimCommon::StorageServiceAbstract::DeleteFileAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFileInfoPath + filename); @@ -323,7 +323,7 @@ void BoxJob::deleteFolder(const QString &foldername) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFolder; + mActionType = PimCommon::StorageServiceAbstract::DeleteFolderAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFolderInfoPath + foldername); @@ -337,7 +337,7 @@ void BoxJob::renameFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::RenameFolder; + mActionType = PimCommon::StorageServiceAbstract::RenameFolderAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFolderInfoPath + source); @@ -352,7 +352,7 @@ void BoxJob::renameFile(const QString &oldName, const QString &newName) { - mActionType = PimCommon::StorageServiceAbstract::RenameFile; + mActionType = PimCommon::StorageServiceAbstract::RenameFileAction; mError = false; QUrl url; @@ -368,7 +368,7 @@ void BoxJob::moveFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::MoveFolder; + mActionType = PimCommon::StorageServiceAbstract::MoveFolderAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFolderInfoPath + source); @@ -383,7 +383,7 @@ void BoxJob::moveFile(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::MoveFile; + mActionType = PimCommon::StorageServiceAbstract::MoveFileAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFileInfoPath + source); @@ -399,7 +399,7 @@ void BoxJob::copyFile(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFile; + mActionType = PimCommon::StorageServiceAbstract::CopyFileAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFileInfoPath + QString::fromLatin1("%1/copy").arg(source)); @@ -414,7 +414,7 @@ void BoxJob::copyFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFolder; + mActionType = PimCommon::StorageServiceAbstract::CopyFolderAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFolderInfoPath + QString::fromLatin1("%1/copy").arg(source)); @@ -431,7 +431,7 @@ { QFile *file = new QFile(filename); if (file->exists()) { - mActionType = PimCommon::StorageServiceAbstract::UploadFile; + mActionType = PimCommon::StorageServiceAbstract::UploadFileAction; mError = false; if (file->open(QIODevice::ReadOnly)) { QUrl url; @@ -455,7 +455,7 @@ void BoxJob::listFolder(const QString &folder) { - mActionType = PimCommon::StorageServiceAbstract::ListFolder; + mActionType = PimCommon::StorageServiceAbstract::ListFolderAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFolderInfoPath + (folder.isEmpty() ? QLatin1String("0") : folder) + QLatin1String("/items?fields=name,created_at,size,modified_at,id")); @@ -468,7 +468,7 @@ void BoxJob::accountInfo() { - mActionType = PimCommon::StorageServiceAbstract::AccountInfo; + mActionType = PimCommon::StorageServiceAbstract::AccountInfoAction; mError = false; QUrl url; url.setUrl(mApiUrl + mCurrentAccountInfoPath); @@ -493,7 +493,7 @@ void BoxJob::createFolder(const QString &foldername, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CreateFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateFolderAction; mError = false; createFolderJob(foldername, destination); } @@ -502,7 +502,7 @@ void BoxJob::shareLink(const QString &root, const QString &fileId) { Q_UNUSED(root); - mActionType = PimCommon::StorageServiceAbstract::ShareLink; + mActionType = PimCommon::StorageServiceAbstract::ShareLinkAction; mError = false; QUrl url; url.setUrl(mApiUrl + mFileInfoPath + fileId); @@ -654,10 +654,10 @@ QNetworkReply * BoxJob::downloadFile(const QString &name, const QString &fileId, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::DownLoadFile; + mActionType = PimCommon::StorageServiceAbstract::DownLoadFileAction; mError = false; - mActionType = PimCommon::StorageServiceAbstract::DownLoadFile; + mActionType = PimCommon::StorageServiceAbstract::DownLoadFileAction; mError = false; const QString defaultDestination = (destination.isEmpty() ? PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder() : destination); delete mDownloadFile; diff -Nru kdepim-4.13.0/pimcommon/storageservice/box/boxstorageservice.cpp kdepim-4.13.3/pimcommon/storageservice/box/boxstorageservice.cpp --- kdepim-4.13.0/pimcommon/storageservice/box/boxstorageservice.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/box/boxstorageservice.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -156,7 +156,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(ShareLink); + mNextAction->setNextActionType(ShareLinkAction); mNextAction->setPath(path); mNextAction->setRootPath(root); if (mToken.isEmpty()) { @@ -177,7 +177,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(DownLoadFile); + mNextAction->setNextActionType(DownLoadFileAction); mNextAction->setNextActionName(name); mNextAction->setDownloadDestination(destination); mNextAction->setFileId(fileId); @@ -201,7 +201,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(DeleteFile); + mNextAction->setNextActionType(DeleteFileAction); mNextAction->setNextActionName(filename); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -221,7 +221,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(DeleteFolder); + mNextAction->setNextActionType(DeleteFolderAction); mNextAction->setNextActionFolder(foldername); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -241,7 +241,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(RenameFolder); + mNextAction->setNextActionType(RenameFolderAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -261,7 +261,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(RenameFile); + mNextAction->setNextActionType(RenameFileAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -281,7 +281,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(MoveFolder); + mNextAction->setNextActionType(MoveFolderAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -301,7 +301,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(MoveFile); + mNextAction->setNextActionType(MoveFileAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -321,7 +321,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(CopyFile); + mNextAction->setNextActionType(CopyFileAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -341,7 +341,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(CopyFolder); + mNextAction->setNextActionType(CopyFolderAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -361,7 +361,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(ListFolder); + mNextAction->setNextActionType(ListFolderAction); mNextAction->setNextActionFolder(folder); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -381,7 +381,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(CreateFolder); + mNextAction->setNextActionType(CreateFolderAction); mNextAction->setNextActionName(name); mNextAction->setNextActionFolder(destination); if (mToken.isEmpty()) { @@ -402,7 +402,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(AccountInfo); + mNextAction->setNextActionType(AccountInfoAction); if (mToken.isEmpty()) { storageServiceauthentication(); } else { @@ -426,7 +426,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(UploadFile); + mNextAction->setNextActionType(UploadFileAction); mNextAction->setNextActionName(filename); mNextAction->setNextActionFolder(destination); mNextAction->setUploadAsName(uploadAsName); @@ -506,7 +506,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(CreateServiceFolder); + mNextAction->setNextActionType(CreateServiceFolderAction); if (mToken.isEmpty()) { storageServiceauthentication(); } else { diff -Nru kdepim-4.13.0/pimcommon/storageservice/dropbox/dropboxjob.cpp kdepim-4.13.3/pimcommon/storageservice/dropbox/dropboxjob.cpp --- kdepim-4.13.0/pimcommon/storageservice/dropbox/dropboxjob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/dropbox/dropboxjob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -66,7 +66,7 @@ void DropBoxJob::requestTokenAccess() { - mActionType = PimCommon::StorageServiceAbstract::RequestToken; + mActionType = PimCommon::StorageServiceAbstract::RequestTokenAction; mError = false; QNetworkRequest request(QUrl(mApiPath + QLatin1String("oauth/request_token"))); request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded")); @@ -86,7 +86,7 @@ void DropBoxJob::getTokenAccess() { - mActionType = PimCommon::StorageServiceAbstract::AccessToken; + mActionType = PimCommon::StorageServiceAbstract::AccessTokenAction; mError = false; QNetworkRequest request(QUrl(mApiPath + QLatin1String("oauth/access_token"))); request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded")); @@ -119,37 +119,37 @@ case PimCommon::StorageServiceAbstract::NoneAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: Q_EMIT authorizationFailed(errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: Q_EMIT authorizationFailed(errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: Q_EMIT uploadFileFailed(errorStr); errorMessage(mActionType, errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: Q_EMIT downLoadFileFailed(errorStr); errorMessage(mActionType, errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::CreateFolder: - case PimCommon::StorageServiceAbstract::AccountInfo: - case PimCommon::StorageServiceAbstract::ListFolder: - case PimCommon::StorageServiceAbstract::ShareLink: - case PimCommon::StorageServiceAbstract::CreateServiceFolder: - case PimCommon::StorageServiceAbstract::DeleteFile: - case PimCommon::StorageServiceAbstract::DeleteFolder: - case PimCommon::StorageServiceAbstract::RenameFolder: - case PimCommon::StorageServiceAbstract::RenameFile: - case PimCommon::StorageServiceAbstract::MoveFolder: - case PimCommon::StorageServiceAbstract::MoveFile: - case PimCommon::StorageServiceAbstract::CopyFile: - case PimCommon::StorageServiceAbstract::CopyFolder: + case PimCommon::StorageServiceAbstract::CreateFolderAction: + case PimCommon::StorageServiceAbstract::AccountInfoAction: + case PimCommon::StorageServiceAbstract::ListFolderAction: + case PimCommon::StorageServiceAbstract::ShareLinkAction: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: + case PimCommon::StorageServiceAbstract::DeleteFileAction: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: + case PimCommon::StorageServiceAbstract::RenameFolderAction: + case PimCommon::StorageServiceAbstract::RenameFileAction: + case PimCommon::StorageServiceAbstract::MoveFolderAction: + case PimCommon::StorageServiceAbstract::MoveFileAction: + case PimCommon::StorageServiceAbstract::CopyFileAction: + case PimCommon::StorageServiceAbstract::CopyFolderAction: errorMessage(mActionType, errorStr); deleteLater(); break; @@ -163,55 +163,55 @@ switch(mActionType) { case PimCommon::StorageServiceAbstract::NoneAction: break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: parseRequestToken(data); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: parseResponseAccessToken(data); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: parseUploadFile(data); break; - case PimCommon::StorageServiceAbstract::CreateFolder: + case PimCommon::StorageServiceAbstract::CreateFolderAction: parseCreateFolder(data); break; - case PimCommon::StorageServiceAbstract::AccountInfo: + case PimCommon::StorageServiceAbstract::AccountInfoAction: parseAccountInfo(data); break; - case PimCommon::StorageServiceAbstract::ListFolder: + case PimCommon::StorageServiceAbstract::ListFolderAction: parseListFolder(data); break; - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::ShareLinkAction: parseShareLink(data); break; - case PimCommon::StorageServiceAbstract::CreateServiceFolder: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::DeleteFile: + case PimCommon::StorageServiceAbstract::DeleteFileAction: parseDeleteFile(data); break; - case PimCommon::StorageServiceAbstract::DeleteFolder: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: parseDeleteFolder(data); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: parseDownLoadFile(data); break; - case PimCommon::StorageServiceAbstract::RenameFolder: + case PimCommon::StorageServiceAbstract::RenameFolderAction: parseRenameFolder(data); break; - case PimCommon::StorageServiceAbstract::RenameFile: + case PimCommon::StorageServiceAbstract::RenameFileAction: parseRenameFile(data); break; - case PimCommon::StorageServiceAbstract::MoveFolder: + case PimCommon::StorageServiceAbstract::MoveFolderAction: parseMoveFolder(data); break; - case PimCommon::StorageServiceAbstract::MoveFile: + case PimCommon::StorageServiceAbstract::MoveFileAction: parseMoveFile(data); break; - case PimCommon::StorageServiceAbstract::CopyFile: + case PimCommon::StorageServiceAbstract::CopyFileAction: parseCopyFile(data); break; - case PimCommon::StorageServiceAbstract::CopyFolder: + case PimCommon::StorageServiceAbstract::CopyFolderAction: parseCopyFolder(data); break; } @@ -386,7 +386,7 @@ void DropBoxJob::createFolder(const QString &foldername, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CreateFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateFolderAction; mError = false; createFolderJob(foldername, destination); } @@ -395,7 +395,7 @@ { QFile *file = new QFile(filename); if (file->exists()) { - mActionType = PimCommon::StorageServiceAbstract::UploadFile; + mActionType = PimCommon::StorageServiceAbstract::UploadFileAction; mError = false; if (file->open(QIODevice::ReadOnly)) { const QString defaultDestination = (destination.isEmpty() ? PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder() : destination); @@ -417,7 +417,7 @@ void DropBoxJob::accountInfo() { - mActionType = PimCommon::StorageServiceAbstract::AccountInfo; + mActionType = PimCommon::StorageServiceAbstract::AccountInfoAction; mError = false; QUrl url(mApiPath + QLatin1String("account/info")); addDefaultUrlItem(url); @@ -430,7 +430,7 @@ void DropBoxJob::listFolder(const QString &folder) { - mActionType = PimCommon::StorageServiceAbstract::ListFolder; + mActionType = PimCommon::StorageServiceAbstract::ListFolderAction; mError = false; QUrl url(mApiPath + QLatin1String("metadata/dropbox/") + folder); addDefaultUrlItem(url); @@ -465,7 +465,7 @@ void DropBoxJob::shareLink(const QString &root, const QString &path) { - mActionType = PimCommon::StorageServiceAbstract::ShareLink; + mActionType = PimCommon::StorageServiceAbstract::ShareLinkAction; mError = false; QUrl url = QUrl(mApiPath + QString::fromLatin1("shares/%1/%2").arg(root).arg(path)); @@ -479,7 +479,7 @@ void DropBoxJob::createServiceFolder() { - mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolderAction; mError = false; createFolderJob(PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder(), QString()); } @@ -487,7 +487,7 @@ QNetworkReply *DropBoxJob::downloadFile(const QString &name, const QString &fileId, const QString &destination) { Q_UNUSED(fileId); - mActionType = PimCommon::StorageServiceAbstract::DownLoadFile; + mActionType = PimCommon::StorageServiceAbstract::DownLoadFileAction; mError = false; const QString defaultDestination = (destination.isEmpty() ? PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder() : destination); delete mDownloadFile; @@ -512,7 +512,7 @@ void DropBoxJob::deleteFile(const QString &filename) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFile; + mActionType = PimCommon::StorageServiceAbstract::DeleteFileAction; mError = false; QUrl url = QUrl(mApiPath + QLatin1String("fileops/delete")); url.addQueryItem(QLatin1String("root"), mRootPath); @@ -525,7 +525,7 @@ void DropBoxJob::deleteFolder(const QString &foldername) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFolder; + mActionType = PimCommon::StorageServiceAbstract::DeleteFolderAction; mError = false; QUrl url = QUrl(mApiPath + QLatin1String("fileops/delete")); url.addQueryItem(QLatin1String("root"), mRootPath); @@ -538,7 +538,7 @@ void DropBoxJob::renameFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::RenameFolder; + mActionType = PimCommon::StorageServiceAbstract::RenameFolderAction; mError = false; QUrl url = QUrl(mApiPath + QLatin1String("fileops/move")); url.addQueryItem(QLatin1String("root"), mRootPath); @@ -568,7 +568,7 @@ void DropBoxJob::renameFile(const QString &oldName, const QString &newName) { - mActionType = PimCommon::StorageServiceAbstract::RenameFile; + mActionType = PimCommon::StorageServiceAbstract::RenameFileAction; mError = false; QUrl url = QUrl(mApiPath + QLatin1String("fileops/move")); url.addQueryItem(QLatin1String("root"), mRootPath); @@ -600,7 +600,7 @@ void DropBoxJob::moveFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::MoveFolder; + mActionType = PimCommon::StorageServiceAbstract::MoveFolderAction; mError = false; QUrl url = QUrl(mApiPath + QLatin1String("fileops/move")); url.addQueryItem(QLatin1String("root"), mRootPath); @@ -615,7 +615,7 @@ void DropBoxJob::moveFile(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::MoveFile; + mActionType = PimCommon::StorageServiceAbstract::MoveFileAction; mError = false; QUrl url = QUrl(mApiPath + QLatin1String("fileops/move")); url.addQueryItem(QLatin1String("root"), mRootPath); @@ -630,7 +630,7 @@ void DropBoxJob::copyFile(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFile; + mActionType = PimCommon::StorageServiceAbstract::CopyFileAction; mError = false; QUrl url = QUrl(mApiPath + QLatin1String("fileops/copy")); url.addQueryItem(QLatin1String("root"), mRootPath); @@ -645,7 +645,7 @@ void DropBoxJob::copyFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFolder; + mActionType = PimCommon::StorageServiceAbstract::CopyFolderAction; mError = false; QUrl url = QUrl(mApiPath + QLatin1String("fileops/copy")); url.addQueryItem(QLatin1String("root"), mRootPath); diff -Nru kdepim-4.13.0/pimcommon/storageservice/dropbox/dropboxstorageservice.cpp kdepim-4.13.3/pimcommon/storageservice/dropbox/dropboxstorageservice.cpp --- kdepim-4.13.0/pimcommon/storageservice/dropbox/dropboxstorageservice.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/dropbox/dropboxstorageservice.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -115,7 +115,7 @@ void DropBoxStorageService::storageServiceShareLink(const QString &root, const QString &path) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(ShareLink); + mNextAction->setNextActionType(ShareLinkAction); mNextAction->setRootPath(root); mNextAction->setPath(path); storageServiceauthentication(); @@ -131,7 +131,7 @@ void DropBoxStorageService::storageServicecreateServiceFolder() { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(CreateServiceFolder); + mNextAction->setNextActionType(CreateServiceFolderAction); storageServiceauthentication(); } else { DropBoxJob *job = new DropBoxJob(this); @@ -166,7 +166,7 @@ void DropBoxStorageService::storageServicelistFolder(const QString &folder) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(ListFolder); + mNextAction->setNextActionType(ListFolderAction); mNextAction->setNextActionFolder(folder); storageServiceauthentication(); } else { @@ -181,7 +181,7 @@ void DropBoxStorageService::storageServiceaccountInfo() { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(AccountInfo); + mNextAction->setNextActionType(AccountInfoAction); storageServiceauthentication(); } else { DropBoxJob *job = new DropBoxJob(this); @@ -195,7 +195,7 @@ void DropBoxStorageService::storageServicecreateFolder(const QString &name, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(CreateFolder); + mNextAction->setNextActionType(CreateFolderAction); mNextAction->setNextActionName(name); mNextAction->setNextActionFolder(destination); storageServiceauthentication(); @@ -211,7 +211,7 @@ void DropBoxStorageService::storageServiceuploadFile(const QString &filename, const QString &uploadAsName, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(UploadFile); + mNextAction->setNextActionType(UploadFileAction); mNextAction->setNextActionName(filename); mNextAction->setNextActionFolder(destination); mNextAction->setUploadAsName(uploadAsName); @@ -291,7 +291,7 @@ void DropBoxStorageService::storageServicedownloadFile(const QString &name, const QString &fileId, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(DownLoadFile); + mNextAction->setNextActionType(DownLoadFileAction); mNextAction->setNextActionName(name); mNextAction->setDownloadDestination(destination); mNextAction->setFileId(fileId); @@ -310,7 +310,7 @@ void DropBoxStorageService::storageServicedeleteFile(const QString &filename) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(DeleteFile); + mNextAction->setNextActionType(DeleteFileAction); mNextAction->setNextActionName(filename); storageServiceauthentication(); } else { @@ -325,7 +325,7 @@ void DropBoxStorageService::storageServicedeleteFolder(const QString &foldername) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(DeleteFolder); + mNextAction->setNextActionType(DeleteFolderAction); mNextAction->setNextActionFolder(foldername); storageServiceauthentication(); } else { @@ -340,7 +340,7 @@ void DropBoxStorageService::storageServiceRenameFolder(const QString &source, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(RenameFolder); + mNextAction->setNextActionType(RenameFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -355,7 +355,7 @@ void DropBoxStorageService::storageServiceRenameFile(const QString &source, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(RenameFile); + mNextAction->setNextActionType(RenameFileAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -370,7 +370,7 @@ void DropBoxStorageService::storageServiceMoveFolder(const QString &source, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(MoveFolder); + mNextAction->setNextActionType(MoveFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -385,7 +385,7 @@ void DropBoxStorageService::storageServiceMoveFile(const QString &source, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(RenameFolder); + mNextAction->setNextActionType(RenameFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -400,7 +400,7 @@ void DropBoxStorageService::storageServiceCopyFile(const QString &source, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(CopyFile); + mNextAction->setNextActionType(CopyFileAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -415,7 +415,7 @@ void DropBoxStorageService::storageServiceCopyFolder(const QString &source, const QString &destination) { if (checkNeedAuthenticate()) { - mNextAction->setNextActionType(CopyFolder); + mNextAction->setNextActionType(CopyFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { diff -Nru kdepim-4.13.0/pimcommon/storageservice/gdrive/gdrivejob.cpp kdepim-4.13.3/pimcommon/storageservice/gdrive/gdrivejob.cpp --- kdepim-4.13.0/pimcommon/storageservice/gdrive/gdrivejob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/gdrive/gdrivejob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -97,7 +97,7 @@ void GDriveJob::listFolder(const QString &folder) { - mActionType = PimCommon::StorageServiceAbstract::ListFolder; + mActionType = PimCommon::StorageServiceAbstract::ListFolderAction; mError = false; const QString folderId = folder.isEmpty() ? QLatin1String("root") : folder; KGAPI2::Drive::ChildReferenceFetchJob *fetchJob = new KGAPI2::Drive::ChildReferenceFetchJob( folderId, mAccount ); @@ -147,7 +147,7 @@ void GDriveJob::requestTokenAccess() { mError = false; - mActionType = PimCommon::StorageServiceAbstract::RequestToken; + mActionType = PimCommon::StorageServiceAbstract::RequestTokenAction; KGAPI2::AuthJob *authJob = new KGAPI2::AuthJob( mAccount, @@ -184,7 +184,7 @@ void GDriveJob::accountInfo() { - mActionType = PimCommon::StorageServiceAbstract::AccountInfo; + mActionType = PimCommon::StorageServiceAbstract::AccountInfoAction; mError = false; KGAPI2::Drive::AboutFetchJob *aboutFetchJob = new KGAPI2::Drive::AboutFetchJob(mAccount, this); connect(aboutFetchJob, SIGNAL(finished(KGAPI2::Job*)), this, SLOT(slotAboutFetchJobFinished(KGAPI2::Job*))); @@ -211,7 +211,7 @@ QNetworkReply *GDriveJob::uploadFile(const QString &filename, const QString &uploadAsName, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::UploadFile; + mActionType = PimCommon::StorageServiceAbstract::UploadFileAction; mError = false; KGAPI2::Drive::FilePtr file( new KGAPI2::Drive::File() ); file->setTitle( uploadAsName ); @@ -245,7 +245,7 @@ void GDriveJob::deleteFile(const QString &filename) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFile; + mActionType = PimCommon::StorageServiceAbstract::DeleteFileAction; mError = false; const QString folderId = filename; KGAPI2::Drive::FileDeleteJob *fileDeleteJob = new KGAPI2::Drive::FileDeleteJob(folderId, mAccount, this); @@ -254,7 +254,7 @@ void GDriveJob::deleteFolder(const QString &foldername) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFolder; + mActionType = PimCommon::StorageServiceAbstract::DeleteFolderAction; mError = false; const QString folderId = foldername; KGAPI2::Drive::FileDeleteJob *fileDeleteJob = new KGAPI2::Drive::FileDeleteJob(folderId, mAccount, this); @@ -286,7 +286,7 @@ QNetworkReply * GDriveJob::downloadFile(const QString &name, const QString &fileId, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::DownLoadFile; + mActionType = PimCommon::StorageServiceAbstract::DownLoadFileAction; mError = false; const QString defaultDestination = (destination.isEmpty() ? PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder() : destination); @@ -305,7 +305,7 @@ void GDriveJob::refreshToken() { - mActionType = PimCommon::StorageServiceAbstract::AccessToken; + mActionType = PimCommon::StorageServiceAbstract::AccessTokenAction; KGAPI2::AuthJob *authJob = new KGAPI2::AuthJob( mAccount, mClientId, @@ -315,7 +315,7 @@ void GDriveJob::createFolder(const QString &foldername, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CreateFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateFolderAction; mError = false; KGAPI2::Drive::FilePtr file( new KGAPI2::Drive::File() ); @@ -342,7 +342,7 @@ void GDriveJob::createServiceFolder() { - mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolderAction; mError = false; const QString folderName = lastPathComponent( QString() ); @@ -361,7 +361,7 @@ { qDebug()<<"source "<setTitle( QLatin1String("copy") ); @@ -387,7 +387,7 @@ void GDriveJob::copyFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFolder; + mActionType = PimCommon::StorageServiceAbstract::CopyFolderAction; mError = false; KGAPI2::Drive::FilePtr file( new KGAPI2::Drive::File() ); file->setTitle( QLatin1String("copy") ); @@ -413,7 +413,7 @@ void GDriveJob::renameFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::RenameFolder; + mActionType = PimCommon::StorageServiceAbstract::RenameFolderAction; qDebug()<<" source "<accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(ShareLink); + mNextAction->setNextActionType(ShareLinkAction); mNextAction->setPath(path); mNextAction->setRootPath(root); if (mAccount->accessToken().isEmpty()) { @@ -198,7 +198,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(DownLoadFile); + mNextAction->setNextActionType(DownLoadFileAction); mNextAction->setNextActionName(name); mNextAction->setDownloadDestination(destination); mNextAction->setFileId(fileId); @@ -224,7 +224,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(DeleteFile); + mNextAction->setNextActionType(DeleteFileAction); mNextAction->setNextActionName(filename); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -246,7 +246,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(DeleteFolder); + mNextAction->setNextActionType(DeleteFolderAction); mNextAction->setNextActionFolder(foldername); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -268,7 +268,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(RenameFolder); + mNextAction->setNextActionType(RenameFolderAction); mNextAction->setRenameFolder(source, destination); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -290,7 +290,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(RenameFile); + mNextAction->setNextActionType(RenameFileAction); mNextAction->setRenameFolder(source, destination); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -312,7 +312,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(MoveFolder); + mNextAction->setNextActionType(MoveFolderAction); mNextAction->setRenameFolder(source, destination); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -334,7 +334,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(MoveFile); + mNextAction->setNextActionType(MoveFileAction); mNextAction->setRenameFolder(source, destination); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -356,7 +356,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(CopyFile); + mNextAction->setNextActionType(CopyFileAction); mNextAction->setRenameFolder(source, destination); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -378,7 +378,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(CopyFolder); + mNextAction->setNextActionType(CopyFolderAction); mNextAction->setRenameFolder(source, destination); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -420,7 +420,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(ListFolder); + mNextAction->setNextActionType(ListFolderAction); mNextAction->setNextActionFolder(folder); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); @@ -442,7 +442,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(CreateFolder); + mNextAction->setNextActionType(CreateFolderAction); mNextAction->setNextActionName(name); mNextAction->setNextActionFolder(destination); if (mAccount->accessToken().isEmpty()) { @@ -465,7 +465,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(AccountInfo); + mNextAction->setNextActionType(AccountInfoAction); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); } else { @@ -491,7 +491,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(UploadFile); + mNextAction->setNextActionType(UploadFileAction); mNextAction->setNextActionName(filename); mNextAction->setNextActionFolder(destination); mNextAction->setUploadAsName(uploadAsName); @@ -585,7 +585,7 @@ readConfig(); if (mAccount->accessToken().isEmpty() || needToRefreshToken()) { - mNextAction->setNextActionType(CreateServiceFolder); + mNextAction->setNextActionType(CreateServiceFolderAction); if (mAccount->accessToken().isEmpty()) { storageServiceauthentication(); } else { diff -Nru kdepim-4.13.0/pimcommon/storageservice/hubic/hubicjob.cpp kdepim-4.13.3/pimcommon/storageservice/hubic/hubicjob.cpp --- kdepim-4.13.0/pimcommon/storageservice/hubic/hubicjob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/hubic/hubicjob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -59,7 +59,7 @@ void HubicJob::createServiceFolder() { - mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolderAction; mError = false; //TODO Q_EMIT actionFailed(QLatin1String("Not Implemented")); @@ -70,7 +70,7 @@ void HubicJob::requestTokenAccess() { mError = false; - mActionType = PimCommon::StorageServiceAbstract::RequestToken; + mActionType = PimCommon::StorageServiceAbstract::RequestTokenAction; QUrl url(mServiceUrl + mAuthorizePath ); url.addQueryItem(QLatin1String("response_type"), QLatin1String("code")); url.addQueryItem(QLatin1String("client_id"), mClientId); @@ -130,7 +130,7 @@ void HubicJob::getTokenAccess(const QString &authorizeCode) { - mActionType = PimCommon::StorageServiceAbstract::AccessToken; + mActionType = PimCommon::StorageServiceAbstract::AccessTokenAction; mError = false; QNetworkRequest request(QUrl(mServiceUrl + mPathToken)); request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded")); @@ -162,37 +162,37 @@ case PimCommon::StorageServiceAbstract::NoneAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: Q_EMIT authorizationFailed(errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: Q_EMIT authorizationFailed(errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: Q_EMIT uploadFileFailed(errorStr); errorMessage(mActionType, errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: Q_EMIT downLoadFileFailed(errorStr); errorMessage(mActionType, errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::DeleteFile: - case PimCommon::StorageServiceAbstract::CreateFolder: - case PimCommon::StorageServiceAbstract::AccountInfo: - case PimCommon::StorageServiceAbstract::ListFolder: - case PimCommon::StorageServiceAbstract::CreateServiceFolder: - case PimCommon::StorageServiceAbstract::DeleteFolder: - case PimCommon::StorageServiceAbstract::RenameFolder: - case PimCommon::StorageServiceAbstract::RenameFile: - case PimCommon::StorageServiceAbstract::MoveFolder: - case PimCommon::StorageServiceAbstract::MoveFile: - case PimCommon::StorageServiceAbstract::CopyFile: - case PimCommon::StorageServiceAbstract::CopyFolder: - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::DeleteFileAction: + case PimCommon::StorageServiceAbstract::CreateFolderAction: + case PimCommon::StorageServiceAbstract::AccountInfoAction: + case PimCommon::StorageServiceAbstract::ListFolderAction: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: + case PimCommon::StorageServiceAbstract::RenameFolderAction: + case PimCommon::StorageServiceAbstract::RenameFileAction: + case PimCommon::StorageServiceAbstract::MoveFolderAction: + case PimCommon::StorageServiceAbstract::MoveFileAction: + case PimCommon::StorageServiceAbstract::CopyFileAction: + case PimCommon::StorageServiceAbstract::CopyFolderAction: + case PimCommon::StorageServiceAbstract::ShareLinkAction: errorMessage(mActionType, errorStr); deleteLater(); break; @@ -212,55 +212,55 @@ case PimCommon::StorageServiceAbstract::NoneAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: parseAccessToken(data); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: parseUploadFile(data); break; - case PimCommon::StorageServiceAbstract::CreateFolder: + case PimCommon::StorageServiceAbstract::CreateFolderAction: parseCreateFolder(data); break; - case PimCommon::StorageServiceAbstract::AccountInfo: + case PimCommon::StorageServiceAbstract::AccountInfoAction: parseAccountInfo(data); break; - case PimCommon::StorageServiceAbstract::ListFolder: + case PimCommon::StorageServiceAbstract::ListFolderAction: parseListFolder(data); break; - case PimCommon::StorageServiceAbstract::CreateServiceFolder: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: parseCreateServiceFolder(data); break; - case PimCommon::StorageServiceAbstract::DeleteFile: + case PimCommon::StorageServiceAbstract::DeleteFileAction: parseDeleteFile(data); break; - case PimCommon::StorageServiceAbstract::DeleteFolder: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: parseDeleteFolder(data); break; - case PimCommon::StorageServiceAbstract::CopyFile: + case PimCommon::StorageServiceAbstract::CopyFileAction: parseCopyFile(data); break; - case PimCommon::StorageServiceAbstract::CopyFolder: + case PimCommon::StorageServiceAbstract::CopyFolderAction: parseCopyFolder(data); break; - case PimCommon::StorageServiceAbstract::RenameFile: + case PimCommon::StorageServiceAbstract::RenameFileAction: parseRenameFile(data); break; - case PimCommon::StorageServiceAbstract::RenameFolder: + case PimCommon::StorageServiceAbstract::RenameFolderAction: parseRenameFolder(data); break; - case PimCommon::StorageServiceAbstract::MoveFolder: + case PimCommon::StorageServiceAbstract::MoveFolderAction: parseMoveFolder(data); break; - case PimCommon::StorageServiceAbstract::MoveFile: + case PimCommon::StorageServiceAbstract::MoveFileAction: parseMoveFile(data); break; - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::ShareLinkAction: parseShareLink(data); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: parseDownloadFile(data); break; } @@ -287,7 +287,7 @@ void HubicJob::refreshToken() { - mActionType = PimCommon::StorageServiceAbstract::AccessToken; + mActionType = PimCommon::StorageServiceAbstract::AccessTokenAction; QNetworkRequest request(QUrl(QLatin1String("https://api.hubic.com/oauth/token/"))); request.setHeader(QNetworkRequest::ContentTypeHeader, QLatin1String("application/x-www-form-urlencoded")); QUrl postData; @@ -304,49 +304,49 @@ void HubicJob::deleteFile(const QString &filename) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFile; + mActionType = PimCommon::StorageServiceAbstract::DeleteFileAction; mError = false; } void HubicJob::deleteFolder(const QString &foldername) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFolder; + mActionType = PimCommon::StorageServiceAbstract::DeleteFolderAction; mError = false; } void HubicJob::renameFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::RenameFolder; + mActionType = PimCommon::StorageServiceAbstract::RenameFolderAction; mError = false; } void HubicJob::renameFile(const QString &oldName, const QString &newName) { - mActionType = PimCommon::StorageServiceAbstract::RenameFile; + mActionType = PimCommon::StorageServiceAbstract::RenameFileAction; mError = false; } void HubicJob::moveFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::MoveFolder; + mActionType = PimCommon::StorageServiceAbstract::MoveFolderAction; mError = false; } void HubicJob::moveFile(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::MoveFile; + mActionType = PimCommon::StorageServiceAbstract::MoveFileAction; mError = false; } void HubicJob::copyFile(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFile; + mActionType = PimCommon::StorageServiceAbstract::CopyFileAction; mError = false; } void HubicJob::copyFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFolder; + mActionType = PimCommon::StorageServiceAbstract::CopyFolderAction; mError = false; } @@ -354,7 +354,7 @@ { QFile *file = new QFile(filename); if (file->exists()) { - mActionType = PimCommon::StorageServiceAbstract::UploadFile; + mActionType = PimCommon::StorageServiceAbstract::UploadFileAction; mError = false; if (file->open(QIODevice::ReadOnly)) { #if 0 @@ -381,7 +381,7 @@ void HubicJob::listFolder(const QString &folder) { - mActionType = PimCommon::StorageServiceAbstract::ListFolder; + mActionType = PimCommon::StorageServiceAbstract::ListFolderAction; mError = false; QUrl url; url.setUrl(mApiUrl + mSwiftTokenPath); @@ -405,7 +405,7 @@ void HubicJob::accountInfo() { - mActionType = PimCommon::StorageServiceAbstract::AccountInfo; + mActionType = PimCommon::StorageServiceAbstract::AccountInfoAction; mError = false; QUrl url; url.setUrl(mApiUrl + mCurrentAccountInfoPath); @@ -418,7 +418,7 @@ void HubicJob::createFolder(const QString &foldername, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CreateFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateFolderAction; mError = false; } @@ -426,7 +426,7 @@ void HubicJob::shareLink(const QString &root, const QString &fileId) { Q_UNUSED(root); - mActionType = PimCommon::StorageServiceAbstract::ShareLink; + mActionType = PimCommon::StorageServiceAbstract::ShareLinkAction; mError = false; } @@ -569,7 +569,7 @@ QNetworkReply * HubicJob::downloadFile(const QString &name, const QString &fileId, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::DownLoadFile; + mActionType = PimCommon::StorageServiceAbstract::DownLoadFileAction; mError = false; #if 0 mActionType = PimCommon::StorageServiceAbstract::DownLoadFile; diff -Nru kdepim-4.13.0/pimcommon/storageservice/hubic/hubicstorageservice.cpp kdepim-4.13.3/pimcommon/storageservice/hubic/hubicstorageservice.cpp --- kdepim-4.13.0/pimcommon/storageservice/hubic/hubicstorageservice.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/hubic/hubicstorageservice.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -152,7 +152,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(ListFolder); + mNextAction->setNextActionType(ListFolderAction); mNextAction->setNextActionFolder(folder); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -172,7 +172,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(CreateFolder); + mNextAction->setNextActionType(CreateFolderAction); mNextAction->setNextActionName(name); mNextAction->setNextActionFolder(destination); if (mToken.isEmpty()) { @@ -193,7 +193,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(AccountInfo); + mNextAction->setNextActionType(AccountInfoAction); if (mToken.isEmpty()) { storageServiceauthentication(); } else { @@ -217,7 +217,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(UploadFile); + mNextAction->setNextActionType(UploadFileAction); mNextAction->setNextActionName(filename); mNextAction->setUploadAsName(uploadAsName); mNextAction->setNextActionFolder(destination); @@ -285,7 +285,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(ShareLink); + mNextAction->setNextActionType(ShareLinkAction); mNextAction->setRootPath(root); mNextAction->setPath(path); if (mToken.isEmpty()) { @@ -311,7 +311,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(DownLoadFile); + mNextAction->setNextActionType(DownLoadFileAction); mNextAction->setNextActionName(name); mNextAction->setDownloadDestination(destination); mNextAction->setFileId(fileId); @@ -335,7 +335,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(CreateServiceFolder); + mNextAction->setNextActionType(CreateServiceFolderAction); if (mToken.isEmpty()) { storageServiceauthentication(); } else { @@ -354,7 +354,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(DeleteFile); + mNextAction->setNextActionType(DeleteFileAction); mNextAction->setNextActionName(filename); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -374,7 +374,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(DeleteFolder); + mNextAction->setNextActionType(DeleteFolderAction); mNextAction->setNextActionFolder(foldername); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -394,7 +394,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(RenameFolder); + mNextAction->setNextActionType(RenameFolderAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -414,7 +414,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(RenameFile); + mNextAction->setNextActionType(RenameFileAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -434,7 +434,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(MoveFolder); + mNextAction->setNextActionType(MoveFolderAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -454,7 +454,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(MoveFile); + mNextAction->setNextActionType(MoveFileAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -474,7 +474,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(CopyFile); + mNextAction->setNextActionType(CopyFileAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); @@ -494,7 +494,7 @@ { const bool needRefresh = needToRefreshToken(); if (mToken.isEmpty() || needRefresh) { - mNextAction->setNextActionType(CopyFolder); + mNextAction->setNextActionType(CopyFolderAction); mNextAction->setRenameFolder(source, destination); if (mToken.isEmpty()) { storageServiceauthentication(); diff -Nru kdepim-4.13.0/pimcommon/storageservice/job/storageserviceabstractjob.cpp kdepim-4.13.3/pimcommon/storageservice/job/storageserviceabstractjob.cpp --- kdepim-4.13.0/pimcommon/storageservice/job/storageserviceabstractjob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/job/storageserviceabstractjob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -60,55 +60,55 @@ switch(type) { case PimCommon::StorageServiceAbstract::NoneAction: break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: error = i18n("Request Token returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: error = i18n("Access Token returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: error = i18n("Upload File returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::CreateFolder: + case PimCommon::StorageServiceAbstract::CreateFolderAction: error = i18n("Create Folder returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::AccountInfo: + case PimCommon::StorageServiceAbstract::AccountInfoAction: error = i18n("Get account info returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::ListFolder: + case PimCommon::StorageServiceAbstract::ListFolderAction: error = i18n("List folder returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::ShareLinkAction: error = i18n("Share Link returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::CreateServiceFolder: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: error = i18n("Create Service Folder returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: error = i18n("Download file returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::DeleteFile: + case PimCommon::StorageServiceAbstract::DeleteFileAction: error = i18n("Delete File returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::DeleteFolder: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: error = i18n("Delete Folder returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::RenameFolder: + case PimCommon::StorageServiceAbstract::RenameFolderAction: error = i18n("Rename Folder returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::RenameFile: + case PimCommon::StorageServiceAbstract::RenameFileAction: error = i18n("Rename File returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::MoveFile: + case PimCommon::StorageServiceAbstract::MoveFileAction: error = i18n("Move File returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::MoveFolder: + case PimCommon::StorageServiceAbstract::MoveFolderAction: error = i18n("Move Folder returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::CopyFile: + case PimCommon::StorageServiceAbstract::CopyFileAction: error = i18n("Copy File returns an error: %1",errorStr); break; - case PimCommon::StorageServiceAbstract::CopyFolder: + case PimCommon::StorageServiceAbstract::CopyFolderAction: error = i18n("Copy Folder returns an error: %1",errorStr); break; } diff -Nru kdepim-4.13.0/pimcommon/storageservice/storageserviceabstract.cpp kdepim-4.13.3/pimcommon/storageservice/storageserviceabstract.cpp --- kdepim-4.13.0/pimcommon/storageservice/storageserviceabstract.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/storageserviceabstract.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -271,54 +271,54 @@ switch(mNextAction->nextActionType()) { case NoneAction: break; - case RequestToken: + case RequestTokenAction: storageServiceauthentication(); break; - case AccessToken: + case AccessTokenAction: break; - case UploadFile: + case UploadFileAction: storageServiceuploadFile(mNextAction->nextActionName(), mNextAction->uploadAsName(), mNextAction->nextActionFolder()); break; - case CreateFolder: + case CreateFolderAction: storageServicecreateFolder(mNextAction->nextActionName(), mNextAction->nextActionFolder()); break; - case ListFolder: + case ListFolderAction: storageServicelistFolder(mNextAction->nextActionFolder()); break; - case AccountInfo: + case AccountInfoAction: storageServiceaccountInfo(); break; - case ShareLink: + case ShareLinkAction: storageServiceShareLink(mNextAction->rootPath(), mNextAction->path()); break; - case CreateServiceFolder: + case CreateServiceFolderAction: storageServicecreateServiceFolder(); break; - case DownLoadFile: + case DownLoadFileAction: storageServicedownloadFile(mNextAction->nextActionName(), mNextAction->fileId(), mNextAction->downloadDestination()); break; - case DeleteFile: + case DeleteFileAction: storageServicedeleteFile(mNextAction->nextActionName()); break; - case DeleteFolder: + case DeleteFolderAction: storageServicedeleteFolder(mNextAction->nextActionFolder()); break; - case RenameFolder: + case RenameFolderAction: storageServiceRenameFolder(mNextAction->renameSource(), mNextAction->renameDestination()); break; - case RenameFile: + case RenameFileAction: storageServiceRenameFile(mNextAction->renameSource(), mNextAction->renameDestination()); break; - case MoveFile: + case MoveFileAction: storageServiceMoveFile(mNextAction->renameSource(), mNextAction->renameDestination()); break; - case MoveFolder: + case MoveFolderAction: storageServiceMoveFolder(mNextAction->renameSource(), mNextAction->renameDestination()); break; - case CopyFile: + case CopyFileAction: storageServiceCopyFile(mNextAction->renameSource(), mNextAction->renameDestination()); break; - case CopyFolder: + case CopyFolderAction: storageServiceCopyFolder(mNextAction->renameSource(), mNextAction->renameDestination()); break; } diff -Nru kdepim-4.13.0/pimcommon/storageservice/storageserviceabstract.h kdepim-4.13.3/pimcommon/storageservice/storageserviceabstract.h --- kdepim-4.13.0/pimcommon/storageservice/storageserviceabstract.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/storageserviceabstract.h 2014-07-09 12:18:50.000000000 +0000 @@ -83,25 +83,25 @@ enum ActionType { NoneAction = 0, //Account - RequestToken, - AccessToken, - AccountInfo, + RequestTokenAction, + AccessTokenAction, + AccountInfoAction, //File - UploadFile, - DownLoadFile, - ShareLink, - DeleteFile, - RenameFile, - MoveFile, - CopyFile, + UploadFileAction, + DownLoadFileAction, + ShareLinkAction, + DeleteFileAction, + RenameFileAction, + MoveFileAction, + CopyFileAction, //Folder - CreateFolder, - ListFolder, - CreateServiceFolder, - DeleteFolder, - RenameFolder, - MoveFolder, - CopyFolder + CreateFolderAction, + ListFolderAction, + CreateServiceFolderAction, + DeleteFolderAction, + RenameFolderAction, + MoveFolderAction, + CopyFolderAction }; bool isInProgress() const; diff -Nru kdepim-4.13.0/pimcommon/storageservice/storageservicemanager.cpp kdepim-4.13.3/pimcommon/storageservice/storageservicemanager.cpp --- kdepim-4.13.0/pimcommon/storageservice/storageservicemanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/storageservicemanager.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -76,6 +76,13 @@ qDeleteAll(mListService); } + +void StorageServiceManager::removeService(const QString &serviceName) +{ + if (mListService.contains(serviceName)) + mListService.remove(serviceName); +} + QString StorageServiceManager::ourIdentifier() const { const QString identifier = QString::fromLatin1( "%1/%2" ). @@ -103,7 +110,6 @@ mListService = lst; writeConfig(); - qDebug()<<"void StorageServiceManager::setListService(const QMap &lst) "; // DBus signal for other IdentityManager instances emit configChanged( ourIdentifier() ); } diff -Nru kdepim-4.13.0/pimcommon/storageservice/storageservicemanager.h kdepim-4.13.3/pimcommon/storageservice/storageservicemanager.h --- kdepim-4.13.0/pimcommon/storageservice/storageservicemanager.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/storageservicemanager.h 2014-07-09 12:18:50.000000000 +0000 @@ -67,6 +67,8 @@ static StorageServiceAbstract::Capabilities capabilities(ServiceType type); static QString kconfigName(); + void removeService(const QString &serviceName); + Q_SIGNALS: void servicesChanged(); void deleteFolderDone(const QString &serviceName, const QString &filename); diff -Nru kdepim-4.13.0/pimcommon/storageservice/webdav/webdavjob.cpp kdepim-4.13.3/pimcommon/storageservice/webdav/webdavjob.cpp --- kdepim-4.13.0/pimcommon/storageservice/webdav/webdavjob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/webdav/webdavjob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -90,7 +90,7 @@ void WebDavJob::requestTokenAccess() { mError = false; - mActionType = PimCommon::StorageServiceAbstract::AccessToken; + mActionType = PimCommon::StorageServiceAbstract::AccessTokenAction; QPointer dlg = new WebDavSettingsDialog; if (dlg->exec()) { mServiceLocation = dlg->serviceLocation(); @@ -109,7 +109,7 @@ void WebDavJob::copyFile(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFile; + mActionType = PimCommon::StorageServiceAbstract::CopyFileAction; mError = false; QString filename; if (!source.isEmpty()) { @@ -128,7 +128,7 @@ void WebDavJob::copyFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CopyFolder; + mActionType = PimCommon::StorageServiceAbstract::CopyFolderAction; mError = false; QString filename; if (!source.isEmpty()) { @@ -146,7 +146,7 @@ void WebDavJob::deleteFile(const QString &filename) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFile; + mActionType = PimCommon::StorageServiceAbstract::DeleteFileAction; mError = false; QUrl url(mServiceLocation); url.setPath(filename); @@ -155,7 +155,7 @@ void WebDavJob::deleteFolder(const QString &foldername) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFolder; + mActionType = PimCommon::StorageServiceAbstract::DeleteFolderAction; mError = false; QUrl url(mServiceLocation); url.setPath(foldername); @@ -164,7 +164,7 @@ void WebDavJob::renameFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::RenameFolder; + mActionType = PimCommon::StorageServiceAbstract::RenameFolderAction; mError = false; QString destinationFolder; @@ -197,7 +197,7 @@ void WebDavJob::renameFile(const QString &oldName, const QString &newName) { - mActionType = PimCommon::StorageServiceAbstract::RenameFile; + mActionType = PimCommon::StorageServiceAbstract::RenameFileAction; mError = false; QString destination; @@ -228,7 +228,7 @@ { QFile *file = new QFile(filename); if (file->exists()) { - mActionType = PimCommon::StorageServiceAbstract::UploadFile; + mActionType = PimCommon::StorageServiceAbstract::UploadFileAction; mError = false; if (file->open(QIODevice::ReadOnly)) { QUrl destinationFile(mServiceLocation); @@ -255,7 +255,7 @@ void WebDavJob::listFolder(const QString &folder) { - mActionType = PimCommon::StorageServiceAbstract::ListFolder; + mActionType = PimCommon::StorageServiceAbstract::ListFolderAction; mError = false; QUrl url(mServiceLocation); if (!folder.isEmpty()) @@ -265,7 +265,7 @@ void WebDavJob::moveFolder(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::MoveFolder; + mActionType = PimCommon::StorageServiceAbstract::MoveFolderAction; mError = false; QString destinationPath; if (!source.isEmpty()) { @@ -291,7 +291,7 @@ void WebDavJob::moveFile(const QString &source, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::MoveFile; + mActionType = PimCommon::StorageServiceAbstract::MoveFileAction; mError = false; QString destinationPath; if (!source.isEmpty()) { @@ -326,7 +326,7 @@ void WebDavJob::createFolder(const QString &foldername, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CreateFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateFolderAction; mError = false; createFolderJob(foldername, destination); } @@ -339,7 +339,7 @@ void WebDavJob::accountInfo() { - mActionType = PimCommon::StorageServiceAbstract::AccountInfo; + mActionType = PimCommon::StorageServiceAbstract::AccountInfoAction; mError = false; QUrl url(mServiceLocation); accountInfo(url.toString()); @@ -359,55 +359,55 @@ case PimCommon::StorageServiceAbstract::NoneAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: parseAccessToken(data); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: parseUploadFile(data); break; - case PimCommon::StorageServiceAbstract::CreateFolder: + case PimCommon::StorageServiceAbstract::CreateFolderAction: parseCreateFolder(data); break; - case PimCommon::StorageServiceAbstract::AccountInfo: + case PimCommon::StorageServiceAbstract::AccountInfoAction: parseAccountInfo(data); break; - case PimCommon::StorageServiceAbstract::ListFolder: + case PimCommon::StorageServiceAbstract::ListFolderAction: parseListFolder(data); break; - case PimCommon::StorageServiceAbstract::DeleteFile: + case PimCommon::StorageServiceAbstract::DeleteFileAction: parseDeleteFile(data); break; - case PimCommon::StorageServiceAbstract::DeleteFolder: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: parseDeleteFolder(data); break; - case PimCommon::StorageServiceAbstract::RenameFolder: + case PimCommon::StorageServiceAbstract::RenameFolderAction: parseRenameFolder(data); break; - case PimCommon::StorageServiceAbstract::RenameFile: + case PimCommon::StorageServiceAbstract::RenameFileAction: parseRenameFile(data); break; - case PimCommon::StorageServiceAbstract::MoveFolder: + case PimCommon::StorageServiceAbstract::MoveFolderAction: parseMoveFolder(data); break; - case PimCommon::StorageServiceAbstract::MoveFile: + case PimCommon::StorageServiceAbstract::MoveFileAction: parseMoveFile(data); break; - case PimCommon::StorageServiceAbstract::CopyFile: + case PimCommon::StorageServiceAbstract::CopyFileAction: parseCopyFile(data); break; - case PimCommon::StorageServiceAbstract::CopyFolder: + case PimCommon::StorageServiceAbstract::CopyFolderAction: parseCopyFolder(data); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: parseDownloadFile(data); break; - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::ShareLinkAction: parseShareLink(data); break; - case PimCommon::StorageServiceAbstract::CreateServiceFolder: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: parseCreateServiceFolder(data); break; } @@ -570,7 +570,7 @@ void WebDavJob::shareLink(const QString &/*root*/, const QString &path) { - mActionType = PimCommon::StorageServiceAbstract::ShareLink; + mActionType = PimCommon::StorageServiceAbstract::ShareLinkAction; mError = false; QString filePath(path); if (!path.startsWith(mServiceLocation)) { @@ -592,14 +592,14 @@ void WebDavJob::createServiceFolder() { - mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolderAction; mError = false; createFolderJob(PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder(), QString()); } QNetworkReply *WebDavJob::downloadFile(const QString &name, const QString &fileId, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::DownLoadFile; + mActionType = PimCommon::StorageServiceAbstract::DownLoadFileAction; mError = false; const QString defaultDestination = (destination.isEmpty() ? PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder() : destination); delete mDownloadFile; diff -Nru kdepim-4.13.0/pimcommon/storageservice/webdav/webdavstorageservice.cpp kdepim-4.13.3/pimcommon/storageservice/webdav/webdavstorageservice.cpp --- kdepim-4.13.0/pimcommon/storageservice/webdav/webdavstorageservice.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/webdav/webdavstorageservice.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -145,7 +145,7 @@ if (needInitialized()) { mNextAction->setRootPath(root); mNextAction->setPath(path); - mNextAction->setNextActionType(ShareLink); + mNextAction->setNextActionType(ShareLinkAction); storageServiceauthentication(); } else { WebDavJob *job = new WebDavJob(this); @@ -159,7 +159,7 @@ void WebDavStorageService::storageServicedownloadFile(const QString &name, const QString &fileId, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(DownLoadFile); + mNextAction->setNextActionType(DownLoadFileAction); mNextAction->setNextActionName(name); mNextAction->setDownloadDestination(destination); mNextAction->setFileId(fileId); @@ -178,7 +178,7 @@ void WebDavStorageService::storageServicecreateServiceFolder() { if (needInitialized()) { - mNextAction->setNextActionType(CreateServiceFolder); + mNextAction->setNextActionType(CreateServiceFolderAction); storageServiceauthentication(); } else { WebDavJob *job = new WebDavJob(this); @@ -192,7 +192,7 @@ void WebDavStorageService::storageServicedeleteFile(const QString &filename) { if (needInitialized()) { - mNextAction->setNextActionType(DeleteFile); + mNextAction->setNextActionType(DeleteFileAction); mNextAction->setNextActionName(filename); storageServiceauthentication(); } else { @@ -207,7 +207,7 @@ void WebDavStorageService::storageServicedeleteFolder(const QString &foldername) { if (needInitialized()) { - mNextAction->setNextActionType(DeleteFolder); + mNextAction->setNextActionType(DeleteFolderAction); mNextAction->setNextActionName(foldername); storageServiceauthentication(); } else { @@ -222,7 +222,7 @@ void WebDavStorageService::storageServiceRenameFolder(const QString &source, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(RenameFolder); + mNextAction->setNextActionType(RenameFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -237,7 +237,7 @@ void WebDavStorageService::storageServiceRenameFile(const QString &source, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(RenameFile); + mNextAction->setNextActionType(RenameFileAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -252,7 +252,7 @@ void WebDavStorageService::storageServiceMoveFolder(const QString &source, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(MoveFolder); + mNextAction->setNextActionType(MoveFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -267,7 +267,7 @@ void WebDavStorageService::storageServiceMoveFile(const QString &source, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(MoveFile); + mNextAction->setNextActionType(MoveFileAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -282,7 +282,7 @@ void WebDavStorageService::storageServiceCopyFile(const QString &source, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(CopyFile); + mNextAction->setNextActionType(CopyFileAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -297,7 +297,7 @@ void WebDavStorageService::storageServiceCopyFolder(const QString &source, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(CopyFolder); + mNextAction->setNextActionType(CopyFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -411,7 +411,7 @@ void WebDavStorageService::storageServicelistFolder(const QString &folder) { if (needInitialized()) { - mNextAction->setNextActionType(ListFolder); + mNextAction->setNextActionType(ListFolderAction); mNextAction->setNextActionFolder(folder); storageServiceauthentication(); } else { @@ -426,7 +426,7 @@ void WebDavStorageService::storageServicecreateFolder(const QString &name, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(CreateFolder); + mNextAction->setNextActionType(CreateFolderAction); mNextAction->setNextActionName(name); mNextAction->setNextActionFolder(destination); storageServiceauthentication(); @@ -442,7 +442,7 @@ void WebDavStorageService::storageServiceaccountInfo() { if (needInitialized()) { - mNextAction->setNextActionType(AccountInfo); + mNextAction->setNextActionType(AccountInfoAction); storageServiceauthentication(); } else { WebDavJob *job = new WebDavJob(this); @@ -461,7 +461,7 @@ void WebDavStorageService::storageServiceuploadFile(const QString &filename, const QString &uploadAsName, const QString &destination) { if (needInitialized()) { - mNextAction->setNextActionType(UploadFile); + mNextAction->setNextActionType(UploadFileAction); mNextAction->setNextActionName(filename); mNextAction->setNextActionFolder(destination); mNextAction->setUploadAsName(uploadAsName); diff -Nru kdepim-4.13.0/pimcommon/storageservice/widgets/storageservicetreewidget.cpp kdepim-4.13.3/pimcommon/storageservice/widgets/storageservicetreewidget.cpp --- kdepim-4.13.0/pimcommon/storageservice/widgets/storageservicetreewidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/widgets/storageservicetreewidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -246,43 +246,100 @@ } StorageServiceTreeWidgetItem::StorageServiceTreeWidgetItem(StorageServiceTreeWidget *parent) - : QTreeWidgetItem(parent) + : QTreeWidgetItem(parent), + mSize(-1) { } bool StorageServiceTreeWidgetItem::operator<(const QTreeWidgetItem &other) const { + const QTreeWidgetItem *otherItem = &other; + const StorageServiceTreeWidgetItem *storageItem = static_cast( otherItem ); + StorageServiceTreeWidget::ItemType sourceType = static_cast(data(StorageServiceTreeWidget::ColumnName, StorageServiceTreeWidget::ElementType).toInt()); StorageServiceTreeWidget::ItemType otherType = static_cast(other.data(StorageServiceTreeWidget::ColumnName, StorageServiceTreeWidget::ElementType).toInt()); if (sourceType == StorageServiceTreeWidget::MoveUpType) { return false; } else if (otherType == StorageServiceTreeWidget::MoveUpType) { return false; - } else if (sourceType == otherType) { - return text(StorageServiceTreeWidget::ColumnName) < other.text(StorageServiceTreeWidget::ColumnName); - } else { - if (sourceType == StorageServiceTreeWidget::Folder) { - return false; + } + + switch(treeWidget()->sortColumn()) { + case StorageServiceTreeWidget::ColumnName: { + if (sourceType == otherType) { + return text(StorageServiceTreeWidget::ColumnName) < other.text(StorageServiceTreeWidget::ColumnName); + } else { + if (sourceType == StorageServiceTreeWidget::Folder) { + return false; + } else { + return true; + } + } + break; + } + case StorageServiceTreeWidget::ColumnSize: { + if (sourceType == otherType) { + return size() < storageItem->size(); + } else { + if (sourceType == StorageServiceTreeWidget::Folder) { + return false; + } else { + return true; + } + } + break; + } + case StorageServiceTreeWidget::ColumnCreated: { + if (sourceType == otherType) { + return createDate() < storageItem->createDate(); } else { - return true; + if (sourceType == StorageServiceTreeWidget::Folder) { + return false; + } else { + return true; + } } + break; } + case StorageServiceTreeWidget::ColumnLastModification: { + if (sourceType == otherType) { + return lastModificationDate() < storageItem->lastModificationDate(); + } else { + if (sourceType == StorageServiceTreeWidget::Folder) { + return false; + } else { + return true; + } + } + break; + } + } + return QTreeWidgetItem::operator < ( other ); } void StorageServiceTreeWidgetItem::setSize(qulonglong size) { - setText(StorageServiceTreeWidget::ColumnSize, KGlobal::locale()->formatByteSize(size)); + if (mSize != size) { + mSize = size; + setText(StorageServiceTreeWidget::ColumnSize, KGlobal::locale()->formatByteSize(mSize)); + } } void StorageServiceTreeWidgetItem::setDateCreated(const KDateTime &date) { - setText(StorageServiceTreeWidget::ColumnCreated, KGlobal::locale()->formatDateTime(date)); + if (date != mCreateDate) { + mCreateDate = date; + setText(StorageServiceTreeWidget::ColumnCreated, KGlobal::locale()->formatDateTime(mCreateDate)); + } } void StorageServiceTreeWidgetItem::setLastModification(const KDateTime &date) { - setText(StorageServiceTreeWidget::ColumnLastModification, KGlobal::locale()->formatDateTime(date)); + if (date != mLastModificationDate) { + mLastModificationDate = date; + setText(StorageServiceTreeWidget::ColumnLastModification, KGlobal::locale()->formatDateTime(mLastModificationDate)); + } } void StorageServiceTreeWidgetItem::setStoreInfo(const QVariantMap &data) @@ -295,4 +352,21 @@ return data(StorageServiceTreeWidget::ColumnName, StorageServiceTreeWidget::Info).value(); } +KDateTime StorageServiceTreeWidgetItem::lastModificationDate() const +{ + return mLastModificationDate; +} + +KDateTime StorageServiceTreeWidgetItem::createDate() const +{ + return mCreateDate; +} + +qulonglong StorageServiceTreeWidgetItem::size() const +{ + return mSize; +} + + + #include "moc_storageservicetreewidget.cpp" diff -Nru kdepim-4.13.0/pimcommon/storageservice/widgets/storageservicetreewidget.h kdepim-4.13.3/pimcommon/storageservice/widgets/storageservicetreewidget.h --- kdepim-4.13.0/pimcommon/storageservice/widgets/storageservicetreewidget.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/widgets/storageservicetreewidget.h 2014-07-09 12:18:50.000000000 +0000 @@ -22,9 +22,9 @@ #define PIMCOMMON_STORAGESERVICETREEWIDGET_H #include +#include #include "pimcommon_export.h" class KMenu; -class KDateTime; namespace PimCommon { class StorageServiceTreeWidget; class StorageServiceAbstract; @@ -38,6 +38,16 @@ void setLastModification(const KDateTime &date); void setStoreInfo(const QVariantMap &data); QVariantMap storeInfo() const; + + + KDateTime lastModificationDate() const; + KDateTime createDate() const; + qulonglong size() const; +private: + KDateTime mCreateDate; + KDateTime mLastModificationDate; + qulonglong mSize; + }; class PIMCOMMON_EXPORT StorageServiceTreeWidget : public QTreeWidget @@ -86,6 +96,7 @@ void createUpAction(KMenu *menu); void createPropertiesAction(KMenu *menu); + Q_SIGNALS: void fileDoubleClicked(); void changeFolder(const QString ¤tFolder, const QString &parentFolder); @@ -105,7 +116,7 @@ void slotItemDoubleClicked(QTreeWidgetItem *item, int column); void slotMoveUp(); void slotContextMenu(const QPoint &pos); - void slotProperties(); + void slotProperties(); }; } diff -Nru kdepim-4.13.0/pimcommon/storageservice/yousendit/yousenditjob.cpp kdepim-4.13.3/pimcommon/storageservice/yousendit/yousenditjob.cpp --- kdepim-4.13.0/pimcommon/storageservice/yousendit/yousenditjob.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/yousendit/yousenditjob.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -55,7 +55,7 @@ void YouSendItJob::copyFile(const QString &/*source*/, const QString &/*destination*/) { - mActionType = PimCommon::StorageServiceAbstract::CopyFile; + mActionType = PimCommon::StorageServiceAbstract::CopyFileAction; mError = false; qDebug()<<" not implemented"; Q_EMIT actionFailed(QLatin1String("Not Implemented")); @@ -64,7 +64,7 @@ void YouSendItJob::copyFolder(const QString &/*source*/, const QString &/*destination*/) { - mActionType = PimCommon::StorageServiceAbstract::CopyFolder; + mActionType = PimCommon::StorageServiceAbstract::CopyFolderAction; mError = false; qDebug()<<" not implemented"; Q_EMIT actionFailed(QLatin1String("Not Implemented")); @@ -73,7 +73,7 @@ void YouSendItJob::createServiceFolder() { - mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateServiceFolderAction; mError = false; createFolderJob(PimCommon::StorageServiceJobConfig::self()->defaultUploadFolder(), QString()); } @@ -97,7 +97,7 @@ void YouSendItJob::deleteFile(const QString &filename) { - mActionType = PimCommon::StorageServiceAbstract::DeleteFile; + mActionType = PimCommon::StorageServiceAbstract::DeleteFileAction; mError = false; QUrl url(mDefaultUrl + QString::fromLatin1("/dpi/v1/folder/file/%1").arg(filename)); qDebug()<<" url"< 0 QUrl url; @@ -242,7 +242,7 @@ void YouSendItJob::accountInfo() { - mActionType = PimCommon::StorageServiceAbstract::AccountInfo; + mActionType = PimCommon::StorageServiceAbstract::AccountInfoAction; mError = false; QUrl url(mDefaultUrl + QLatin1String("/dpi/v2/user")); url.addQueryItem(QLatin1String("email"),mUsername); @@ -255,7 +255,7 @@ void YouSendItJob::createFolder(const QString &foldername, const QString &destination) { - mActionType = PimCommon::StorageServiceAbstract::CreateFolder; + mActionType = PimCommon::StorageServiceAbstract::CreateFolderAction; mError = false; createFolderJob(foldername, destination); } @@ -295,37 +295,37 @@ case PimCommon::StorageServiceAbstract::NoneAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: Q_EMIT authorizationFailed(errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: Q_EMIT authorizationFailed(errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: Q_EMIT uploadFileFailed(errorStr); errorMessage(mActionType, errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: Q_EMIT downLoadFileFailed(errorStr); errorMessage(mActionType, errorStr); deleteLater(); break; - case PimCommon::StorageServiceAbstract::DeleteFile: - case PimCommon::StorageServiceAbstract::DeleteFolder: - case PimCommon::StorageServiceAbstract::CreateFolder: - case PimCommon::StorageServiceAbstract::AccountInfo: - case PimCommon::StorageServiceAbstract::ListFolder: - case PimCommon::StorageServiceAbstract::CreateServiceFolder: - case PimCommon::StorageServiceAbstract::RenameFolder: - case PimCommon::StorageServiceAbstract::RenameFile: - case PimCommon::StorageServiceAbstract::MoveFolder: - case PimCommon::StorageServiceAbstract::MoveFile: - case PimCommon::StorageServiceAbstract::CopyFile: - case PimCommon::StorageServiceAbstract::CopyFolder: - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::DeleteFileAction: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: + case PimCommon::StorageServiceAbstract::CreateFolderAction: + case PimCommon::StorageServiceAbstract::AccountInfoAction: + case PimCommon::StorageServiceAbstract::ListFolderAction: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: + case PimCommon::StorageServiceAbstract::RenameFolderAction: + case PimCommon::StorageServiceAbstract::RenameFileAction: + case PimCommon::StorageServiceAbstract::MoveFolderAction: + case PimCommon::StorageServiceAbstract::MoveFileAction: + case PimCommon::StorageServiceAbstract::CopyFileAction: + case PimCommon::StorageServiceAbstract::CopyFolderAction: + case PimCommon::StorageServiceAbstract::ShareLinkAction: errorMessage(mActionType, errorStr); deleteLater(); break; @@ -336,55 +336,55 @@ case PimCommon::StorageServiceAbstract::NoneAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::RequestToken: + case PimCommon::StorageServiceAbstract::RequestTokenAction: parseRequestToken(data); break; - case PimCommon::StorageServiceAbstract::AccessToken: + case PimCommon::StorageServiceAbstract::AccessTokenAction: deleteLater(); break; - case PimCommon::StorageServiceAbstract::UploadFile: + case PimCommon::StorageServiceAbstract::UploadFileAction: parseUploadFile(data); break; - case PimCommon::StorageServiceAbstract::CreateFolder: + case PimCommon::StorageServiceAbstract::CreateFolderAction: parseCreateFolder(data); break; - case PimCommon::StorageServiceAbstract::AccountInfo: + case PimCommon::StorageServiceAbstract::AccountInfoAction: parseAccountInfo(data); break; - case PimCommon::StorageServiceAbstract::ListFolder: + case PimCommon::StorageServiceAbstract::ListFolderAction: parseListFolder(data); break; - case PimCommon::StorageServiceAbstract::CreateServiceFolder: + case PimCommon::StorageServiceAbstract::CreateServiceFolderAction: parseCreateServiceFolder(data); break; - case PimCommon::StorageServiceAbstract::DeleteFolder: + case PimCommon::StorageServiceAbstract::DeleteFolderAction: parseDeleteFolder(data); break; - case PimCommon::StorageServiceAbstract::DeleteFile: + case PimCommon::StorageServiceAbstract::DeleteFileAction: parseDeleteFile(data); break; - case PimCommon::StorageServiceAbstract::DownLoadFile: + case PimCommon::StorageServiceAbstract::DownLoadFileAction: parseDownloadFile(data); break; - case PimCommon::StorageServiceAbstract::RenameFolder: + case PimCommon::StorageServiceAbstract::RenameFolderAction: parseRenameFolder(data); break; - case PimCommon::StorageServiceAbstract::RenameFile: + case PimCommon::StorageServiceAbstract::RenameFileAction: parseRenameFile(data); break; - case PimCommon::StorageServiceAbstract::MoveFolder: + case PimCommon::StorageServiceAbstract::MoveFolderAction: parseMoveFolder(data); break; - case PimCommon::StorageServiceAbstract::MoveFile: + case PimCommon::StorageServiceAbstract::MoveFileAction: parseMoveFile(data); break; - case PimCommon::StorageServiceAbstract::CopyFile: + case PimCommon::StorageServiceAbstract::CopyFileAction: parseCopyFile(data); break; - case PimCommon::StorageServiceAbstract::CopyFolder: + case PimCommon::StorageServiceAbstract::CopyFolderAction: parseCopyFolder(data); break; - case PimCommon::StorageServiceAbstract::ShareLink: + case PimCommon::StorageServiceAbstract::ShareLinkAction: parseShareLink(data); break; } @@ -593,7 +593,7 @@ void YouSendItJob::startUploadFile(const QString &fileId) { - mActionType = PimCommon::StorageServiceAbstract::UploadFile; + mActionType = PimCommon::StorageServiceAbstract::UploadFileAction; mError = false; QUrl url(mDefaultUrl + QLatin1String("/dpi/v1/folder/file/initUpload")); QNetworkRequest request(url); @@ -615,7 +615,7 @@ void YouSendItJob::shareLink(const QString &root, const QString &path) { mError = false; - mActionType = PimCommon::StorageServiceAbstract::ShareLink; + mActionType = PimCommon::StorageServiceAbstract::ShareLinkAction; Q_EMIT actionFailed(QLatin1String("Not Implemented")); qDebug()<<" not implemented"; deleteLater(); diff -Nru kdepim-4.13.0/pimcommon/storageservice/yousendit/yousenditstorageservice.cpp kdepim-4.13.3/pimcommon/storageservice/yousendit/yousenditstorageservice.cpp --- kdepim-4.13.0/pimcommon/storageservice/yousendit/yousenditstorageservice.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/storageservice/yousendit/yousenditstorageservice.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -139,7 +139,7 @@ void YouSendItStorageService::storageServicelistFolder(const QString &folder) { if (needAuthenticate()) { - mNextAction->setNextActionType(ListFolder); + mNextAction->setNextActionType(ListFolderAction); mNextAction->setNextActionFolder(folder); storageServiceauthentication(); } else { @@ -156,7 +156,7 @@ if (needAuthenticate()) { mNextAction->setNextActionName(name); mNextAction->setNextActionFolder(destination); - mNextAction->setNextActionType(CreateFolder); + mNextAction->setNextActionType(CreateFolderAction); storageServiceauthentication(); } else { YouSendItJob *job = new YouSendItJob(this); @@ -170,7 +170,7 @@ void YouSendItStorageService::storageServiceaccountInfo() { if (needAuthenticate()) { - mNextAction->setNextActionType(AccountInfo); + mNextAction->setNextActionType(AccountInfoAction); storageServiceauthentication(); } else { YouSendItJob *job = new YouSendItJob(this); @@ -192,7 +192,7 @@ mNextAction->setNextActionName(filename); mNextAction->setNextActionFolder(destination); mNextAction->setUploadAsName(uploadAsName); - mNextAction->setNextActionType(UploadFile); + mNextAction->setNextActionType(UploadFileAction); storageServiceauthentication(); } else { YouSendItJob *job = new YouSendItJob(this); @@ -255,7 +255,7 @@ if (needAuthenticate()) { mNextAction->setRootPath(root); mNextAction->setPath(path); - mNextAction->setNextActionType(ShareLink); + mNextAction->setNextActionType(ShareLinkAction); storageServiceauthentication(); } else { YouSendItJob *job = new YouSendItJob(this); @@ -270,7 +270,7 @@ { if (needAuthenticate()) { mNextAction->setNextActionName(name); - mNextAction->setNextActionType(DownLoadFile); + mNextAction->setNextActionType(DownLoadFileAction); mNextAction->setDownloadDestination(destination); mNextAction->setFileId(fileId); storageServiceauthentication(); @@ -288,7 +288,7 @@ void YouSendItStorageService::storageServicecreateServiceFolder() { if (needAuthenticate()) { - mNextAction->setNextActionType(CreateServiceFolder); + mNextAction->setNextActionType(CreateServiceFolderAction); storageServiceauthentication(); } else { YouSendItJob *job = new YouSendItJob(this); @@ -303,7 +303,7 @@ { if (needAuthenticate()) { mNextAction->setNextActionName(filename); - mNextAction->setNextActionType(DeleteFile); + mNextAction->setNextActionType(DeleteFileAction); storageServiceauthentication(); } else { YouSendItJob *job = new YouSendItJob(this); @@ -318,7 +318,7 @@ { if (needAuthenticate()) { mNextAction->setNextActionName(foldername); - mNextAction->setNextActionType(DeleteFolder); + mNextAction->setNextActionType(DeleteFolderAction); storageServiceauthentication(); } else { YouSendItJob *job = new YouSendItJob(this); @@ -332,7 +332,7 @@ void YouSendItStorageService::storageServiceRenameFolder(const QString &source, const QString &destination) { if (needAuthenticate()) { - mNextAction->setNextActionType(RenameFolder); + mNextAction->setNextActionType(RenameFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -347,7 +347,7 @@ void YouSendItStorageService::storageServiceRenameFile(const QString &source, const QString &destination) { if (needAuthenticate()) { - mNextAction->setNextActionType(RenameFile); + mNextAction->setNextActionType(RenameFileAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -362,7 +362,7 @@ void YouSendItStorageService::storageServiceMoveFolder(const QString &source, const QString &destination) { if (needAuthenticate()) { - mNextAction->setNextActionType(MoveFolder); + mNextAction->setNextActionType(MoveFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -377,7 +377,7 @@ void YouSendItStorageService::storageServiceMoveFile(const QString &source, const QString &destination) { if (needAuthenticate()) { - mNextAction->setNextActionType(MoveFile); + mNextAction->setNextActionType(MoveFileAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -392,7 +392,7 @@ void YouSendItStorageService::storageServiceCopyFile(const QString &source, const QString &destination) { if (needAuthenticate()) { - mNextAction->setNextActionType(CopyFile); + mNextAction->setNextActionType(CopyFileAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { @@ -407,7 +407,7 @@ void YouSendItStorageService::storageServiceCopyFolder(const QString &source, const QString &destination) { if (needAuthenticate()) { - mNextAction->setNextActionType(CopyFolder); + mNextAction->setNextActionType(CopyFolderAction); mNextAction->setRenameFolder(source, destination); storageServiceauthentication(); } else { diff -Nru kdepim-4.13.0/pimcommon/templatewidgets/templateeditdialog.cpp kdepim-4.13.3/pimcommon/templatewidgets/templateeditdialog.cpp --- kdepim-4.13.0/pimcommon/templatewidgets/templateeditdialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/templatewidgets/templateeditdialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -17,6 +17,7 @@ #include "templateeditdialog.h" #include "pimcommon/texteditor/richtexteditor/richtexteditorwidget.h" +#include "pimcommon/texteditor/richtexteditor/richtexteditor.h" #include #include @@ -60,7 +61,8 @@ setMainWidget(w); if (!defaultTemplate) { enableButtonOk(false); - connect(mTemplateNameEdit, SIGNAL(textChanged(QString)),SLOT(slotTemplateNameChanged(QString))); + connect(mTemplateNameEdit, SIGNAL(textChanged(QString)),SLOT(slotTemplateChanged())); + connect(mTextEdit->editor(), SIGNAL(textChanged()),SLOT(slotTemplateChanged())); mTemplateNameEdit->setFocus(); } readConfig(); @@ -87,9 +89,10 @@ } } -void TemplateEditDialog::slotTemplateNameChanged(const QString &text) + +void TemplateEditDialog::slotTemplateChanged() { - enableButtonOk(!text.trimmed().isEmpty()); + enableButtonOk(!mTemplateNameEdit->text().trimmed().isEmpty() && !mTextEdit->editor()->toPlainText().trimmed().isEmpty()); } void TemplateEditDialog::setScript(const QString &text) diff -Nru kdepim-4.13.0/pimcommon/templatewidgets/templateeditdialog.h kdepim-4.13.3/pimcommon/templatewidgets/templateeditdialog.h --- kdepim-4.13.0/pimcommon/templatewidgets/templateeditdialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/templatewidgets/templateeditdialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -37,7 +37,7 @@ QString script() const; private Q_SLOTS: - void slotTemplateNameChanged(const QString &); + void slotTemplateChanged(); private: void readConfig(); diff -Nru kdepim-4.13.0/pimcommon/templatewidgets/templatelistwidget.cpp kdepim-4.13.3/pimcommon/templatewidgets/templatelistwidget.cpp --- kdepim-4.13.0/pimcommon/templatewidgets/templatelistwidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/templatewidgets/templatelistwidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -174,7 +174,7 @@ } if (lstSelectedItems.count() == 1 && !defaultTemplate) { menu->addSeparator(); - menu->addAction( i18n("Remove"), q, SLOT(slotRemove())); + menu->addAction( KIcon(QLatin1String("edit-delete")), i18n("Remove"), q, SLOT(slotRemove())); } } menu->addSeparator(); diff -Nru kdepim-4.13.0/pimcommon/templatewidgets/templatemanager.cpp kdepim-4.13.3/pimcommon/templatewidgets/templatemanager.cpp --- kdepim-4.13.0/pimcommon/templatewidgets/templatemanager.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimcommon/templatewidgets/templatemanager.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -26,6 +26,7 @@ #include using namespace PimCommon; + TemplateManager::TemplateManager(const QString &relativeTemplateDir, PimCommon::TemplateListWidget *templateListWidget) : QObject(templateListWidget), mTemplateListWidget(templateListWidget) @@ -39,7 +40,6 @@ TemplateManager::~TemplateManager() { - } void TemplateManager::slotDirectoryChanged() @@ -65,7 +65,6 @@ void TemplateManager::loadTemplates() { if ( !mTemplatesDirectories.isEmpty() ) { - mDirWatch->stopScan(); Q_FOREACH (const QString &directory, mTemplatesDirectories) { mDirWatch->removeDir( directory ); } diff -Nru kdepim-4.13.0/pimsettingexporter/dialog/showarchivestructuredialog.cpp kdepim-4.13.3/pimsettingexporter/dialog/showarchivestructuredialog.cpp --- kdepim-4.13.0/pimsettingexporter/dialog/showarchivestructuredialog.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimsettingexporter/dialog/showarchivestructuredialog.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -37,10 +37,11 @@ mTreeWidget->header()->hide(); mTreeWidget->setAlternatingRowColors(true); setMainWidget(mTreeWidget); - fillTree(); + const bool result = fillTree(); mTreeWidget->expandAll(); readConfig(); setButtonText(User1, i18n("Save As Text...")); + enableButton(User1, result); connect(this, SIGNAL(user1Clicked()), SLOT(slotExportAsLogFile())); } @@ -54,19 +55,20 @@ PimCommon::Util::saveTextAs(mLogFile, QLatin1String("*.txt"), this); } -void ShowArchiveStructureDialog::fillTree() +bool ShowArchiveStructureDialog::fillTree() { KZip *zip = new KZip(mFileName); bool result = zip->open(QIODevice::ReadOnly); if (!result) { KMessageBox::error(this, i18n("Archive cannot be opened in read mode."), i18n("Cannot open archive")); delete zip; - return; + return result; } const KArchiveDirectory *topDirectory = zip->directory(); const bool isAValidArchive = searchArchiveElement(Utils::infoPath(), topDirectory, i18n("Info")); if (!isAValidArchive) { KMessageBox::error(this, i18n("This is not kdepim archive."), i18n("Show information")); + result = false; } else { searchArchiveElement(Utils::mailsPath(), topDirectory, Utils::appTypeToI18n(Utils::KMail)); searchArchiveElement(Utils::alarmPath(), topDirectory, Utils::appTypeToI18n(Utils::KAlarm)); @@ -81,6 +83,7 @@ searchArchiveElement(Utils::akonadiPath(), topDirectory, Utils::storedTypeToI18n(Utils::AkonadiDb)); } delete zip; + return result; } bool ShowArchiveStructureDialog::searchArchiveElement(const QString &path, const KArchiveDirectory *topDirectory, const QString &name) diff -Nru kdepim-4.13.0/pimsettingexporter/dialog/showarchivestructuredialog.h kdepim-4.13.3/pimsettingexporter/dialog/showarchivestructuredialog.h --- kdepim-4.13.0/pimsettingexporter/dialog/showarchivestructuredialog.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimsettingexporter/dialog/showarchivestructuredialog.h 2014-07-09 12:18:50.000000000 +0000 @@ -37,7 +37,7 @@ private: void exportAsLogFile(); - void fillTree(); + bool fillTree(); void readConfig(); void writeConfig(); diff -Nru kdepim-4.13.0/pimsettingexporter/mail/exportmailjob.h kdepim-4.13.3/pimsettingexporter/mail/exportmailjob.h --- kdepim-4.13.0/pimsettingexporter/mail/exportmailjob.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimsettingexporter/mail/exportmailjob.h 2014-07-09 12:18:50.000000000 +0000 @@ -20,6 +20,9 @@ #include "abstractimportexportjob.h" #include + +#include + class KUrl; class ArchiveStorage; diff -Nru kdepim-4.13.0/pimsettingexporter/pimsettingexporter.desktop kdepim-4.13.3/pimsettingexporter/pimsettingexporter.desktop --- kdepim-4.13.0/pimsettingexporter/pimsettingexporter.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimsettingexporter/pimsettingexporter.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,6 +7,7 @@ Name[da]=Eksportør til PIM-indstillinger Name[de]=PIM-Einstellungs-Export Name[el]=Εξαγωγέας ρυθμίσεων PIM +Name[en_GB]=PIM Setting Exporter Name[es]=Exportador de preferencias de PIM Name[et]=PIM-i seadistuste eksport Name[fi]=PIM-asetusten vienti @@ -50,6 +51,7 @@ Comment[da]=Eksportør af PIM-indstillinger lader dig gemme alle data fra PIM-programmer og gendanne dem på et andet system. Comment[de]=Speichert alle Daten von PIM-Anwendungen, um sie später in anderen Systemen wiederherzustellen. Comment[el]=Ο εξαγωγέας ρυθμίσεων του PIM σάς επιτρέπει την αποθήκευση όλων των δεδομένων από τις εφαρμογές PIM και την επαναφορά τους σε άλλο σύστημα. +Comment[en_GB]=PIM Setting Exporter allows to save all data from PIM apps and restore them in other system. Comment[es]=El exportador de preferencias de PIM permite guardar todos los datos de aplicaciones PIM y restaurarlos en otro sistema. Comment[et]=PIM-i seadistuste eksport võimaldab salvestada kõik PIM-i rakenduste andmed ja taastada need teises süsteemis. Comment[fi]=PIM-asetusten vienti tallentaa PIM-sovellusten tiedot palautettavaksi toisessa järjestelmässä. diff -Nru kdepim-4.13.0/pimsettingexporter/pimsettingexporter_options.h kdepim-4.13.3/pimsettingexporter/pimsettingexporter_options.h --- kdepim-4.13.0/pimsettingexporter/pimsettingexporter_options.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/pimsettingexporter/pimsettingexporter_options.h 2014-07-09 12:18:50.000000000 +0000 @@ -25,7 +25,7 @@ { KCmdLineOptions options; options.add("import", ki18n("Import the given file" )); - options.add("export", ki18n("Import the given file" )); + options.add("export", ki18n("Export the given file" )); options.add( "+[url]", ki18n( "File or url. " "The user will be asked whether to import or export." ) ); diff -Nru kdepim-4.13.0/sieveeditor/sieveeditor.desktop kdepim-4.13.3/sieveeditor/sieveeditor.desktop --- kdepim-4.13.0/sieveeditor/sieveeditor.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/sieveeditor/sieveeditor.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,9 +7,12 @@ Name[da]=Sieve-editor Name[de]=Sieve-Editor Name[el]=Επεξεργαστής Sieve +Name[en_GB]=Sieve Editor Name[es]=Editor de Sieve +Name[et]=Sieve redaktor Name[fi]=Sieve-muokkain Name[fr]=Éditeur Sieve +Name[gl]=Editor de Sieve Name[hu]=Sieve szerkesztő Name[ia]=Editor de Sieve Name[it]=Editor Sieve @@ -41,9 +44,12 @@ GenericName[da]=Sieve-editor GenericName[de]=Sieve-Editor GenericName[el]=Επεξεργαστής Sieve +GenericName[en_GB]=Sieve Editor GenericName[es]=Editor de Sieve +GenericName[et]=Sieve redaktor GenericName[fi]=Sieve-muokkain GenericName[fr]=Éditeur Sieve +GenericName[gl]=Editor de Sieve GenericName[hu]=Sieve szerkesztő GenericName[ia]=Editor de Sieve GenericName[it]=Editor Sieve diff -Nru kdepim-4.13.0/sieveeditor/sieveeditormanagesievewidget.cpp kdepim-4.13.3/sieveeditor/sieveeditormanagesievewidget.cpp --- kdepim-4.13.0/sieveeditor/sieveeditormanagesievewidget.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/sieveeditor/sieveeditormanagesievewidget.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -48,7 +48,7 @@ const QList listConfig = SieveEditorUtil::readServerSieveConfig(); Q_FOREACH ( const SieveEditorUtil::SieveServerConfig &conf, listConfig) { last = new SieveTreeWidgetItem( treeView(), last ); - last->setText( 0, conf.serverName ); + last->setText( 0, conf.serverName + QString::fromLatin1(" (%1)").arg(conf.userName) ); last->setIcon( 0, SmallIcon( QLatin1String("network-server") ) ); const KUrl u = conf.url(); diff -Nru kdepim-4.13.0/storageservicemanager/data/storageservicemanager.notifyrc kdepim-4.13.3/storageservicemanager/data/storageservicemanager.notifyrc --- kdepim-4.13.0/storageservicemanager/data/storageservicemanager.notifyrc 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/storageservicemanager/data/storageservicemanager.notifyrc 2014-07-09 12:18:50.000000000 +0000 @@ -7,16 +7,19 @@ Comment[da]=StorageServiceManager Comment[de]=Speicherdienstverwaltung Comment[el]=StorageServiceManager +Comment[en_GB]=StorageServiceManager Comment[es]=Gestor del servicio de almacenamiento +Comment[et]=Salvestusteenuse haldur Comment[fi]=Tallennuspalveluiden hallinta Comment[fr]=StorageServiceManager +Comment[gl]=Xestor do servizo de almacenamento Comment[hu]=Tároló szolgáltatás kezelő Comment[ia]=StorageServiceManager Comment[it]=StorageServiceManager Comment[nb]=Behandler for lagringstjeneste Comment[nds]=Datenaflaag-Deenstpleger Comment[nl]=Beheerder van opslagservice -Comment[pl]=Usługa zarządcy przechowywania +Comment[pl]=Usługa zarządzania przechowywaniem Comment[pt]=Gestor de Serviços de Armazenamento Comment[pt_BR]=Gerenciador de Serviços de Armazenamento Comment[ru]=Служба хранения данных @@ -38,9 +41,12 @@ Name[da]=Handling mislykkedes Name[de]=Aktion ist fehlgeschlagen Name[el]=Αποτυχία ενέργειας +Name[en_GB]=Action Failed Name[es]=Falló la acción +Name[et]=Toiming nurjus Name[fi]=Toiminto epäonnistui Name[fr]=L'action a échoué +Name[gl]=Fallou unha acción Name[hu]=A művelet meghiúsult Name[ia]=Action falleva Name[it]=Azione non riuscita @@ -66,9 +72,12 @@ Comment[da]=En fejl blev returneret Comment[de]=Ein Fehler wurde zurückgegeben Comment[el]=Επιστράφηκε σφάλμα +Comment[en_GB]=An error was returned Comment[es]=Se devolvió un error +Comment[et]=Tekkis tõrge Comment[fi]=Tapahtui virhe Comment[fr]=Une erreur s'est produite +Comment[gl]=Devolveuse un erro Comment[hu]=Egy hiba tért vissza Comment[ia]=Il retornava un error Comment[it]=È stato restituito un errore diff -Nru kdepim-4.13.0/storageservicemanager/storageservicemanager.desktop kdepim-4.13.3/storageservicemanager/storageservicemanager.desktop --- kdepim-4.13.0/storageservicemanager/storageservicemanager.desktop 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/storageservicemanager/storageservicemanager.desktop 2014-07-09 12:18:50.000000000 +0000 @@ -7,14 +7,17 @@ Name[da]=Håndtering af lagringstjeneste Name[de]=Speicherdienstverwaltung Name[el]=Διαχειριστής υπηρεσίας αποθήκευσης +Name[en_GB]=Storage Service Manager Name[es]=Gestor del servicio de almacenamiento +Name[et]=Salvestusteenuse haldur Name[fi]=Tallennuspalvelun hallinta Name[fr]=Gestionnaire de service de stockage +Name[gl]=Xestor do servizo de almacenamento Name[hu]=Tároló szolgáltatás kezelő Name[ia]=Gerente de Servicio de immagazinage Name[it]=Gestore dei servizi di memorizzazione Name[nb]=Behandler for lagringstjeneste -Name[nds]=Datenaflaag-Deenstpleger +Name[nds]=Aflaagdeenst-Pleger Name[nl]=Beheerder van opslagservice Name[pl]=Usługa zarządcy przechowywania Name[pt]=Gestor de Serviços de Armazenamento @@ -41,14 +44,17 @@ GenericName[da]=Håndtering af lagringstjeneste GenericName[de]=Speicherdienstverwaltung GenericName[el]=Διαχειριστής υπηρεσίας αποθήκευσης +GenericName[en_GB]=Storage Service Manager GenericName[es]=Gestor del servicio de almacenamiento +GenericName[et]=Salvestusteenuse haldur GenericName[fi]=Tallennuspalvelun hallinta GenericName[fr]=Gestionnaire de service de stockage +GenericName[gl]=Xestor do servizo de almacenamento GenericName[hu]=Tároló szolgáltatás kezelő GenericName[ia]=Gerente de Servicio de immagazinage GenericName[it]=Gestore dei servizi di memorizzazione GenericName[nb]=Behandler for lagringstjeneste -GenericName[nds]=Datenaflaag-Deenstpleger +GenericName[nds]=Aflaagdeenst-Pleger GenericName[nl]=Beheerder van opslagservice GenericName[pl]=Usługa zarządcy przechowywania GenericName[pt]=Gestor de Serviços de Armazenamento diff -Nru kdepim-4.13.0/storageservicemanager/storageservicemanagermainwindow.cpp kdepim-4.13.3/storageservicemanager/storageservicemanagermainwindow.cpp --- kdepim-4.13.0/storageservicemanager/storageservicemanagermainwindow.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/storageservicemanager/storageservicemanagermainwindow.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -233,6 +233,7 @@ void StorageServiceManagerMainWindow::slotServiceRemoved(const QString &serviceName) { mStorageServiceTabWidget->serviceRemoved(serviceName); + mStorageManager->removeService(serviceName); } void StorageServiceManagerMainWindow::readConfig() diff -Nru kdepim-4.13.0/templateparser/tests/templateparsertest.cpp kdepim-4.13.3/templateparser/tests/templateparsertest.cpp --- kdepim-4.13.0/templateparser/tests/templateparsertest.cpp 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/templateparser/tests/templateparsertest.cpp 2014-07-09 12:18:50.000000000 +0000 @@ -34,182 +34,182 @@ void TemplateParserTester::test_convertedHtml_data() { - QTest::addColumn( "mailFileName" ); - QTest::addColumn( "referenceFileName" ); + QTest::addColumn( "mailFileName" ); + QTest::addColumn( "referenceFileName" ); - QDir dir( QLatin1String(MAIL_DATA_DIR) ); - foreach ( const QString &file, dir.entryList( QStringList(QLatin1String("plain*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks ) ) { - QTest::newRow( file.toLatin1() ) << QString(dir.path() + QLatin1Char('/') + file) << QString(dir.path() + QLatin1Char('/') + file + QLatin1String(".html")); - } + QDir dir( QLatin1String(MAIL_DATA_DIR) ); + foreach ( const QString &file, dir.entryList( QStringList(QLatin1String("plain*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks ) ) { + QTest::newRow( file.toLatin1() ) << QString(dir.path() + QLatin1Char('/') + file) << QString(dir.path() + QLatin1Char('/') + file + QLatin1String(".html")); + } } void TemplateParserTester::test_convertedHtml() { - QFETCH( QString, mailFileName ); - QFETCH( QString, referenceFileName ); + QFETCH( QString, mailFileName ); + QFETCH( QString, referenceFileName ); - // load input mail - QFile mailFile( mailFileName ); - QVERIFY( mailFile.open( QIODevice::ReadOnly ) ); - const QByteArray mailData = KMime::CRLFtoLF( mailFile.readAll() ); - QVERIFY( !mailData.isEmpty() ); - KMime::Message::Ptr msg( new KMime::Message ); - msg->setContent( mailData ); - msg->parse(); - - // load expected result - QFile referenceFile( referenceFileName ); - QVERIFY( referenceFile.open( QIODevice::ReadOnly ) ); - const QByteArray referenceRawData = KMime::CRLFtoLF( referenceFile.readAll() ); - const QString referenceData = QString::fromLatin1(referenceRawData ); - QVERIFY( !referenceData.isEmpty() ); - - EmptySource emptySource; - - QCOMPARE( msg->subject()->as7BitString( false ).constData(), "Plain Message Test" ); - QCOMPARE( msg->contents().size(), 0 ); - - ObjectTreeParser otp( &emptySource ); - otp.parseObjectTree( msg.get() ); - - QVERIFY( otp.htmlContent().isEmpty() ); - QVERIFY( !otp.plainTextContent().isEmpty() ); - const QString convertedHtmlContent = otp.convertedHtmlContent(); - QVERIFY( !convertedHtmlContent.isEmpty() ); + // load input mail + QFile mailFile( mailFileName ); + QVERIFY( mailFile.open( QIODevice::ReadOnly ) ); + const QByteArray mailData = KMime::CRLFtoLF( mailFile.readAll() ); + QVERIFY( !mailData.isEmpty() ); + KMime::Message::Ptr msg( new KMime::Message ); + msg->setContent( mailData ); + msg->parse(); + + // load expected result + QFile referenceFile( referenceFileName ); + QVERIFY( referenceFile.open( QIODevice::ReadOnly ) ); + const QByteArray referenceRawData = KMime::CRLFtoLF( referenceFile.readAll() ); + const QString referenceData = QString::fromLatin1(referenceRawData ); + QVERIFY( !referenceData.isEmpty() ); + + EmptySource emptySource; + + QCOMPARE( msg->subject()->as7BitString( false ).constData(), "Plain Message Test" ); + QCOMPARE( msg->contents().size(), 0 ); + + ObjectTreeParser otp( &emptySource ); + otp.parseObjectTree( msg.get() ); + + QVERIFY( otp.htmlContent().isEmpty() ); + QVERIFY( !otp.plainTextContent().isEmpty() ); + const QString convertedHtmlContent = otp.convertedHtmlContent(); + QVERIFY( !convertedHtmlContent.isEmpty() ); - QCOMPARE( convertedHtmlContent, referenceData ); + QCOMPARE( convertedHtmlContent, referenceData ); } void TemplateParserTester::test_bodyFromHtml() { - const QString content( QLatin1String("Plain mail with signature" - "This is the message text from Sudhendu Kumar<" - "dontspamme@yoohoo.com>.

    --
    Thanks & " - "Regards
    Sudhendu Kumar")); - QWebPage page; - page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); - page.settings()->setAttribute( QWebSettings::JavaEnabled, false ); - page.settings()->setAttribute( QWebSettings::PluginsEnabled, false ); + const QString content( QLatin1String("Plain mail with signature" + "This is the message text from Sudhendu Kumar<" + "dontspamme@yoohoo.com>.

    --
    Thanks & " + "Regards
    Sudhendu Kumar")); + QWebPage page; + page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); + page.settings()->setAttribute( QWebSettings::JavaEnabled, false ); + page.settings()->setAttribute( QWebSettings::PluginsEnabled, false ); - page.currentFrame()->setHtml( content ); + page.currentFrame()->setHtml( content ); - page.settings()->setAttribute( QWebSettings::JavascriptEnabled, true ); + page.settings()->setAttribute( QWebSettings::JavascriptEnabled, true ); - const QString bodyElement = page.currentFrame()->evaluateJavaScript( - QLatin1String("document.getElementsByTagName('body')[0].innerHTML")).toString(); + const QString bodyElement = page.currentFrame()->evaluateJavaScript( + QLatin1String("document.getElementsByTagName('body')[0].innerHTML")).toString(); - page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); + page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); - const QString expectedBody( QLatin1String("This is the message text from Sudhendu Kumar" - "<dontspamme@yoohoo.com>.

    --
    " - "Thanks & Regards
    Sudhendu Kumar") ); + const QString expectedBody( QLatin1String("This is the message text from Sudhendu Kumar" + "<dontspamme@yoohoo.com>.

    --
    " + "Thanks & Regards
    Sudhendu Kumar") ); - QCOMPARE( bodyElement, expectedBody ); + QCOMPARE( bodyElement, expectedBody ); - page.settings()->setAttribute( QWebSettings::JavascriptEnabled, true ); + page.settings()->setAttribute( QWebSettings::JavascriptEnabled, true ); - const QString headElement = page.currentFrame()->evaluateJavaScript( - QLatin1String("document.getElementsByTagName('head')[0].innerHTML") ).toString(); + const QString headElement = page.currentFrame()->evaluateJavaScript( + QLatin1String("document.getElementsByTagName('head')[0].innerHTML") ).toString(); - page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); + page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); - const QString expectedHead( QLatin1String("Plain mail with signature") ); + const QString expectedHead( QLatin1String("Plain mail with signature") ); - QCOMPARE( headElement, expectedHead ); + QCOMPARE( headElement, expectedHead ); } void TemplateParserTester::test_processWithTemplatesForBody_data() { - QTest::addColumn( "command" ); - QTest::addColumn( "text" ); - QTest::addColumn( "expected" ); - QTest::addColumn( "selection" ); - - QTest::newRow( "%OTEXT") << "%OTEXT" << "Original text.\nLine two." << "Original text.\nLine two." << ""; - QTest::newRow( "%OTEXT") << "%OTEXT" << "-----BEGIN PGP MESSAGE-----\nVersion: GnuPG v1.4.12 (GNU/Linux)\n\ -\n\ -hQEMAwzOQ1qnzNo7AQgA1345CrnOBTGf2eo4ABR6wkOdasI9SELRBKA1fNkFcq+Z\n\ -Qg0gWB5RLapU+VFRc5hK1zPOZ1dY6j3+uPHO4RhjfUgfiZ8T7oaWav15yP+07u21\n\ -EI9W9sk+eQU9GZSOayURucmZa/mbBz9hrsmePpORxD+C3uNTYa6ePTFlQP6wEZOI\n\ -7E53DrtJnF0EzIsCBIVep6CyuYfuSSwQ5gMgyPzfBqiGHNw96w2i/eayErc6lquL\n\ -JPFhIcMMq8w9Yo9+vXCAbkns6dtBAzlnAzuV86VFUZ/MnHTlCNk2yHyGLP6BS6hG\n\ -kFEUmgdHrGRizdz1sjo1tSmOLu+Gyjlv1Ir/Sqr8etJQAeTq3heKslAfhtotAMMt\n\ -R3tk228Su13Q3CAP/rktAyuGMDFtH8klW09zFdsZBDu8svE6d9e2nZ541NGspFVI\n\ -6XTZHUMMdlgnTBcu3aPc0ow=\n\ -=0xtc\n\ ------END PGP MESSAGE-----" << "Crypted line.\nCrypted line two." << ""; - QTest::newRow( "%QUOTE") << "%QUOTE" << "Quoted text.\nLine two." << "> Quoted text.\n> Line two." << ""; + QTest::addColumn( "command" ); + QTest::addColumn( "text" ); + QTest::addColumn( "expected" ); + QTest::addColumn( "selection" ); + + QTest::newRow( "%OTEXT") << "%OTEXT" << "Original text.\nLine two." << "Original text.\nLine two." << ""; + QTest::newRow( "%OTEXT") << "%OTEXT" << "-----BEGIN PGP MESSAGE-----\nVersion: GnuPG v1.4.12 (GNU/Linux)\n" + "\n" + "hQEMAwzOQ1qnzNo7AQgA1345CrnOBTGf2eo4ABR6wkOdasI9SELRBKA1fNkFcq+Z\n" + "Qg0gWB5RLapU+VFRc5hK1zPOZ1dY6j3+uPHO4RhjfUgfiZ8T7oaWav15yP+07u21\n" + "EI9W9sk+eQU9GZSOayURucmZa/mbBz9hrsmePpORxD+C3uNTYa6ePTFlQP6wEZOI\n" + "7E53DrtJnF0EzIsCBIVep6CyuYfuSSwQ5gMgyPzfBqiGHNw96w2i/eayErc6lquL\n" + "JPFhIcMMq8w9Yo9+vXCAbkns6dtBAzlnAzuV86VFUZ/MnHTlCNk2yHyGLP6BS6hG\n" + "kFEUmgdHrGRizdz1sjo1tSmOLu+Gyjlv1Ir/Sqr8etJQAeTq3heKslAfhtotAMMt\n" + "R3tk228Su13Q3CAP/rktAyuGMDFtH8klW09zFdsZBDu8svE6d9e2nZ541NGspFVI\n" + "6XTZHUMMdlgnTBcu3aPc0ow=\n" + "=0xtc\n" + "-----END PGP MESSAGE-----" << "Crypted line.\nCrypted line two." << ""; + QTest::newRow( "%QUOTE") << "%QUOTE" << "Quoted text.\nLine two." << "> Quoted text.\n> Line two." << ""; } void TemplateParserTester::test_processWithTemplatesForBody() { - QFETCH( QString, command ); - QFETCH( QString, text ); - QFETCH( QString, expected ); - QFETCH( QString, selection ); - - KMime::Message::Ptr msg( new KMime::Message() ); - msg->setBody( text.toLocal8Bit() ); - msg->parse(); - TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::Reply ); - parser.setSelection( selection ); - KPIMIdentities::IdentityManager* identMan = new KPIMIdentities::IdentityManager; - parser.setIdentityManager( identMan ); - parser.setAllowDecryption( true ); - parser.mOrigMsg = msg; + QFETCH( QString, command ); + QFETCH( QString, text ); + QFETCH( QString, expected ); + QFETCH( QString, selection ); + + KMime::Message::Ptr msg( new KMime::Message() ); + msg->setBody( text.toLocal8Bit() ); + msg->parse(); + TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::Reply ); + parser.setSelection( selection ); + KPIMIdentities::IdentityManager* identMan = new KPIMIdentities::IdentityManager; + parser.setIdentityManager( identMan ); + parser.setAllowDecryption( true ); + parser.mOrigMsg = msg; - parser.processWithTemplate( command ); + parser.processWithTemplate( command ); - identMan->deleteLater(); - QCOMPARE( QString::fromLatin1( msg->encodedBody() ), expected ); + identMan->deleteLater(); + QCOMPARE( QString::fromLatin1( msg->encodedBody() ), expected ); } void TemplateParserTester::test_processWithTemplatesForContent_data() { - QTest::addColumn( "command" ); - QTest::addColumn( "mailFileName" ); - QTest::addColumn( "expected" ); - - QDir dir( QLatin1String(MAIL_DATA_DIR) ); - foreach ( const QString &file, dir.entryList( QStringList(QLatin1String("plain*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks ) ) { - QTest::newRow( file.toLatin1() ) << "%OTIME" << QString(dir.path() + QLatin1Char('/') + file) << "11:30"; - QTest::newRow( file.toLatin1() ) << "%OTIMELONG" << QString(dir.path() + QLatin1Char('/') + file) << "11:30:27"; - QTest::newRow( file.toLatin1() ) << "%OTIMELONGEN" << QString(dir.path() + QLatin1Char('/') + file) << "11:30:27"; - QTest::newRow( file.toLatin1() ) << "%ODATE" << QString(dir.path() + QLatin1Char('/') + file) << "Sunday 07 August 2011"; - QTest::newRow( file.toLatin1() ) << "%ODATESHORT" << QString(dir.path() + QLatin1Char('/') + file) << "2011-08-07"; - QTest::newRow( file.toLatin1() ) << "%ODATEEN" << QString(dir.path() + QLatin1Char('/') + file) << "Sunday 07 August 2011"; - QTest::newRow( file.toLatin1() ) << "%OFULLSUBJ" << QString(dir.path() + QLatin1Char('/') + file) << "Plain Message Test"; - QTest::newRow( file.toLatin1() ) << "%OFULLSUBJECT" << QString(dir.path() + QLatin1Char('/') + file) << "Plain Message Test"; - QTest::newRow( file.toLatin1() ) << "%OFROMFNAME" << QString(dir.path() + QLatin1Char('/') + file) << "Sudhendu"; - QTest::newRow( file.toLatin1() ) << "%OFROMLNAME" << QString(dir.path() + QLatin1Char('/') + file) << "Kumar"; - QTest::newRow( file.toLatin1() ) << "%OFROMNAME" << QString(dir.path() + QLatin1Char('/') + file) << "Sudhendu Kumar"; - QTest::newRow( file.toLatin1() ) << "%OFROMADDR" << QString(dir.path() + QLatin1Char('/') + file) << "Sudhendu Kumar "; - } + QTest::addColumn( "command" ); + QTest::addColumn( "mailFileName" ); + QTest::addColumn( "expected" ); + + QDir dir( QLatin1String(MAIL_DATA_DIR) ); + foreach ( const QString &file, dir.entryList( QStringList(QLatin1String("plain*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks ) ) { + QTest::newRow( file.toLatin1() ) << "%OTIME" << QString(dir.path() + QLatin1Char('/') + file) << "11:30"; + QTest::newRow( file.toLatin1() ) << "%OTIMELONG" << QString(dir.path() + QLatin1Char('/') + file) << "11:30:27"; + QTest::newRow( file.toLatin1() ) << "%OTIMELONGEN" << QString(dir.path() + QLatin1Char('/') + file) << "11:30:27"; + QTest::newRow( file.toLatin1() ) << "%ODATE" << QString(dir.path() + QLatin1Char('/') + file) << "Sunday 07 August 2011"; + QTest::newRow( file.toLatin1() ) << "%ODATESHORT" << QString(dir.path() + QLatin1Char('/') + file) << "2011-08-07"; + QTest::newRow( file.toLatin1() ) << "%ODATEEN" << QString(dir.path() + QLatin1Char('/') + file) << "Sunday 07 August 2011"; + QTest::newRow( file.toLatin1() ) << "%OFULLSUBJ" << QString(dir.path() + QLatin1Char('/') + file) << "Plain Message Test"; + QTest::newRow( file.toLatin1() ) << "%OFULLSUBJECT" << QString(dir.path() + QLatin1Char('/') + file) << "Plain Message Test"; + QTest::newRow( file.toLatin1() ) << "%OFROMFNAME" << QString(dir.path() + QLatin1Char('/') + file) << "Sudhendu"; + QTest::newRow( file.toLatin1() ) << "%OFROMLNAME" << QString(dir.path() + QLatin1Char('/') + file) << "Kumar"; + QTest::newRow( file.toLatin1() ) << "%OFROMNAME" << QString(dir.path() + QLatin1Char('/') + file) << "Sudhendu Kumar"; + QTest::newRow( file.toLatin1() ) << "%OFROMADDR" << QString(dir.path() + QLatin1Char('/') + file) << "Sudhendu Kumar "; + } } void TemplateParserTester::test_processWithTemplatesForContent() { - QFETCH( QString, command ); - QFETCH( QString, mailFileName ); - QFETCH( QString, expected ); - - QFile mailFile( mailFileName ); - QVERIFY( mailFile.open( QIODevice::ReadOnly ) ); - const QByteArray mailData = KMime::CRLFtoLF( mailFile.readAll() ); - QVERIFY( !mailData.isEmpty() ); - KMime::Message::Ptr msg( new KMime::Message ); - msg->setContent( mailData ); - msg->parse(); - - TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::Reply ); - KPIMIdentities::IdentityManager* identMan = new KPIMIdentities::IdentityManager; - parser.setIdentityManager( identMan ); - parser.setAllowDecryption( false ); - parser.mOrigMsg = msg; - parser.processWithTemplate( command ); + QFETCH( QString, command ); + QFETCH( QString, mailFileName ); + QFETCH( QString, expected ); + + QFile mailFile( mailFileName ); + QVERIFY( mailFile.open( QIODevice::ReadOnly ) ); + const QByteArray mailData = KMime::CRLFtoLF( mailFile.readAll() ); + QVERIFY( !mailData.isEmpty() ); + KMime::Message::Ptr msg( new KMime::Message ); + msg->setContent( mailData ); + msg->parse(); + + TemplateParser::TemplateParser parser( msg, TemplateParser::TemplateParser::Reply ); + KPIMIdentities::IdentityManager* identMan = new KPIMIdentities::IdentityManager; + parser.setIdentityManager( identMan ); + parser.setAllowDecryption( false ); + parser.mOrigMsg = msg; + parser.processWithTemplate( command ); - identMan->deleteLater(); - QCOMPARE( QString::fromLatin1( msg->encodedBody() ), expected ); + identMan->deleteLater(); + QCOMPARE( QString::fromLatin1( msg->encodedBody() ), expected ); } QTEST_KDEMAIN( TemplateParserTester, GUI ) diff -Nru kdepim-4.13.0/templateparser/tests/templateparsertest.h kdepim-4.13.3/templateparser/tests/templateparsertest.h --- kdepim-4.13.0/templateparser/tests/templateparsertest.h 2014-04-10 07:40:20.000000000 +0000 +++ kdepim-4.13.3/templateparser/tests/templateparsertest.h 2014-07-09 12:18:50.000000000 +0000 @@ -25,9 +25,9 @@ class TemplateParserTester : public QObject { - Q_OBJECT + Q_OBJECT - private slots: +private slots: /** * checks whether text/plain only mails are converted to a valid HTML */