Merge remote-tracking branch 'origin/KDE/4.14'

Conflicts:
	kmail/autotests/cryptostateindicatorwidgettest.cpp
	kmail/editor/kmcomposewin.cpp
	kmail/kmmainwidget.cpp
	kmail/kmmainwidget.h
	kmail/tests/CMakeLists.txt
	korgac/mailclient.cpp
	messagecomposer/sender/akonadisender.cpp
wilder-work
Montel Laurent 11 years ago
commit 96cbea8156
  1. 5
      CMakeLists.txt
  2. 2
      autotests/CMakeLists.txt
  3. 2
      autotests/cryptostateindicatorwidgettest.cpp
  4. 2
      autotests/kactionmenutransporttest.cpp
  5. 2
      autotests/kactionmenutransporttest.h
  6. 2
      editor/attachmentview.cpp
  7. 2
      editor/attachmentview.h
  8. 26
      editor/kmcomposewin.cpp
  9. 1
      editor/kmcomposewin.h
  10. 0
      editor/widgets/cryptostateindicatorwidget.cpp
  11. 0
      editor/widgets/cryptostateindicatorwidget.h
  12. 0
      editor/widgets/snippetwidget.cpp
  13. 0
      editor/widgets/snippetwidget.h
  14. 42
      kmmainwidget.cpp
  15. 3
      kmmainwidget.h
  16. 80
      widgets/kactionmenuaccount.cpp
  17. 38
      widgets/kactionmenuaccount.h
  18. 2
      widgets/kactionmenutransport.cpp
  19. 2
      widgets/kactionmenutransport.h

