Commit 6f1b9b27 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

KIcon -> QIcon

REVIEW: 120851
parent 00770693
......@@ -127,11 +127,13 @@ QIcon Conversation::avatar() const
if (d->isGroupChat) {
return QIcon();
} else {
QString path = d->targetContact->avatarData().fileName;
const QString path = d->targetContact->avatarData().fileName;
QIcon icon;
if (path.isEmpty()) {
path = QLatin1String("im-user");
}
return KIcon(path);
icon = QIcon::fromTheme(QStringLiteral("im-user"));
} else
icon = QIcon(path);
return icon;
}
}
......
......@@ -21,11 +21,10 @@
#define CONVERSATION_H
#include <QObject>
#include <QIcon>
#include <TelepathyQt/Account>
#include <TelepathyQt/TextChannel>
#include <KIcon>
#include "messages-model.h"
class MessagesModel;
......
......@@ -29,7 +29,6 @@
#include <TelepathyQt/ContactManager>
#include <TelepathyQt/PendingContacts>
#include <KIcon>
#include <KGlobal>
#include <KComponentData>
#include <KConfigGroup>
......@@ -163,11 +162,11 @@ QVariant PinnedContactsModel::data(const QModelIndex &index, int role) const
if (p->contact()) {
QString file = p->contact()->avatarData().fileName;
if (!file.isEmpty()) {
icon = KIcon(file);
icon = QIcon::fromTheme(file);
}
}
if (icon.isNull()) {
icon = KIcon(QLatin1String("im-user"));
icon = QIcon::fromTheme(QStringLiteral("im-user"));
}
return icon;
}
......
......@@ -21,8 +21,8 @@
#include "accounts-list-model.h"
#include <QIcon>
#include <KDebug>
#include <KIcon>
#include <KLocalizedString>
#include <KPixmapSequence>
......@@ -112,7 +112,7 @@ QVariant KTp::AccountsListModel::data(const QModelIndex &index, int role) const
break;
case Qt::DecorationRole:
data = QVariant(KIcon(account->iconName()));
data = QVariant(QIcon::fromTheme(account->iconName()));
break;
case AccountsListModel::ConnectionStateRole:
......@@ -269,7 +269,7 @@ const QString KTp::AccountsListModel::connectionStateString(const Tp::AccountPtr
}
}
const KIcon KTp::AccountsListModel::connectionStateIcon(const Tp::AccountPtr &account) const
const QIcon KTp::AccountsListModel::connectionStateIcon(const Tp::AccountPtr &account) const
{
if (account->isEnabled()) {
switch (account->connectionStatus()) {
......@@ -277,14 +277,14 @@ const KIcon KTp::AccountsListModel::connectionStateIcon(const Tp::AccountPtr &ac
return KTp::Presence(account->currentPresence()).icon();
case Tp::ConnectionStatusConnecting:
//imho this is not really worth animating, but feel free to play around..
return KIcon(KPixmapSequence(QLatin1String("process-working"), 22).frameAt(0));
return QIcon(KPixmapSequence(QLatin1String("process-working"), 22).frameAt(0));
case Tp::ConnectionStatusDisconnected:
return KIcon(QLatin1String("user-offline"));
return QIcon::fromTheme(QStringLiteral("user-offline"));
default:
return KIcon(QLatin1String("user-offline"));
return QIcon::fromTheme(QStringLiteral("user-offline"));
}
} else {
return KIcon();
return QIcon();
}
}
......
......@@ -29,8 +29,6 @@
#include <KTp/Models/ktpmodels_export.h>
#include <KTp/types.h>
class KIcon;
namespace KTp
{
......@@ -71,7 +69,7 @@ private:
Private * const d;
const QString connectionStateString(const Tp::AccountPtr &account) const;
const KIcon connectionStateIcon(const Tp::AccountPtr &account) const;
const QIcon connectionStateIcon(const Tp::AccountPtr &account) const;
const QString connectionStatusReason(const Tp::AccountPtr &account) const;
};
......
......@@ -24,9 +24,6 @@
#include <TelepathyQt/AccountManager>
#include <TelepathyQt/AccountSet>
#include <KIcon>
class KTp::AccountsTreeProxyModel::Private
{
public:
......@@ -77,7 +74,7 @@ QVariant KTp::AccountsTreeProxyModel::dataForGroup(const QString &group, int rol
case Qt::DecorationRole:
account = d->accountManager->accountForObjectPath(group);
if (account) {
return KIcon(account->iconName());
return QIcon::fromTheme(account->iconName());
}
break;
case KTp::AccountRole:
......
......@@ -18,8 +18,8 @@
*/
#include "rooms-model.h"
#include <KIcon>
#include <KLocale>
#include <QIcon>
// RoomsModel
KTp::RoomsModel::RoomsModel(QObject *parent): QAbstractListModel(parent)
......@@ -64,7 +64,7 @@ QVariant KTp::RoomsModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
case Qt::DecorationRole:
if (roomInfo.info.value(QLatin1String("password")).toBool()) {
return KIcon(QLatin1String("object-locked"));
return QIcon::fromTheme(QStringLiteral("object-locked"));
} else {
return QVariant();
}
......@@ -117,9 +117,9 @@ QVariant KTp::RoomsModel::headerData(int section, Qt::Orientation orientation, i
case Qt::DecorationRole:
switch (section) {
case PasswordColumn:
return KIcon(QLatin1String("object-locked"));
return QIcon::fromTheme(QStringLiteral("object-locked"));
case MembersColumn:
return KIcon(QLatin1String("meeting-participant"));
return QIcon::fromTheme(QStringLiteral("meeting-participant"));
}
}
}
......@@ -208,9 +208,9 @@ QVariant KTp::FavoriteRoomsModel::data(const QModelIndex &index, int role) const
switch (index.column()) {
case BookmarkColumn:
if (room.value(QLatin1String("is-bookmarked")).toBool()) {
return KIcon(QLatin1String("bookmarks"));
return QIcon::fromTheme(QStringLiteral("bookmarks"));
} else {
return KIcon(KIcon(QLatin1String("bookmarks")).pixmap(32, 32, QIcon::Disabled));
return QIcon(QIcon::fromTheme(QStringLiteral("bookmarks")).pixmap(32, 32, QIcon::Disabled));
}
case HandleNameColumn:
case AccountIdentifierColumn:
......
......@@ -74,7 +74,7 @@ void KTp::ContactViewDelegate::paint(QPainter *painter, const QStyleOptionViewIt
QPixmap avatar;
avatar.load(index.data(KTp::ContactAvatarPathRole).toString());
if (avatar.isNull()) {
avatar = KIcon(QLatin1String("im-user-online")).pixmap(option.decorationSize);
avatar = QIcon::fromTheme(QStringLiteral("im-user-online")).pixmap(option.decorationSize);
} else if (avatar.width() > option.decorationSize.width() || avatar.height() > option.decorationSize.height()) {
//resize larger avatars if required
avatar = avatar.scaled(option.decorationSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
......
......@@ -24,7 +24,6 @@
#include <KNotifyConfigWidget>
#include <KMessageBox>
#include <KLocalizedString>
#include <KIcon>
namespace KTp
{
......@@ -64,7 +63,7 @@ void SettingsKcmDialog::addNotificationsModule()
notificationWidget, SLOT(save()));
KPageWidgetItem *notificationPage = new KPageWidgetItem(notificationWidget, i18n("Notifications"));
notificationPage->setIcon(KIcon(QLatin1String("preferences-desktop-notification")));
notificationPage->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-notification")));
addPage(notificationPage);
}
......
......@@ -47,7 +47,6 @@
#include <KMessageBox>
#include <KIconLoader>
#include <KMimeType>
#include <KIcon>
namespace KTp {
......@@ -308,14 +307,14 @@ void ContactInfoDialog::Private::addStateRow(const QString& description, Tp::Con
QIcon icon;
switch (state) {
case Tp::Contact::PresenceStateYes:
icon = KIcon(QLatin1String("task-complete"));
icon = QIcon::fromTheme(QStringLiteral("task-complete"));
break;
case Tp::Contact::PresenceStateNo:
icon = KIcon(QLatin1String("task-reject"));
icon = QIcon::fromTheme(QStringLiteral("task-reject"));
break;
case Tp::Contact::PresenceStateAsk:
default:
icon = KIcon(QLatin1String("task-attempt"));
icon = QIcon::fromTheme(QStringLiteral("task-attempt"));
break;
}
......
......@@ -27,7 +27,6 @@
#include <TelepathyQt/PendingReady>
#include <KDebug>
#include <KIcon>
namespace KTp
{
......
......@@ -23,7 +23,7 @@
#include <KLocalizedString>
#include <KIconLoader>
#include <KIcon>
#include <QIcon>
namespace KTp
{
......@@ -38,23 +38,21 @@ Presence::Presence(const Tp::Presence &presence) :
{
}
KIcon Presence::icon(bool useImIcons) const
QIcon Presence::icon(bool useImIcons) const
{
const QString &name(iconName(useImIcons));
if (!name.isEmpty()) {
return KIcon(name);
return QIcon::fromTheme(name);
}
return KIcon();
return QIcon();
}
KIcon Presence::icon(QStringList overlays, bool useImIcons) const
QIcon Presence::icon(QStringList overlays, bool useImIcons) const
{
const QString &name(iconName(useImIcons));
if (!name.isEmpty()) {
return KIcon(name,
KIconLoader::global(),
overlays);
return KIconLoader::global()->loadIcon(name, KIconLoader::NoGroup, 0, KIconLoader::DefaultState, overlays);
}
return KIcon();
return QIcon();
}
QString Presence::iconName(bool useImIcons) const
......
......@@ -26,8 +26,6 @@
#include <KTp/ktpcommoninternals_export.h>
class KIcon;
namespace KTp
{
......@@ -43,7 +41,7 @@ public:
* \param useImIcons Use im-user-* icons instead of the user-* (i.e. the "pawn" icons instead of the "circles").
* \return The icon for the current presence.
*/
KIcon icon(bool useImIcons = false) const;
QIcon icon(bool useImIcons = false) const;
/**
* \brief Get the icon for the presence with the specified overlays.
......@@ -52,7 +50,7 @@ public:
* \param useImIcons Use im-user-* icons instead of the user-* (i.e. the "pawn" icons instead of the "circles").
* \return The icon for the current presence.
*/
KIcon icon(QStringList overlays, bool useImIcons = false) const;
QIcon icon(QStringList overlays, bool useImIcons = false) const;
/**
* \brief Get the name of the icon for the presence.
......
......@@ -20,7 +20,7 @@
#include <QAction>
#include <KIcon>
#include <QIcon>
#include <KLocalizedString>
#include <KPluginFactory>
#include <KFileDialog>
......@@ -48,9 +48,9 @@ enum IMActionType {
class IMAction : public QAction {
Q_OBJECT
public:
IMAction(const QString &text, const KIcon &icon, const KTp::ContactPtr &contact,
IMAction(const QString &text, const QIcon &icon, const KTp::ContactPtr &contact,
const Tp::AccountPtr &account, IMActionType type, QObject *parent);
IMAction(const QString &text, const KIcon &icon, const QUrl &uri,
IMAction(const QString &text, const QIcon &icon, const QUrl &uri,
IMActionType type, QObject *parent);
KTp::ContactPtr contact() const;
Tp::AccountPtr account() const;
......@@ -63,7 +63,7 @@ private:
IMActionType m_type;
};
IMAction::IMAction(const QString &text, const KIcon &icon, const KTp::ContactPtr &contact,
IMAction::IMAction(const QString &text, const QIcon &icon, const KTp::ContactPtr &contact,
const Tp::AccountPtr &account, IMActionType type, QObject *parent):
QAction(icon, text, parent),
m_contact(contact),
......@@ -72,7 +72,7 @@ IMAction::IMAction(const QString &text, const KIcon &icon, const KTp::ContactPtr
{
}
IMAction::IMAction(const QString &text, const KIcon &icon, const QUrl &uri,
IMAction::IMAction(const QString &text, const QIcon &icon, const QUrl &uri,
IMActionType type, QObject *parent):
QAction(icon, text, parent),
m_uri(uri),
......@@ -134,7 +134,7 @@ QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &pe
if (contact->textChatCapability()) {
QAction *action = new IMAction(i18n("Start Chat Using %1...", account->displayName()),
KIcon(QLatin1String("text-x-generic")),
QIcon::fromTheme(QStringLiteral("text-x-generic")),
contact,
account,
TextChannel,
......@@ -144,7 +144,7 @@ QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &pe
}
if (contact->audioCallCapability()) {
QAction *action = new IMAction(i18n("Start Audio Call Using %1...", account->displayName()),
KIcon(QLatin1String("audio-headset")),
QIcon::fromTheme(QStringLiteral("audio-headset")),
contact,
account,
AudioChannel,
......@@ -154,7 +154,7 @@ QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &pe
}
if (contact->videoCallCapability()) {
QAction *action = new IMAction(i18n("Start Video Call Using %1...", account->displayName()),
KIcon(QLatin1String("camera-web")),
QIcon::fromTheme(QStringLiteral("camera-web")),
contact,
account,
VideoChannel,
......@@ -165,7 +165,7 @@ QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &pe
if (contact->fileTransferCapability()) {
QAction *action = new IMAction(i18n("Send Files Using %1...", account->displayName()),
KIcon(QLatin1String("mail-attachment")),
QIcon::fromTheme(QStringLiteral("mail-attachment")),
contact,
account,
FileTransfer,
......@@ -175,7 +175,7 @@ QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &pe
}
if (contact->collaborativeEditingCapability()) {
QAction *action = new IMAction(i18n("Collaboratively edit a document Using %1...", account->displayName()),
KIcon(QLatin1String("document-edit")),
QIcon::fromTheme(QStringLiteral("document-edit")),
contact,
account,
CollabEditing,
......@@ -186,7 +186,7 @@ QList<QAction*> KPeopleActionsPlugin::actionsForPerson(const KABC::Addressee &pe
//FIXME-KPEOPLE
// QAction *action = new IMAction(i18n("Open Log Viewer..."),
// KIcon(QLatin1String("documentation")),
// QIcon::fromTheme(QStringLiteral("documentation")),
// personData->uri(),
// LogViewer,
// parent);
......
......@@ -23,7 +23,6 @@
#include <TelepathyQt/PendingDebugMessageList>
#include <KDebug>
#include <KIcon>
#include <KColorScheme>
#include <KStandardAction>
#include <KAction>
......
......@@ -25,7 +25,6 @@
#include <QtAlgorithms>
#include <KAction>
#include <KIcon>
#include <KStatusBar>
#include <KToolBar>
#include <KLocalizedString>
......
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