Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit d41176f0 authored by Elvis Angelaccio's avatar Elvis Angelaccio

Port to QOverload

Nicer syntax for connections with overloaded signals or slots.
parent 7cc0e17a
......@@ -165,7 +165,7 @@ bool MainWindow::loadPart()
// #365200: this will disable m_recentFilesAction, while openUrl() will enable it.
// So updateActions() needs to be called after openUrl() returns.
connect(m_part, SIGNAL(busy()), this, SLOT(updateActions()), Qt::QueuedConnection);
connect(m_part, static_cast<void (KParts::ReadOnlyPart::*)()>(&KParts::ReadOnlyPart::completed), this, &MainWindow::addPartUrl);
connect(m_part, QOverload<>::of(&KParts::ReadOnlyPart::completed), this, &MainWindow::addPartUrl);
return true;
}
......
......@@ -293,9 +293,9 @@ bool CliInterface::runProcess(const QString& programName, const QStringList& arg
if (m_operationMode == Extract) {
// Extraction jobs need a dedicated post-processing function.
connect(m_process, static_cast<void (KPtyProcess::*)(int, QProcess::ExitStatus)>(&KPtyProcess::finished), this, &CliInterface::extractProcessFinished);
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &CliInterface::extractProcessFinished);
} else {
connect(m_process, static_cast<void (KPtyProcess::*)(int, QProcess::ExitStatus)>(&KPtyProcess::finished), this, &CliInterface::processFinished);
connect(m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &CliInterface::processFinished);
}
m_stdOutData.clear();
......
......@@ -89,8 +89,8 @@ CreateDialog::CreateDialog(QWidget *parent,
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
connect(this, &QDialog::accepted, this, &CreateDialog::slotUpdateDefaultMimeType);
connect(m_ui->mimeComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &CreateDialog::slotUpdateWidgets);
connect(m_ui->mimeComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &CreateDialog::slotUpdateFilenameExtension);
connect(m_ui->mimeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CreateDialog::slotUpdateWidgets);
connect(m_ui->mimeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &CreateDialog::slotUpdateFilenameExtension);
m_vlayout->addWidget(m_ui);
......
......@@ -203,7 +203,7 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList& args)
connect(m_model, &ArchiveModel::loadingFinished,
this, &Part::slotLoadingFinished);
connect(m_model, &ArchiveModel::droppedFiles,
this, static_cast<void (Part::*)(const QStringList&, const Archive::Entry*, const QString&)>(&Part::slotAddFiles));
this, QOverload<const QStringList&, const Archive::Entry*, const QString&>::of(&Part::slotAddFiles));
connect(m_model, &ArchiveModel::error,
this, &Part::slotError);
connect(m_model, &ArchiveModel::messageWidget,
......@@ -213,7 +213,7 @@ Part::Part(QWidget *parentWidget, QObject *parent, const QVariantList& args)
this, &Part::setBusyGui);
connect(this, &Part::ready,
this, &Part::setReadyGui);
connect(this, static_cast<void (KParts::ReadOnlyPart::*)()>(&KParts::ReadOnlyPart::completed),
connect(this, QOverload<>::of(&KParts::ReadOnlyPart::completed),
this, &Part::setFileNameFromArchive);
connect(ArkSettings::self(), &KCoreConfigSkeleton::configChanged, this, &Part::updateActions);
......@@ -364,14 +364,14 @@ void Part::setupActions()
m_openFileAction->setText(i18nc("open a file with external program", "&Open"));
m_openFileAction->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
m_openFileAction->setToolTip(i18nc("@info:tooltip", "Click to open the selected file with the associated application"));
connect(m_openFileAction, &QAction::triggered, m_signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(m_openFileAction, &QAction::triggered, m_signalMapper, QOverload<>::of(&QSignalMapper::map));
m_signalMapper->setMapping(m_openFileAction, OpenFile);
m_openFileWithAction = actionCollection()->addAction(QStringLiteral("openfilewith"));
m_openFileWithAction->setText(i18nc("open a file with external program", "Open &With..."));
m_openFileWithAction->setIcon(QIcon::fromTheme(QStringLiteral("document-open")));
m_openFileWithAction->setToolTip(i18nc("@info:tooltip", "Click to open the selected file with an external program"));
connect(m_openFileWithAction, &QAction::triggered, m_signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(m_openFileWithAction, &QAction::triggered, m_signalMapper, QOverload<>::of(&QSignalMapper::map));
m_signalMapper->setMapping(m_openFileWithAction, OpenFileWith);
m_previewAction = actionCollection()->addAction(QStringLiteral("preview"));
......@@ -379,7 +379,7 @@ void Part::setupActions()
m_previewAction->setIcon(QIcon::fromTheme(QStringLiteral("document-preview-archive")));
m_previewAction->setToolTip(i18nc("@info:tooltip", "Click to preview the selected file"));
actionCollection()->setDefaultShortcut(m_previewAction, Qt::CTRL + Qt::Key_P);
connect(m_previewAction, &QAction::triggered, m_signalMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(m_previewAction, &QAction::triggered, m_signalMapper, QOverload<>::of(&QSignalMapper::map));
m_signalMapper->setMapping(m_previewAction, Preview);
m_extractArchiveAction = actionCollection()->addAction(QStringLiteral("extract_all"));
......@@ -401,7 +401,7 @@ void Part::setupActions()
m_addFilesAction->setText(i18n("Add &Files..."));
m_addFilesAction->setToolTip(i18nc("@info:tooltip", "Click to add files to the archive"));
actionCollection()->setDefaultShortcut(m_addFilesAction, Qt::ALT + Qt::Key_A);
connect(m_addFilesAction, &QAction::triggered, this, static_cast<void (Part::*)()>(&Part::slotAddFiles));
connect(m_addFilesAction, &QAction::triggered, this, QOverload<>::of(&Part::slotAddFiles));
m_renameFileAction = actionCollection()->addAction(QStringLiteral("rename"));
m_renameFileAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
......@@ -436,7 +436,7 @@ void Part::setupActions()
m_pasteFilesAction->setText(i18nc("@action:inmenu", "Pa&ste"));
actionCollection()->setDefaultShortcut(m_pasteFilesAction, Qt::CTRL + Qt::Key_V);
m_pasteFilesAction->setToolTip(i18nc("@info:tooltip", "Click to paste the files here"));
connect(m_pasteFilesAction, &QAction::triggered, this, static_cast<void (Part::*)()>(&Part::slotPasteFiles));
connect(m_pasteFilesAction, &QAction::triggered, this, QOverload<>::of(&Part::slotPasteFiles));
m_propertiesAction = actionCollection()->addAction(QStringLiteral("properties"));
m_propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
......@@ -465,7 +465,7 @@ void Part::setupActions()
m_searchAction->setToolTip(i18nc("@info:tooltip", "Click to search in archive"));
connect(m_searchAction, &QAction::triggered, this, &Part::slotShowFind);
connect(m_signalMapper, static_cast<void (QSignalMapper::*)(int)>(&QSignalMapper::mapped),
connect(m_signalMapper, QOverload<int>::of(&QSignalMapper::mapped),
this, &Part::slotOpenEntry);
updateActions();
......
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