Commit 93c65f74 authored by Jonathan Marten's avatar Jonathan Marten
Browse files

File Size View: Convert to new Qt5 connect syntax

Differential Revision: https://phabricator.kde.org/D28551
parent a7c65d17
......@@ -419,8 +419,7 @@ void FSView::addColorItems(QMenu *popup, int id)
{
_colorID = id;
connect(popup, SIGNAL(triggered(QAction*)),
this, SLOT(colorActivated(QAction*)));
connect(popup, &QMenu::triggered, this, &FSView::colorActivated);
addPopupItem(popup, i18n("None"), colorMode() == None, id++);
addPopupItem(popup, i18n("Depth"), colorMode() == Depth, id++);
......
......@@ -63,8 +63,7 @@ FSJob::FSJob(FSView *v)
: KIO::Job()
{
_view = v;
QObject::connect(v, SIGNAL(progress(int,int,QString)),
this, SLOT(progressSlot(int,int,QString)));
connect(v, &FSView::progress, this, &FSJob::progressSlot);
}
void FSJob::kill(bool /*quietly*/)
......@@ -137,37 +136,25 @@ FSViewPart::FSViewPart(QWidget *parentWidget,
action->setToolTip(i18n("Show FSView manual"));
action->setWhatsThis(i18n("Opens the help browser with the "
"FSView documentation"));
connect(action, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(action, &QAction::triggered, this, &FSViewPart::showHelp);
QObject::connect(_visMenu->menu(), SIGNAL(aboutToShow()),
SLOT(slotShowVisMenu()));
QObject::connect(_areaMenu->menu(), SIGNAL(aboutToShow()),
SLOT(slotShowAreaMenu()));
QObject::connect(_depthMenu->menu(), SIGNAL(aboutToShow()),
SLOT(slotShowDepthMenu()));
QObject::connect(_colorMenu->menu(), SIGNAL(aboutToShow()),
SLOT(slotShowColorMenu()));
connect(_visMenu->menu(), &QMenu::aboutToShow,this, &FSViewPart::slotShowVisMenu);
connect(_areaMenu->menu(), &QMenu::aboutToShow, this, &FSViewPart::slotShowAreaMenu);
connect(_depthMenu->menu(), &QMenu::aboutToShow, this, &FSViewPart::slotShowDepthMenu);
connect(_colorMenu->menu(), &QMenu::aboutToShow, this, &FSViewPart::slotShowColorMenu);
// Both of these click signals are connected. Whether a single or
// double click activates an item is checked against the current
// style setting when the click happens.
QObject::connect(_view, SIGNAL(clicked(TreeMapItem*)),
_ext, SLOT(itemSingleClicked(TreeMapItem*)));
QObject::connect(_view, SIGNAL(doubleClicked(TreeMapItem*)),
_ext, SLOT(itemDoubleClicked(TreeMapItem*)));
QObject::connect(_view, SIGNAL(returnPressed(TreeMapItem*)),
_ext, SLOT(selected(TreeMapItem*)));
QObject::connect(_view, SIGNAL(selectionChanged()),
this, SLOT(updateActions()));
QObject::connect(_view,
SIGNAL(contextMenuRequested(TreeMapItem*,QPoint)),
this,
SLOT(contextMenu(TreeMapItem*,QPoint)));
QObject::connect(_view, SIGNAL(started()), this, SLOT(startedSlot()));
QObject::connect(_view, SIGNAL(completed(int)),
this, SLOT(completedSlot(int)));
connect(_view, &FSView::clicked, _ext, &FSViewBrowserExtension::itemSingleClicked);
connect(_view, &FSView::doubleClicked, _ext, &FSViewBrowserExtension::itemDoubleClicked);
connect(_view, &TreeMapWidget::returnPressed, _ext, &FSViewBrowserExtension::selected);
connect(_view, QOverload<>::of(&TreeMapWidget::selectionChanged), this, &FSViewPart::updateActions);
connect(_view, &TreeMapWidget::contextMenuRequested, this, &FSViewPart::contextMenu);
connect(_view, &FSView::started, this, &FSViewPart::startedSlot);
connect(_view, &FSView::completed, this, &FSViewPart::completedSlot);
// Create common file management actions - this is necessary in KDE4
// as these common actions are no longer automatically part of KParts.
......@@ -182,23 +169,23 @@ FSViewPart::FSViewPart(QWidget *parentWidget,
moveToTrashAction->setText(i18nc("@action:inmenu File", "Move to Trash"));
moveToTrashAction->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")));
actionCollection()->setDefaultShortcut(moveToTrashAction, QKeySequence(QKeySequence::Delete));
connect(moveToTrashAction, SIGNAL(triggered()), _ext, SLOT(trash()));
connect(moveToTrashAction, &QAction::triggered, _ext, &FSViewBrowserExtension::trash);
QAction *deleteAction = actionCollection()->addAction(QStringLiteral("delete"));
deleteAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
deleteAction->setText(i18nc("@action:inmenu File", "Delete"));
actionCollection()->setDefaultShortcut(deleteAction, QKeySequence(Qt::SHIFT | Qt::Key_Delete));
connect(deleteAction, SIGNAL(triggered()), _ext, SLOT(del()));
connect(deleteAction, &QAction::triggered, _ext, &FSViewBrowserExtension::del);
QAction *editMimeTypeAction = actionCollection()->addAction(QStringLiteral("editMimeType"));
editMimeTypeAction->setText(i18nc("@action:inmenu Edit", "&Edit File Type..."));
connect(editMimeTypeAction, SIGNAL(triggered()), _ext, SLOT(editMimeType()));
connect(editMimeTypeAction, &QAction::triggered, _ext, &FSViewBrowserExtension::editMimeType);
QAction *propertiesAction = actionCollection()->addAction(QStringLiteral("properties"));
propertiesAction->setText(i18nc("@action:inmenu File", "Properties"));
propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
propertiesAction->setShortcut(Qt::ALT | Qt::Key_Return);
connect(propertiesAction, SIGNAL(triggered()), SLOT(slotProperties()));
connect(propertiesAction, &QAction::triggered, this, &FSViewPart::slotProperties);
QTimer::singleShot(1, this, SLOT(showInfo()));
......@@ -456,8 +443,7 @@ void FSViewBrowserExtension::del()
KIO::Job *job = KIO::del(urls);
KJobWidgets::setWindow(job, _view);
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
connect(job, SIGNAL(result(KJob*)),
this, SLOT(refresh()));
connect(job, &KJob::result, this, &FSViewBrowserExtension::refresh);
}
}
......@@ -476,8 +462,7 @@ void FSViewBrowserExtension::trash()
KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, urls, QUrl("trash:/"), job);
KJobWidgets::setWindow(job, _view);
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
connect(job, SIGNAL(result(KJob*)),
this, SLOT(refresh()));
connect(job, &KJob::result, this, &FSViewBrowserExtension::refresh);
}
}
}
......
......@@ -41,8 +41,17 @@ public:
explicit FSViewBrowserExtension(FSViewPart *viewPart);
~FSViewBrowserExtension() override;
protected slots:
public slots:
void selected(TreeMapItem *);
void itemSingleClicked(TreeMapItem *i);
void itemDoubleClicked(TreeMapItem *i);
void trash();
void del();
void editMimeType();
protected slots:
void refresh();
void copy()
......@@ -53,13 +62,6 @@ protected slots:
{
copySelection(true);
}
void trash();
void del();
void editMimeType();
void itemSingleClicked(TreeMapItem *i);
void itemDoubleClicked(TreeMapItem *i);
private:
void copySelection(bool move);
......
......@@ -18,12 +18,12 @@
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
// KDE compliant startup
KAboutData aboutData(QStringLiteral("fsview"), i18n("FSView"), QStringLiteral("0.1"),
i18n("Filesystem Viewer"),
KAboutLicense::GPL,
i18n("(c) 2002, Josef Weidendorfer"));
QApplication app(argc, argv);
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
aboutData.setupCommandLine(&parser);
......@@ -42,12 +42,9 @@ int main(int argc, char *argv[])
// TreeMap Widget as toplevel window
FSView w(new Inode());
QObject::connect(&w, SIGNAL(clicked(TreeMapItem*)),
&w, SLOT(selected(TreeMapItem*)));
QObject::connect(&w, SIGNAL(returnPressed(TreeMapItem*)),
&w, SLOT(selected(TreeMapItem*)));
QObject::connect(&w, SIGNAL(contextMenuRequested(TreeMapItem*,QPoint)),
&w, SLOT(contextMenu(TreeMapItem*,QPoint)));
QObject::connect(&w, &TreeMapWidget::clicked, &w, &FSView::selected);
QObject::connect(&w, &TreeMapWidget::returnPressed, &w, &FSView::selected);
QObject::connect(&w, &TreeMapWidget::contextMenuRequested, &w, &FSView::contextMenu);
w.setPath(path);
w.show();
......
......@@ -3176,8 +3176,7 @@ void TreeMapWidget::addSplitDirectionItems(QMenu *popup, int id)
{
_splitID = id;
connect(popup, SIGNAL(triggered(QAction*)),
this, SLOT(splitActivated(QAction*)));
connect(popup, &QMenu::triggered, this, &TreeMapWidget::splitActivated);
addPopupItem(popup, i18n("Recursive Bisection"),
splitMode() == TreeMapItem::Bisection, id++);
......@@ -3245,8 +3244,7 @@ void TreeMapWidget::addVisualizationItems(QMenu *popup, int id)
{
_visID = id;
connect(popup, SIGNAL(triggered(QAction*)),
this, SLOT(visualizationActivated(QAction*)));
connect(popup, &QMenu::triggered, this, &TreeMapWidget::visualizationActivated);
QMenu *spopup = new QMenu(i18n("Nesting"));
addSplitDirectionItems(spopup, id + 100);
......@@ -3323,8 +3321,7 @@ void TreeMapWidget::addSelectionItems(QMenu *popup,
_selectionID = id;
_menuItem = i;
connect(popup, SIGNAL(triggered(QAction*)),
this, SLOT(selectionActivated(QAction*)));
connect(popup, &QMenu::triggered, this, &TreeMapWidget::selectionActivated);
while (i) {
QString name = i->text(0);
......@@ -3359,8 +3356,7 @@ void TreeMapWidget::addFieldStopItems(QMenu *popup,
{
_fieldStopID = id;
connect(popup, SIGNAL(triggered(QAction*)),
this, SLOT(fieldStopActivated(QAction*)));
connect(popup, &QMenu::triggered, this, &TreeMapWidget::fieldStopActivated);
addPopupItem(popup, i18n("No %1 Limit", fieldType(0)), fieldStop(0).isEmpty(), id);
......@@ -3417,8 +3413,7 @@ void TreeMapWidget::addAreaStopItems(QMenu *popup,
_areaStopID = id;
_menuItem = i;
connect(popup, SIGNAL(triggered(QAction*)),
this, SLOT(areaStopActivated(QAction*)));
connect(popup, &QMenu::triggered, this, &TreeMapWidget::areaStopActivated);
bool foundArea = false;
......@@ -3491,8 +3486,7 @@ void TreeMapWidget::addDepthStopItems(QMenu *popup,
_depthStopID = id;
_menuItem = i;
connect(popup, SIGNAL(triggered(QAction*)),
this, SLOT(depthStopActivated(QAction*)));
connect(popup, &QMenu::triggered, this, &TreeMapWidget::depthStopActivated);
bool foundDepth = false;
......
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