~ubuntu-branches/ubuntu/vivid/kdepim/vivid

« back to all changes in this revision

Viewing changes to kmail/configuredialog.cpp

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Jonathan Riddell, Rohan Garg, Scott Kitterman
  • Date: 2012-11-21 13:12:36 UTC
  • mfrom: (0.2.33)
  • Revision ID: package-import@ubuntu.com-20121121131236-32ijw9a2txrar80k
Tags: 4:4.9.80-0ubuntu1
[ Jonathan Riddell ]
* New upstream beta release

[ Rohan Garg ]
* Add nepomuk-core-dev to build-deps

[ Scott Kitterman ]
* Add new package, libpimcommon4
  - Add libpimcommon4.install
  - Add to debian/control, including kdepim-dbg and kdepim-dev depends
  - Add to kdepim-dev.install
* Remove usr/bin/backupmail and related files from kmail.install as they are
  not provided by upstream anymore
* Add usr/bin/pimsettingexporter and related files to kmail.install
* Add libnepomukwidgets-dev to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
#include "composer.h"
45
45
#include "tag.h"
46
46
#include "accountconfigorderdialog.h"
 
47
#include "util.h"
47
48
 
48
49
#include "foldertreewidget.h"
49
50
 
57
58
#include "messagelist/utils/themecombobox.h"
58
59
#include "messagelist/utils/themeconfigbutton.h"
59
60
 
 
61
#include "messagecomposer/autocorrection/composerautocorrectionwidget.h"
 
62
#include "messagecomposer/autoimageresizing/autoresizeimagewidget.h"
 
63
 
60
64
#include "messageviewer/autoqpointer.h"
61
65
#include "messageviewer/nodehelper.h"
62
66
#include "messageviewer/configurewidget.h"
72
76
#include "templateparser/customtemplates.h"
73
77
#include "templateparser/globalsettings_base.h"
74
78
#include "mailcommon/mailutil.h"
75
 
 
 
79
#include "mailcommon/tagwidget.h"
76
80
#include "messagecomposer/messagecomposersettings.h"
 
81
#include <soprano/nao.h>
77
82
 
78
83
// other kdenetwork headers:
79
84
#include <kpimidentities/identity.h>
111
116
#include <KIconButton>
112
117
#include <KColorScheme>
113
118
#include <KComboBox>
114
 
#include <Nepomuk/Tag>
 
119
#include <Nepomuk2/Tag>
115
120
#include <KCModuleProxy>
116
121
 
117
122
// Qt headers:
144
149
#include <akonadi/agenttypedialog.h>
145
150
#include <akonadi/agentinstancecreatejob.h>
146
151
 
147
 
#include <nepomuk/resourcemanager.h>
 
152
#include <nepomuk2/resourcemanager.h>
148
153
 
149
154
#include <libkdepim/nepomukwarning.h>
150
155
using namespace MailCommon;
335
340
  connect( mConfirmSendCheck, SIGNAL(stateChanged(int)),
336
341
           this, SLOT(slotEmitChanged()) );
337
342
 
 
343
  mCheckSpellingBeforeSending = new QCheckBox( i18n("Check spelling before sending"), group );
 
344
  glay->addWidget( mCheckSpellingBeforeSending, 1, 0, 1, 2 );
 
345
  connect( mCheckSpellingBeforeSending, SIGNAL(stateChanged(int)),
 
346
           this, SLOT(slotEmitChanged()) );
 
347
 
338
348
  // "send on check" combo:
339
349
  mSendOnCheckCombo = new KComboBox( group );
340
350
  mSendOnCheckCombo->setEditable( false );
342
352
                                      << i18n("Never Automatically")
343
353
                                      << i18n("On Manual Mail Checks")
344
354
                                      << i18n("On All Mail Checks") );
345
 
  glay->addWidget( mSendOnCheckCombo, 1, 1 );
 
355
  glay->addWidget( mSendOnCheckCombo, 2, 1 );
346
356
  connect( mSendOnCheckCombo, SIGNAL(activated(int)),
347
357
           this, SLOT(slotEmitChanged()) );
348
358
 
352
362
  mSendMethodCombo->addItems( QStringList()
353
363
                                      << i18n("Send Now")
354
364
                                      << i18n("Send Later") );
355
 
  glay->addWidget( mSendMethodCombo, 2, 1 );
 
365
  glay->addWidget( mSendMethodCombo, 3, 1 );
356
366
  connect( mSendMethodCombo, SIGNAL(activated(int)),
357
367
           this, SLOT(slotEmitChanged()) );
358
368
 
359
369
  // "default domain" input field:
360
370
  mDefaultDomainEdit = new KLineEdit( group );
361
 
  glay->addWidget( mDefaultDomainEdit, 3, 1 );
 
371
  glay->addWidget( mDefaultDomainEdit, 4, 1 );
362
372
  connect( mDefaultDomainEdit, SIGNAL(textChanged(QString)),
363
373
           this, SLOT(slotEmitChanged()) );
364
374
 
365
375
  // labels:
366
376
  QLabel *l =  new QLabel( i18n("Send &messages in outbox folder:"), group );
367
377
  l->setBuddy( mSendOnCheckCombo );
368
 
  glay->addWidget( l, 1, 0 );
 
378
  glay->addWidget( l, 2, 0 );
369
379
 
370
380
  QString msg = i18n( GlobalSettings::self()->sendOnCheckItem()->whatsThis().toUtf8() );
371
381
  l->setWhatsThis( msg );
373
383
 
374
384
  l = new QLabel( i18n("Defa&ult send method:"), group );
375
385
  l->setBuddy( mSendMethodCombo );
376
 
  glay->addWidget( l, 2, 0 );
 
386
  glay->addWidget( l, 3, 0 );
377
387
  l = new QLabel( i18n("Defaul&t domain:"), group );
378
388
  l->setBuddy( mDefaultDomainEdit );
379
 
  glay->addWidget( l, 3, 0 );
 
389
  glay->addWidget( l, 4, 0 );
380
390
 
381
391
  // and now: add QWhatsThis:
382
392
  msg = i18n( "<qt><p>The default domain is used to complete email "
395
405
{
396
406
  mSendMethodCombo->setCurrentIndex( MessageComposer::MessageComposerSettings::self()->sendImmediate() ? 0 : 1 );
397
407
  mConfirmSendCheck->setChecked( GlobalSettings::self()->confirmBeforeSend() );
 
408
  mCheckSpellingBeforeSending->setChecked(GlobalSettings::self()->checkSpellingBeforeSend());
398
409
  QString defaultDomain = MessageComposer::MessageComposerSettings::defaultDomain();
399
410
  if( defaultDomain.isEmpty() ) {
400
411
    defaultDomain = QHostInfo::localHostName();
407
418
  GlobalSettings::self()->setSendOnCheck( mSendOnCheckCombo->currentIndex() );
408
419
  MessageComposer::MessageComposerSettings::self()->setDefaultDomain( mDefaultDomainEdit->text() );
409
420
  GlobalSettings::self()->setConfirmBeforeSend( mConfirmSendCheck->isChecked() );
 
421
  GlobalSettings::self()->setCheckSpellingBeforeSend(mCheckSpellingBeforeSending->isChecked());
410
422
  MessageComposer::MessageComposerSettings::self()->setSendImmediate( mSendMethodCombo->currentIndex() == 0 );
411
423
}
412
424
 
526
538
    connect( manualMailCheck, SIGNAL(toggled(bool)), this, SLOT(slotIncludeInCheckChanged(bool)) );
527
539
  }
528
540
 
529
 
  QAction *switchOffline = new QAction( i18nc( "Label to a checkbox, so is either checked/unchecked", "Switch offline on KMail Shutdown" ), menu );
530
 
  switchOffline->setCheckable( true );
531
 
  switchOffline->setChecked( OfflineOnShutdown );
532
 
  switchOffline->setData( ident );
533
 
  menu->addAction( switchOffline );
 
541
  if( !MailCommon::Util::isLocalCollection( ident ) ) {
 
542
    QAction *switchOffline = new QAction( i18nc( "Label to a checkbox, so is either checked/unchecked", "Switch offline on KMail Shutdown" ), menu );
 
543
    switchOffline->setCheckable( true );
 
544
    switchOffline->setChecked( OfflineOnShutdown );
 
545
    switchOffline->setData( ident );
 
546
    menu->addAction( switchOffline );
 
547
    connect( switchOffline, SIGNAL(toggled(bool)), this, SLOT(slotOfflineOnShutdownChanged(bool)) );
 
548
  }
 
549
 
534
550
 
535
551
  QAction *checkOnStartup = new QAction( i18n( "Check mail on startup" ), menu );
536
552
  checkOnStartup->setCheckable( true );
538
554
  checkOnStartup->setData( ident );
539
555
  menu->addAction( checkOnStartup );
540
556
 
541
 
  connect( switchOffline, SIGNAL(toggled(bool)), this, SLOT(slotOfflineOnShutdownChanged(bool)) );
542
557
  connect( checkOnStartup, SIGNAL(toggled(bool)), this, SLOT(slotCheckOnStatupChanged(bool)) );
543
558
 
544
559
  menu->exec(  mAccountsReceiving.mAccountList->view()->mapToGlobal( pos ) );
1038
1053
  KConfigGroup collectionFolderView( KMKernel::self()->config(), "CollectionFolderView" );
1039
1054
 
1040
1055
  static const QColor defaultColor[ numColorNames ] = {
1041
 
    QColor( 0x00, 0x80, 0x00 ), // quoted l1
1042
 
    QColor( 0x00, 0x70, 0x00 ), // quoted l2
1043
 
    QColor( 0x00, 0x60, 0x00 ), // quoted l3
 
1056
    KMail::Util::quoteL1Color(),
 
1057
    KMail::Util::quoteL2Color(),
 
1058
    KMail::Util::quoteL3Color(),
1044
1059
    scheme.foreground( KColorScheme::LinkText ).color(), // link
1045
1060
    scheme.foreground( KColorScheme::VisitedText ).color(),// visited link
1046
1061
    scheme.foreground( KColorScheme::NegativeText ).color(), // misspelled words
1583
1598
  connect( mSystemTrayCheck, SIGNAL(stateChanged(int)),
1584
1599
           this, SLOT(slotEmitChanged()) );
1585
1600
 
 
1601
  mSystemTrayShowUnreadMail = new QCheckBox( i18n("Show unread mail in tray icon"), this );
 
1602
  vlay->addWidget( mSystemTrayShowUnreadMail );
 
1603
  connect( mSystemTrayShowUnreadMail, SIGNAL(stateChanged(int)),
 
1604
           this, SLOT(slotEmitChanged()) );
 
1605
  connect( mSystemTrayCheck, SIGNAL(toggled(bool)),
 
1606
           mSystemTrayShowUnreadMail, SLOT(setEnabled(bool)) );
 
1607
 
 
1608
 
1586
1609
  // System tray modes
1587
1610
  mSystemTrayGroup = new KButtonGroup( this );
1588
1611
  mSystemTrayGroup->setTitle( i18n("System Tray Mode" ) );
1604
1627
void AppearancePage::SystemTrayTab::doLoadFromGlobalSettings()
1605
1628
{
1606
1629
  mSystemTrayCheck->setChecked( GlobalSettings::self()->systemTrayEnabled() );
 
1630
  mSystemTrayShowUnreadMail->setChecked( GlobalSettings::self()->systemTrayShowUnread() );
1607
1631
  mSystemTrayGroup->setSelected( GlobalSettings::self()->systemTrayPolicy() );
1608
1632
  mSystemTrayGroup->setEnabled( mSystemTrayCheck->isChecked() );
1609
1633
}
1612
1636
{
1613
1637
  GlobalSettings::self()->setSystemTrayEnabled( mSystemTrayCheck->isChecked() );
1614
1638
  GlobalSettings::self()->setSystemTrayPolicy( mSystemTrayGroup->selected() );
 
1639
  GlobalSettings::self()->setSystemTrayShowUnread( mSystemTrayShowUnreadMail->isChecked() );
1615
1640
  GlobalSettings::self()->writeConfig();
1616
1641
}
1617
1642
 
1649
1674
AppearancePageMessageTagTab::AppearancePageMessageTagTab( QWidget * parent )
1650
1675
  : ConfigModuleTab( parent )
1651
1676
{
1652
 
  mEmitChanges = true;
1653
1677
  mPreviousTag = -1;
1654
 
 
1655
1678
  QHBoxLayout *maingrid = new QHBoxLayout( this );
1656
1679
  maingrid->setMargin( KDialog::marginHint() );
1657
1680
  maingrid->setSpacing( KDialog::spacingHint() );
1658
1681
 
1659
 
  mNepomukActive = Nepomuk::ResourceManager::instance()->initialized();
 
1682
  mNepomukActive = Nepomuk2::ResourceManager::instance()->initialized();
1660
1683
  if ( mNepomukActive ) {
1661
1684
 
1662
1685
    //Lefthand side Listbox and friends
1724
1747
    mTagSettingGroupBox = new QGroupBox( i18n("Ta&g Settings"),
1725
1748
                                         this );
1726
1749
    tagsettinggrid->addWidget( mTagSettingGroupBox );
1727
 
    QGridLayout *settings = new QGridLayout( mTagSettingGroupBox );
1728
 
    settings->setMargin( KDialog::marginHint() );
1729
 
    settings->setSpacing( KDialog::spacingHint() );
1730
 
 
1731
 
    //Stretcher layout for adding some space after the label
1732
 
    QVBoxLayout *spacer = new QVBoxLayout();
1733
 
    settings->addLayout( spacer, 0, 0, 1, 2 );
1734
 
    spacer->addSpacing( 2 * KDialog::spacingHint() );
1735
 
 
1736
 
    //First row for renaming
1737
 
    mTagNameLineEdit = new KLineEdit( mTagSettingGroupBox );
1738
 
    mTagNameLineEdit->setTrapReturnKey( true );
1739
 
    settings->addWidget( mTagNameLineEdit, 1, 1 );
1740
 
 
1741
 
    QLabel *namelabel = new QLabel( i18nc("@label:listbox Name of the tag", "Name:")
1742
 
                                    , mTagSettingGroupBox );
1743
 
    namelabel->setBuddy( mTagNameLineEdit );
1744
 
    settings->addWidget( namelabel, 1, 0 );
1745
 
 
1746
 
    connect( mTagNameLineEdit, SIGNAL(textChanged(QString)),
1747
 
             this, SLOT(slotEmitChangeCheck()) );
1748
 
 
1749
 
    //Second row for text color
1750
 
    mTextColorCheck = new QCheckBox( i18n("Change te&xt color:"),
1751
 
                                     mTagSettingGroupBox );
1752
 
    settings->addWidget( mTextColorCheck, 2, 0 );
1753
 
 
1754
 
    mTextColorCombo = new KColorCombo( mTagSettingGroupBox );
1755
 
    settings->addWidget( mTextColorCombo, 2, 1 );
1756
 
 
1757
 
    connect( mTextColorCheck, SIGNAL(toggled(bool)),
1758
 
             mTextColorCombo, SLOT(setEnabled(bool)) );
1759
 
    connect( mTextColorCheck, SIGNAL(stateChanged(int)),
1760
 
             this, SLOT(slotEmitChangeCheck()) );
1761
 
    connect( mTextColorCombo, SIGNAL(activated(int)),
1762
 
             this, SLOT(slotEmitChangeCheck()) );
1763
 
 
1764
 
    //Third row for text background color
1765
 
    mBackgroundColorCheck = new QCheckBox( i18n("Change &background color:"),
1766
 
                                           mTagSettingGroupBox );
1767
 
    settings->addWidget( mBackgroundColorCheck, 3, 0 );
1768
 
 
1769
 
    mBackgroundColorCombo = new KColorCombo( mTagSettingGroupBox );
1770
 
    settings->addWidget( mBackgroundColorCombo, 3, 1 );
1771
 
 
1772
 
    connect( mBackgroundColorCheck, SIGNAL(toggled(bool)),
1773
 
             mBackgroundColorCombo, SLOT(setEnabled(bool)) );
1774
 
    connect( mBackgroundColorCheck, SIGNAL(stateChanged(int)),
1775
 
             this, SLOT(slotEmitChangeCheck()) );
1776
 
    connect( mBackgroundColorCombo, SIGNAL(activated(int)),
1777
 
             this, SLOT(slotEmitChangeCheck()) );
1778
 
 
1779
 
    //Fourth for font selection
1780
 
    mTextFontCheck = new QCheckBox( i18n("Change fo&nt:"), mTagSettingGroupBox );
1781
 
    settings->addWidget( mTextFontCheck, 4, 0 );
1782
 
 
1783
 
    mFontRequester = new KFontRequester( mTagSettingGroupBox );
1784
 
    settings->addWidget( mFontRequester, 4, 1 );
1785
 
 
1786
 
    connect( mTextFontCheck, SIGNAL(toggled(bool)),
1787
 
             mFontRequester, SLOT(setEnabled(bool)) );
1788
 
    connect( mTextFontCheck, SIGNAL(stateChanged(int)),
1789
 
             this, SLOT(slotEmitChangeCheck()) );
1790
 
    connect( mFontRequester, SIGNAL(fontSelected(QFont)),
1791
 
             this, SLOT(slotEmitChangeCheck()) );
1792
 
 
1793
 
    //Fifth for toolbar icon
1794
 
    mIconButton = new KIconButton( mTagSettingGroupBox );
1795
 
    mIconButton->setIconSize( 16 );
1796
 
    mIconButton->setIconType( KIconLoader::NoGroup, KIconLoader::Action );
1797
 
    settings->addWidget( mIconButton, 5, 1 );
1798
 
    connect( mIconButton, SIGNAL(iconChanged(QString)),
1799
 
             SLOT(slotIconNameChanged(QString)) );
1800
 
 
1801
 
    QLabel *iconlabel = new QLabel( i18n("Message tag &icon:"),
1802
 
                                    mTagSettingGroupBox );
1803
 
    iconlabel->setBuddy( mIconButton );
1804
 
    settings->addWidget( iconlabel, 5, 0 );
1805
 
 
1806
 
    //We do not connect the checkbox to icon selector since icons are used in the
1807
 
    //menus as well
1808
 
    connect( mIconButton, SIGNAL(iconChanged(QString)),
1809
 
             this, SLOT(slotEmitChangeCheck()) );
1810
 
 
1811
 
    //Sixth for shortcut
1812
 
    mKeySequenceWidget = new KKeySequenceWidget( mTagSettingGroupBox );
1813
 
    settings->addWidget( mKeySequenceWidget, 6, 1 );
1814
 
    QLabel *sclabel = new QLabel( i18n("Shortc&ut:") , mTagSettingGroupBox );
1815
 
    sclabel->setBuddy( mKeySequenceWidget );
1816
 
    settings->addWidget( sclabel, 6, 0 );
 
1750
    QList<KActionCollection *> actionCollections;
1817
1751
    if( kmkernel->getKMMainWidget() )
1818
 
      mKeySequenceWidget->setCheckActionCollections(
1819
 
                                                    kmkernel->getKMMainWidget()->actionCollections() );
1820
 
    else
1821
 
      mKeySequenceWidget->setEnabled(false);
1822
 
 
1823
 
    connect( mKeySequenceWidget, SIGNAL(keySequenceChanged(QKeySequence)),
1824
 
             this, SLOT(slotEmitChangeCheck()) );
1825
 
 
1826
 
    //Seventh for Toolbar checkbox
1827
 
    mInToolbarCheck = new QCheckBox( i18n("Enable &toolbar button"),
1828
 
                                     mTagSettingGroupBox );
1829
 
    settings->addWidget( mInToolbarCheck, 7, 0 );
1830
 
    connect( mInToolbarCheck, SIGNAL(stateChanged(int)),
1831
 
             this, SLOT(slotEmitChangeCheck()) );
1832
 
 
1833
 
    tagsettinggrid->addStretch( 10 );
1834
 
 
1835
 
    //Adjust widths for columns
1836
 
    maingrid->setStretchFactor( mTagsGroupBox, 1 );
1837
 
    maingrid->setStretchFactor( tagsettinggrid, 1 );
1838
 
 
1839
 
    //Other Connections
 
1752
      actionCollections = kmkernel->getKMMainWidget()->actionCollections();
 
1753
 
 
1754
    QHBoxLayout *lay = new QHBoxLayout(mTagSettingGroupBox);
 
1755
    mTagWidget = new MailCommon::TagWidget(actionCollections,this);
 
1756
    lay->addWidget(mTagWidget);
 
1757
 
 
1758
    connect(mTagWidget,SIGNAL(changed()),this, SLOT(slotEmitChangeCheck()));
1840
1759
 
1841
1760
    //For enabling the add button in case box is non-empty
1842
1761
    connect( mTagAddLineEdit, SIGNAL(textChanged(QString)),
1843
1762
             this, SLOT(slotAddLineTextChanged(QString)) );
1844
1763
 
1845
1764
    //For on-the-fly updating of tag name in editbox
1846
 
    connect( mTagNameLineEdit, SIGNAL(textChanged(QString)),
 
1765
    connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
1847
1766
             this, SLOT(slotNameLineTextChanged(QString)) );
1848
1767
 
 
1768
    connect( mTagWidget, SIGNAL(iconNameChanged(QString)), SLOT(slotIconNameChanged(QString)) );
 
1769
 
1849
1770
    connect(  mTagAddLineEdit, SIGNAL(returnPressed()),
1850
1771
             this, SLOT(slotAddNewTag()) );
1851
1772
 
1864
1785
 
1865
1786
    connect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
1866
1787
             this, SLOT(slotSelectionChanged()) );
 
1788
    //Adjust widths for columns
 
1789
    maingrid->setStretchFactor( mTagsGroupBox, 1 );
 
1790
    maingrid->setStretchFactor( lay, 1 );
 
1791
    tagsettinggrid->addStretch( 10 );
 
1792
 
 
1793
 
1867
1794
  } else {
1868
1795
    QLabel *lab = new QLabel;
1869
1796
    lab->setText( i18n( "The Nepomuk semantic search service is not available. We cannot configure tags. You can enable it in \"System Settings\"" ) );
1951
1878
 
1952
1879
  tmp_desc->tagName = tagItem->text();
1953
1880
 
1954
 
  tmp_desc->textColor = mTextColorCheck->isChecked() ?
1955
 
                          mTextColorCombo->color() : QColor();
1956
 
 
1957
 
  tmp_desc->backgroundColor = mBackgroundColorCheck->isChecked() ?
1958
 
                                mBackgroundColorCombo->color() : QColor();
1959
 
 
1960
 
  tmp_desc->textFont = mTextFontCheck->isChecked() ?
1961
 
                          mFontRequester->font() : QFont();
1962
 
 
1963
 
  tmp_desc->iconName = mIconButton->icon();
1964
 
 
1965
 
  mKeySequenceWidget->applyStealShortcut();
1966
 
  tmp_desc->shortcut = KShortcut( mKeySequenceWidget->keySequence() );
1967
 
 
1968
 
  tmp_desc->inToolbar = mInToolbarCheck->isChecked();
 
1881
  tmp_desc->textColor = mTagWidget->textColorCheck()->isChecked() ?
 
1882
                          mTagWidget->textColorCombo()->color() : QColor();
 
1883
 
 
1884
  tmp_desc->backgroundColor = mTagWidget->backgroundColorCheck()->isChecked() ?
 
1885
                                mTagWidget->backgroundColorCombo()->color() : QColor();
 
1886
 
 
1887
  tmp_desc->textFont = mTagWidget->textFontCheck()->isChecked() ?
 
1888
                          mTagWidget->fontRequester()->font() : QFont();
 
1889
 
 
1890
  tmp_desc->iconName = mTagWidget->iconButton()->icon();
 
1891
 
 
1892
  mTagWidget->keySequenceWidget()->applyStealShortcut();
 
1893
  tmp_desc->shortcut = KShortcut( mTagWidget->keySequenceWidget()->keySequence() );
 
1894
 
 
1895
  tmp_desc->inToolbar = mTagWidget->inToolBarCheck()->isChecked();
1969
1896
}
1970
1897
 
1971
1898
void AppearancePage::MessageTagTab::slotUpdateTagSettingWidgets( int aIndex )
1976
1903
    mTagUpButton->setEnabled( false );
1977
1904
    mTagDownButton->setEnabled( false );
1978
1905
 
1979
 
    mTagNameLineEdit->setEnabled( false );
1980
 
    mTextColorCheck->setEnabled( false );
1981
 
    mBackgroundColorCheck->setEnabled( false );
1982
 
    mTextFontCheck->setEnabled( false );
1983
 
    mInToolbarCheck->setEnabled( false );
1984
 
    mTextColorCombo->setEnabled( false );
1985
 
    mFontRequester->setEnabled( false );
1986
 
    mIconButton->setEnabled( false );
1987
 
    mKeySequenceWidget->setEnabled( false );
1988
 
    mBackgroundColorCombo->setEnabled( false );
 
1906
    mTagWidget->setEnabled(false);
1989
1907
    return;
1990
1908
  }
 
1909
  mTagWidget->setEnabled(true);
1991
1910
 
1992
1911
  mTagRemoveButton->setEnabled( true );
1993
1912
  mTagUpButton->setEnabled( ( 0 != aIndex ) );
1994
1913
  mTagDownButton->setEnabled(( ( int( mTagListBox->count() ) - 1 ) != aIndex ) );
1995
 
 
1996
1914
  QListWidgetItem * item = mTagListBox->currentItem();
1997
1915
  TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( item );
1998
1916
  KMail::Tag::Ptr tmp_desc = tagItem->kmailTag();
1999
1917
 
2000
 
  mTagNameLineEdit->setEnabled( true );
2001
 
  mTagNameLineEdit->setText( tmp_desc->tagName );
2002
 
 
2003
 
  QColor tmp_color = tmp_desc->textColor;
2004
 
  mTextColorCheck->setEnabled( true );
2005
 
  if ( tmp_color.isValid() ) {
2006
 
    mTextColorCombo->setColor( tmp_color );
2007
 
    mTextColorCheck->setChecked( true );
2008
 
  } else {
2009
 
    mTextColorCombo->setColor( Qt::white );
2010
 
    mTextColorCheck->setChecked( false );
2011
 
  }
2012
 
 
2013
 
  tmp_color = tmp_desc->backgroundColor;
2014
 
  mBackgroundColorCheck->setEnabled( true );
2015
 
  if ( tmp_color.isValid() ) {
2016
 
    mBackgroundColorCombo->setColor( tmp_color );
2017
 
    mBackgroundColorCheck->setChecked( true );
2018
 
  } else {
2019
 
    mBackgroundColorCombo->setColor( Qt::white );
2020
 
    mBackgroundColorCheck->setChecked( false );
2021
 
  }
2022
 
 
2023
 
  QFont tmp_font = tmp_desc->textFont;
2024
 
  mTextFontCheck->setEnabled( true );
2025
 
  mTextFontCheck->setChecked( ( tmp_font != QFont() ) );
2026
 
  mFontRequester->setFont( tmp_font );
2027
 
 
2028
 
  mIconButton->setEnabled( true );
2029
 
  mIconButton->setIcon( tmp_desc->iconName );
2030
 
 
2031
 
  mKeySequenceWidget->setEnabled( true );
2032
 
  mKeySequenceWidget->setKeySequence( tmp_desc->shortcut.primary(),
 
1918
  mTagRemoveButton->setEnabled( !tmp_desc->tagStatus );
 
1919
 
 
1920
  disconnect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
 
1921
           this, SLOT(slotNameLineTextChanged(QString)) );
 
1922
 
 
1923
  mTagWidget->tagNameLineEdit()->setEnabled(!tmp_desc->tagStatus);
 
1924
  mTagWidget->tagNameLineEdit()->setText( tmp_desc->tagName );
 
1925
  connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
 
1926
           this, SLOT(slotNameLineTextChanged(QString)) );
 
