summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Whiting <[email protected]>2015-09-11 13:13:13 -0600
committerJeremy Whiting <[email protected]>2015-09-11 13:13:13 -0600
commit82707732d37a20f60a14d4945c4d2592fd60140f (patch)
tree71fcbb86609252d71911bd246ed4cccd089949a6
parente63fb3f0b1f6d849763cc13f22fc0e6614186b9f (diff)
Port from KDialog to QDialog and KPushButton to QPushButton.
-rw-r--r--krfb/connectiondialog.cpp29
-rw-r--r--krfb/connectiondialog.h4
-rw-r--r--krfb/invitationsrfbclient.cpp5
-rw-r--r--krfb/trayicon.cpp5
-rw-r--r--krfb/trayicon.h1
-rw-r--r--krfb/tubesrfbclient.cpp5
-rw-r--r--krfb/ui/mainwidget.ui7
7 files changed, 34 insertions, 22 deletions
diff --git a/krfb/connectiondialog.cpp b/krfb/connectiondialog.cpp
index 2810c01..e465035 100644
--- a/krfb/connectiondialog.cpp
+++ b/krfb/connectiondialog.cpp
@@ -26,14 +26,28 @@
#include <KLocalizedString>
#include <KStandardGuiItem>
+#include <KConfigGroup>
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <KGuiItem>
+#include <QVBoxLayout>
template <typename UI>
ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
- : KDialog(parent)
+ : QDialog(parent)
{
- setCaption(i18n("New Connection"));
- setButtons(Ok | Cancel);
- setDefaultButton(Cancel);
+ setWindowTitle(i18n("New Connection"));
+ QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
+ QWidget *mainWidget = new QWidget(this);
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ setLayout(mainLayout);
+ mainLayout->addWidget(mainWidget);
+ QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setDefault(true);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+ connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+ buttonBox->button(QDialogButtonBox::Cancel)->setDefault(true);
setModal(true);
setMinimumSize(500, 200);
@@ -45,13 +59,14 @@ ConnectionDialog<UI>::ConnectionDialog(QWidget *parent)
KGuiItem accept = KStandardGuiItem::ok();
accept.setText(i18n("Accept Connection"));
- setButtonGuiItem(Ok, accept);
+ KGuiItem::assign(okButton, accept);
KGuiItem refuse = KStandardGuiItem::cancel();
refuse.setText(i18n("Refuse Connection"));
- setButtonGuiItem(Cancel, refuse);
+ KGuiItem::assign(buttonBox->button(QDialogButtonBox::Cancel), refuse);
- setMainWidget(m_connectWidget);
+ mainLayout->addWidget(m_connectWidget);
+ mainLayout->addWidget(buttonBox);
}
//**********
diff --git a/krfb/connectiondialog.h b/krfb/connectiondialog.h
index f29b7bc..8902dba 100644
--- a/krfb/connectiondialog.h
+++ b/krfb/connectiondialog.h
@@ -23,10 +23,10 @@
#define CONNECTIONDIALOG_H
#include "ui_connectionwidget.h"
-#include <KDialog>
+#include <QDialog>
template <typename UI>
-class ConnectionDialog : public KDialog
+class ConnectionDialog : public QDialog
{
public:
ConnectionDialog(QWidget *parent);
diff --git a/krfb/invitationsrfbclient.cpp b/krfb/invitationsrfbclient.cpp
index 975d682..85d9f8b 100644
--- a/krfb/invitationsrfbclient.cpp
+++ b/krfb/invitationsrfbclient.cpp
@@ -31,6 +31,7 @@
#include <QDebug>
#include <QtCore/QSocketNotifier>
#include <poll.h>
+#include <KConfigGroup>
struct PendingInvitationsRfbClient::Private
{
@@ -82,8 +83,8 @@ void PendingInvitationsRfbClient::processNewClient()
dialog->setRemoteHost(host);
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
- connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
- connect(dialog, SIGNAL(cancelClicked()), SLOT(reject()));
+ connect(dialog, SIGNAL(clicked()), SLOT(dialogAccepted()));
+ connect(dialog, SIGNAL(clicked()), SLOT(reject()));
dialog->show();
}
diff --git a/krfb/trayicon.cpp b/krfb/trayicon.cpp
index 77dfc14..6105ceb 100644
--- a/krfb/trayicon.cpp
+++ b/krfb/trayicon.cpp
@@ -27,10 +27,11 @@
#include <KAboutApplicationDialog>
#include <KActionCollection>
-#include <KDialog>
+#include <QDialog>
#include <KLocalizedString>
#include <KStandardAction>
#include <KToggleAction>
+#include <KConfigGroup>
class ClientActions
{
@@ -139,7 +140,7 @@ void TrayIcon::onClientDisconnected(RfbClient* client)
void TrayIcon::showAbout()
{
// TODO: Port to KF5 equivalent
-// KDialog *dlg = new KAboutApplicationDialog(KGlobal::mainComponent().aboutData());
+// QDialog *dlg = new KAboutApplicationDialog(KGlobal::mainComponent().aboutData());
// dlg->setAttribute(Qt::WA_DeleteOnClose, true);
// dlg->show();
}
diff --git a/krfb/trayicon.h b/krfb/trayicon.h
index fbcca50..4744ff1 100644
--- a/krfb/trayicon.h
+++ b/krfb/trayicon.h
@@ -20,7 +20,6 @@
#include <KStatusNotifierItem>
-class KDialog;
class RfbClient;
class ClientActions;
diff --git a/krfb/tubesrfbclient.cpp b/krfb/tubesrfbclient.cpp
index 11b4d91..cd0ab6a 100644
--- a/krfb/tubesrfbclient.cpp
+++ b/krfb/tubesrfbclient.cpp
@@ -21,6 +21,7 @@
#include "connectiondialog.h"
#include <KNotification>
#include <KLocalizedString>
+#include <KConfigGroup>
QString TubesRfbClient::name() const
{
@@ -68,8 +69,8 @@ void PendingTubesRfbClient::showConfirmationDialog()
dialog->setContactName(name);
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
- connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
- connect(dialog, SIGNAL(cancelClicked()), SLOT(reject()));
+ connect(dialog, SIGNAL(clicked()), SLOT(dialogAccepted()));
+ connect(dialog, SIGNAL(clicked()), SLOT(reject()));
dialog->show();
}
diff --git a/krfb/ui/mainwidget.ui b/krfb/ui/mainwidget.ui
index 2925e78..8a3db46 100644
--- a/krfb/ui/mainwidget.ui
+++ b/krfb/ui/mainwidget.ui
@@ -442,7 +442,7 @@
</widget>
</item>
<item>
- <widget class="KPushButton" name="unattendedPasswordButton">
+ <widget class="QPushButton" name="unattendedPasswordButton">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
@@ -486,11 +486,6 @@
</layout>
</widget>
<customwidgets>
- <customwidget>
- <class>KPushButton</class>
- <extends>QPushButton</extends>
- <header>kpushbutton.h</header>
- </customwidget>
</customwidgets>
<tabstops>
<tabstop>enableSharingCheckBox</tabstop>