Commit 27978d60 authored by Laurent Montel's avatar Laurent Montel 😁

Move sonnect::dictionary to composerviewbase. Start to create autotest

parent 91834595
......@@ -285,8 +285,9 @@ KMComposeWin::KMComposeWin( const KMime::Message::Ptr &aMsg, bool lastSignState,
sigController->setIdentityCombo( identity );
sigController->suspend(); // we have to do identity change tracking ourselves due to the template code
mDictionaryCombo = new DictionaryComboBox( mHeadersArea );
mDictionaryCombo->setToolTip( i18n( "Select the dictionary to use when spell-checking this message" ) );
Sonnet::DictionaryComboBox *dictionaryCombo = new DictionaryComboBox( mHeadersArea );
dictionaryCombo->setToolTip( i18n( "Select the dictionary to use when spell-checking this message" ) );
mComposerBase->setDictionary(dictionaryCombo);
mFccFolder = new MailCommon::FolderRequester( mHeadersArea );
mFccFolder->setNotAllowToCreateNewFolder( true );
......@@ -376,7 +377,7 @@ KMComposeWin::KMComposeWin( const KMime::Message::Ptr &aMsg, bool lastSignState,
editor->setAcceptDrops( true );
connect(sigController, SIGNAL(signatureAdded()), mComposerBase->editor(), SLOT(startExternalEditor()));
connect( mDictionaryCombo, SIGNAL(dictionaryChanged(QString)),
connect( mComposerBase->dictionary(), SIGNAL(dictionaryChanged(QString)),
this, SLOT(slotSpellCheckingLanguage(QString)) );
connect( editor, SIGNAL(languageChanged(QString)),
......@@ -637,9 +638,9 @@ void KMComposeWin::readConfig( bool reload /* = false */ )
if ( mBtnDictionary->isChecked() ) {
mDictionaryCombo->setCurrentByDictionaryName( GlobalSettings::self()->previousDictionary() );
mComposerBase->dictionary()->setCurrentByDictionaryName( GlobalSettings::self()->previousDictionary() );
} else {
mDictionaryCombo->setCurrentByDictionaryName( ident.dictionary() );
mComposerBase->dictionary()->setCurrentByDictionaryName( ident.dictionary() );
}
QString fccName;
......@@ -664,7 +665,7 @@ void KMComposeWin::writeConfig( void )
GlobalSettings::self()->setPreviousIdentity( mComposerBase->identityCombo()->currentIdentity() );
}
GlobalSettings::self()->setPreviousFcc( QString::number(mFccFolder->collection().id()) );
GlobalSettings::self()->setPreviousDictionary( mDictionaryCombo->currentDictionaryName() );
GlobalSettings::self()->setPreviousDictionary( mComposerBase->dictionary()->currentDictionaryName() );
GlobalSettings::self()->setAutoSpellChecking(
mAutoSpellCheckingAction->isChecked() );
MessageViewer::GlobalSettings::self()->setUseFixedFont( mFixedFontAction->isChecked() );
......@@ -841,7 +842,7 @@ void KMComposeWin::rethinkFields( bool fromSlot )
mDictionaryAction->setChecked( abs( mShowHeaders )&HDR_DICTIONARY );
}
rethinkHeaderLine( showHeaders,HDR_DICTIONARY, row, mDictionaryLabel,
mDictionaryCombo, mBtnDictionary );
mComposerBase->dictionary(), mBtnDictionary );
if ( !fromSlot ) {
mFccAction->setChecked( abs( mShowHeaders )&HDR_FCC );
......@@ -1726,7 +1727,7 @@ void KMComposeWin::setMessage( const KMime::Message::Ptr &newMsg, bool lastSignS
dictionary = ident.dictionary();
}
mDictionaryCombo->setCurrentByDictionaryName( dictionary );
mComposerBase->dictionary()->setCurrentByDictionaryName( dictionary );
}
mEdtReplyTo->setText( mMsg->replyTo()->asUnicodeString() );
......@@ -3229,9 +3230,9 @@ void KMComposeWin::slotIdentityChanged( uint uoid, bool initalChange )
if ( !mBtnDictionary->isChecked() && !mIgnoreStickyFields ) {
mDictionaryCombo->setCurrentByDictionaryName( ident.dictionary() );
mComposerBase->dictionary()->setCurrentByDictionaryName( ident.dictionary() );
}
slotSpellCheckingLanguage( mDictionaryCombo->currentDictionary() );
slotSpellCheckingLanguage( mComposerBase->dictionary()->currentDictionary() );
if ( !mBtnFcc->isChecked() && !mPreventFccOverwrite ) {
setFcc( ident.fcc() );
}
......@@ -3409,7 +3410,7 @@ void KMComposeWin::updateSignatureAndEncryptionStateIndicators()
void KMComposeWin::slotLanguageChanged( const QString &language )
{
mDictionaryCombo->setCurrentByDictionary( language );
mComposerBase->dictionary()->setCurrentByDictionary( language );
}
......
......@@ -75,10 +75,6 @@ namespace boost {
template <typename T> class shared_ptr;
}
namespace Sonnet {
class DictionaryComboBox;
}
namespace KPIMIdentities {
class Identity;
}
......@@ -607,7 +603,6 @@ private:
private:
int validateLineWrapWidth();
QWidget *mMainWidget;
Sonnet::DictionaryComboBox *mDictionaryCombo;
MessageComposer::ComposerLineEdit *mEdtFrom, *mEdtReplyTo;
PimCommon::LineEditWithAutoCorrection *mEdtSubject;
QLabel *mLblIdentity, *mLblTransport, *mLblFcc;
......
......@@ -48,6 +48,8 @@
#include <messageviewer/utils/kcursorsaver.h>
#endif
#include <sonnet/dictionarycombobox.h>
#include <messagecore/helpers/messagehelpers.h>
#include <messagecore/utils/stringutil.h>
#include <messagecore/attachment/attachmentcollector.h>
......@@ -97,6 +99,7 @@ MessageComposer::ComposerViewBase::ComposerViewBase ( QObject* parent, QWidget *
, m_identMan( 0 )
, m_editor( 0 )
, m_transport( 0 )
, m_dictionary( 0 )
, m_fccCombo( 0 )
, m_parentWidget( parentGui )
, m_sign( false )
......@@ -931,6 +934,15 @@ void MessageComposer::ComposerViewBase::initAutoSave()
updateAutoSave();
}
Sonnet::DictionaryComboBox *MessageComposer::ComposerViewBase::dictionary() const
{
return m_dictionary;
}
void MessageComposer::ComposerViewBase::setDictionary(Sonnet::DictionaryComboBox *dictionary)
{
m_dictionary = dictionary;
}
void MessageComposer::ComposerViewBase::updateAutoSave()
{
......
......@@ -36,6 +36,10 @@ class QTimer;
class KJob;
class QWidget;
namespace Sonnet {
class DictionaryComboBox;
}
namespace SendLater {
class SendLaterInfo;
}
......@@ -153,6 +157,9 @@ public:
Akonadi::CollectionComboBox* fccCombo();
void setFcc( const Akonadi::Collection& id );
Sonnet::DictionaryComboBox *dictionary() const;
void setDictionary(Sonnet::DictionaryComboBox *dictionary);
/**
* Widgets for editing differ in client classes, so
* values are set before sending.
......@@ -309,6 +316,7 @@ private:
KPIMIdentities::IdentityManager* m_identMan;
MessageComposer::KMeditor* m_editor;
MailTransport::TransportComboBox* m_transport;
Sonnet::DictionaryComboBox* m_dictionary;
Akonadi::CollectionComboBox* m_fccCombo;
Akonadi::Collection m_fccCollection;
QWidget* m_parentWidget;
......
......@@ -66,6 +66,8 @@ add_messagecomposer_test( infoparttest.cpp )
add_messagecomposer_test( textparttest.cpp )
add_messagecomposer_test( globalparttest.cpp )
add_messagecomposer_test( composerviewbasetest.cpp )
# Crypto
add_messagecomposer_cryptotest( signjobtest.cpp )
add_messagecomposer_cryptotest( encryptjobtest.cpp )
......
/*
Copyright (c) 2014 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 "composerviewbasetest.h"
#include <qtest_kde.h>
ComposerViewBaseTest::ComposerViewBaseTest(QObject *parent)
: QObject(parent)
{
}
ComposerViewBaseTest::~ComposerViewBaseTest()
{
}
QTEST_KDEMAIN(ComposerViewBaseTest, NoGUI)
/*
Copyright (c) 2014 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 COMPOSERVIEWBASETEST_H
#define COMPOSERVIEWBASETEST_H
#include <QObject>
class ComposerViewBaseTest : public QObject
{
Q_OBJECT
public:
explicit ComposerViewBaseTest(QObject *parent = 0);
~ComposerViewBaseTest();
};
#endif // COMPOSERVIEWBASETEST_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment