aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar ctrlaltca2023-07-08 01:38:33 +0200
committerGravatar GitHub2023-07-08 01:38:33 +0200
commit28292170d8c02743cabfabba3a1623b8d71b9aa2 (patch)
tree03c7269f527a40a5b86863db7c111f2552afe46c /src/modules
parentMerge branch 'bugfix/script-editor-out-of-range-exception' (diff)
downloadKVIrc-28292170d8c02743cabfabba3a1623b8d71b9aa2.tar.gz
KVIrc-28292170d8c02743cabfabba3a1623b8d71b9aa2.tar.bz2
KVIrc-28292170d8c02743cabfabba3a1623b8d71b9aa2.zip
Port to (and require) Qt 5.15. Drop KDE4 support, fix KDE5 (#2541)
* Port to (and require) Qt 5.15. Drop KDE4 support, implement KDE5 support where needed. --------- Co-authored-by: Fabio Bas <fabio.bas@officineinformatiche.net>
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/addon/AddonFunctions.cpp2
-rw-r--r--src/modules/addon/AddonManagementDialog.cpp4
-rw-r--r--src/modules/channelsjoin/ChannelsJoinDialog.cpp4
-rw-r--r--src/modules/dcc/DccCanvasWindow.cpp2
-rw-r--r--src/modules/dcc/DccChatWindow.cpp2
-rw-r--r--src/modules/dcc/DccDialog.cpp18
-rw-r--r--src/modules/dcc/DccFileTransfer.cpp6
-rw-r--r--src/modules/dcc/DccVideoWindow.cpp4
-rw-r--r--src/modules/dcc/DccVoiceCodec.cpp2
-rw-r--r--src/modules/dcc/DccVoiceWindow.cpp4
-rw-r--r--src/modules/dialog/libkvidialog.cpp8
-rw-r--r--src/modules/editor/ScriptEditorImplementation.cpp2
-rw-r--r--src/modules/file/libkvifile.cpp6
-rw-r--r--src/modules/filetransferwindow/FileTransferWindow.cpp115
-rw-r--r--src/modules/help/HelpWindow.cpp4
-rw-r--r--src/modules/http/HttpFileTransfer.cpp4
-rw-r--r--src/modules/links/LinksWindow.cpp2
-rw-r--r--src/modules/list/ListWindow.cpp10
-rw-r--r--src/modules/logview/LogFile.cpp9
-rw-r--r--src/modules/my/Idle_x11.cpp1
-rw-r--r--src/modules/notifier/NotifierWindow.cpp8
-rw-r--r--src/modules/objects/KvsObject_painter.cpp6
-rw-r--r--src/modules/objects/KvsObject_pixmap.cpp2
-rw-r--r--src/modules/objects/KvsObject_webView.cpp2
-rw-r--r--src/modules/objects/KvsObject_widget.cpp22
-rw-r--r--src/modules/objects/qthttp/qhttpauthenticator.cpp5
-rw-r--r--src/modules/options/OptionsDialog.cpp6
-rw-r--r--src/modules/options/OptionsWidgetContainer.cpp4
-rw-r--r--src/modules/options/OptionsWidget_message.cpp10
-rw-r--r--src/modules/raweditor/RawEditorWindow.cpp2
-rw-r--r--src/modules/reguser/RegisteredUsersDialog.cpp4
-rw-r--r--src/modules/reguser/RegistrationWizard.cpp4
-rw-r--r--src/modules/setup/SetupWizard.cpp5
-rw-r--r--src/modules/sharedfileswindow/SharedFilesWindow.cpp2
-rw-r--r--src/modules/socketspy/SocketSpyWindow.cpp2
-rw-r--r--src/modules/spaste/SlowPasteController.cpp4
-rw-r--r--src/modules/str/libkvistr.cpp110
-rw-r--r--src/modules/system/libkvisystem.cpp12
-rw-r--r--src/modules/term/TermWidget.cpp36
-rw-r--r--src/modules/term/TermWidget.h4
-rw-r--r--src/modules/term/TermWindow.cpp2
-rw-r--r--src/modules/term/TermWindow.h2
-rw-r--r--src/modules/term/libkviterm.cpp10
-rw-r--r--src/modules/theme/ThemeFunctions.cpp4
-rw-r--r--src/modules/theme/ThemeManagementDialog.cpp4
-rw-r--r--src/modules/tip/libkvitip.cpp4
-rw-r--r--src/modules/toolbareditor/CustomizeToolBarsDialog.cpp4
-rw-r--r--src/modules/upnp/Manager.cpp6
-rw-r--r--src/modules/upnp/RootService.cpp6
-rw-r--r--src/modules/upnp/Service.cpp34
-rw-r--r--src/modules/upnp/SsdpConnection.cpp8
-rw-r--r--src/modules/upnp/WanConnectionService.cpp14
-rw-r--r--src/modules/upnp/XmlFunctions.cpp8
-rw-r--r--src/modules/upnp/igdcontrolpoint.cpp14
-rw-r--r--src/modules/url/libkviurl.cpp16
55 files changed, 237 insertions, 358 deletions
diff --git a/src/modules/addon/AddonFunctions.cpp b/src/modules/addon/AddonFunctions.cpp
index 5aa50a1be..646cbb37a 100644
--- a/src/modules/addon/AddonFunctions.cpp
+++ b/src/modules/addon/AddonFunctions.cpp
@@ -102,7 +102,7 @@ namespace AddonFunctions
// load its picture
pByteArray = r.binaryInfoFields()->find("Image");
if(pByteArray)
- pix.loadFromData(*pByteArray, nullptr, nullptr);
+ pix.loadFromData(*pByteArray);
if(pix.isNull())
{
diff --git a/src/modules/addon/AddonManagementDialog.cpp b/src/modules/addon/AddonManagementDialog.cpp
index ffe9c4671..dccb34058 100644
--- a/src/modules/addon/AddonManagementDialog.cpp
+++ b/src/modules/addon/AddonManagementDialog.cpp
@@ -48,7 +48,7 @@
#include <QPushButton>
#include <QLayout>
#include <QApplication>
-#include <QDesktopWidget>
+#include <QScreen>
#include <QLineEdit>
#include <QLabel>
#include <QFrame>
@@ -192,7 +192,7 @@ AddonManagementDialog::AddonManagementDialog(QWidget * p)
resize(g_rectManagementDialogGeometry.width(),
g_rectManagementDialogGeometry.height());
- QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
+ QRect rect = g_pMainWindow->screen()->availableGeometry();
move(rect.x() + ((rect.width() - g_rectManagementDialogGeometry.width()) / 2), rect.y() + ((rect.height() - g_rectManagementDialogGeometry.height()) / 2));
new QShortcut(Qt::Key_Escape, this, SLOT(closeClicked()));
diff --git a/src/modules/channelsjoin/ChannelsJoinDialog.cpp b/src/modules/channelsjoin/ChannelsJoinDialog.cpp
index d2c03f419..df964d01b 100644
--- a/src/modules/channelsjoin/ChannelsJoinDialog.cpp
+++ b/src/modules/channelsjoin/ChannelsJoinDialog.cpp
@@ -38,7 +38,6 @@
#include <QCheckBox>
#include <QCloseEvent>
-#include <QDesktopWidget>
#include <QEvent>
#include <QGroupBox>
#include <QHeaderView>
@@ -47,6 +46,7 @@
#include <QLineEdit>
#include <QMouseEvent>
#include <QPushButton>
+#include <QScreen>
#include <QString>
extern ChannelsJoinDialog * g_pChannelsWindow;
@@ -131,7 +131,7 @@ ChannelsJoinDialog::ChannelsJoinDialog(const char * name)
resize(g_rectChannelsJoinGeometry.width(), g_rectChannelsJoinGeometry.height());
- QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
+ QRect rect = g_pMainWindow->screen()->availableGeometry();
move(rect.x() + ((rect.width() - g_rectChannelsJoinGeometry.width()) / 2), rect.y() + ((rect.height() - g_rectChannelsJoinGeometry.height()) / 2));
enableJoin();
diff --git a/src/modules/dcc/DccCanvasWindow.cpp b/src/modules/dcc/DccCanvasWindow.cpp
index e2adee2a4..a923d23d5 100644
--- a/src/modules/dcc/DccCanvasWindow.cpp
+++ b/src/modules/dcc/DccCanvasWindow.cpp
@@ -134,7 +134,7 @@ DccCanvasWindow::~DccCanvasWindow()
const QString & DccCanvasWindow::target()
{
// This may change on the fly...
- m_szTarget.sprintf("%s@%s:%s",
+ m_szTarget = QString::asprintf("%s@%s:%s",
m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szIp.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
return m_szTarget;
}
diff --git a/src/modules/dcc/DccChatWindow.cpp b/src/modules/dcc/DccChatWindow.cpp
index f10caab61..4dbeb7bed 100644
--- a/src/modules/dcc/DccChatWindow.cpp
+++ b/src/modules/dcc/DccChatWindow.cpp
@@ -293,7 +293,7 @@ QPixmap * DccChatWindow::myIconPtr()
void DccChatWindow::getBaseLogFileName(QString & buffer)
{
- buffer.sprintf("%s_%s_%s", m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szIp.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
+ buffer = QString::asprintf("%s_%s_%s", m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szIp.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
}
void DccChatWindow::ownMessage(const QString & text, bool bUserFeedback)
diff --git a/src/modules/dcc/DccDialog.cpp b/src/modules/dcc/DccDialog.cpp
index 6beb70ad8..15a89338d 100644
--- a/src/modules/dcc/DccDialog.cpp
+++ b/src/modules/dcc/DccDialog.cpp
@@ -33,11 +33,11 @@
#include <QPushButton>
#include <QLabel>
#include <QStringList>
-#include <QDesktopWidget>
#include <QEvent>
#include <QCloseEvent>
#include <QShowEvent>
#include <QIcon>
+#include <QScreen>
DccDialog::DccDialog(DccBroker * br, DccDescriptor * dcc)
{
@@ -120,10 +120,10 @@ void DccAcceptDialog::closeEvent(QCloseEvent * e)
void DccAcceptDialog::showEvent(QShowEvent * e)
{
- int iScreen = g_pApp->desktop()->screenNumber(g_pMainWindow);
- if(iScreen < 0)
- iScreen = g_pApp->desktop()->primaryScreen();
- QRect rect = g_pApp->desktop()->screenGeometry(iScreen);
+ QScreen *pScreen = g_pMainWindow->screen();
+ if(!pScreen)
+ pScreen = g_pApp->primaryScreen();
+ QRect rect = pScreen->availableGeometry();
move(rect.x() + ((rect.width() - width()) / 2),rect.y() + ((rect.height() - height()) / 2));
QWidget::showEvent(e);
}
@@ -186,10 +186,10 @@ void DccRenameDialog::closeEvent(QCloseEvent * e)
void DccRenameDialog::showEvent(QShowEvent * e)
{
- int iScreen = g_pApp->desktop()->screenNumber(g_pMainWindow);
- if(iScreen < 0)
- iScreen = g_pApp->desktop()->primaryScreen();
- QRect rect = g_pApp->desktop()->screenGeometry(iScreen);
+ QScreen *pScreen = g_pMainWindow->screen();
+ if(!pScreen)
+ pScreen = g_pApp->primaryScreen();
+ QRect rect = pScreen->availableGeometry();
move(rect.x() + ((rect.width() - width()) / 2),rect.y() + ((rect.height() - height()) / 2));
QWidget::showEvent(e);
}
diff --git a/src/modules/dcc/DccFileTransfer.cpp b/src/modules/dcc/DccFileTransfer.cpp
index 34fa1ff34..7e02b672a 100644
--- a/src/modules/dcc/DccFileTransfer.cpp
+++ b/src/modules/dcc/DccFileTransfer.cpp
@@ -1676,8 +1676,8 @@ void DccFileTransfer::displayPaint(QPainter * p, int column, QRect rect)
QString szFrom = __tr2qs_ctx("From: ", "dcc");
QString szTo = __tr2qs_ctx("To: ", "dcc");
- int daW1 = fm.width(szFrom);
- int daW2 = fm.width(szTo);
+ int daW1 = fm.horizontalAdvance(szFrom);
+ int daW2 = fm.horizontalAdvance(szTo);
if(daW1 < daW2)
daW1 = daW2;
int iLineSpacing = fm.lineSpacing();
@@ -2010,7 +2010,7 @@ void DccFileTransfer::addToTransferLog(const QString & s)
{
QDateTime dt = QDateTime::currentDateTime();
QString ts;
- ts.sprintf("[%4d.%2d.%2d %2d:%2d:%2d] ", dt.date().year(), dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second());
+ ts = QString::asprintf("[%4d.%2d.%2d %2d:%2d:%2d] ", dt.date().year(), dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second());
m_szTransferLog += ts + s;
m_szTransferLog += "<br>";
}
diff --git a/src/modules/dcc/DccVideoWindow.cpp b/src/modules/dcc/DccVideoWindow.cpp
index 963a30b36..7f4f66ea4 100644
--- a/src/modules/dcc/DccVideoWindow.cpp
+++ b/src/modules/dcc/DccVideoWindow.cpp
@@ -657,13 +657,13 @@ const QString & DccVideoWindow::target()
if(!m_pszTarget)
m_pszTarget = new QString();
- m_pszTarget->sprintf("%s@%s:%s", m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szIp.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
+ m_pszTarget = QString::asprintf("%s@%s:%s", m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szIp.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
return *m_pszTarget;
}
void DccVideoWindow::getBaseLogFileName(QString & buffer)
{
- buffer.sprintf("dccvideo_%s_%s_%s", m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szLocalFileName.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
+ buffer = QString::asprintf("dccvideo_%s_%s_%s", m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szLocalFileName.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
}
void DccVideoWindow::fillCaptionBuffers()
diff --git a/src/modules/dcc/DccVoiceCodec.cpp b/src/modules/dcc/DccVoiceCodec.cpp
index 5e70d176c..7036cfab7 100644
--- a/src/modules/dcc/DccVoiceCodec.cpp
+++ b/src/modules/dcc/DccVoiceCodec.cpp
@@ -223,7 +223,7 @@ void DccVideoSJpegCodec::decode(KviDataBuffer * stream, KviDataBuffer * videoSig
if(!img.isNull())
{
videoSignal->clear();
- videoSignal->append(img.bits(), img.byteCount());
+ videoSignal->append(img.bits(), img.sizeInBytes());
}
stream->remove(len);
}
diff --git a/src/modules/dcc/DccVoiceWindow.cpp b/src/modules/dcc/DccVoiceWindow.cpp
index 279823727..976e6bf74 100644
--- a/src/modules/dcc/DccVoiceWindow.cpp
+++ b/src/modules/dcc/DccVoiceWindow.cpp
@@ -833,14 +833,14 @@ void DccVoiceWindow::connectionInProgress()
const QString & DccVoiceWindow::target()
{
// This may change on the fly...
- m_szTarget.sprintf("%s@%s:%s",
+ m_szTarget = QString::asprintf("%s@%s:%s",
m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szIp.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
return m_szTarget;
}
void DccVoiceWindow::getBaseLogFileName(QString & buffer)
{
- buffer.sprintf("dccvoice_%s_%s_%s", m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szLocalFileName.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
+ buffer = QString::asprintf("dccvoice_%s_%s_%s", m_pDescriptor->szNick.toUtf8().data(), m_pDescriptor->szLocalFileName.toUtf8().data(), m_pDescriptor->szPort.toUtf8().data());
}
void DccVoiceWindow::fillCaptionBuffers()
diff --git a/src/modules/dialog/libkvidialog.cpp b/src/modules/dialog/libkvidialog.cpp
index 49dc95a42..5002fff24 100644
--- a/src/modules/dialog/libkvidialog.cpp
+++ b/src/modules/dialog/libkvidialog.cpp
@@ -41,7 +41,7 @@
#include <QLineEdit>
#include <QLabel>
#include <QPushButton>
-#include <QDesktopWidget>
+#include <QScreen>
#include <QEvent>
#include <QCloseEvent>
@@ -444,7 +444,7 @@ void KviKvsCallbackTextInput::done(int code)
void KviKvsCallbackTextInput::showEvent(QShowEvent * e)
{
- QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen());
+ QRect rect = g_pApp->primaryScreen()->availableGeometry();
move((rect.width() - width()) / 2, (rect.height() - height()) / 2);
QDialog::showEvent(e);
@@ -583,11 +583,7 @@ void KviKvsCallbackFileDialog::done(int code)
if(code == QDialog::Accepted)
{
-#ifdef COMPILE_KDE4_SUPPORT
- if(mode() == KFile::ExistingOnly)
-#else
if(fileMode() == QFileDialog::ExistingFiles)
-#endif
{
KviKvsArray * a = new KviKvsArray();
QStringList sl = selectedFiles();
diff --git a/src/modules/editor/ScriptEditorImplementation.cpp b/src/modules/editor/ScriptEditorImplementation.cpp
index a453b0951..e5d043b01 100644
--- a/src/modules/editor/ScriptEditorImplementation.cpp
+++ b/src/modules/editor/ScriptEditorImplementation.cpp
@@ -95,7 +95,7 @@ ScriptEditorWidget::ScriptEditorWidget(QWidget * pParent)
: QTextEdit(pParent)
{
m_pSyntaxHighlighter = nullptr;
- setTabStopWidth(48);
+ setTabStopDistance(48);
setAcceptRichText(false);
setWordWrapMode(QTextOption::NoWrap);
m_pParent = pParent;
diff --git a/src/modules/file/libkvifile.cpp b/src/modules/file/libkvifile.cpp
index 2ff800b5f..b57cd7f26 100644
--- a/src/modules/file/libkvifile.cpp
+++ b/src/modules/file/libkvifile.cpp
@@ -761,7 +761,7 @@ static bool file_kvs_fnc_ls(KviKvsModuleFunctionCall * c)
return true;
}
- QFlags<QDir::Filter> iFlags = nullptr;
+ QFlags<QDir::Filter> iFlags;
if(szFlags.isEmpty())
iFlags = QDir::Dirs | QDir::Files | QDir::NoSymLinks | QDir::Readable | QDir::Writable | QDir::Executable | QDir::Hidden | QDir::System;
else
@@ -784,7 +784,7 @@ static bool file_kvs_fnc_ls(KviKvsModuleFunctionCall * c)
iFlags |= QDir::System;
}
- QFlags<QDir::SortFlag> iSort = nullptr;
+ QFlags<QDir::SortFlag> iSort;
if(szFlags.isEmpty())
iSort = QDir::Unsorted;
else
@@ -1666,7 +1666,7 @@ static bool file_kvs_fnc_time(KviKvsModuleFunctionCall * c)
}
else if(szType.toLower() == "c")
{
- time = f.created();
+ time = f.birthTime();
}
else if(szType.toLower() == "m")
{
diff --git a/src/modules/filetransferwindow/FileTransferWindow.cpp b/src/modules/filetransferwindow/FileTransferWindow.cpp
index 03328ecd5..040b55483 100644
--- a/src/modules/filetransferwindow/FileTransferWindow.cpp
+++ b/src/modules/filetransferwindow/FileTransferWindow.cpp
@@ -49,17 +49,15 @@
#include <QKeyEvent>
#include <QWidgetAction>
#include <QHeaderView>
+#include <QMimeDatabase>
#include <vector>
-#ifdef COMPILE_KDE4_SUPPORT
-#include <kurl.h>
-#include <krun.h>
-#include <kmimetype.h>
-#include <kmimetypetrader.h>
-#include <kiconloader.h>
-#else
-#include <QMimeDatabase>
-#endif //COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
+#include <KApplicationTrader>
+#include <KTerminalLauncherJob>
+#include <KIO/ApplicationLauncherJob>
+#include <KIO/JobUiDelegateFactory>
+#endif //COMPILE_KDE_SUPPORT
#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
#include <shellapi.h>
@@ -440,15 +438,9 @@ void FileTransferWindow::rightButtonPressed(FileTransferItem * it, const QPoint
tmp += __tr2qs_ctx("Size: %1", "filetransferwindow").arg(KviQString::makeSizeReadable(fi.size()));
}
-#ifdef COMPILE_KDE4_SUPPORT
- tmp += "<br>";
- tmp += "Mime: ";
- tmp += KMimeType::findByPath(szFile)->name();
-#else
tmp += "<br>";
tmp += "Mime: ";
tmp += QMimeDatabase().mimeTypeForFile(szFile).name();
-#endif //COMPILE_KDE4_SUPPORT
QWidgetAction * pWaction = new QWidgetAction(m_pLocalFilePopup);
QLabel * l = new QLabel(tmp, m_pLocalFilePopup);
@@ -458,9 +450,9 @@ void FileTransferWindow::rightButtonPressed(FileTransferItem * it, const QPoint
pWaction->setDefaultWidget(l);
m_pLocalFilePopup->addAction(pWaction);
-#ifdef COMPILE_KDE4_SUPPORT
- QString mimetype = KMimeType::findByPath(szFile)->name();
- KService::List offers = KMimeTypeTrader::self()->query(mimetype, "Application");
+#ifdef COMPILE_KDE_SUPPORT
+ QString mimetype = QMimeDatabase().mimeTypeForFile(szFile).name();
+ KService::List offers = KApplicationTrader::queryByMimeType(mimetype);
pAction = m_pLocalFilePopup->addAction(__tr2qs_ctx("&Open", "filetransferwindow"), this, SLOT(openLocalFile()));
pAction->setData(-1);
@@ -473,8 +465,8 @@ void FileTransferWindow::rightButtonPressed(FileTransferItem * it, const QPoint
itOffers != offers.end(); ++itOffers)
{
pAction = m_pOpenFilePopup->addAction(
- SmallIcon((*itOffers).data()->icon()),
- (*itOffers).data()->name());
+ QIcon::fromTheme(itOffers->data()->icon()),
+ itOffers->data()->name());
pAction->setData(idx);
idx++;
}
@@ -489,7 +481,7 @@ void FileTransferWindow::rightButtonPressed(FileTransferItem * it, const QPoint
m_pLocalFilePopup->addAction(__tr2qs_ctx("Open &Location", "filetransferwindow"), this, SLOT(openLocalFileFolder()));
m_pLocalFilePopup->addAction(__tr2qs_ctx("Terminal at Location", "filetransferwindow"), this, SLOT(openLocalFileTerminal()));
m_pLocalFilePopup->addSeparator();
-#endif //COMPILE_KDE4_SUPPORT
+#endif //COMPILE_KDE_SUPPORT
//-| Grifisx & Noldor |-
#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
@@ -560,7 +552,7 @@ KviFileTransfer * FileTransferWindow::selectedTransfer()
void FileTransferWindow::openFilePopupActivated(QAction * pAction)
{
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
bool bOk = false;
int ip = pAction->data().toInt(&bOk);
if(!bOk || ip < 0)
@@ -573,8 +565,8 @@ void FileTransferWindow::openFilePopupActivated(QAction * pAction)
if(tmp.isEmpty())
return;
- QString mimetype = KMimeType::findByPath(tmp)->name();
- KService::List offers = KMimeTypeTrader::self()->query(mimetype, "Application");
+ QString mimetype = QMimeDatabase().mimeTypeForFile(tmp).name();
+ KService::List offers = KApplicationTrader::queryByMimeType(mimetype);
int idx = 0;
for(KService::List::Iterator itOffers = offers.begin();
@@ -582,16 +574,20 @@ void FileTransferWindow::openFilePopupActivated(QAction * pAction)
{
if(idx == ip)
{
- KUrl::List lst;
- KUrl url;
+ QList<QUrl> lst;
+ QUrl url;
url.setPath(tmp);
lst.append(url);
- KRun::run(*((*itOffers).data()), lst, g_pMainWindow);
+ KService::Ptr service(itOffers->data());
+ auto *job = new KIO::ApplicationLauncherJob(service);
+ job->setUrls(lst);
+ job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, g_pMainWindow));
+ job->start();
break;
}
idx++;
}
-#endif //COMPILE_KDE4_SUPPORT
+#endif //COMPILE_KDE_SUPPORT
}
void FileTransferWindow::openLocalFileTerminal()
@@ -613,7 +609,7 @@ void FileTransferWindow::openLocalFileTerminal()
tmp.prepend("cmd.exe /k cd \"");
system(tmp.toLocal8Bit().data());
#else // G&N end
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
KviFileTransfer * t = selectedTransfer();
if(!t)
return;
@@ -629,8 +625,10 @@ void FileTransferWindow::openLocalFileTerminal()
tmp.prepend("konsole --workdir=\"");
tmp.append("\"");
- KRun::runCommand(tmp, g_pMainWindow);
-#endif //COMPILE_KDE4_SUPPORT
+ auto job = new KTerminalLauncherJob(QString());
+ job->setWorkingDirectory(tmp);
+ job->start();
+#endif //COMPILE_KDE_SUPPORT
#endif
}
@@ -669,7 +667,7 @@ void FileTransferWindow::openLocalFile()
ShellExecute(0, TEXT("open"), tmp.toStdWString().c_str(), nullptr, nullptr, SW_SHOWNORMAL); //You have to link the shell32.lib
#else
// G&N end
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
KviFileTransfer * t = selectedTransfer();
if(!t)
return;
@@ -677,21 +675,23 @@ void FileTransferWindow::openLocalFile()
if(tmp.isEmpty())
return;
- QString mimetype = KMimeType::findByPath(tmp)->name(); //KMimeType
- KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimetype, "Application");
- if(!offer)
+ QString mimetype = QMimeDatabase().mimeTypeForFile(tmp).name();
+ KService::Ptr service = KApplicationTrader::preferredService(mimetype);
+ if(!service)
{
openLocalFileWith();
return;
}
- KUrl::List lst;
- KUrl url;
+ QList<QUrl> lst;
+ QUrl url;
url.setPath(tmp);
lst.append(url);
-
- KRun::run(*offer, lst, g_pMainWindow);
-#endif //COMPILE_KDE4_SUPPORT
+ auto *job = new KIO::ApplicationLauncherJob(service);
+ job->setUrls(lst);
+ job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, g_pMainWindow));
+ job->start();
+#endif //COMPILE_KDE_SUPPORT
#endif
}
@@ -710,7 +710,7 @@ void FileTransferWindow::openLocalFileWith()
WinExec(tmp.toLocal8Bit().data(), SW_SHOWNORMAL);
#else
// G&N end
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
KviFileTransfer * t = selectedTransfer();
if(!t)
return;
@@ -718,12 +718,16 @@ void FileTransferWindow::openLocalFileWith()
if(tmp.isEmpty())
return;
- KUrl::List lst;
- KUrl url;
+ QList<QUrl> lst;
+ QUrl url;
url.setPath(tmp);
lst.append(url);
- KRun::displayOpenWithDialog(lst, g_pMainWindow);
-#endif //COMPILE_KDE4_SUPPORT
+ // no service parameter brings up Run::displayOpenWithDialog
+ auto *job = new KIO::ApplicationLauncherJob();
+ job->setUrls(lst);
+ job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, g_pMainWindow));
+ job->start();
+#endif //COMPILE_KDE_SUPPORT
#endif
}
@@ -754,7 +758,7 @@ void FileTransferWindow::openLocalFileFolder()
WinExec(tmp.toLocal8Bit().data(), SW_MAXIMIZE);
#else
// G&N end
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
KviFileTransfer * t = selectedTransfer();
if(!t)
return;
@@ -767,17 +771,20 @@ void FileTransferWindow::openLocalFileFolder()
return;
tmp = tmp.left(idx);
- QString mimetype = KMimeType::findByPath(tmp)->name(); // inode/directory
- KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimetype, "Application");
- if(!offer)
+ QString mimetype = QMimeDatabase().mimeTypeForFile(tmp).name(); // inode/directory
+ KService::Ptr service = KApplicationTrader::preferredService(mimetype);
+ if(!service)
return;
- KUrl::List lst;
- KUrl url;
+ QList<QUrl> lst;
+ QUrl url;
url.setPath(tmp);
lst.append(url);
- KRun::run(*offer, lst, g_pMainWindow);
-#endif //COMPILE_KDE4_SUPPORT
+ auto *job = new KIO::ApplicationLauncherJob(service);
+ job->setUrls(lst);
+ job->setUiDelegate(KIO::createDefaultJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, g_pMainWindow));
+ job->start();
+#endif //COMPILE_KDE_SUPPORT
#endif
}
@@ -840,7 +847,7 @@ void FileTransferWindow::clearTerminated()
void FileTransferWindow::getBaseLogFileName(QString & buffer)
{
- buffer.sprintf("FILETRANSFER");
+ buffer = QString::asprintf("FILETRANSFER");
}
QPixmap * FileTransferWindow::myIconPtr()
diff --git a/src/modules/help/HelpWindow.cpp b/src/modules/help/HelpWindow.cpp
index c7140d641..3f0219df9 100644
--- a/src/modules/help/HelpWindow.cpp
+++ b/src/modules/help/HelpWindow.cpp
@@ -187,7 +187,7 @@ void HelpWindow::startSearch()
QString buf = str;
str = str.replace("-", " ");
str = str.replace(QRegExp(R"(\s[\S]?\s)"), " ");
- m_terms = str.split(" ", QString::SkipEmptyParts);
+ m_terms = str.split(" ", Qt::SkipEmptyParts);
QStringList termSeq;
QStringList seqWords;
QStringList::iterator it = m_terms.begin();
@@ -218,7 +218,7 @@ void HelpWindow::startSearch()
__tr2qs("Using a wildcard within phrases is not allowed."));
return;
}
- seqWords += s.split(' ', QString::SkipEmptyParts);
+ seqWords += s.split(' ', Qt::SkipEmptyParts);
termSeq << s;
beg = str.indexOf('\"', end + 1);
}
diff --git a/src/modules/http/HttpFileTransfer.cpp b/src/modules/http/HttpFileTransfer.cpp
index b21b81904..57540ce00 100644
--- a/src/modules/http/HttpFileTransfer.cpp
+++ b/src/modules/http/HttpFileTransfer.cpp
@@ -147,8 +147,8 @@ void HttpFileTransfer::displayPaint(QPainter * p, int column, QRect rect)
QString szFrom = __tr2qs_ctx("From: ", "http");
QString szTo = __tr2qs_ctx("To: ", "http");
- int daW1 = fm.width(szFrom);
- int daW2 = fm.width(szTo);
+ int daW1 = fm.horizontalAdvance(szFrom);
+ int daW2 = fm.horizontalAdvance(szTo);
if(daW1 < daW2)
daW1 = daW2;
int iLineSpacing = fm.lineSpacing();
diff --git a/src/modules/links/LinksWindow.cpp b/src/modules/links/LinksWindow.cpp
index 2ffb0bb88..7512608f3 100644
--- a/src/modules/links/LinksWindow.cpp
+++ b/src/modules/links/LinksWindow.cpp
@@ -107,7 +107,7 @@ LinksWindow::~LinksWindow()
void LinksWindow::getBaseLogFileName(QString & buffer)
{
- buffer.sprintf("LINKS_%d", context()->id());
+ buffer = QString::asprintf("LINKS_%d", context()->id());
}
void LinksWindow::requestLinks()
diff --git a/src/modules/list/ListWindow.cpp b/src/modules/list/ListWindow.cpp
index 8a52f28e8..aa1777ebe 100644
--- a/src/modules/list/ListWindow.cpp
+++ b/src/modules/list/ListWindow.cpp
@@ -120,18 +120,18 @@ QSize ChannelTreeWidgetItemDelegate::sizeHint(const QStyleOptionViewItem & sovIt
{
case 0:
//channel
- return QSize(fm.width(item->itemData()->m_szChan), iHeight);
+ return QSize(fm.horizontalAdvance(item->itemData()->m_szChan), iHeight);
break;
case 1:
//users
- return QSize(fm.width(item->itemData()->m_szUsers.toInt()), iHeight);
+ return QSize(fm.horizontalAdvance(item->itemData()->m_szUsers.toInt()), iHeight);
break;
case 2:
default:
//topic
if(item->itemData()->m_szStrippedTopic.isEmpty())
item->itemData()->m_szStrippedTopic = KviControlCodes::stripControlBytes(item->itemData()->m_szTopic);
- return QSize(fm.width(item->itemData()->m_szStrippedTopic), iHeight);
+ return QSize(fm.horizontalAdvance(item->itemData()->m_szStrippedTopic), iHeight);
break;
}
//make gcc happy
@@ -275,7 +275,7 @@ ListWindow::~ListWindow()
void ListWindow::getBaseLogFileName(QString & szBuffer)
{
- szBuffer.sprintf("LIST_%d", context()->id());
+ szBuffer = QString::asprintf("LIST_%d", context()->id());
}
void ListWindow::requestList()
@@ -382,7 +382,7 @@ void ListWindow::exportList()
szDate = date.toString(Qt::ISODate);
break;
case 2:
- szDate = date.toString(Qt::SystemLocaleShortDate);
+ szDate = QLocale().toString(date, QLocale::ShortFormat);
break;
}
szFile = QString(__tr2qs("Channel list for %1 - %2")).arg(connection()->currentNetworkName(), szDate);
diff --git a/src/modules/logview/LogFile.cpp b/src/modules/logview/LogFile.cpp
index 43d98f01c..be244077b 100644
--- a/src/modules/logview/LogFile.cpp
+++ b/src/modules/logview/LogFile.cpp
@@ -30,6 +30,7 @@
#include "KviFileUtils.h"
#include <QFileInfo>
+#include <QLocale>
#ifdef COMPILE_ZLIB_SUPPORT
#include <zlib.h>
@@ -91,14 +92,14 @@ LogFile::LogFile(const QString & szName)
m_date = QDate::fromString(szDate, Qt::ISODate);
break;
case 2:
- m_date = QDate::fromString(szDate, Qt::SystemLocaleShortDate);
+ m_date = QLocale().toDate(szDate, QLocale::ShortFormat);
if(!m_date.isValid())
{
// some locale date formats use '/' as a separator; we change them to '-'
// when creating log files. Try to reverse that change here
QString szUnescapedDate = szDate;
szUnescapedDate.replace('-', KVI_PATH_SEPARATOR_CHAR);
- m_date = QDate::fromString(szUnescapedDate, Qt::SystemLocaleShortDate);
+ m_date = QLocale().toDate(szUnescapedDate, QLocale::ShortFormat);
if(m_date.isValid())
{
//qt4 defaults to 1900 for years. So "11" means "1911" instead of "2011".. what a pity
@@ -122,14 +123,14 @@ LogFile::LogFile(const QString & szName)
m_date = QDate::fromString(szDate, Qt::ISODate);
if(!m_date.isValid())
{
- m_date = QDate::fromString(szDate, Qt::SystemLocaleShortDate);
+ m_date = QLocale().toDate(szDate, QLocale::ShortFormat);
if(!m_date.isValid())
{
// some locale date formats use '/' as a separator; we change them to '-'
// when creating log files. Try to reverse that change here
QString szUnescapedDate = szDate;
szUnescapedDate.replace('-', KVI_PATH_SEPARATOR_CHAR);
- m_date = QDate::fromString(szUnescapedDate, Qt::SystemLocaleShortDate);
+ m_date = QLocale().toDate(szUnescapedDate, QLocale::ShortFormat);
if(m_date.isValid())
{
//qt4 defaults to 1900 for years. So "11" means "1911" instead of "2011".. what a pity
diff --git a/src/modules/my/Idle_x11.cpp b/src/modules/my/Idle_x11.cpp
index 2913369e0..a859c2771 100644
--- a/src/modules/my/Idle_x11.cpp
+++ b/src/modules/my/Idle_x11.cpp
@@ -30,7 +30,6 @@ int IdlePlatform::secondsIdle() const { return 0; }
#else
// COMPILE_XSS_SUPPORT implies COMPILE_QX11INFO_SUPPORT
#include <QApplication>
-#include <QDesktopWidget>
#include <QX11Info>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
diff --git a/src/modules/notifier/NotifierWindow.cpp b/src/modules/notifier/NotifierWindow.cpp
index d3a7f6902..6e0dd3fcd 100644
--- a/src/modules/notifier/NotifierWindow.cpp
+++ b/src/modules/notifier/NotifierWindow.cpp
@@ -38,7 +38,6 @@
#include "KviThemedLineEdit.h"
#include <QApplication>
-#include <QDesktopWidget>
#include <QEvent>
#include <QFontMetrics>
#include <QImage>
@@ -47,6 +46,7 @@
#include <QPaintEvent>
#include <QPen>
#include <QRegExp>
+#include <QScreen>
#include <QToolTip>
extern NotifierWindow * g_pNotifierWindow;
@@ -75,8 +75,7 @@ NotifierWindow::NotifierWindow()
hide();
// Positioning the notifier bottom-right
- QDesktopWidget * pDesktop = QApplication::desktop();
- QRect r = pDesktop->availableGeometry(pDesktop->primaryScreen());
+ QRect r = g_pApp->primaryScreen()->availableGeometry();
m_wndRect.setRect(
r.x() + r.width() - (WDG_MIN_WIDTH + SPACING),
@@ -227,10 +226,11 @@ void NotifierWindow::stopAutoHideTimer()
#if COMPILE_KDE_SUPPORT
#include <kwindowsystem.h>
+#include <kx11extras.h>
static bool active_window_is_full_screen()
{
- WId activeId = KWindowSystem::activeWindow();
+ WId activeId = KX11Extras::activeWindow();
KWindowInfo wi = KWindowInfo(activeId, NET::WMState);
return (wi.valid() && wi.hasState(NET::FullScreen));
}
diff --git a/src/modules/objects/KvsObject_painter.cpp b/src/modules/objects/KvsObject_painter.cpp
index 4918253d3..0b425d38b 100644
--- a/src/modules/objects/KvsObject_painter.cpp
+++ b/src/modules/objects/KvsObject_painter.cpp
@@ -887,7 +887,7 @@ KVSO_CLASS_FUNCTION(painter, drawRoundRect)
KVSO_PARAMETERS_END(c)
QString function = "$drawRoundRect";
KVSO_PARAMETERS_PAINTER(pXOrArray, iY, iW, iH)
- m_pPainter->drawRoundRect(iX, iY, iW, iH, iXrnd, iYrnd);
+ m_pPainter->drawRoundedRect(iX, iY, iW, iH, iXrnd, iYrnd);
return true;
}
@@ -1140,7 +1140,7 @@ KVSO_CLASS_FUNCTION(painter, fontMetricsWidth)
KVSO_PARAMETER("text", KVS_PT_STRING, 0, szText)
KVSO_PARAMETERS_END(c)
if(m_pPainter->isActive())
- c->returnValue()->setInteger(m_pPainter->fontMetrics().width(szText));
+ c->returnValue()->setInteger(m_pPainter->fontMetrics().horizontalAdvance(szText));
else
c->warning(__tr2qs_ctx("$fontMetricsWidth: the painter is not active!", "objects"));
return true;
@@ -1193,7 +1193,7 @@ KVSO_CLASS_FUNCTION(painter, begin)
QPrintDialog printDialog(m_pPrinter, nullptr);
if(printDialog.exec() == QDialog::Accepted)
{
- qDebug("papersize %d", m_pPrinter->paperSize());
+ qDebug("papersize %d", m_pPrinter->pageLayout().pageSize().id());
m_pPainter->begin(m_pPrinter);
return true;
}
diff --git a/src/modules/objects/KvsObject_pixmap.cpp b/src/modules/objects/KvsObject_pixmap.cpp
index e3ef0a5c8..9bd184479 100644
--- a/src/modules/objects/KvsObject_pixmap.cpp
+++ b/src/modules/objects/KvsObject_pixmap.cpp
@@ -668,7 +668,7 @@ KVSO_CLASS_FUNCTION(pixmap, grabWidget)
}
if(!m_pPixmap)
m_pPixmap = new QPixmap();
- *m_pPixmap = QPixmap::grabWidget(((KvsObject_widget *)pObject)->widget());
+ *m_pPixmap = ((KvsObject_widget *)pObject)->widget()->grab();
return true;
}
diff --git a/src/modules/objects/KvsObject_webView.cpp b/src/modules/objects/KvsObject_webView.cpp
index abb46faba..d61077532 100644
--- a/src/modules/objects/KvsObject_webView.cpp
+++ b/src/modules/objects/KvsObject_webView.cpp
@@ -1115,7 +1115,7 @@ KVSO_CLASS_FUNCTION(webView, hitTestContent)
return true;
KviKvsHash * pHash = new KviKvsHash();
pHash->set("imageurl", new KviKvsVariant(res.imageUrl().toString()));
- pHash->set("linktitle", new KviKvsVariant(res.linkTitle().toString()));
+ pHash->set("linktitle", new KviKvsVariant(res.linkTitleString()));
pHash->set("linktext", new KviKvsVariant(res.linkText()));
pHash->set("linkelement", new KviKvsVariant((kvs_int_t)insertElement(res.linkElement())));
pHash->set("enclosingelement", new KviKvsVariant((kvs_int_t)insertElement(res.enclosingBlockElement())));
diff --git a/src/modules/objects/KvsObject_widget.cpp b/src/modules/objects/KvsObject_widget.cpp
index c41183d5b..3da0bc09b 100644
--- a/src/modules/objects/KvsObject_widget.cpp
+++ b/src/modules/objects/KvsObject_widget.cpp
@@ -38,7 +38,6 @@
#include "KvsObject_painter.h"
#include <QKeyEvent>
-#include <QDesktopWidget>
#include <QWidget>
#include <QToolTip>
#include <QFont>
@@ -54,12 +53,9 @@
#include <QPainter>
#include <QApplication>
#include <QPoint>
+#include <QScreen>
#include <QContextMenuEvent>
-#ifdef COMPILE_KDE4_SUPPORT
-#include <KStatusBar>
-#endif
-
KviKvsWidget::KviKvsWidget(KvsObject_widget * object, QWidget * par)
: QWidget(par), m_pObject(object)
{
@@ -104,9 +100,9 @@ const char * const widgetattributes_tbl[] = {
const QPalette::ColorRole colorrole_cod[] = {
QPalette::Window,
- QPalette::Background,
+ QPalette::Window,
+ QPalette::WindowText,
QPalette::WindowText,
- QPalette::Foreground,
QPalette::Base,
QPalette::AlternateBase,
QPalette::Text,
@@ -1088,7 +1084,7 @@ KVSO_CLASS_FUNCTION(widget, fontMetricsWidth)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("string", KVS_PT_STRING, 0, m_szStr)
KVSO_PARAMETERS_END(c)
- c->returnValue()->setInteger(widget()->fontMetrics().width(m_szStr));
+ c->returnValue()->setInteger(widget()->fontMetrics().horizontalAdvance(m_szStr));
return true;
}
@@ -1110,7 +1106,7 @@ KVSO_CLASS_FUNCTION(widget, screenResolution)
{
CHECK_INTERNAL_POINTER(widget())
KviKvsArray * a = new KviKvsArray();
- QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen());
+ QRect rect = g_pApp->primaryScreen()->availableGeometry();
a->set(0, new KviKvsVariant((kvs_int_t)rect.width()));
a->set(1, new KviKvsVariant((kvs_int_t)rect.height()));
c->returnValue()->setArray(a);
@@ -1241,7 +1237,7 @@ KVSO_CLASS_FUNCTION(widget, mapFromGlobal)
KVSO_CLASS_FUNCTION(widget, centerToScreen)
{
CHECK_INTERNAL_POINTER(widget())
- QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen());
+ QRect rect = g_pApp->primaryScreen()->availableGeometry();
widget()->move((rect.width() - widget()->width()) / 2, (rect.height() - widget()->height()) / 2);
return true;
}
@@ -1825,10 +1821,10 @@ KVSO_CLASS_FUNCTION(widget, setWFlags)
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("widget_flags", KVS_PT_STRINGLIST, KVS_PF_OPTIONAL, wflags)
KVSO_PARAMETERS_END(c)
- Qt::WindowFlags flag, sum = nullptr;
+ Qt::WindowFlags flag, sum;
for(auto & it : wflags)
{
- flag = nullptr;
+ flag = Qt::WindowFlags();
for(size_t j{}; j < widgettypes_num; j++)
{
if(KviQString::equalCI(it, widgettypes_tbl[j]))
@@ -2155,7 +2151,7 @@ KVSO_CLASS_FUNCTION(widget, grab)
QPixmap * pPixmap = new QPixmap();
qDebug("grabbing");
- *pPixmap = QPixmap::grabWidget(((QWidget *)(ob->object())));
+ *pPixmap = ((QWidget *)(ob->object()))->grab();
KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass("pixmap");
KviKvsVariantList params;
KviKvsObject * pObject = pClass->allocateInstance(nullptr, "internalpixmap", c->context(), &params);
diff --git a/src/modules/objects/qthttp/qhttpauthenticator.cpp b/src/modules/objects/qthttp/qhttpauthenticator.cpp
index 194fe856d..9acb7717b 100644
--- a/src/modules/objects/qthttp/qhttpauthenticator.cpp
+++ b/src/modules/objects/qthttp/qhttpauthenticator.cpp
@@ -50,6 +50,7 @@
#include <qendian.h>
#include <qstring.h>
#include <qdatetime.h>
+#include <QRandomGenerator>
//#define NTLMV1_CLIENT
@@ -284,7 +285,7 @@ void QHttpAuthenticator::detach()
if(!d)
{
d = new QHttpAuthenticatorPrivate;
- d->ref.store(1);
+ d->ref.storeRelaxed(1);
return;
}
@@ -351,7 +352,7 @@ bool QHttpAuthenticator::isNull() const
QHttpAuthenticatorPrivate::QHttpAuthenticatorPrivate()
: ref(0), method(None), hasFailed(false), phase(Start), nonceCount(0)
{
- cnonce = QCryptographicHash::hash(QByteArray::number(qrand(), 16) + QByteArray::number(qrand(), 16),
+ cnonce = QCryptographicHash::hash(QByteArray::number(QRandomGenerator::global()->generate(), 16) + QByteArray::number(QRandomGenerator::global()->generate(), 16),
QCryptographicHash::Md5)
.toHex();
nonceCount = 0;
diff --git a/src/modules/options/OptionsDialog.cpp b/src/modules/options/OptionsDialog.cpp
index 6883337aa..d067e83fe 100644
--- a/src/modules/options/OptionsDialog.cpp
+++ b/src/modules/options/OptionsDialog.cpp
@@ -45,8 +45,8 @@
#include <QEvent>
#include <QCloseEvent>
#include <QShortcut>
+#include <QScreen>
#include <QHeaderView>
-#include <QDesktopWidget>
#include <QStackedWidget>
#include <QMenu>
@@ -289,7 +289,7 @@ OptionsDialog::~OptionsDialog()
void OptionsDialog::showEvent(QShowEvent * e)
{
// setup a minimum size and move to the screen the main kvirc window is
- QRect r = g_pApp->desktop()->screenGeometry(g_pMainWindow);
+ QRect r = g_pMainWindow->screen()->availableGeometry();
int w = r.width();
int h = r.height();
@@ -466,7 +466,7 @@ void OptionsDialog::search(const QStringList & lKeywords)
void OptionsDialog::search(const QString & szKeywords)
{
- QStringList lKeywords = szKeywords.split(" ", QString::SkipEmptyParts);
+ QStringList lKeywords = szKeywords.split(" ", Qt::SkipEmptyParts);
search(lKeywords);
}
diff --git a/src/modules/options/OptionsWidgetContainer.cpp b/src/modules/options/OptionsWidgetContainer.cpp
index 6ff3e5e31..4b5c40a76 100644
--- a/src/modules/options/OptionsWidgetContainer.cpp
+++ b/src/modules/options/OptionsWidgetContainer.cpp
@@ -33,11 +33,11 @@
#include <QLayout>
#include <QPushButton>
-#include <QDesktopWidget>
#include <QEvent>
#include <QGridLayout>
#include <QCloseEvent>
#include <QIcon>
+#include <QScreen>
extern OptionsInstanceManager * g_pOptionsInstanceManager;
@@ -142,7 +142,7 @@ void OptionsWidgetContainer::showEvent(QShowEvent * e)
{
if(!parent())
{
- QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
+ QRect rect = g_pMainWindow->screen()->availableGeometry();
move(rect.x() + ((rect.width() - width()) / 2), rect.y() + ((rect.height() - height()) / 2));
}
diff --git a/src/modules/options/OptionsWidget_message.cpp b/src/modules/options/OptionsWidget_message.cpp
index 2755bedfe..2b9319579 100644
--- a/src/modules/options/OptionsWidget_message.cpp
+++ b/src/modules/options/OptionsWidget_message.cpp
@@ -657,29 +657,29 @@ void OptionsWidget_messageColors::load()
{
MessageListWidgetItem * it = (MessageListWidgetItem *)m_pListView->item(i);
- tmp.sprintf("Fore%d", it->optionId());
+ tmp = QString::asprintf("Fore%d", it->optionId());
int fore = cfg.readIntEntry(tmp, it->msgType()->fore());
if(fore < 0 || fore > 15)
fore = 0;
it->msgType()->setFore(fore);
- tmp.sprintf("Back%d", it->optionId());
+ tmp = QString::asprintf("Back%d", it->optionId());
int back = cfg.readIntEntry(tmp, it->msgType()->back());
if(back < 0 || back > 15)
back = KviControlCodes::Transparent;
it->msgType()->setBack(back);
- tmp.sprintf("Icon%d", it->optionId());
+ tmp = QString::asprintf("Icon%d", it->optionId());
int ico = cfg.readIntEntry(tmp, it->msgType()->pixId());
if(ico < 0 || ico >= KviIconManager::IconCount)
ico = 0;
it->msgType()->setPixId(ico);
- tmp.sprintf("Log%d", it->optionId());
+ tmp = QString::asprintf("Log%d", it->optionId());
bool bLog = cfg.readBoolEntry(tmp, it->msgType()->logEnabled());
it->msgType()->enableLogging(bLog);
- tmp.sprintf("Level%d", it->optionId());
+ tmp = QString::asprintf("Level%d", it->optionId());
int iLevel = cfg.readIntEntry(tmp, it->msgType()->level());
it->msgType()->setLevel(iLevel);
diff --git a/src/modules/raweditor/RawEditorWindow.cpp b/src/modules/raweditor/RawEditorWindow.cpp
index c9aedb643..0cfb8489c 100644
--- a/src/modules/raweditor/RawEditorWindow.cpp
+++ b/src/modules/raweditor/RawEditorWindow.cpp
@@ -54,7 +54,7 @@ RawTreeWidgetItem::RawTreeWidgetItem(QTreeWidget * par, int idx, bool bEnabled)
{
m_iIdx = idx;
QString szName;
- szName.sprintf("%03d", idx);
+ szName = QString::asprintf("%03d", idx);
setText(0, szName);
setEnabled(bEnabled);
}
diff --git a/src/modules/reguser/RegisteredUsersDialog.cpp b/src/modules/reguser/RegisteredUsersDialog.cpp
index 5f51decd6..4ebdcfbff 100644
--- a/src/modules/reguser/RegisteredUsersDialog.cpp
+++ b/src/modules/reguser/RegisteredUsersDialog.cpp
@@ -53,7 +53,6 @@
#include <QImageReader>
#include <QImage>
#include <QString>
-#include <QDesktopWidget>
#include <QComboBox>
#include <QToolTip>
#include <QStyle>
@@ -64,6 +63,7 @@
#include <QAbstractItemView>
#include <QAbstractTextDocumentLayout>
#include <QShortcut>
+#include <QScreen>
#include <memory>
@@ -331,7 +331,7 @@ RegisteredUsersDialog::RegisteredUsersDialog(QWidget * par)
resize(KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).width(),
KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).height());
- QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
+ QRect rect = g_pMainWindow->screen()->availableGeometry();
move(rect.x() + ((rect.width() - KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).width()) / 2), rect.y() + ((rect.height() - KVI_OPTION_RECT(KviOption_rectRegisteredUsersDialogGeometry).height()) / 2));
}
}
diff --git a/src/modules/reguser/RegistrationWizard.cpp b/src/modules/reguser/RegistrationWizard.cpp
index 7cd29fea4..cc42624bc 100644
--- a/src/modules/reguser/RegistrationWizard.cpp
+++ b/src/modules/reguser/RegistrationWizard.cpp
@@ -33,7 +33,6 @@
#include "KviRegisteredUserDataBase.h"
#include "KviIconManager.h"
-#include <QDesktopWidget>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
@@ -41,6 +40,7 @@
#include <QLayout>
#include <QVariant>
#include <QFrame>
+#include <QScreen>
extern KVIRC_API KviRegisteredUserDataBase * g_pRegisteredUserDataBase;
extern KviPointerList<RegistrationWizard> * g_pRegistrationWizardList;
@@ -404,7 +404,7 @@ void RegistrationWizard::showEvent(QShowEvent * e)
if(height() < 420)
resize(width(), 420);
- QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen());
+ QRect rect = g_pApp->primaryScreen()->availableGeometry();
move((rect.width() - width()) / 2, (rect.height() - height()) / 2);
KviTalWizard::showEvent(e);
}
diff --git a/src/modules/setup/SetupWizard.cpp b/src/modules/setup/SetupWizard.cpp
index 8cef633e1..64f0aaf14 100644
--- a/src/modules/setup/SetupWizard.cpp
+++ b/src/modules/setup/SetupWizard.cpp
@@ -45,7 +45,7 @@ bool g_bFoundMirc;
#include <QValidator>
#include <QTextCodec>
#include <QLayout>
-#include <QDesktopWidget>
+#include <QScreen>
#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)
#include <winnls.h> // for MultiByteToWideChar
@@ -608,8 +608,7 @@ SetupWizard::~SetupWizard()
void SetupWizard::showEvent(QShowEvent * e)
{
- int primary_screen = g_pApp->desktop()->primaryScreen();
- QRect r = g_pApp->desktop()->screenGeometry(primary_screen);
+ QRect r = g_pApp->primaryScreen()->availableGeometry();
int w = r.width();
int h = r.height();
diff --git a/src/modules/sharedfileswindow/SharedFilesWindow.cpp b/src/modules/sharedfileswindow/SharedFilesWindow.cpp
index 27dffb0e5..00019eaac 100644
--- a/src/modules/sharedfileswindow/SharedFilesWindow.cpp
+++ b/src/modules/sharedfileswindow/SharedFilesWindow.cpp
@@ -337,7 +337,7 @@ void SharedFilesWindow::sharedFileRemoved(KviSharedFile * f)
void SharedFilesWindow::getBaseLogFileName(QString & buffer)
{
- buffer.sprintf("SHAREDFILES");
+ buffer = QString::asprintf("SHAREDFILES");
}
QPixmap * SharedFilesWindow::myIconPtr()
diff --git a/src/modules/socketspy/SocketSpyWindow.cpp b/src/modules/socketspy/SocketSpyWindow.cpp
index 03df1b107..08a9a206a 100644
--- a/src/modules/socketspy/SocketSpyWindow.cpp
+++ b/src/modules/socketspy/SocketSpyWindow.cpp
@@ -74,7 +74,7 @@ QSize SocketSpyWindow::sizeHint() const
void SocketSpyWindow::getBaseLogFileName(QString & buffer)
{
- buffer.sprintf("SOCKETSPY_%d", context()->id());
+ buffer = QString::asprintf("SOCKETSPY_%d", context()->id());
}
void SocketSpyWindow::fillCaptionBuffers()
diff --git a/src/modules/spaste/SlowPasteController.cpp b/src/modules/spaste/SlowPasteController.cpp
index 8d724e766..f60e84396 100644
--- a/src/modules/spaste/SlowPasteController.cpp
+++ b/src/modules/spaste/SlowPasteController.cpp
@@ -88,11 +88,11 @@ bool SlowPasteController::pasteClipboardInit()
QString tmp(g_pApp->clipboard()->text());
if(m_pClipBuff)
{
- (*m_pClipBuff) += tmp.isEmpty() ? QStringList() : tmp.split("\n", QString::KeepEmptyParts);
+ (*m_pClipBuff) += tmp.isEmpty() ? QStringList() : tmp.split("\n", Qt::KeepEmptyParts);
}
else
{
- m_pClipBuff = new QStringList(tmp.isEmpty() ? QStringList() : tmp.split("\n", QString::KeepEmptyParts));
+ m_pClipBuff = new QStringList(tmp.isEmpty() ? QStringList() : tmp.split("\n", Qt::KeepEmptyParts));
}
//avoid double connection
disconnect(m_pTimer, SIGNAL(timeout()), nullptr, nullptr);
diff --git a/src/modules/str/libkvistr.cpp b/src/modules/str/libkvistr.cpp
index bd836d4a0..82922e988 100644
--- a/src/modules/str/libkvistr.cpp
+++ b/src/modules/str/libkvistr.cpp
@@ -1720,7 +1720,6 @@ static bool str_kvs_fnc_split(KviKvsModuleFunctionCall * c)
KVSM_PARAMETER("maxitems", KVS_PT_INTEGER, KVS_PF_OPTIONAL, iMaxItems)
KVSM_PARAMETERS_END(c)
-#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
if(c->params()->count() < 4)
iMaxItems = -1;
@@ -1738,7 +1737,7 @@ static bool str_kvs_fnc_split(KviKvsModuleFunctionCall * c)
bool bWild = szFla.contains('w', Qt::CaseInsensitive);
bool bContainsR = szFla.contains('r', Qt::CaseInsensitive);
- QString::SplitBehavior splitBehavior = szFla.contains('n', Qt::CaseInsensitive) ? QString::SkipEmptyParts : QString::KeepEmptyParts;
+ Qt::SplitBehavior splitBehavior = szFla.contains('n', Qt::CaseInsensitive) ? Qt::SkipEmptyParts : Qt::KeepEmptyParts;
Qt::CaseSensitivity sensitivity = szFla.contains('s', Qt::CaseInsensitive) ? Qt::CaseSensitive : Qt::CaseInsensitive;
QVector<QStringRef> list;
@@ -1758,113 +1757,6 @@ static bool str_kvs_fnc_split(KviKvsModuleFunctionCall * c)
a->append(new KviKvsVariant{list[i].toString()});
a->append(new KviKvsVariant{szStr.mid(list[iMaxItems - 1].position())});
}
-#else //QT_VERSION
- if(c->params()->count() < 4)
- iMaxItems = -1;
-
- KviKvsArray * a = new KviKvsArray();
- c->returnValue()->setArray(a);
-
- if(szSep.isEmpty())
- {
- a->set(0, new KviKvsVariant(szStr));
- return true;
- }
-
- if(iMaxItems == 0)
- return true;
-
- bool bWild = szFla.contains('w', Qt::CaseInsensitive);
- bool bContainsR = szFla.contains('r', Qt::CaseInsensitive);
- bool bCaseSensitive = szFla.contains('s', Qt::CaseInsensitive);
- bool bNoEmpty = szFla.contains('n', Qt::CaseInsensitive);
-
- int id = 0;
-
- int iMatch = 0;
- int iStrLen = szStr.length();
- int iBegin = 0;
-
- if(bContainsR || bWild)
- {
- QRegExp re(szSep, bCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive, bWild ? QRegExp::Wildcard : QRegExp::RegExp2);
-
- while((iMatch != -1) && (iMatch < iStrLen) && ((id < (iMaxItems - 1)) || (iMaxItems < 0)))
- {
- iMatch = re.indexIn(szStr, iBegin);
- if(iMatch != -1)
- {
- int len = re.matchedLength();
- if((len == 0) && (iBegin == iMatch))
- iMatch++; // safety measure for empty string matching
-
- QString tmp = szStr.mid(iBegin, iMatch - iBegin);
- if(bNoEmpty)
- {
- if(!tmp.isEmpty())
- {
- a->set(id, new KviKvsVariant(tmp));
- id++;
- }
- }
- else
- {
- a->set(id, new KviKvsVariant(tmp));
- id++;
- }
-
- iMatch += len;
- iBegin = iMatch;
- }
- }
- }
- else
- {
- while((iMatch != -1) && (iMatch < iStrLen) && ((id < (iMaxItems - 1)) || (iMaxItems < 0)))
- {
- iMatch = szStr.indexOf(szSep, iBegin, bCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);
- if(iMatch != -1)
- {
- QString tmp = szStr.mid(iBegin, iMatch - iBegin);
- if(bNoEmpty)
- {
- if(!tmp.isEmpty())
- {
- a->set(id, new KviKvsVariant(tmp));
- id++;
- }
- }
- else
- {
- a->set(id, new KviKvsVariant(tmp));
- id++;
- }
-
- iMatch += szSep.length();
- iBegin = iMatch;
- }
- }
- }
-
- if(iBegin < iStrLen)
- {
- QString tmpx = szStr.right(iStrLen - iBegin);
- if(bNoEmpty)
- {
- if(!tmpx.isEmpty())
- a->set(id, new KviKvsVariant(tmpx));
- }
- else
- {
- a->set(id, new KviKvsVariant(tmpx));
- }
- }
- else
- {
- if(!bNoEmpty)
- a->set(id, new KviKvsVariant(QString())); // empty string at the end
- }
-#endif //QT_VERSION
return true;
}
diff --git a/src/modules/system/libkvisystem.cpp b/src/modules/system/libkvisystem.cpp
index 842d3fa3f..c1d8f08a0 100644
--- a/src/modules/system/libkvisystem.cpp
+++ b/src/modules/system/libkvisystem.cpp
@@ -50,9 +50,7 @@
#endif
#ifdef COMPILE_KDE_SUPPORT
-// invokeTerminal() for system.runcmd
-// tools we need to work around the absence of
-#include <KToolInvocation>
+#include <KTerminalLauncherJob>
#endif
// invokeTerminal()
#include <QProcess>
@@ -759,10 +757,10 @@ static bool system_kvs_cmd_runcmd(KviKvsModuleCommandCall * c)
}
#ifdef COMPILE_KDE_SUPPORT // We have invokeTerminal().
-
- KToolInvocation::invokeTerminal(szCommand.toLocal8Bit());
-
-#else // No invokeTerminal() for us, we'll use a
+ auto job = new KTerminalLauncherJob(szCommand);
+ job->start();
+#else
+ // No invokeTerminal() for us, we'll use a
// combination of QStringList and QProcess.
QStringList szTerminals;
#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) // Only »cmd.exe /k« in the list.
diff --git a/src/modules/term/TermWidget.cpp b/src/modules/term/TermWidget.cpp
index 304daea00..14ea1e518 100644
--- a/src/modules/term/TermWidget.cpp
+++ b/src/modules/term/TermWidget.cpp
@@ -34,11 +34,10 @@
#include <QToolTip>
#include <QTimer>
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
-#include "klibloader.h"
-#include "kparts/part.h"
-#include "kparts/factory.h"
+#include <KPluginFactory>
+#include <KParts/ReadOnlyPart>
#include <kde_terminal_interface.h>
#include <unordered_set>
@@ -78,32 +77,23 @@ TermWidget::TermWidget(QWidget * par, bool bIsStandalone)
setFrameStyle(QFrame::Sunken | QFrame::Panel);
- KPluginFactory * pKonsoleFactory = KPluginLoader("libkonsolepart").factory();
+ m_pKonsolePart = KPluginFactory::instantiatePlugin<KParts::ReadOnlyPart>(KPluginMetaData(QStringLiteral("konsolepart")), this).plugin;
- if(pKonsoleFactory)
+ if(m_pKonsolePart)
{
- m_pKonsolePart = static_cast<KParts::ReadOnlyPart *>(pKonsoleFactory->create<QObject>(this, this));
+ // start the terminal
+ qobject_cast<TerminalInterface *>(m_pKonsolePart)->showShellInDir(QString());
- if(m_pKonsolePart)
- {
- // start the terminal
- qobject_cast<TerminalInterface *>(m_pKonsolePart)->showShellInDir(QString());
+ m_pKonsoleWidget = m_pKonsolePart->widget();
- m_pKonsoleWidget = m_pKonsolePart->widget();
+ setFocusProxy(m_pKonsoleWidget);
+ m_pKonsoleWidget->show();
- setFocusProxy(m_pKonsoleWidget);
- m_pKonsoleWidget->show();
-
- connect(m_pKonsolePart, SIGNAL(destroyed()), this, SLOT(konsoleDestroyed()));
- }
- else
- {
- m_pKonsoleWidget = new QLabel(__tr2qs("Can't create the terminal emulation part"), this);
- }
+ connect(m_pKonsolePart, SIGNAL(destroyed()), this, SLOT(konsoleDestroyed()));
}
else
{
- m_pKonsoleWidget = new QLabel(__tr2qs("Can't retrieve the terminal emulation factory"), this);
+ m_pKonsoleWidget = new QLabel(__tr2qs("Can't create the terminal emulation part"), this);
}
}
@@ -183,4 +173,4 @@ QSize TermWidget::sizeHint() const
return QSize(wdth + 2, hght + 2);
}
-#endif //COMPILE_KDE4_SUPPORT
+#endif //COMPILE_KDE_SUPPORT
diff --git a/src/modules/term/TermWidget.h b/src/modules/term/TermWidget.h
index d9e41fae0..4c5794443 100644
--- a/src/modules/term/TermWidget.h
+++ b/src/modules/term/TermWidget.h
@@ -26,13 +26,13 @@
#include "kvi_settings.h"
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include <QFrame>
#include <QLabel>
#include <QPushButton>
#include "KviTalHBox.h"
-#include "kparts/part.h"
+#include <KParts/Part>
class KviMainWindow;
diff --git a/src/modules/term/TermWindow.cpp b/src/modules/term/TermWindow.cpp
index 9ee745226..76f6bbb5a 100644
--- a/src/modules/term/TermWindow.cpp
+++ b/src/modules/term/TermWindow.cpp
@@ -25,7 +25,7 @@
#include "TermWindow.h"
#include "TermWidget.h"
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include "KviIconManager.h"
#include "KviOptions.h"
#include "KviLocale.h"
diff --git a/src/modules/term/TermWindow.h b/src/modules/term/TermWindow.h
index 2fc4a87ec..25e4365a6 100644
--- a/src/modules/term/TermWindow.h
+++ b/src/modules/term/TermWindow.h
@@ -26,7 +26,7 @@
#include "kvi_settings.h"
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include "KviWindow.h"
#include "KviCString.h"
diff --git a/src/modules/term/libkviterm.cpp b/src/modules/term/libkviterm.cpp
index 4c56d5f1d..b4bc32b8a 100644
--- a/src/modules/term/libkviterm.cpp
+++ b/src/modules/term/libkviterm.cpp
@@ -29,7 +29,7 @@
#include <QSplitter>
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
#include "TermWidget.h"
#include "TermWindow.h"
@@ -66,7 +66,7 @@ KviModule * g_pTermModule = nullptr;
static bool term_kvs_cmd_open(KviKvsModuleCommandCall * c)
{
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
c->module()->lock(); // multiple locks are allowed
if(
c->hasSwitch('m', "mdi") || // compat only
@@ -81,7 +81,7 @@ static bool term_kvs_cmd_open(KviKvsModuleCommandCall * c)
w->show();
}
#else
- c->warning("Terminal emulation service not supported (non-KDE4 compilation)");
+ c->warning("Terminal emulation service not supported (non-KDE compilation)");
#endif
return true;
}
@@ -96,9 +96,9 @@ static bool term_module_init(KviModule * m)
static bool term_module_cleanup(KviModule *)
{
-#ifdef COMPILE_KDE4_SUPPORT
+#ifdef COMPILE_KDE_SUPPORT
while(!g_pTermWidgetList.empty())
- delete *g_pSocketSpyWindowList.begin();
+ delete *g_pTermWidgetList.begin();
while(!g_pTermWindowList.empty())
(*g_pTermWindowList.begin())->close();
diff --git a/src/modules/theme/ThemeFunctions.cpp b/src/modules/theme/ThemeFunctions.cpp
index 0f9b92de4..187a21f13 100644
--- a/src/modules/theme/ThemeFunctions.cpp
+++ b/src/modules/theme/ThemeFunctions.cpp
@@ -115,7 +115,7 @@ namespace ThemeFunctions
// load its picture
pByteArray = r.binaryInfoFields()->find("Image");
if(pByteArray)
- pix.loadFromData(*pByteArray, nullptr, nullptr);
+ pix.loadFromData(*pByteArray);
if(pix.isNull())
{
@@ -182,7 +182,7 @@ namespace ThemeFunctions
QPixmap pixScreenshot;
pByteArray = r.binaryInfoFields()->find(szTmp);
if(pByteArray)
- pixScreenshot.loadFromData(*pByteArray, nullptr, nullptr);
+ pixScreenshot.loadFromData(*pByteArray);
if(szThemeName.isEmpty() || szThemeVersion.isEmpty() || szThemeSubdirectory.isEmpty() || szThemeEngineVersion.isEmpty())
bValid = false;
diff --git a/src/modules/theme/ThemeManagementDialog.cpp b/src/modules/theme/ThemeManagementDialog.cpp
index 3b4fe8ed9..088042c25 100644
--- a/src/modules/theme/ThemeManagementDialog.cpp
+++ b/src/modules/theme/ThemeManagementDialog.cpp
@@ -54,7 +54,6 @@
#include <QRegExp>
#include <QMessageBox>
#include <QDir>
-#include <QDesktopWidget>
#include <QStringList>
#include <QDateTime>
#include <QFileDialog>
@@ -68,6 +67,7 @@
#include <QAbstractTextDocumentLayout>
#include <QShortcut>
#include <QMenu>
+#include <QScreen>
extern QRect g_rectManagementDialogGeometry;
@@ -230,7 +230,7 @@ ThemeManagementDialog::ThemeManagementDialog(QWidget * parent)
resize(g_rectManagementDialogGeometry.width(),
g_rectManagementDialogGeometry.height());
- QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
+ QRect rect = g_pMainWindow->screen()->availableGeometry();
move(rect.x() + ((rect.width() - g_rectManagementDialogGeometry.width()) / 2), rect.y() + ((rect.height() - g_rectManagementDialogGeometry.height()) / 2));
new QShortcut(Qt::Key_Escape, this, SLOT(closeClicked()));
diff --git a/src/modules/tip/libkvitip.cpp b/src/modules/tip/libkvitip.cpp
index f913ca14d..0735d8fd3 100644
--- a/src/modules/tip/libkvitip.cpp
+++ b/src/modules/tip/libkvitip.cpp
@@ -34,8 +34,8 @@
#include <QPushButton>
#include <QFont>
#include <QPainter>
-#include <QDesktopWidget>
#include <QCloseEvent>
+#include <QScreen>
TipWindow * g_pTipWindow = nullptr;
@@ -115,7 +115,7 @@ TipWindow::~TipWindow()
void TipWindow::showEvent(QShowEvent *)
{
- QRect rect = g_pApp->desktop()->screenGeometry(g_pApp->desktop()->primaryScreen());
+ QRect rect = g_pApp->primaryScreen()->availableGeometry();
move((rect.width() - width()) / 2, (rect.height() - height()) / 2);
}
diff --git a/src/modules/toolbareditor/CustomizeToolBarsDialog.cpp b/src/modules/toolbareditor/CustomizeToolBarsDialog.cpp
index f79e50fa2..c2348b1d0 100644
--- a/src/modules/toolbareditor/CustomizeToolBarsDialog.cpp
+++ b/src/modules/toolbareditor/CustomizeToolBarsDialog.cpp
@@ -53,8 +53,8 @@
#include <QEvent>
#include <QSplitter>
#include <QDropEvent>
-#include <QDesktopWidget>
#include <QMimeData>
+#include <QScreen>
CustomizeToolBarsDialog * CustomizeToolBarsDialog::m_pInstance = nullptr;
extern QRect g_rectToolBarEditorDialogGeometry;
@@ -376,7 +376,7 @@ void CustomizeToolBarsDialog::currentToolBarChanged()
void CustomizeToolBarsDialog::showEvent(QShowEvent * e)
{
- QRect rect = g_pApp->desktop()->screenGeometry(g_pMainWindow);
+ QRect rect = g_pMainWindow->screen()->availableGeometry();
move(rect.x() + ((rect.width() - width()) / 2), rect.y() + ((rect.height() - height()) / 2));
QWidget::showEvent(e);
diff --git a/src/modules/upnp/Manager.cpp b/src/modules/upnp/Manager.cpp
index 12b828edd..03cc5e823 100644
--- a/src/modules/upnp/Manager.cpp
+++ b/src/modules/upnp/Manager.cpp
@@ -62,7 +62,7 @@ namespace UPnP
// Initialize the manager, detect all devices
void Manager::initialize()
{
- qDebug() << "UPnP::Manager: initiating a broadcast to detect UPnP devices..." << endl;
+ qDebug() << "UPnP::Manager: initiating a broadcast to detect UPnP devices..." << Qt::endl;
// Create the SSDP object to detect devices
m_pSsdpConnection = new SsdpConnection();
@@ -126,7 +126,7 @@ namespace UPnP
{
if(!m_bBroadcastFoundIt)
{
- qDebug() << "UPnP::Manager: timeout, no broadcast response received!" << endl;
+ qDebug() << "UPnP::Manager: timeout, no broadcast response received!" << Qt::endl;
m_bBroadcastFailed = true;
}
@@ -135,7 +135,7 @@ namespace UPnP
// A device was discovered by the SSDP broadcast
void Manager::slotDeviceFound(const QString & hostname, int port, const QString & rootUrl)
{
- qDebug() << "UPnP::Manager: device found, initializing IgdControlPoint to query it." << endl;
+ qDebug() << "UPnP::Manager: device found, initializing IgdControlPoint to query it." << Qt::endl;
// this blocks the action of our timeout timer
m_bBroadcastFoundIt = true;
diff --git a/src/modules/upnp/RootService.cpp b/src/modules/upnp/RootService.cpp
index efce5e6da..6ec711669 100644
--- a/src/modules/upnp/RootService.cpp
+++ b/src/modules/upnp/RootService.cpp
@@ -55,7 +55,7 @@ namespace UPnP
// Recursively add all devices and embedded devices to the deviceServices_ map
void RootService::addDeviceServices(const QDomNode & device)
{
- qDebug() << "UPnP discovered device " << XmlFunctions::getNodeValue(device, "/UDN") << endl;
+ qDebug() << "UPnP discovered device " << XmlFunctions::getNodeValue(device, "/UDN") << Qt::endl;
if(XmlFunctions::getNodeValue(device, "/deviceType") == InternetGatewayDeviceType)
{
@@ -68,7 +68,7 @@ namespace UPnP
if(description.isNull())
description = __tr2qs("Unknown");
- qDebug() << "Model: " << description << endl;
+ qDebug() << "Model: " << description << Qt::endl;
g_pApp->activeConsole()->output(KVI_OUT_GENERICSTATUS, __tr2qs_ctx("[UPNP]: found gateway device: %s", "upnp"), description.toUtf8().data());
}
@@ -174,7 +174,7 @@ namespace UPnP
else
{
qWarning() << "UPnP::RootService::getServiceByType -"
- << " type '" << serviceType << "' not found for device '" << deviceUdn << "'." << endl;
+ << " type '" << serviceType << "' not found for device '" << deviceUdn << "'." << Qt::endl;
return false;
}
diff --git a/src/modules/upnp/Service.cpp b/src/modules/upnp/Service.cpp
index cc337f972..50035138d 100644
--- a/src/modules/upnp/Service.cpp
+++ b/src/modules/upnp/Service.cpp
@@ -57,20 +57,20 @@ namespace UPnP
, m_iPort(port)
{
m_szInformationUrl = informationUrl;
- qDebug() << "UPnP::Service: created information service url='" << m_szInformationUrl << "'." << endl;
+ qDebug() << "UPnP::Service: created information service url='" << m_szInformationUrl << "'." << Qt::endl;
}
// The constructor for action services
Service::Service(const ServiceParameters & params)
: m_szControlUrl(params.controlUrl), m_szInformationUrl(params.scpdUrl), m_iPendingRequests(0), m_szServiceId(params.serviceId), m_szServiceType(params.serviceType), m_szBaseXmlPrefix("s"), m_szHostname(params.hostname), m_iPort(params.port)
{
- qDebug() << "CREATED UPnP::Service: url='" << m_szControlUrl << "' id='" << m_szServiceId << "'." << endl;
+ qDebug() << "CREATED UPnP::Service: url='" << m_szControlUrl << "' id='" << m_szServiceId << "'." << Qt::endl;
}
// The destructor
Service::~Service()
{
- qDebug() << "DESTROYED UPnP::Service [url=" << m_szControlUrl << ", id=" << m_szServiceId << "]" << endl;
+ qDebug() << "DESTROYED UPnP::Service [url=" << m_szControlUrl << ", id=" << m_szServiceId << "]" << Qt::endl;
}
// Makes a UPnP action request
@@ -89,7 +89,7 @@ namespace UPnP
// Makes a UPnP action request (keeps pointers from the external interface)
int Service::callActionInternal(const QString & actionName, const QMap<QString, QString> * arguments, const QString & prefix)
{
- qDebug() << "UPnP::Service: calling remote procedure '" << actionName << "'." << endl;
+ qDebug() << "UPnP::Service: calling remote procedure '" << actionName << "'." << Qt::endl;
// Create the data message
//NOTE: we shouldm use serviceId_ instead of serviceType_, but it seems that my router
@@ -162,7 +162,7 @@ namespace UPnP
// TODO: rename to downloadFile()
int Service::callInformationUrl()
{
- qDebug() << "UPnP::Service: requesting file '" << m_szInformationUrl << "'." << endl;
+ qDebug() << "UPnP::Service: requesting file '" << m_szInformationUrl << "'." << Qt::endl;
// Send the GET request
// TODO: User-Agent: Mozilla/4.0 (compatible; UPnP/1.0; Windows NT/5.1)
@@ -193,20 +193,20 @@ namespace UPnP
QString faultString = XmlFunctions::getNodeValue(response, "/faultstring");
QString errorCode = XmlFunctions::getNodeValue(response, "/detail/" + faultString + "/errorCode");
QString errorDescription = XmlFunctions::getNodeValue(response, "/detail/" + faultString + "/errorDescription");
- qWarning() << "UPnP::Service - Action failed: " << errorCode << " " << errorDescription << endl;
+ qWarning() << "UPnP::Service - Action failed: " << errorCode << " " << errorDescription << Qt::endl;
}
// The control point received a response to callAction()
void Service::gotActionResponse(const QString & responseType, const QMap<QString, QString> & /*resultValues*/)
{
- qWarning() << "UPnP::Service - Action response '" << responseType << "' is not handled." << endl;
+ qWarning() << "UPnP::Service - Action response '" << responseType << "' is not handled." << Qt::endl;
}
// The control point received a response to callInformationUrl()
void Service::gotInformationResponse(const QDomNode & response)
{
QString rootTagName = response.nodeName();
- qWarning() << "UPnP::Service - Service response (with root '" << rootTagName << "') is not handled." << endl;
+ qWarning() << "UPnP::Service - Service response (with root '" << rootTagName << "') is not handled." << Qt::endl;
}
// The QHttp object retrieved data.
@@ -214,11 +214,11 @@ namespace UPnP
{
QNetworkReply * reply = qobject_cast<QNetworkReply *>(sender());
- qDebug() << "UPnP::Service: received HTTP response for request " << endl;
+ qDebug() << "UPnP::Service: received HTTP response for request " << Qt::endl;
if(!reply)
{
- qWarning() << "UPnP::Service - HTTP Request failed: " << reply->errorString() << endl;
+ qWarning() << "UPnP::Service - HTTP Request failed: " << reply->errorString() << Qt::endl;
m_iPendingRequests--;
emit queryFinished(true);
return;
@@ -226,7 +226,7 @@ namespace UPnP
if(reply->error() != QNetworkReply::NoError)
{
- qWarning() << "UPnP::Service - HTTP Request failed: " << reply->errorString() << endl;
+ qWarning() << "UPnP::Service - HTTP Request failed: " << reply->errorString() << Qt::endl;
m_iPendingRequests--;
emit queryFinished(true);
reply->deleteLater();
@@ -254,7 +254,7 @@ namespace UPnP
if(cutAt > -1)
{
baseNamespace.truncate(cutAt);
- qDebug() << "Device is using " << baseNamespace << " as XML namespace" << endl;
+ qDebug() << "Device is using " << baseNamespace << " as XML namespace" << Qt::endl;
m_szBaseXmlPrefix = baseNamespace;
}
}
@@ -262,13 +262,13 @@ namespace UPnP
// Determine how to process the data
if(xml.namedItem(m_szBaseXmlPrefix + ":Envelope").isNull())
{
- qDebug() << "UPnP::Service: plain XML detected, calling gotInformationResponse()." << endl;
+ qDebug() << "UPnP::Service: plain XML detected, calling gotInformationResponse()." << Qt::endl;
// No SOAP envelope found, this is a normal response to callService()
gotInformationResponse(xml.lastChild());
}
else
{
- qDebug() << xml.toString() << endl;
+ qDebug() << xml.toString() << Qt::endl;
// Got a SOAP message response to callAction()
QDomNode resultNode = XmlFunctions::getNode(xml, "/" + m_szBaseXmlPrefix + ":Envelope/" + m_szBaseXmlPrefix + ":Body").firstChild();
@@ -278,7 +278,7 @@ namespace UPnP
{
if(resultNode.nodeName().startsWith("m:") || resultNode.nodeName().startsWith("u:"))
{
- qDebug() << "UPnP::Service: SOAP envelope detected, calling gotActionResponse()." << endl;
+ qDebug() << "UPnP::Service: SOAP envelope detected, calling gotActionResponse()." << Qt::endl;
// Action success, return SOAP body
QMap<QString, QString> resultValues;
@@ -298,7 +298,7 @@ namespace UPnP
}
else
{
- qDebug() << "UPnP::Service: SOAP error detected, calling gotActionResponse()." << endl;
+ qDebug() << "UPnP::Service: SOAP error detected, calling gotActionResponse()." << Qt::endl;
// Action failed
gotActionErrorResponse(resultNode);
@@ -307,7 +307,7 @@ namespace UPnP
}
else
{
- qWarning() << "UPnP::Service - XML parsing failed: " << errorMessage << endl;
+ qWarning() << "UPnP::Service - XML parsing failed: " << errorMessage << Qt::endl;
}
// Only emit when bytes>0
diff --git a/src/modules/upnp/SsdpConnection.cpp b/src/modules/upnp/SsdpConnection.cpp
index adfa21ace..8958653ec 100644
--- a/src/modules/upnp/SsdpConnection.cpp
+++ b/src/modules/upnp/SsdpConnection.cpp
@@ -62,7 +62,7 @@ namespace UPnP
// Data was received by the socket
void SsdpConnection::slotDataReceived()
{
- qDebug() << "UPnP::SsdpConnection: received " << m_pSocket->bytesAvailable() << " bytes." << endl;
+ qDebug() << "UPnP::SsdpConnection: received " << m_pSocket->bytesAvailable() << " bytes." << Qt::endl;
// Response from Diederik's Acatel router:
//
@@ -114,7 +114,7 @@ namespace UPnP
// Send a broadcast to detect all devices
void SsdpConnection::queryDevices(int bindPort)
{
- qDebug() << "UPnP::SsdpConnection: sending broadcast packet." << endl;
+ qDebug() << "UPnP::SsdpConnection: sending broadcast packet." << Qt::endl;
// Send a packet to a broadcast address
QHostAddress address("239.255.255.250");
@@ -130,7 +130,7 @@ namespace UPnP
bool success = m_pSocket->bind(bindPort);
if(!success)
{
- qDebug() << "UPnP::SsdpConnection: failed to bind to port " << bindPort << "." << endl;
+ qDebug() << "UPnP::SsdpConnection: failed to bind to port " << bindPort << "." << Qt::endl;
}
// Send the data
@@ -139,7 +139,7 @@ namespace UPnP
if(bytesWritten == -1)
{
- qDebug() << "UPnP::SsdpConnection: failed to send the UPnP broadcast packet." << endl;
+ qDebug() << "UPnP::SsdpConnection: failed to send the UPnP broadcast packet." << Qt::endl;
}
}
diff --git a/src/modules/upnp/WanConnectionService.cpp b/src/modules/upnp/WanConnectionService.cpp
index efbe87b73..1ea6223d3 100644
--- a/src/modules/upnp/WanConnectionService.cpp
+++ b/src/modules/upnp/WanConnectionService.cpp
@@ -96,7 +96,7 @@ namespace UPnP
void WanConnectionService::gotActionResponse(const QString & responseType, const QMap<QString, QString> & resultValues)
{
qDebug() << "UPnP::WanConnectionService: parsing action response:"
- << " type='" << responseType << "'." << endl;
+ << " type='" << responseType << "'." << Qt::endl;
// Check the message type
if(responseType == "GetExternalIPAddressResponse")
@@ -104,14 +104,14 @@ namespace UPnP
// Get the external IP address from the response
m_szExternalIpAddress = resultValues["NewExternalIPAddress"];
- qDebug() << "UPnP::WanConnectionService: externalIp='" << m_szExternalIpAddress << "'." << endl;
+ qDebug() << "UPnP::WanConnectionService: externalIp='" << m_szExternalIpAddress << "'." << Qt::endl;
}
else if(responseType == "GetNATRSIPStatusResponse")
{
// Get the nat status from the response
m_bNatEnabled = (resultValues["NewNATEnabled"] == "1");
- qDebug() << "UPnP::WanConnectionService: natEnabled=" << m_bNatEnabled << "." << endl;
+ qDebug() << "UPnP::WanConnectionService: natEnabled=" << m_bNatEnabled << "." << Qt::endl;
}
else if(responseType == "GetGenericPortMappingEntryResponse")
{
@@ -133,20 +133,20 @@ namespace UPnP
qDebug() << "UPnP::WanConnectionService - Received mapping: " << map->protocol << " " << map->remoteHost << ":" << map->externalPort
<< " to " << map->internalClient << ":" << map->internalPort
- << " max " << map->leaseDuration << "s '" << map->description << "' " << (map->enabled ? "enabled" : "disabled") << endl;
+ << " max " << map->leaseDuration << "s '" << map->description << "' " << (map->enabled ? "enabled" : "disabled") << Qt::endl;
}
else if(responseType == "AddPortMappingResponse")
{
- qDebug() << "UPnP::WanConnectionService - Received mapping enabled" << endl;
+ qDebug() << "UPnP::WanConnectionService - Received mapping enabled" << Qt::endl;
}
else if(responseType == "DeletePortMappingResponse")
{
- qDebug() << "UPnP::WanConnectionService - Received mapping disabled" << endl;
+ qDebug() << "UPnP::WanConnectionService - Received mapping disabled" << Qt::endl;
}
else
{
qDebug() << "UPnP::WanConnectionService - Unexpected response type"
- << " '" << responseType << "' encountered." << endl;
+ << " '" << responseType << "' encountered." << Qt::endl;
}
}
diff --git a/src/modules/upnp/XmlFunctions.cpp b/src/modules/upnp/XmlFunctions.cpp
index c2d7caf6b..35cebb38f 100644
--- a/src/modules/upnp/XmlFunctions.cpp
+++ b/src/modules/upnp/XmlFunctions.cpp
@@ -39,7 +39,7 @@
QDomNode XmlFunctions::getNode(const QDomNode & rootNode, const QString & path)
{
- QStringList pathItems = path.split("/", QString::SkipEmptyParts);
+ QStringList pathItems = path.split("/", Qt::SkipEmptyParts);
QDomNode childNode = rootNode.namedItem(pathItems[0]); // can be a null node
int i = 1;
@@ -57,7 +57,7 @@ QDomNode XmlFunctions::getNode(const QDomNode & rootNode, const QString & path)
if(childNode.isNull())
{
qDebug() << "XmlFunctions::getNode() - Notice: node '" << pathItems[i - 1] << "'"
- << " does not exist (root=" << rootNode.nodeName() << " path=" << path << ")." << endl;
+ << " does not exist (root=" << rootNode.nodeName() << " path=" << path << ")." << Qt::endl;
}
return childNode;
@@ -79,7 +79,7 @@ QDomNode XmlFunctions::getNodeChildByKey(const QDomNodeList & childNodes, const
for(int i = 0; i < childNodes.count(); i++)
{
// kdDebug() << "node " << childNodes.item(i).nodeName() << "/" << keyTagName
- // << "=" << childNodes.item(i).namedItem(keyTagName).toElement().text() << " == " << keyValue << "?" << endl;
+ // << "=" << childNodes.item(i).namedItem(keyTagName).toElement().text() << " == " << keyValue << "?" << Qt::endl;
// If the node has an childname with a certain value... e.g. <childNodes> <item><name>value</name></item> .. </childNodes>
if(childNodes.item(i).namedItem(keyTagName).toElement().text() == keyValue)
@@ -100,7 +100,7 @@ QString XmlFunctions::getNodeValue(const QDomNode & rootNode, const QString & pa
// Added code to avoid more assertion errors, and trace the cause.
if(rootNode.isNull())
{
- qWarning() << "XmlFunctions::getNodeValue: attempted to request '" << path << "' on null root node." << endl;
+ qWarning() << "XmlFunctions::getNodeValue: attempted to request '" << path << "' on null root node." << Qt::endl;
return QString();
}
diff --git a/src/modules/upnp/igdcontrolpoint.cpp b/src/modules/upnp/igdcontrolpoint.cpp
index 0c2adce1e..dbc196eaa 100644
--- a/src/modules/upnp/igdcontrolpoint.cpp
+++ b/src/modules/upnp/igdcontrolpoint.cpp
@@ -49,9 +49,9 @@ namespace UPnP
: QObject(), m_bGatewayAvailable(false), m_iIgdPort(0), m_pRootService(nullptr), m_pWanConnectionService(nullptr)
{
qDebug() << "CREATED UPnP::IgdControlPoint: created control point"
- << " url='" << hostname << ":" << port << "/" << rootUrl << "'." << endl;
+ << " url='" << hostname << ":" << port << "/" << rootUrl << "'." << Qt::endl;
- qDebug() << "UPnP::IgdControlPoint: querying services..." << endl;
+ qDebug() << "UPnP::IgdControlPoint: querying services..." << Qt::endl;
// Store device url
m_szIgdHostname = hostname;
@@ -68,7 +68,7 @@ namespace UPnP
delete m_pRootService;
delete m_pWanConnectionService;
- qDebug() << "DESTROYED UPnP::IgdControlPoint [host=" << m_szIgdHostname << ", port=" << m_iIgdPort << "]" << endl;
+ qDebug() << "DESTROYED UPnP::IgdControlPoint [host=" << m_szIgdHostname << ", port=" << m_iIgdPort << "]" << Qt::endl;
}
// Return the external IP address
@@ -113,7 +113,7 @@ namespace UPnP
m_bGatewayAvailable = true;
qDebug() << "UPnP::IgdControlPoint: WAN/IP connection service found, "
- << "querying service '" << params.serviceId << "' for external IP address..." << endl;
+ << "querying service '" << params.serviceId << "' for external IP address..." << Qt::endl;
// Call the service
m_pWanConnectionService = new WanConnectionService(params);
@@ -122,7 +122,7 @@ namespace UPnP
}
else
{
- qDebug() << "UPnP::IgdControlPoint: no PPP/IP connection service found :(" << endl;
+ qDebug() << "UPnP::IgdControlPoint: no PPP/IP connection service found :(" << Qt::endl;
}
}
}
@@ -132,12 +132,12 @@ namespace UPnP
{
if(!error)
{
- qDebug() << "IgdControlPoint: UPnP gateway device found." << endl;
+ qDebug() << "IgdControlPoint: UPnP gateway device found." << Qt::endl;
}
else
{
// Just started, the request for the external IP failed. This should succeed, abort portation
- qDebug() << "Requesting external IP address failed, leaving UPnP gateway device untouched." << endl;
+ qDebug() << "Requesting external IP address failed, leaving UPnP gateway device untouched." << Qt::endl;
}
}
diff --git a/src/modules/url/libkviurl.cpp b/src/modules/url/libkviurl.cpp
index 5674cafc8..53f966126 100644
--- a/src/modules/url/libkviurl.cpp
+++ b/src/modules/url/libkviurl.cpp
@@ -499,14 +499,14 @@ void saveUrlList()
QTextStream stream(&file);
- stream << g_List.size() << endl;
+ stream << g_List.size() << Qt::endl;
for(auto tmp : g_List)
{
- stream << tmp->url << endl;
- stream << tmp->window << endl;
- stream << tmp->count << endl;
- stream << tmp->timestamp << endl;
+ stream << tmp->url << Qt::endl;
+ stream << tmp->window << Qt::endl;
+ stream << tmp->count << Qt::endl;
+ stream << tmp->timestamp << Qt::endl;
}
file.flush();
file.close();
@@ -569,10 +569,10 @@ void saveBanList()
QTextStream stream(&file);
- stream << g_BanList.size() << endl;
+ stream << g_BanList.size() << Qt::endl;
for(auto tmp : g_BanList)
{
- stream << *tmp << endl;
+ stream << *tmp << Qt::endl;
}
file.flush();
file.close();
@@ -749,7 +749,7 @@ bool urllist_module_event_onUrl(KviKvsModuleEventCall * c)
QString tmpTimestamp;
QDate d = QDate::currentDate();
QString date;
- date.sprintf("%d-%d%d-%d%d", d.year(), d.month() / 10, d.month() % 10, d.day() / 10, d.day() % 10);
+ date = QString::asprintf("%d-%d%d-%d%d", d.year(), d.month() / 10, d.month() % 10, d.day() / 10, d.day() % 10);
tmpTimestamp = "[" + date + "]" + " [";
tmpTimestamp += QTime::currentTime().toString() + "]";
tmp->url = szUrl;