Happy New Year!
[quassel.git] / src / qtui / settingspages / identityeditwidget.cpp
index 25d5abc..eb93ff4 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2014 by the Quassel Project                        *
+ *   Copyright (C) 2005-2015 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
 
 #include "identityeditwidget.h"
 
-#include <QDesktopServices>
 #include <QDragEnterEvent>
 #include <QDropEvent>
 #include <QFileDialog>
+#include <QIcon>
+#include <QMimeData>
 #include <QUrl>
 #include <QMessageBox>
 
+#if QT_VERSION < 0x050000
+#  include <QDesktopServices>
+#else
+#  include <QStandardPaths>
+#endif
+
 #include "client.h"
-#include "iconloader.h"
 
 IdentityEditWidget::IdentityEditWidget(QWidget *parent)
     : QWidget(parent)
 {
     ui.setupUi(this);
 
-    ui.addNick->setIcon(SmallIcon("list-add"));
-    ui.deleteNick->setIcon(SmallIcon("edit-delete"));
-    ui.renameNick->setIcon(SmallIcon("edit-rename"));
-    ui.nickUp->setIcon(SmallIcon("go-up"));
-    ui.nickDown->setIcon(SmallIcon("go-down"));
+    ui.addNick->setIcon(QIcon::fromTheme("list-add"));
+    ui.deleteNick->setIcon(QIcon::fromTheme("edit-delete"));
+    ui.renameNick->setIcon(QIcon::fromTheme("edit-rename"));
+    ui.nickUp->setIcon(QIcon::fromTheme("go-up"));
+    ui.nickDown->setIcon(QIcon::fromTheme("go-down"));
 
     // We need to know whenever the state of input widgets changes...
     connect(ui.realName, SIGNAL(textEdited(const QString &)), this, SIGNAL(widgetHasChanged()));
@@ -318,7 +324,12 @@ void IdentityEditWidget::on_clearOrLoadKeyButton_clicked()
     QSslKey key;
 
     if (ui.keyTypeLabel->property("sslKey").toByteArray().isEmpty())
-        key = keyByFilename(QFileDialog::getOpenFileName(this, tr("Load a Key"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
+        key = keyByFilename(QFileDialog::getOpenFileName(this, tr("Load a Key"),
+#if QT_VERSION < 0x050000
+                                                         QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
+#else
+                                                         QStandardPaths::writableLocation(QStandardPaths::HomeLocation)));
+#endif
 
     showKeyState(key);
     emit widgetHasChanged();
@@ -376,8 +387,12 @@ void IdentityEditWidget::on_clearOrLoadCertButton_clicked()
     QSslCertificate cert;
 
     if (ui.certOrgLabel->property("sslCert").toByteArray().isEmpty())
-        cert = certByFilename(QFileDialog::getOpenFileName(this, tr("Load a Certificate"), QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
-
+        cert = certByFilename(QFileDialog::getOpenFileName(this, tr("Load a Certificate"),
+#if QT_VERSION < 0x050000
+                                                           QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
+#else
+                                                           QStandardPaths::writableLocation(QStandardPaths::HomeLocation)));
+#endif
     showCertState(cert);
     emit widgetHasChanged();
 }