From ad05b3be51bdbda882f89feabcf26bf91e293e9c Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Mon, 6 May 2013 13:28:56 +0200 Subject: [PATCH] Minor --- accountconfigorderdialog.h | 2 +- attachmentmissingwarning.cpp | 40 +++++++------- attachmentmissingwarning.h | 21 ++++---- identityaddvcarddialog.cpp | 100 +++++++++++++++++------------------ identityaddvcarddialog.h | 24 +++++---- identityeditvcarddialog.cpp | 78 +++++++++++++-------------- identityeditvcarddialog.h | 16 +++--- tagselectdialog.cpp | 2 - tagselectdialog.h | 3 +- 9 files changed, 143 insertions(+), 143 deletions(-) diff --git a/accountconfigorderdialog.h b/accountconfigorderdialog.h index 20595c7f1..184b88edd 100644 --- a/accountconfigorderdialog.h +++ b/accountconfigorderdialog.h @@ -32,7 +32,7 @@ public: explicit AccountConfigOrderDialog(QWidget *parent); ~AccountConfigOrderDialog(); enum Type { - IdentifierAccount = (Qt::UserRole+1) + IdentifierAccount = Qt::UserRole+1 }; private Q_SLOTS: void slotOk(); diff --git a/attachmentmissingwarning.cpp b/attachmentmissingwarning.cpp index c89a09327..c936f178c 100644 --- a/attachmentmissingwarning.cpp +++ b/attachmentmissingwarning.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2012 Montel Laurent + Copyright (c) 2012, 2013 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 @@ -23,42 +23,40 @@ AttachmentMissingWarning::AttachmentMissingWarning(QWidget *parent) :KMessageWidget(parent) { - setVisible(false); - setCloseButtonVisible(true); - setMessageType(Information); - setText( i18n( "The message you have composed seems to refer to an attached file but you have not attached anything. Do you want to attach a file to your message?" ) ); - setWordWrap(true); - - KAction *action = this->findChild(); // should give us the close action... - if ( action ) { - connect( action, SIGNAL(triggered(bool)), SLOT(explicitlyClosed()) ); - } - - action = new KAction( KIcon(QLatin1String( "mail-attachment" )), i18n( "&Attach file" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(slotAttachFile()) ); - addAction( action ); - + setVisible(false); + setCloseButtonVisible(true); + setMessageType(Information); + setText( i18n( "The message you have composed seems to refer to an attached file but you have not attached anything. Do you want to attach a file to your message?" ) ); + setWordWrap(true); + + KAction *action = this->findChild(); // should give us the close action... + if ( action ) { + connect( action, SIGNAL(triggered(bool)), SLOT(explicitlyClosed()) ); + } + + action = new KAction( KIcon(QLatin1String( "mail-attachment" )), i18n( "&Attach file" ), this ); + connect( action, SIGNAL(triggered(bool)), SLOT(slotAttachFile()) ); + addAction( action ); } AttachmentMissingWarning::~AttachmentMissingWarning() { - } void AttachmentMissingWarning::slotAttachFile() { - Q_EMIT attachMissingFile(); + Q_EMIT attachMissingFile(); } void AttachmentMissingWarning::slotFileAttached() { - setVisible(false); - Q_EMIT closeAttachMissingFile(); + setVisible(false); + Q_EMIT closeAttachMissingFile(); } void AttachmentMissingWarning::explicitlyClosed() { - Q_EMIT closeAttachMissingFile(); + Q_EMIT closeAttachMissingFile(); } #include "attachmentmissingwarning.moc" diff --git a/attachmentmissingwarning.h b/attachmentmissingwarning.h index 663a8cd05..ee8578971 100644 --- a/attachmentmissingwarning.h +++ b/attachmentmissingwarning.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2012 Montel Laurent + Copyright (c) 2012, 2013 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 @@ -17,21 +17,24 @@ #ifndef ATTACHMENTMISSINGWARNING_H #define ATTACHMENTMISSINGWARNING_H + #include class AttachmentMissingWarning : public KMessageWidget { - Q_OBJECT + Q_OBJECT public: - explicit AttachmentMissingWarning(QWidget *parent = 0); - ~AttachmentMissingWarning(); + explicit AttachmentMissingWarning(QWidget *parent = 0); + ~AttachmentMissingWarning(); + private Q_SLOTS: - void explicitlyClosed(); - void slotAttachFile(); - void slotFileAttached(); + void explicitlyClosed(); + void slotAttachFile(); + void slotFileAttached(); + Q_SIGNALS: - void attachMissingFile(); - void closeAttachMissingFile(); + void attachMissingFile(); + void closeAttachMissingFile(); }; #endif // ATTACHMENTMISSINGWARNING_H diff --git a/identityaddvcarddialog.cpp b/identityaddvcarddialog.cpp index 82b3c7182..63eb38803 100644 --- a/identityaddvcarddialog.cpp +++ b/identityaddvcarddialog.cpp @@ -1,5 +1,5 @@ /* - Copyright (c) 2012 Montel Laurent + Copyright (c) 2012, 2013 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 @@ -28,53 +28,53 @@ IdentityAddVcardDialog::IdentityAddVcardDialog(KPIMIdentities::IdentityManager *manager, QWidget *parent) - :KDialog(parent) + :KDialog(parent) { - setCaption( i18n( "Create own vCard" ) ); - setButtons( Ok|Cancel ); - setDefaultButton( Ok ); - setModal( true ); - QWidget *mainWidget = new QWidget( this ); - QVBoxLayout *vlay = new QVBoxLayout( mainWidget ); - vlay->setSpacing( KDialog::spacingHint() ); - vlay->setMargin( KDialog::marginHint() ); - setMainWidget( mainWidget ); - - mButtonGroup = new QButtonGroup( this ); - - // row 1: radio button - QRadioButton *radio = new QRadioButton( i18n("&With empty fields"), this ); - radio->setChecked( true ); - vlay->addWidget( radio ); - mButtonGroup->addButton( radio, (int)Empty ); - - // row 2: radio button - radio = new QRadioButton( i18n("&Duplicate existing vCard"), this ); - vlay->addWidget( radio ); - mButtonGroup->addButton( radio, (int)ExistingEntry ); - - // row 3: combobox with existing identities and label - QHBoxLayout* hlay = new QHBoxLayout(); // inherits spacing - vlay->addLayout( hlay ); - mComboBox = new KComboBox( this ); - mComboBox->setEditable( false ); - - mComboBox->addItems( manager->shadowIdentities() ); - mComboBox->setEnabled( false ); - QLabel *label = new QLabel( i18n("&Existing identities:"), this ); - label->setBuddy( mComboBox ); - label->setEnabled( false ); - hlay->addWidget( label ); - hlay->addWidget( mComboBox, 1 ); - - vlay->addStretch( 1 ); // spacer - - // enable/disable combobox and label depending on the third radio - // button's state: - connect( radio, SIGNAL(toggled(bool)), - label, SLOT(setEnabled(bool)) ); - connect( radio, SIGNAL(toggled(bool)), - mComboBox, SLOT(setEnabled(bool)) ); + setCaption( i18n( "Create own vCard" ) ); + setButtons( Ok|Cancel ); + setDefaultButton( Ok ); + setModal( true ); + QWidget *mainWidget = new QWidget( this ); + QVBoxLayout *vlay = new QVBoxLayout( mainWidget ); + vlay->setSpacing( KDialog::spacingHint() ); + vlay->setMargin( KDialog::marginHint() ); + setMainWidget( mainWidget ); + + mButtonGroup = new QButtonGroup( this ); + + // row 1: radio button + QRadioButton *radio = new QRadioButton( i18n("&With empty fields"), this ); + radio->setChecked( true ); + vlay->addWidget( radio ); + mButtonGroup->addButton( radio, (int)Empty ); + + // row 2: radio button + radio = new QRadioButton( i18n("&Duplicate existing vCard"), this ); + vlay->addWidget( radio ); + mButtonGroup->addButton( radio, (int)ExistingEntry ); + + // row 3: combobox with existing identities and label + QHBoxLayout* hlay = new QHBoxLayout(); // inherits spacing + vlay->addLayout( hlay ); + mComboBox = new KComboBox( this ); + mComboBox->setEditable( false ); + + mComboBox->addItems( manager->shadowIdentities() ); + mComboBox->setEnabled( false ); + QLabel *label = new QLabel( i18n("&Existing identities:"), this ); + label->setBuddy( mComboBox ); + label->setEnabled( false ); + hlay->addWidget( label ); + hlay->addWidget( mComboBox, 1 ); + + vlay->addStretch( 1 ); // spacer + + // enable/disable combobox and label depending on the third radio + // button's state: + connect( radio, SIGNAL(toggled(bool)), + label, SLOT(setEnabled(bool)) ); + connect( radio, SIGNAL(toggled(bool)), + mComboBox, SLOT(setEnabled(bool)) ); } @@ -84,13 +84,13 @@ IdentityAddVcardDialog::~IdentityAddVcardDialog() IdentityAddVcardDialog::DuplicateMode IdentityAddVcardDialog::duplicateMode() const { - const int id = mButtonGroup->checkedId(); - return static_cast( id ); + const int id = mButtonGroup->checkedId(); + return static_cast( id ); } QString IdentityAddVcardDialog::duplicateVcardFromIdentity() const { - return mComboBox->currentText(); + return mComboBox->currentText(); } #include "identityaddvcarddialog.moc" diff --git a/identityaddvcarddialog.h b/identityaddvcarddialog.h index 87a55aa19..0438ec154 100644 --- a/identityaddvcarddialog.h +++ b/identityaddvcarddialog.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2012 Montel Laurent + Copyright (c) 2012, 2013 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 @@ -22,23 +22,27 @@ class QButtonGroup; class KComboBox; namespace KPIMIdentities { - class IdentityManager; +class IdentityManager; } class IdentityAddVcardDialog: public KDialog { - Q_OBJECT + Q_OBJECT public: - enum DuplicateMode { Empty, ExistingEntry }; - explicit IdentityAddVcardDialog(KPIMIdentities::IdentityManager *manager, QWidget *parent = 0); - ~IdentityAddVcardDialog(); + enum DuplicateMode { + Empty, + ExistingEntry + }; - DuplicateMode duplicateMode() const; - QString duplicateVcardFromIdentity() const; + explicit IdentityAddVcardDialog(KPIMIdentities::IdentityManager *manager, QWidget *parent = 0); + ~IdentityAddVcardDialog(); + + DuplicateMode duplicateMode() const; + QString duplicateVcardFromIdentity() const; private: - QButtonGroup *mButtonGroup; - KComboBox *mComboBox; + QButtonGroup *mButtonGroup; + KComboBox *mComboBox; }; #endif // IDENTITYADDVCARDDIALOG_H diff --git a/identityeditvcarddialog.cpp b/identityeditvcarddialog.cpp index 00400d6f6..0729e5a8c 100644 --- a/identityeditvcarddialog.cpp +++ b/identityeditvcarddialog.cpp @@ -26,61 +26,59 @@ #include IdentityEditVcardDialog::IdentityEditVcardDialog(QWidget *parent) - : KDialog(parent) + : KDialog(parent) { - setCaption( i18n( "Edit own vCard" ) ); - setButtons( Ok|Cancel ); - setDefaultButton( Ok ); - setModal( true ); - QWidget *mainWidget = new QWidget( this ); - QHBoxLayout *mainLayout = new QHBoxLayout( mainWidget ); - mainLayout->setSpacing( KDialog::spacingHint() ); - mainLayout->setMargin( KDialog::marginHint() ); - setMainWidget( mainWidget ); + setCaption( i18n( "Edit own vCard" ) ); + setButtons( Ok|Cancel ); + setDefaultButton( Ok ); + setModal( true ); + QWidget *mainWidget = new QWidget( this ); + QHBoxLayout *mainLayout = new QHBoxLayout( mainWidget ); + mainLayout->setSpacing( KDialog::spacingHint() ); + mainLayout->setMargin( KDialog::marginHint() ); + setMainWidget( mainWidget ); - mContactEditor = new Akonadi::ContactEditor( Akonadi::ContactEditor::CreateMode, Akonadi::ContactEditor::VCardMode, this ); - mainLayout->addWidget(mContactEditor); + mContactEditor = new Akonadi::ContactEditor( Akonadi::ContactEditor::CreateMode, Akonadi::ContactEditor::VCardMode, this ); + mainLayout->addWidget(mContactEditor); } IdentityEditVcardDialog::~IdentityEditVcardDialog() { - } - -void IdentityEditVcardDialog::loadVcard( const QString& vcardFileName) +void IdentityEditVcardDialog::loadVcard( const QString &vcardFileName) { - if (vcardFileName.isEmpty()) { - return; - } - mVcardFileName = vcardFileName; - QFile file( vcardFileName ); + if (vcardFileName.isEmpty()) { + return; + } + mVcardFileName = vcardFileName; + QFile file( vcardFileName ); - if ( file.open( QIODevice::ReadOnly ) ) { - const QByteArray data = file.readAll(); - file.close(); - if ( !data.isEmpty() ) { - KABC::VCardConverter converter; - KABC::Addressee addr = converter.parseVCard( data ); - mContactEditor->setContactTemplate(addr); + if ( file.open( QIODevice::ReadOnly ) ) { + const QByteArray data = file.readAll(); + file.close(); + if ( !data.isEmpty() ) { + KABC::VCardConverter converter; + KABC::Addressee addr = converter.parseVCard( data ); + mContactEditor->setContactTemplate(addr); + } } - } } QString IdentityEditVcardDialog::saveVcard() const { - const KABC::Addressee addr = mContactEditor->contact(); - KABC::VCardConverter converter; - QFile file(mVcardFileName); - if ( file.open( QIODevice::WriteOnly |QIODevice::Text ) ) { - const QByteArray data = converter.exportVCard( addr, KABC::VCardConverter::v3_0 ); - file.write( data ); - file.flush(); - file.close(); - } else { - kDebug()<<"We can not open file: "<contact(); + KABC::VCardConverter converter; + QFile file(mVcardFileName); + if ( file.open( QIODevice::WriteOnly |QIODevice::Text ) ) { + const QByteArray data = converter.exportVCard( addr, KABC::VCardConverter::v3_0 ); + file.write( data ); + file.flush(); + file.close(); + } else { + kDebug()<<"We can not open file: "<config(), "TagSelectDialog" ); group.writeEntry( "Size", size() ); - } void TagSelectDialog::slotAddNewTag() diff --git a/tagselectdialog.h b/tagselectdialog.h index bbceb07c0..836348a8e 100644 --- a/tagselectdialog.h +++ b/tagselectdialog.h @@ -32,9 +32,8 @@ #include #include #include "tag.h" -class QListWidget; - +class QListWidget; class TagSelectDialog : public KDialog { Q_OBJECT