Commit 1105d7df authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QDialog

parent 942c7c6c
......@@ -23,101 +23,112 @@
#include <QGridLayout>
#include <QGroupBox>
#include <QCheckBox>
#include <kconfig.h>
#include <KConfigGroup>
#include <QPushButton>
#include <QDialogButtonBox>
#include <KConfig>
// ---------- VCardExportSelection Dialog ---------------- //
VCardExportSelectionDialog::VCardExportSelectionDialog( QWidget *parent )
: KDialog( parent )
: QDialog( parent )
{
setCaption( i18nc( "@title:window", "Select vCard Fields" ) );
setButtons( Ok | Cancel );
setDefaultButton( Ok );
setModal( true );
showButtonSeparator( true );
QFrame *page = new QFrame( this );
setMainWidget( page );
QGridLayout *layout = new QGridLayout( page );
layout->setSpacing( spacingHint() );
layout->setMargin( marginHint() );
setWindowTitle(i18nc("@title:window", "Select vCard Fields"));
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
QPushButton *user1Button = new QPushButton;
buttonBox->addButton(user1Button, QDialogButtonBox::ActionRole);
QPushButton *user2Button = new QPushButton;
buttonBox->addButton(user2Button, QDialogButtonBox::ActionRole);
connect(buttonBox, &QDialogButtonBox::accepted, this, &VCardExportSelectionDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &VCardExportSelectionDialog::reject);
okButton->setDefault(true);
setModal(true);
QFrame *page = new QFrame(this);
mainLayout->addWidget(page);
mainLayout->addWidget(buttonBox);
QGridLayout *layout = new QGridLayout(page);
QGroupBox *gbox = new QGroupBox(
i18nc( "@title:group", "Fields to be exported" ), page );
gbox->setFlat( true );
layout->addWidget( gbox, 0, 0, 1, 2 );
i18nc("@title:group", "Fields to be exported"), page);
gbox->setFlat(true);
layout->addWidget(gbox, 0, 0, 1, 2);
mPrivateBox = new QCheckBox( i18nc( "@option:check", "Private fields" ), page );
mPrivateBox = new QCheckBox(i18nc("@option:check", "Private fields"), page);
mPrivateBox->setToolTip(
i18nc( "@info:tooltip", "Export private fields" ) );
i18nc("@info:tooltip", "Export private fields"));
mPrivateBox->setWhatsThis(
i18nc( "@info:whatsthis",
"Check this box if you want to export the contact's "
"private fields to the vCard output file." ) );
layout->addWidget( mPrivateBox, 1, 0 );
i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"private fields to the vCard output file."));
layout->addWidget(mPrivateBox, 1, 0);
mBusinessBox = new QCheckBox( i18nc( "@option:check", "Business fields" ), page );
mBusinessBox = new QCheckBox(i18nc("@option:check", "Business fields"), page);
mBusinessBox->setToolTip(
i18nc( "@info:tooltip", "Export business fields" ) );
i18nc("@info:tooltip", "Export business fields"));
mBusinessBox->setWhatsThis(
i18nc( "@info:whatsthis",
"Check this box if you want to export the contact's "
"business fields to the vCard output file." ) );
layout->addWidget( mBusinessBox, 2, 0 );
i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"business fields to the vCard output file."));
layout->addWidget(mBusinessBox, 2, 0);
mOtherBox = new QCheckBox( i18nc( "@option:check", "Other fields" ), page );
mOtherBox = new QCheckBox(i18nc("@option:check", "Other fields"), page);
mOtherBox->setToolTip(
i18nc( "@info:tooltip", "Export other fields" ) );
i18nc("@info:tooltip", "Export other fields"));
mOtherBox->setWhatsThis(
i18nc( "@info:whatsthis",
"Check this box if you want to export the contact's "
"other fields to the vCard output file." ) );
layout->addWidget( mOtherBox, 3, 0 );
i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"other fields to the vCard output file."));
layout->addWidget(mOtherBox, 3, 0);
mEncryptionKeys = new QCheckBox( i18nc( "@option:check", "Encryption keys" ), page );
mEncryptionKeys = new QCheckBox(i18nc("@option:check", "Encryption keys"), page);
mEncryptionKeys->setToolTip(
i18nc( "@info:tooltip", "Export encryption keys" ) );
i18nc("@info:tooltip", "Export encryption keys"));
mEncryptionKeys->setWhatsThis(
i18nc( "@info:whatsthis",
"Check this box if you want to export the contact's "
"encryption keys to the vCard output file." ) );
layout->addWidget( mEncryptionKeys, 1, 1 );
i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"encryption keys to the vCard output file."));
layout->addWidget(mEncryptionKeys, 1, 1);
mPictureBox = new QCheckBox( i18nc( "@option:check", "Pictures" ), page );
mPictureBox = new QCheckBox(i18nc("@option:check", "Pictures"), page);
mPictureBox->setToolTip(
i18nc( "@info:tooltip", "Export pictures" ) );
i18nc("@info:tooltip", "Export pictures"));
mPictureBox->setWhatsThis(
i18nc( "@info:whatsthis",
"Check this box if you want to export the contact's "
"picture to the vCard output file." ) );
layout->addWidget( mPictureBox, 2, 1 );
i18nc("@info:whatsthis",
"Check this box if you want to export the contact's "
"picture to the vCard output file."));
layout->addWidget(mPictureBox, 2, 1);
gbox = new QGroupBox(
i18nc( "@title:group", "Export options" ), page );
gbox->setFlat( true );
layout->addWidget( gbox, 4, 0, 1, 2 );
i18nc("@title:group", "Export options"), page);
gbox->setFlat(true);
layout->addWidget(gbox, 4, 0, 1, 2);
mDisplayNameBox = new QCheckBox( i18nc( "@option:check", "Display name as full name" ), page );
mDisplayNameBox = new QCheckBox(i18nc("@option:check", "Display name as full name"), page);
mDisplayNameBox->setToolTip(
i18nc( "@info:tooltip", "Export display name as full name" ) );
i18nc("@info:tooltip", "Export display name as full name"));
mDisplayNameBox->setWhatsThis(
i18nc( "@info:whatsthis",
"Check this box if you want to export the contact's display name "
"in the vCard's full name field. This may be required to get the "
"name shown correctly in GMail or Android." ) );
layout->addWidget( mDisplayNameBox, 5, 0, 1, 2 );
KConfig config( QLatin1String("kaddressbookrc") );
const KConfigGroup group( &config, "XXPortVCard" );
mPrivateBox->setChecked( group.readEntry( "ExportPrivateFields", true ) );
mBusinessBox->setChecked( group.readEntry( "ExportBusinessFields", true ) );
mOtherBox->setChecked( group.readEntry( "ExportOtherFields", true ) );
mEncryptionKeys->setChecked( group.readEntry( "ExportEncryptionKeys", true ) );
mPictureBox->setChecked( group.readEntry( "ExportPictureFields", true ) );
mDisplayNameBox->setChecked( group.readEntry( "ExportDisplayName", false ) );
i18nc("@info:whatsthis",
"Check this box if you want to export the contact's display name "
"in the vCard's full name field. This may be required to get the "
"name shown correctly in GMail or Android."));
layout->addWidget(mDisplayNameBox, 5, 0, 1, 2);
KConfig config(QLatin1String("kaddressbookrc"));
const KConfigGroup group(&config, "XXPortVCard");
mPrivateBox->setChecked(group.readEntry("ExportPrivateFields", true));
mBusinessBox->setChecked(group.readEntry("ExportBusinessFields", true));
mOtherBox->setChecked(group.readEntry("ExportOtherFields", true));
mEncryptionKeys->setChecked(group.readEntry("ExportEncryptionKeys", true));
mPictureBox->setChecked(group.readEntry("ExportPictureFields", true));
mDisplayNameBox->setChecked(group.readEntry("ExportDisplayName", false));
}
VCardExportSelectionDialog::~VCardExportSelectionDialog()
......
......@@ -18,10 +18,10 @@
#ifndef VCARDEXPORTSELECTIONDIALOG_H
#define VCARDEXPORTSELECTIONDIALOG_H
#include <KDialog>
#include <QDialog>
class QCheckBox;
class VCardExportSelectionDialog : public KDialog
class VCardExportSelectionDialog : public QDialog
{
public:
VCardExportSelectionDialog( QWidget *parent );
......
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