1927
 
 
1928
 
 
1929
  mTagWidget->setTagTextColor(tmp_desc->textColor);
 
1930
 
 
1931
  mTagWidget->setTagBackgroundColor(tmp_desc->backgroundColor);
 
1932
 
 
1933
  mTagWidget->setTagTextFont(tmp_desc->textFont);
 
1934
 
 
1935
  mTagWidget->iconButton()->setEnabled( !tmp_desc->tagStatus );
 
1936
  mTagWidget->iconButton()->setIcon( tmp_desc->iconName );
 
1937
 
 
1938
  mTagWidget->keySequenceWidget()->setEnabled( true );
 
1939
  mTagWidget->keySequenceWidget()->setKeySequence( tmp_desc->shortcut.primary(),
2033
1940
                                      KKeySequenceWidget::NoValidate );
2034
1941
 
2035
 
  mInToolbarCheck->setEnabled( true );
2036
 
  mInToolbarCheck->setChecked( tmp_desc->inToolbar );
 
1942
  mTagWidget->inToolBarCheck()->setEnabled( true );
 
1943
  mTagWidget->inToolBarCheck()->setChecked( tmp_desc->inToolbar );
2037
1944
}
2038
1945
 
2039
1946
void AppearancePage::MessageTagTab::slotSelectionChanged()
2040
1947
{
 
1948
  mEmitChanges = false;
2041
1949
  slotRecordTagSettings( mPreviousTag );
2042
1950
  slotUpdateTagSettingWidgets( mTagListBox->currentRow() );
2043
1951
  mPreviousTag = mTagListBox->currentRow();
 
1952
  mEmitChanges = true;
2044
1953
}
2045
1954
 