@ -104,7 +104,7 @@ if (KDEPIM_BUILD_DESKTOP)
identity/identityaddvcarddialog.cpp
)
set(kmailprivate_editor_LIB_SRCS
editor/snippetwidget.cpp
editor/widgets/snippetwidget.cpp
editor/kmcomposereditor.cpp
editor/composer.cpp
editor/codecaction.cpp
@ -112,7 +112,7 @@ if (KDEPIM_BUILD_DESKTOP)
editor/kmcomposewin.cpp
editor/attachmentcontroller.cpp
editor/attachmentview.cpp
editor/cryptostateindicatorwidget.cpp
editor/widgets/cryptostateindicatorwidget.cpp
editor/kmstorageservice.cpp
editor/validatesendmailshortcut.cpp
editor/kmcomposerglobalaction.cpp
@ -162,6 +162,7 @@ if (KDEPIM_BUILD_DESKTOP)
widgets/displaymessageformatactionmenu.cpp
widgets/statusbarlabeltoggledstate.cpp
widgets/kactionmenutransport.cpp
widgets/kactionmenuaccount.cpp
)
set(kmailprivate_tag_LIB_SRCS
tag/tagactionmanager.cpp

@ -36,7 +36,7 @@ ecm_mark_as_test(kmail_createfollowupreminderonexistingmessagejobtest)
target_link_libraries( createfollowupreminderonexistingmessagejobtest Qt5::Test Qt5::Widgets KF5::AkonadiCore KF5::CalendarCore KF5::Mime followupreminder messagecomposer)
set( kmail_cryptostateindicatorwidgettest_source cryptostateindicatorwidgettest.cpp ../editor/cryptostateindicatorwidget.cpp)
set( kmail_cryptostateindicatorwidgettest_source cryptostateindicatorwidgettest.cpp ../editor/widgets/cryptostateindicatorwidget.cpp)
add_executable( cryptostateindicatorwidgettest ${kmail_cryptostateindicatorwidgettest_source})
add_test(cryptostateindicatorwidgettest cryptostateindicatorwidgettest)
ecm_mark_as_test(cryptostateindicatorwidgettest)

@ -16,8 +16,8 @@
*/
#include "cryptostateindicatorwidgettest.h"
#include "editor/cryptostateindicatorwidget.h"
#include <qtest.h>
#include "editor/widgets/cryptostateindicatorwidget.h"
#include <QLabel>
CryptoStateIndicatorWidgetTest::CryptoStateIndicatorWidgetTest(QObject *parent) : QObject(parent)
{

@ -1,5 +1,5 @@
/*
Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
Copyright (c) 2015 Montel Laurent <montel@kde.org>
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

@ -1,5 +1,5 @@
/*
Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
Copyright (c) 2015 Montel Laurent <montel@kde.org>
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

@ -213,7 +213,7 @@ void AttachmentView::startDrag(Qt::DropActions supportedActions)
}
}
QWidget *AttachmentView::widget()
QWidget *AttachmentView::widget() const
{
return d->widget;
}

@ -46,7 +46,7 @@ public:
explicit AttachmentView(MessageComposer::AttachmentModel *model, QWidget *parent = Q_NULLPTR);
~AttachmentView();
QWidget *widget();
QWidget *widget() const;
public Q_SLOTS:
/// model sets these

@ -43,7 +43,7 @@
#include "messagecore/utils/stringutil.h"
#include "messagecore/attachment/attachmentcollector.h"
#include "util.h"
#include "editor/snippetwidget.h"
#include "editor/widgets/snippetwidget.h"
#include "templatesconfiguration_kfg.h"
#include "foldercollectionmonitor.h"
#include "kernel/mailkernel.h"
@ -55,7 +55,7 @@
#include "job/createnewcontactjob.h"
#include "job/savedraftjob.h"
#include "warningwidgets/externaleditorwarning.h"
#include "cryptostateindicatorwidget.h"
#include "widgets/cryptostateindicatorwidget.h"
#include "validatesendmailshortcut.h"
#include "job/saveasfilejob.h"
#include "editor/kmstorageservice.h"
@ -2070,7 +2070,7 @@ void KMComposeWin::slotInsertRecentFile(const QUrl &u)
job->start();
}
void KMComposeWin::slotInsertTextFile(KJob *job)
bool KMComposeWin::showErrorMessage(KJob *job)
{
if (job->error()) {
if (static_cast<KIO::Job *>(job)->ui()) {
@ -2078,7 +2078,14 @@ void KMComposeWin::slotInsertTextFile(KJob *job)
} else {
qCDebug(KMAIL_LOG) << " job->errorString() :" << job->errorString();
}
return true;
}
return false;
}
void KMComposeWin::slotInsertTextFile(KJob*job)
{
showErrorMessage(job);
}
void KMComposeWin::slotSelectCryptoModule(bool init)
@ -2229,12 +2236,7 @@ void KMComposeWin::slotPasteAsAttachment()
void KMComposeWin::slotFetchJob(KJob *job)
{
if (job->error()) {
if (static_cast<KIO::Job *>(job)->ui()) {
static_cast<KIO::Job *>(job)->ui()->showErrorMessage();
} else {
qCDebug(KMAIL_LOG) << " job->errorString() :" << job->errorString();
}
if (showErrorMessage(job)) {
return;
}
Akonadi::ItemFetchJob *fjob = dynamic_cast<Akonadi::ItemFetchJob *>(job);
@ -2528,11 +2530,7 @@ void KMComposeWin::printComposeResult(KJob *job, bool preview)
command->setPrintPreview(preview);
command->start();
} else {
if (static_cast<KIO::Job *>(job)->ui()) {
static_cast<KIO::Job *>(job)->ui()->showErrorMessage();
} else {
qCWarning(KMAIL_LOG) << "Composer for printing failed:" << composer->errorString();
}
showErrorMessage(job);
}
}

@ -609,6 +609,7 @@ private:
inline bool encryptToSelf() const;
private:
bool showErrorMessage(KJob *job);
int validateLineWrapWidth();
Akonadi::Collection mCollectionForNewMessage;
QMap<QByteArray, QString> mExtraHeaders;

@ -43,6 +43,7 @@
#include "widgets/collectionpane.h"
#include "manageshowcollectionproperties.h"
#include "widgets/kactionmenutransport.h"
#include "widgets/kactionmenuaccount.h"
#if !defined(NDEBUG)
#include <ksieveui/debug/sievedebugdialog.h>
using KSieveUi::SieveDebugDialog;
@ -1301,25 +1302,6 @@ void KMMainWidget::slotCheckMailOnStartup()
kmkernel->checkMailOnStartup();
}
//-----------------------------------------------------------------------------
void KMMainWidget::slotCheckOneAccount(QAction *item)
{
if (!item) {
return;
}
Akonadi::AgentInstance agent = Akonadi::AgentManager::self()->instance(item->data().toString());
if (agent.isValid()) {
if (!agent.isOnline()) {
agent.setIsOnline(true);
}
agent.synchronize();
} else {
qCDebug(KMAIL_LOG) << "account with identifier" << item->data().toString() << "not found";
}
}
//-----------------------------------------------------------------------------
void KMMainWidget::slotCompose()
{
KMail::Composer *win;
@ -2813,18 +2795,6 @@ void KMMainWidget::showMessagePopup(const Akonadi::Item &msg , const QUrl &url,
menu->exec(aPoint, Q_NULLPTR);
delete menu;
}
//-----------------------------------------------------------------------------
void KMMainWidget::getAccountMenu()
{
mActMenu->clear();
const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances();
foreach (const Akonadi::AgentInstance &type, lst) {
// Explicitly make a copy, as we're not changing values of the list but only
// the local copy which is passed to action.
QAction *action = mActMenu->addAction(QString(type.name()).replace(QLatin1Char('&'), QLatin1String("&&")));
action->setData(type.identifier());
}
}
void KMMainWidget::setupActions()
{
@ -2857,16 +2827,14 @@ void KMMainWidget::setupActions()
actionCollection()->setDefaultShortcut(action, QKeySequence(Qt::CTRL + Qt::Key_L));
}
KActionMenu *actActionMenu = new KActionMenu(QIcon::fromTheme(QLatin1String("mail-receive")), i18n("Check Mail In"), this);
KActionMenuAccount *actActionMenu = new KActionMenuAccount(this);
actActionMenu->setIcon(QIcon::fromTheme(QLatin1String("mail-receive")));
actActionMenu->setText(i18n("Check Mail In"));
actActionMenu->setIconText(i18n("Check Mail"));
actActionMenu->setToolTip(i18n("Check Mail"));
actionCollection()->addAction(QLatin1String("check_mail_in"), actActionMenu);
actActionMenu->setDelayed(true); //needed for checking "all accounts"
connect(actActionMenu, &KActionMenu::triggered, this, &KMMainWidget::slotCheckMail);
mActMenu = actActionMenu->menu();
connect(mActMenu, SIGNAL(triggered(QAction*)),
SLOT(slotCheckOneAccount(QAction*)));
connect(mActMenu, &QMenu::aboutToShow, this, &KMMainWidget::getAccountMenu);
mSendQueued = new QAction(QIcon::fromTheme(QLatin1String("mail-send")), i18n("&Send Queued Messages"), this);
actionCollection()->addAction(QLatin1String("send_queued"), mSendQueued);

@ -335,8 +335,6 @@ protected:
protected Q_SLOTS:
void updateFileMenu();
void slotCheckOneAccount(QAction *);
void getAccountMenu();
void slotHelp();
void slotFilter();
void slotManageSieveScripts();
@ -589,7 +587,6 @@ private:
KMReaderWin *mMsgView;
QSplitter *mSplitter1, *mSplitter2, *mFolderViewSplitter;
Akonadi::Collection mTemplateFolder;
QMenu *mActMenu;
bool mLongFolderList;
bool mStartupDone;
bool mWasEverShown;

@ -0,0 +1,80 @@
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
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 "kactionmenuaccount.h"
#include <AkonadiCore/AgentInstance>
#include <AkonadiCore/AgentManager>
#include "mailcommon/util/mailutil.h"
#include "kmail_debug.h"
#include <QMenu>
KActionMenuAccount::KActionMenuAccount(QObject *parent)
: KActionMenu(parent),
mInitialized(false)
{
setDelayed(true);
connect( menu(),SIGNAL(aboutToShow()),SLOT(slotCheckTransportMenu()));
connect( menu(), SIGNAL(triggered(QAction*)), this, SLOT(slotSelectAccount(QAction*)) );
connect( Akonadi::AgentManager::self(), SIGNAL(instanceNameChanged(Akonadi::AgentInstance)), this, SLOT(updateAccountMenu()));
connect( Akonadi::AgentManager::self(), SIGNAL(instanceRemoved(Akonadi::AgentInstance)), this, SLOT(updateAccountMenu()));
connect( Akonadi::AgentManager::self(), SIGNAL(instanceAdded(Akonadi::AgentInstance)), this, SLOT(updateAccountMenu()));
}
KActionMenuAccount::~KActionMenuAccount()
{
}
void KActionMenuAccount::slotSelectAccount(QAction *act)
{
if ( !act ) {
return;
}
Akonadi::AgentInstance agent = Akonadi::AgentManager::self()->instance( act->data().toString() );
if ( agent.isValid() ) {
if ( !agent.isOnline() ) {
agent.setIsOnline( true );
}
agent.synchronize();
} else {
qCDebug(KMAIL_LOG) << "account with identifier" << act->data().toString() << "not found";
}
}
void KActionMenuAccount::slotCheckTransportMenu()
{
if (!mInitialized) {
mInitialized = true;
updateAccountMenu();
}
}
void KActionMenuAccount::updateAccountMenu()
{
if (mInitialized) {
menu()->clear();
const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances();
Q_FOREACH ( const Akonadi::AgentInstance& type, lst ) {
// Explicitly make a copy, as we're not changing values of the list but only
// the local copy which is passed to action.
QAction* action = menu()->addAction( QString( type.name() ).replace(QLatin1Char('&'), QLatin1String("&&")) );
action->setData( type.identifier() );
}
}
}

@ -0,0 +1,38 @@
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
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 KACTIONMENUACCOUNT_H
#define KACTIONMENUACCOUNT_H
#include <KActionMenu>
class KActionMenuAccount : public KActionMenu
{
Q_OBJECT
public:
explicit KActionMenuAccount(QObject *parent = 0);
~KActionMenuAccount();
private Q_SLOTS:
void updateAccountMenu();
void slotCheckTransportMenu();
void slotSelectAccount(QAction *act);
private:
bool mInitialized;
};
#endif // KACTIONMENUACCOUNT_H

@ -1,5 +1,5 @@
/*
Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
Copyright (c) 2015 Montel Laurent <montel@kde.org>
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

@ -1,5 +1,5 @@
/*
Copyright (c) 2013-2015 Montel Laurent <montel@kde.org>
Copyright (c) 2015 Montel Laurent <montel@kde.org>
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

Loading…
Cancel
Save