kio: user notification optimization

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-03-22 12:55:38 +02:00
parent 70d01331b7
commit 6f0e672758
3 changed files with 12 additions and 12 deletions

View file

@ -579,7 +579,7 @@ void SlaveInterface::messageBox(int type, const QString &text, const QString &ca
d->connection->suspend(); d->connection->suspend();
} }
QHash<UserNotificationHandler::MessageBoxDataType, QVariant> data; QHash<UserNotificationHandler::MessageBoxDataType, QString> data;
data.insert(UserNotificationHandler::MSG_TEXT, text); data.insert(UserNotificationHandler::MSG_TEXT, text);
data.insert(UserNotificationHandler::MSG_CAPTION, caption); data.insert(UserNotificationHandler::MSG_CAPTION, caption);
data.insert(UserNotificationHandler::MSG_YES_BUTTON_TEXT, buttonYes); data.insert(UserNotificationHandler::MSG_YES_BUTTON_TEXT, buttonYes);

View file

@ -50,7 +50,7 @@ UserNotificationHandler::~UserNotificationHandler()
qDeleteAll(m_pendingRequests); qDeleteAll(m_pendingRequests);
} }
void UserNotificationHandler::requestMessageBox(SlaveInterface* iface, int type, const QHash<MessageBoxDataType, QVariant>& data) void UserNotificationHandler::requestMessageBox(SlaveInterface* iface, int type, const QHash<MessageBoxDataType, QString>& data)
{ {
Request* r = new Request; Request* r = new Request;
r->type = type; r->type = type;
@ -80,13 +80,13 @@ void UserNotificationHandler::processRequest()
JobUiDelegate ui; JobUiDelegate ui;
const JobUiDelegate::MessageBoxType type = static_cast<JobUiDelegate::MessageBoxType>(r->type); const JobUiDelegate::MessageBoxType type = static_cast<JobUiDelegate::MessageBoxType>(r->type);
result = ui.requestMessageBox(type, result = ui.requestMessageBox(type,
r->data.value(MSG_TEXT).toString(), r->data.value(MSG_TEXT),
r->data.value(MSG_CAPTION).toString(), r->data.value(MSG_CAPTION),
r->data.value(MSG_YES_BUTTON_TEXT).toString(), r->data.value(MSG_YES_BUTTON_TEXT),
r->data.value(MSG_NO_BUTTON_TEXT).toString(), r->data.value(MSG_NO_BUTTON_TEXT),
r->data.value(MSG_YES_BUTTON_ICON).toString(), r->data.value(MSG_YES_BUTTON_ICON),
r->data.value(MSG_NO_BUTTON_ICON).toString(), r->data.value(MSG_NO_BUTTON_ICON),
r->data.value(MSG_DONT_ASK_AGAIN).toString()); r->data.value(MSG_DONT_ASK_AGAIN));
m_cachedResults.insert(key, new int(result)); m_cachedResults.insert(key, new int(result));
} }
} else { } else {

View file

@ -23,7 +23,7 @@
#include <QHash> #include <QHash>
#include <QCache> #include <QCache>
#include <QPointer> #include <QPointer>
#include <QVariant> #include <QString>
namespace KIO { namespace KIO {
@ -52,13 +52,13 @@ public:
int type; int type;
QPointer<SlaveInterface> slave; QPointer<SlaveInterface> slave;
QHash<MessageBoxDataType, QVariant> data; QHash<MessageBoxDataType, QString> data;
}; };
UserNotificationHandler(QObject* parent = 0); UserNotificationHandler(QObject* parent = 0);
virtual ~UserNotificationHandler(); virtual ~UserNotificationHandler();
void requestMessageBox(SlaveInterface* iface, int type, const QHash<MessageBoxDataType, QVariant>& data); void requestMessageBox(SlaveInterface* iface, int type, const QHash<MessageBoxDataType, QString>& data);
private Q_SLOTS: private Q_SLOTS:
void processRequest(); void processRequest();