2046
1955
void AppearancePage::MessageTagTab::slotRemoveTag()
2050
1959
    QListWidgetItem * item = mTagListBox->takeItem( mTagListBox->currentRow() );
2051
1960
    TagListWidgetItem *tagItem = static_cast<TagListWidgetItem*>( item );
2052
1961
    KMail::Tag::Ptr tmp_desc = tagItem->kmailTag();
2053
 
    Nepomuk::Tag nepomukTag( tmp_desc->nepomukResourceUri );
 
1962
    Nepomuk2::Tag nepomukTag( tmp_desc->nepomukResourceUri );
2054
1963
    nepomukTag.remove();
2055
1964
    mPreviousTag = -1;
2056
1965
 
2077
1986
  if ( aText.isEmpty() && !mTagListBox->currentItem())
2078
1987
    return;
2079
1988
 
 
1989
  const int count = mTagListBox->count();
 
1990
  for ( int i=0; i < count; ++i ) {
 
1991
    if(mTagListBox->item(i)->text() == aText) {
 
1992
      KMessageBox::error(this,i18n("We can not create tag. A tag with same name already exists."));
 
1993
      disconnect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
 
1994
               this, SLOT(slotNameLineTextChanged(QString)) );
 
1995
      mTagWidget->tagNameLineEdit()->setText(mTagListBox->currentItem()->text());
 
1996
      connect( mTagWidget->tagNameLineEdit(), SIGNAL(textChanged(QString)),
 
1997
               this, SLOT(slotNameLineTextChanged(QString)) );
 
1998
      return;
 
1999
    }
 
