summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Krishnavanshi <[email protected]>2017-08-23 18:53:43 +0530
committerPali Roh├ír <[email protected]>2017-12-22 09:10:31 +0100
commit522df83279641e1526c3315f1cd15608de109fe7 (patch)
tree13512f15ff26c291ba4afac667d03c7ebf75cafd
parentb7b7882c900e65e12bde2bf5d5dcde9c7512af48 (diff)
Ported privacy plugin Kdialog and KVBox occurances
-rw-r--r--plugins/privacy/privacyplugin.cpp2
-rw-r--r--plugins/privacy/privacypreferences.cpp66
-rw-r--r--plugins/statistics/statisticsplugin.cpp2
3 files changed, 47 insertions, 23 deletions
diff --git a/plugins/privacy/privacyplugin.cpp b/plugins/privacy/privacyplugin.cpp
index fd26585..50e36c3 100644
--- a/plugins/privacy/privacyplugin.cpp
+++ b/plugins/privacy/privacyplugin.cpp
@@ -61,7 +61,7 @@ PrivacyPlugin::PrivacyPlugin(QObject *parent, const QVariantList &)
actionCollection()->addAction(QStringLiteral("addToBlackList"), addToBlackList);
connect(addToBlackList, SIGNAL(triggered(bool)), this, SLOT(slotAddToBlackList()));
- setComponentName(QStringLiteral("kopete"), i18n("Kopete"));
+ setComponentName(QStringLiteral("kopete_privacy"), i18n("Kopete"));
setXMLFile(QStringLiteral("privacyui.rc"));
m_inboundHandler = new PrivacyMessageHandlerFactory(Kopete::Message::Inbound,
diff --git a/plugins/privacy/privacypreferences.cpp b/plugins/privacy/privacypreferences.cpp
index 9b125de..ca0321c 100644
--- a/plugins/privacy/privacypreferences.cpp
+++ b/plugins/privacy/privacypreferences.cpp
@@ -21,10 +21,13 @@
#include <QPointer>
#include <kpluginfactory.h>
-#include <kdialog.h>
-#include <kvbox.h>
+#include <QDialog>
+#include <QVBoxLayout>
#include <KLocalizedString>
#include <KDebug>
+#include <KConfigGroup>
+#include <QDialogButtonBox>
+#include <QPushButton>
#include "kopeteuiglobal.h"
#include "kopetemetacontact.h"
@@ -162,16 +165,28 @@ void PrivacyPreferences::slotChkDropAllToggled(bool enabled)
void PrivacyPreferences::slotBtnAddToWhiteListClicked()
{
- QPointer <KDialog> addDialog = new KDialog(this);
- addDialog->setCaption(i18n("Add Contact to Whitelist"));
- addDialog->setButtons(KDialog::Ok | KDialog::Cancel);
- addDialog->setDefaultButton(KDialog::Ok);
- addDialog->showButtonSeparator(true);
-
- QPointer <KVBox> box = new KVBox(addDialog);
- box->setSpacing(KDialog::spacingHint());
+ QPointer <QDialog> addDialog = new QDialog(this);
+ addDialog->setWindowTitle(i18n("Add Contact to Whitelist"));
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
+ QWidget *mainWidget = new QWidget(this);
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ addDialog->setLayout(mainLayout);
+ mainLayout->addWidget(mainWidget);
+ QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setDefault(true);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ connect(buttonBox, &QDialogButtonBox::accepted, addDialog, &QDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, addDialog, &QDialog::reject);
+
+ buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
+
+ QPointer <QWidget> box = new QWidget(addDialog);
+ QVBoxLayout *boxVBoxLayout = new QVBoxLayout(box);
+ boxVBoxLayout->setMargin(0);
QPointer <ContactSelectorWidget> selector = new ContactSelectorWidget(box);
- addDialog->setMainWidget(box);
+ boxVBoxLayout->addWidget(selector);
+ mainLayout->addWidget(box);
+ mainLayout->addWidget(buttonBox);
if (addDialog->exec() == QDialog::Accepted && addDialog && selector) {
foreach (const AccountListEntry &entry, selector->contacts()) {
@@ -186,17 +201,26 @@ void PrivacyPreferences::slotBtnAddToWhiteListClicked()
void PrivacyPreferences::slotBtnAddToBlackListClicked()
{
- QPointer <KDialog> addDialog = new KDialog(this);
- addDialog->setCaption(i18n("Add Contact to Blacklist"));
- addDialog->setButtons(KDialog::Ok | KDialog::Cancel);
- addDialog->setDefaultButton(KDialog::Ok);
- addDialog->showButtonSeparator(true);
-
- QPointer <KVBox> box = new KVBox(addDialog);
- box->setSpacing(KDialog::spacingHint());
+ QPointer <QDialog> addDialog = new QDialog(this);
+ addDialog->setWindowTitle(i18n("Add Contact to Blacklist"));
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
+ QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ okButton->setDefault(true);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ connect(buttonBox, &QDialogButtonBox::accepted, addDialog, &QDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, addDialog, &QDialog::reject);
+ buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
+
+ QPointer <QWidget> box = new QWidget(addDialog);
+ QVBoxLayout *boxVBoxLayout = new QVBoxLayout(box);
+ boxVBoxLayout->setMargin(0);
QPointer <ContactSelectorWidget> selector = new ContactSelectorWidget(box);
- addDialog->setMainWidget(box);
-
+ boxVBoxLayout->addWidget(selector);
+ mainLayout->addWidget(selector);
+ mainLayout->addWidget(box);
+ mainLayout->addWidget(buttonBox);
+
if (addDialog->exec() == QDialog::Accepted && addDialog && selector) {
foreach (const AccountListEntry &entry, selector->contacts()) {
m_blackListModel->addAccount(entry);
diff --git a/plugins/statistics/statisticsplugin.cpp b/plugins/statistics/statisticsplugin.cpp
index cc81744..a0e0971 100644
--- a/plugins/statistics/statisticsplugin.cpp
+++ b/plugins/statistics/statisticsplugin.cpp
@@ -75,7 +75,7 @@ StatisticsPlugin::StatisticsPlugin(QObject *parent, const QVariantList & /*args*
connect(Kopete::ContactList::self(), SIGNAL(metaContactRemoved(Kopete::MetaContact *)),
this, SLOT(slotMetaContactRemoved(Kopete::MetaContact *)));
- setComponentName(QStringLiteral("statistics"), i18n("Kopete"));
+ setComponentName(QStringLiteral("kopete_statistics"), i18n("Kopete"));
setXMLFile(QStringLiteral("statisticsui.rc"));
/* Initialization reads the database, so it could be a bit time-consuming