Commit 42b57a3b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Minor

parent d5a03e6b
......@@ -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();
......
/*
Copyright (c) 2012 Montel Laurent <montel@kde.org>
Copyright (c) 2012, 2013 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
......@@ -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<KAction *>(); // 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<KAction *>(); // 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"
/*
Copyright (c) 2012 Montel Laurent <montel@kde.org>
Copyright (c) 2012, 2013 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
......@@ -17,21 +17,24 @@
#ifndef ATTACHMENTMISSINGWARNING_H
#define ATTACHMENTMISSINGWARNING_H
#include <KMessageWidget>
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
/*
Copyright (c) 2012 Montel Laurent <montel@kde.org>
Copyright (c) 2012, 2013 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
......@@ -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<DuplicateMode>( id );
const int id = mButtonGroup->checkedId();
return static_cast<DuplicateMode>( id );
}
QString IdentityAddVcardDialog::duplicateVcardFromIdentity() const
{
return mComboBox->currentText();
return mComboBox->currentText();
}
#include "identityaddvcarddialog.moc"
/*
Copyright (c) 2012 Montel Laurent <montel@kde.org>
Copyright (c) 2012, 2013 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
......@@ -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
......@@ -26,61 +26,59 @@
#include <QFile>
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: "<<mVcardFileName;
}
return mVcardFileName;
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: "<<mVcardFileName;
}
return mVcardFileName;
}
#include "identityeditvcarddialog.moc"
......@@ -26,23 +26,23 @@ class ContactEditor;
class IdentityEditVcardDialog : public KDialog
{
Q_OBJECT
Q_OBJECT
public:
explicit IdentityEditVcardDialog(QWidget *parent = 0);
~IdentityEditVcardDialog();
explicit IdentityEditVcardDialog(QWidget *parent = 0);
~IdentityEditVcardDialog();
/**
* @brief loadVcard load vcard in a contact editor
* @param vcardFileName
*/
void loadVcard(const QString& vcardFileName);
/**
void loadVcard(const QString &vcardFileName);
/**
* @brief saveVcard
* @return The file path for current vcard.
*/
QString saveVcard() const;
QString saveVcard() const;
private:
QString mVcardFileName;
Akonadi::ContactEditor *mContactEditor;
QString mVcardFileName;
Akonadi::ContactEditor *mContactEditor;
};
#endif // IDENTITYEDITVCARDDIALOG_H
......@@ -77,14 +77,12 @@ TagSelectDialog::TagSelectDialog( QWidget * parent, int numberOfSelectedMessages
} else {
resize( 500, 300 );
}
}
TagSelectDialog::~TagSelectDialog()
{
KConfigGroup group( KMKernel::self()->config(), "TagSelectDialog" );
group.writeEntry( "Size", size() );
}
void TagSelectDialog::slotAddNewTag()
......
......@@ -32,9 +32,8 @@
#include <KDialog>
#include <Akonadi/Item>
#include "tag.h"
class QListWidget;
class QListWidget;
class TagSelectDialog : public KDialog
{
Q_OBJECT
......
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