2000
  }
 
2001
 
 
2002
 
2080
2003
  //Disconnect so the tag information is not saved and reloaded with every
2081
2004
  //letter
2082
2005
  disconnect( mTagListBox, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),
2098
2021
}
2099
2022
 
2100
2023
void AppearancePage::MessageTagTab::slotAddNewTag()
2101
 
{
 
2024
{  
 
2025
  const QString newTagName = mTagAddLineEdit->text();
 
2026
  const int count = mTagListBox->count();
 
2027
  for ( int i=0; i < count; ++i ) {
 
2028
    if(mTagListBox->item(i)->text() == newTagName) {
 
2029
      KMessageBox::error(this,i18n("We can not create tag. A tag with same name already exists."));
 
2030
      return;
 
2031
    }
 
2032
  }
 
2033
 
 
2034
 
2102
2035
  const int tmp_priority = mTagListBox->count();
2103
 
  const QString newTagName = mTagAddLineEdit->text();
2104
 
  Nepomuk::Tag nepomukTag( newTagName );
 
2036
  Nepomuk2::Tag nepomukTag( newTagName );
2105
2037
  nepomukTag.setLabel( newTagName );
2106
2038
 
2107
2039
  KMail::Tag::Ptr tag = KMail::Tag::fromNepomuk( nepomukTag );
2121
2053
 
2122
2054
  mTagListBox->clear();
2123
2055
  QList<KMail::TagPtr> msgTagList;
2124
 
  foreach( const Nepomuk::Tag &nepomukTag, Nepomuk::Tag::allTags() ) {
 
2056
  foreach( const Nepomuk2::Tag &nepomukTag, Nepomuk2::Tag::allTags() ) {
2125
2057
    KMail::Tag::Ptr tag = KMail::Tag::fromNepomuk( nepomukTag );
2126
2058
    msgTagList.append( tag );
2127
2059
  }
2183
2115
      tag->priority = i;
2184
2116
 
2185
2117
      KMail::Tag::SaveFlags saveFlags = 0;
2186
 
      if ( mTextColorCheck->isChecked() )
 
2118
      if ( mTagWidget->textColorCheck()->isChecked() )
2187
2119
        saveFlags |= KMail::Tag::TextColor;
2188
 
      if ( mBackgroundColorCheck->isChecked() )
 
2120
      if ( mTagWidget->backgroundColorCheck()->isChecked() )
2189
2121
        saveFlags |= KMail::Tag::BackgroundColor;
2190
 
      if ( mTextFontCheck->isChecked() )
 
2122
      if ( mTagWidget->textFontCheck()->isChecked() )
2191
2123
        saveFlags |= KMail::Tag::Font;
2192
2124
      tag->saveToNepomuk( saveFlags );
2193
2125
    }
2254
2186
  //
2255
2187
  mAttachmentsTab = new AttachmentsTab();
2256
2188
  addTab( mAttachmentsTab, i18nc("Config->Composer->Attachments", "Attachments") );
 
2189
 
 
2190
  //
 
2191
  // "autocorrection" tab:
 
2192
  //
 
2193
  mAutoCorrectionTab = new AutoCorrectionTab();
 
2194
  addTab( mAutoCorrectionTab, i18n("Autocorrection") );
 
2195
 
 
2196
  //
 
2197
  // "autoresize" tab:
 
2198
  //
 
2199
  mAutoImageResizeTab = new AutoImageResizeTab();
 
2200
  addTab( mAutoImageResizeTab, i18n("Auto Resize Image") );
 
2201
 
2257
2202
}
2258
2203
 
2259
2204
QString ComposerPage::GeneralTab::helpAnchor() const
2270
2215
  QGroupBox   *group;
2271
2216
  QLabel      *label;
2272
2217
  KHBox       *hbox;
2273
 
  QString      msg;
2274
2218
 
2275
2219
  vlay = new QVBoxLayout( this );
2276
2220
  vlay->setSpacing( KDialog::spacingHint() );
2319
2263
  connect( mReplyUsingHtml, SIGNAL(stateChanged(int)),
2320
2264
           this, SLOT(slotEmitChanged()) );
2321
2265
 
 
2266
 
 
2267
  mImprovePlainTextOfHtmlMessage = new QCheckBox( MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessageItem()->label(), this );
 
2268
  vlay->addWidget( mImprovePlainTextOfHtmlMessage );
 
2269
#ifdef GRANTLEE_GREATER_0_2
 
2270
  connect( mImprovePlainTextOfHtmlMessage, SIGNAL(stateChanged(int)),
 
2271
           this, SLOT(slotEmitChanged()) );
 
2272
#else
 
2273
  mImprovePlainTextOfHtmlMessage->setWhatsThis(
 
2274
                 i18n( "To support improving the plain text of HTML messages, KMail must be compiled "
 
2275
                       "with Grantlee 0.3 or greater." ) );
 
2276
  mImprovePlainTextOfHtmlMessage->setEnabled(false);
 
2277
#endif
 
2278
 
2322
2279
  mQuoteSelectionOnlyCheck = new QCheckBox( MessageComposer::MessageComposerSettings::self()->quoteSelectionOnlyItem()->label(),
2323
2280
                                            this );
2324
2281
  mQuoteSelectionOnlyCheck->setToolTip(
2528
2485
  const int wrapColumn = MessageComposer::MessageComposerSettings::self()->lineWrapWidth();
2529
2486
  const bool showRecentAddress = MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposer();
2530
2487
  const int maximumRecipient = MessageComposer::MessageComposerSettings::self()->maximumRecipients();
 
2488
  const bool improvePlainText = MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage();
2531
2489
 
2532
2490
  MessageComposer::MessageComposerSettings::self()->useDefaults( bUseDefaults );
2533
2491
 
2539
2497
  mWrapColumnSpin->setValue( wrapColumn );
2540
2498
  mMaximumRecipients->setValue( maximumRecipient );
2541
2499
  mShowRecentAddressesInComposer->setChecked( showRecentAddress );
 
2500
  mImprovePlainTextOfHtmlMessage->setChecked(improvePlainText);
2542
2501
 
2543
2502
}
2544
2503
 
2560
2519
  mMaximumRecipients->setValue( MessageComposer::MessageComposerSettings::self()->maximumRecipients() );
2561
2520
  mAutoSave->setValue( GlobalSettings::self()->autosaveInterval() );
2562
2521
  mShowRecentAddressesInComposer->setChecked( MessageComposer::MessageComposerSettings::self()->showRecentAddressesInComposer() );
 
2522
  mImprovePlainTextOfHtmlMessage->setChecked(MessageComposer::MessageComposerSettings::self()->improvePlainTextOfHtmlMessage());
2563
2523
 
2564
2524
#ifdef KDEPIM_ENTERPRISE_BUILD
2565
2525
  mRecipientCheck->setChecked( GlobalSettings::self()->tooManyRecipients() );
2590
2550
  MessageComposer::MessageComposerSettings::self()->setMaximumRecipients( mMaximumRecipients->value() );
2591
2551
  GlobalSettings::self()->setAutosaveInterval( mAutoSave->value() );
2592
2552
  MessageComposer::MessageComposerSettings::self()->setShowRecentAddressesInComposer( mShowRecentAddressesInComposer->isChecked() );
2593
 
 
 
2553
  MessageComposer::MessageComposerSettings::self()->setImprovePlainTextOfHtmlMessage( mImprovePlainTextOfHtmlMessage->isChecked() );
2594
2554
#ifdef KDEPIM_ENTERPRISE_BUILD
2595
2555
  GlobalSettings::self()->setTooManyRecipients( mRecipientCheck->isChecked() );
2596
2556
  GlobalSettings::self()->setRecipientThreshold( mRecipientSpin->value() );
2677
2637
 
2678
2638
  connect( mWidget, SIGNAL(changed()),
2679
2639
           this, SLOT(slotEmitChanged()) );
2680
 
  connect( mWidget, SIGNAL(templatesUpdated()), KMKernel::self(), SLOT(updatedTemplates()) );
 
2640
  if( KMKernel::self() )
 
2641
    connect( mWidget, SIGNAL(templatesUpdated()), KMKernel::self(), SLOT(updatedTemplates()) );
2681
2642
}
2682
2643
 
2683
2644
void ComposerPage::CustomTemplatesTab::doLoadFromGlobalSettings()
3023
2984
 
3024
2985
void ComposerPage::HeadersTab::slotMimeHeaderSelectionChanged()
3025
2986
{
 
2987
  mEmitChanges = false;
3026
2988
  QTreeWidgetItem * item = mTagList->currentItem();
3027
2989
 
3028
2990
  if ( item ) {
3037
2999
  mTagValueEdit->setEnabled( item );
3038
3000
  mTagNameLabel->setEnabled( item );
3039
3001
  mTagValueLabel->setEnabled( item );
 
3002
  mEmitChanges = true;
3040
3003
}
3041
3004
 
3042
3005
 
3047
3010
  QTreeWidgetItem * item = mTagList->currentItem();
3048
3011
  if ( item )
3049
3012
    item->setText( 0, text );
3050
 
  emit changed( true );
 
3013
  slotEmitChanged();
3051
3014
}
3052
3015
 
3053
3016
 
3058
3021
  QTreeWidgetItem * item = mTagList->currentItem();
3059
3022
  if ( item )
3060
3023
    item->setText( 1, text );
3061
 
  emit changed( true );
 
3024
  slotEmitChanged();
3062
3025
}
3063
3026
 
3064
3027
 
3066
3029
{
3067
3030
  QTreeWidgetItem *listItem = new QTreeWidgetItem( mTagList );
3068
3031
  mTagList->setCurrentItem( listItem );
3069
 
  emit changed( true );
 
3032
  slotEmitChanged();
3070
3033
}
3071
3034
 
3072
3035
 
3096
3059
    );
3097
3060
  }
3098
3061
 
3099
 
  emit changed( true );
 
3062
  slotEmitChanged();
3100
3063
}
3101
3064
 
3102
3065
void ComposerPage::HeadersTab::doLoadOther()
3219
3182
           this, SLOT(slotEmitChanged()) );
3220
3183
  vlay->addWidget( mMissingAttachmentDetectionCheck );
3221
3184
 
 
3185
 
 
3186
  QHBoxLayout * layAttachment = new QHBoxLayout;
 
3187
  label = new QLabel( i18n("Warn when inserting attachments larger than:"), this );
 
3188
  label->setAlignment( Qt::AlignLeft );
 
3189
  layAttachment->addWidget(label);
 
3190
 
 
3191
  mMaximumAttachmentSize = new KIntNumInput( this );
 
3192
  mMaximumAttachmentSize->setRange( -1, 99999 );
 
3193
  mMaximumAttachmentSize->setSingleStep( 100 );
 
3194
  mMaximumAttachmentSize->setSuffix(i18nc("spinbox suffix: unit for kilobyte", " kB"));
 
3195
  connect( mMaximumAttachmentSize, SIGNAL(valueChanged(int)),
 
3196
           this, SLOT(slotEmitChanged()) );
 
3197
  mMaximumAttachmentSize->setSpecialValueText(i18n("No limit"));
 
3198
  layAttachment->addWidget(mMaximumAttachmentSize);
 
3199
  vlay->addLayout(layAttachment);
 
3200
 
 
3201
 
3222
3202
  // "Attachment key words" label and string list editor
3223
3203
  label = new QLabel( i18n("Recognize any of the following key words as "
3224
3204
                           "intention to attach a file:"), this );
3253
3233
 
3254
3234
  const QStringList attachWordsList = GlobalSettings::self()->attachmentKeywords();
3255
3235
  mAttachWordsListEditor->setStringList( attachWordsList );
 
3236
  const int maximumAttachmentSize(MessageComposer::MessageComposerSettings::self()->maximumAttachmentSize());
 
3237
  mMaximumAttachmentSize->setValue(maximumAttachmentSize == -1 ? -1 : MessageComposer::MessageComposerSettings::self()->maximumAttachmentSize()/1024);
3256
3238
}
3257
3239
 
3258
3240
void ComposerPage::AttachmentsTab::save()
3265
3247
    mAttachWordsListEditor->stringList() );
3266
3248
 
3267
3249
  KMime::setUseOutlookAttachmentEncoding( mOutlookCompatibleCheck->isChecked() );
 
3250
  const int maximumAttachmentSize(mMaximumAttachmentSize->value());
 
3251
  MessageComposer::MessageComposerSettings::self()->setMaximumAttachmentSize(maximumAttachmentSize == -1 ? -1 : maximumAttachmentSize*1024);
3268
3252
 
3269
3253
}
3270
3254
 
3282
3266
  }
3283
3267
}
3284
3268
 
 
3269
ComposerPageAutoCorrectionTab::ComposerPageAutoCorrectionTab(QWidget *parent)
 
3270
  : ConfigModuleTab(parent)
 
3271
{
 
3272
  QVBoxLayout *vlay = new QVBoxLayout( this );
 
3273
  vlay->setSpacing( 0 );
 
3274
  vlay->setMargin( 0 );
 
3275
  autocorrectionWidget = new MessageComposer::ComposerAutoCorrectionWidget(this);
 
3276
  if(KMKernel::self())
 
3277
    autocorrectionWidget->setAutoCorrection(KMKernel::self()->composerAutoCorrection());
 
3278
  vlay->addWidget(autocorrectionWidget);
 
3279
  setLayout(vlay);
 
3280
  connect( autocorrectionWidget, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
 
3281
 
 
3282
}
 
3283
 
 
3284
QString ComposerPageAutoCorrectionTab::helpAnchor() const
 
3285
{
 
3286
  return QString::fromLatin1("configure-autocorrection");
 
3287
}
 
3288
 
 
3289
void ComposerPageAutoCorrectionTab::save()
 
3290
{
 
3291
  autocorrectionWidget->writeConfig();
 
3292
}
 
3293
 
 
3294
void ComposerPageAutoCorrectionTab::doLoadFromGlobalSettings()
 
3295
{
 
3296
  autocorrectionWidget->loadConfig();
 
3297
}
 
3298
 
 
3299
void ComposerPageAutoCorrectionTab::doResetToDefaultsOther()
 
3300
{
 
3301
  autocorrectionWidget->resetToDefault();
 
3302
}
 
3303
 
 
3304
 
 
3305
ComposerPageAutoImageResizeTab::ComposerPageAutoImageResizeTab(QWidget *parent)
 
3306
  : ConfigModuleTab(parent)
 
3307
{
 
3308
  QVBoxLayout *vlay = new QVBoxLayout( this );
 
3309
  vlay->setSpacing( 0 );
 
3310
  vlay->setMargin( 0 );
 
3311
  autoResizeWidget = new MessageComposer::AutoResizeImageWidget(this);
 
3312
  vlay->addWidget(autoResizeWidget);
 
3313
  setLayout(vlay);
 
3314
  connect( autoResizeWidget, SIGNAL(changed()), this, SLOT(slotEmitChanged()) );
 
3315
 
 
3316
}
 
3317
 
 
3318
QString ComposerPageAutoImageResizeTab::helpAnchor() const
 
3319
{
 
3320
  return QString::fromLatin1("configure-image-resize");
 
3321
}
 
3322
 
 
3323
void ComposerPageAutoImageResizeTab::save()
 
3324
{
 
3325
  autoResizeWidget->writeConfig();
 
3326
}
 
3327
 
 
3328
void ComposerPageAutoImageResizeTab::doLoadFromGlobalSettings()
 
3329
{
 
3330
  autoResizeWidget->loadConfig();
 
3331
}
 
3332
 
 
3333
void ComposerPageAutoImageResizeTab::doResetToDefaultsOther()
 
3334
{
 
3335
  autoResizeWidget->resetToDefault();
 
3336
}
 
3337
 
 
3338
 
3285
3339
// *************************************************************
3286
3340
// *                                                           *
3287
3341
// *                      SecurityPage                         *
3503
3557
  mWidget = new Ui::WarningConfiguration;
3504
3558
  mWidget->setupUi( this );
3505
3559
 
 
3560
  mWidget->chiasmusButton->hide();
 
3561
 
3506
3562
  connect( mWidget->warnGroupBox, SIGNAL(toggled(bool)), SLOT(slotEmitChanged()) );
3507
3563
  connect( mWidget->mWarnUnsigned, SIGNAL(toggled(bool)), SLOT(slotEmitChanged()) );
3508
3564
  connect( mWidget->warnUnencryptedCB, SIGNAL(toggled(bool)), SLOT(slotEmitChanged()) );
3509
3565
  connect( mWidget->warnReceiverNotInCertificateCB, SIGNAL(toggled(bool)), SLOT(slotEmitChanged()) );
3510
3566
 
3511
3567
  connect( mWidget->gnupgButton, SIGNAL(clicked()), SLOT(slotConfigureGnupg()) );
3512
 
  connect( mWidget->chiasmusButton, SIGNAL(clicked()), SLOT(slotConfigureChiasmus()) );
 
3568
  //connect( mWidget->chiasmusButton, SIGNAL(clicked()), SLOT(slotConfigureChiasmus()) );
3513
3569
  connect( mWidget->enableAllWarningsPB, SIGNAL(clicked()), SLOT(slotReenableAllWarningsClicked()) );
3514
3570
}
3515
3571
 
3631
3687
  delete dlg;
3632
3688
}
3633
3689
 
 
3690
#if 0
3634
3691
void SecurityPage::WarningTab::slotConfigureChiasmus()
3635
3692
{
3636
3693
  using namespace Kleo;
3651
3708
  else
3652
3709
    kDebug() << "Kleo::CryptoBackendFactory::instance() returned NULL!";
3653
3710
}
3654
 
 
 
3711
#endif
3655
3712
////
3656
3713
 
3657
3714
QString SecurityPage::SMimeTab::helpAnchor() const