┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/places
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels/places')
-rw-r--r--src/panels/places/placesitem.cpp8
-rw-r--r--src/panels/places/placesitemeditdialog.cpp5
-rw-r--r--src/panels/places/placesitemlistgroupheader.cpp1
-rw-r--r--src/panels/places/placesitemlistwidget.cpp1
-rw-r--r--src/panels/places/placesitemmodel.cpp38
-rw-r--r--src/panels/places/placesitemsignalhandler.cpp1
-rw-r--r--src/panels/places/placespanel.cpp61
-rw-r--r--src/panels/places/placesview.cpp1
8 files changed, 52 insertions, 64 deletions
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp
index 173da29c5..0fd430abc 100644
--- a/src/panels/places/placesitem.cpp
+++ b/src/panels/places/placesitem.cpp
@@ -69,8 +69,8 @@ void PlacesItem::setUrl(const KUrl& url)
m_trashDirLister = new KDirLister();
m_trashDirLister->setAutoErrorHandlingEnabled(false, 0);
m_trashDirLister->setDelayedMimeTypes(true);
- QObject::connect(m_trashDirLister, SIGNAL(completed()),
- m_signalHandler, SLOT(onTrashDirListerCompleted()));
+ QObject::connect(m_trashDirLister.data(), static_cast<void(KDirLister::*)()>(&KDirLister::completed),
+ m_signalHandler.data(), &PlacesItemSignalHandler::onTrashDirListerCompleted);
m_trashDirLister->openUrl(url);
}
@@ -271,8 +271,8 @@ void PlacesItem::initializeDevice(const QString& udi)
if (m_access) {
setUrl(m_access->filePath());
- QObject::connect(m_access, SIGNAL(accessibilityChanged(bool,QString)),
- m_signalHandler, SLOT(onAccessibilityChanged()));
+ QObject::connect(m_access.data(), &Solid::StorageAccess::accessibilityChanged,
+ m_signalHandler.data(), &PlacesItemSignalHandler::onAccessibilityChanged);
} else if (m_disc && (m_disc->availableContent() & Solid::OpticalDisc::Audio) != 0) {
Solid::Block *block = m_device.as<Solid::Block>();
if (block) {
diff --git a/src/panels/places/placesitemeditdialog.cpp b/src/panels/places/placesitemeditdialog.cpp
index 08c910d17..350f39089 100644
--- a/src/panels/places/placesitemeditdialog.cpp
+++ b/src/panels/places/placesitemeditdialog.cpp
@@ -24,9 +24,11 @@
#include "placesitemeditdialog.h"
#include <KAboutData>
+#include <k4aboutdata.h>
#include <KComponentData>
#include <KDebug>
#include <KFile>
+#include <KGlobal>
#include <KIconButton>
#include <KLineEdit>
#include <KLocale>
@@ -133,7 +135,7 @@ void PlacesItemEditDialog::initialize()
formLayout->addRow(i18nc("@label", "Location:"), m_urlEdit);
// Provide room for at least 40 chars (average char width is half of height)
m_urlEdit->setMinimumWidth(m_urlEdit->fontMetrics().height() * (40 / 2));
- connect(m_urlEdit->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(slotUrlChanged(QString)));
+ connect(m_urlEdit->lineEdit(), &KLineEdit::textChanged, this, &PlacesItemEditDialog::slotUrlChanged);
m_iconButton = new KIconButton(mainWidget);
formLayout->addRow(i18nc("@label", "Choose an icon:"), m_iconButton);
@@ -167,4 +169,3 @@ void PlacesItemEditDialog::initialize()
setMainWidget(mainWidget);
}
-#include "placesitemeditdialog.moc"
diff --git a/src/panels/places/placesitemlistgroupheader.cpp b/src/panels/places/placesitemlistgroupheader.cpp
index ec7c4b18c..e17fd4d66 100644
--- a/src/panels/places/placesitemlistgroupheader.cpp
+++ b/src/panels/places/placesitemlistgroupheader.cpp
@@ -42,4 +42,3 @@ QPalette::ColorRole PlacesItemListGroupHeader::normalTextColorRole() const
return QPalette::WindowText;
}
-#include "placesitemlistgroupheader.moc"
diff --git a/src/panels/places/placesitemlistwidget.cpp b/src/panels/places/placesitemlistwidget.cpp
index e33d1daf9..83b00d798 100644
--- a/src/panels/places/placesitemlistwidget.cpp
+++ b/src/panels/places/placesitemlistwidget.cpp
@@ -40,4 +40,3 @@ QPalette::ColorRole PlacesItemListWidget::normalTextColorRole() const
return QPalette::WindowText;
}
-#include "placesitemlistwidget.moc"
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index d906118f2..3eedec5e6 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -35,6 +35,7 @@
#include <KLocale>
#include <KStandardDirs>
#include <KUser>
+#include <KGlobal>
#include "placesitem.h"
#include <QAction>
#include <QDate>
@@ -52,8 +53,8 @@
#include <views/viewproperties.h>
#ifdef HAVE_BALOO
- #include <baloo/query.h>
- #include <baloo/indexerconfig.h>
+ #include <Baloo/Query>
+ #include <Baloo/IndexerConfig>
#endif
namespace {
@@ -98,17 +99,17 @@ PlacesItemModel::PlacesItemModel(QObject* parent) :
m_saveBookmarksTimer = new QTimer(this);
m_saveBookmarksTimer->setInterval(syncBookmarksTimeout);
m_saveBookmarksTimer->setSingleShot(true);
- connect(m_saveBookmarksTimer, SIGNAL(timeout()), this, SLOT(saveBookmarks()));
+ connect(m_saveBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::saveBookmarks);
m_updateBookmarksTimer = new QTimer(this);
m_updateBookmarksTimer->setInterval(syncBookmarksTimeout);
m_updateBookmarksTimer->setSingleShot(true);
- connect(m_updateBookmarksTimer, SIGNAL(timeout()), this, SLOT(updateBookmarks()));
+ connect(m_updateBookmarksTimer, &QTimer::timeout, this, &PlacesItemModel::updateBookmarks);
- connect(m_bookmarkManager, SIGNAL(changed(QString,QString)),
- m_updateBookmarksTimer, SLOT(start()));
- connect(m_bookmarkManager, SIGNAL(bookmarksChanged(QString)),
- m_updateBookmarksTimer, SLOT(start()));
+ connect(m_bookmarkManager, &KBookmarkManager::changed,
+ m_updateBookmarksTimer, static_cast<void(QTimer::*)()>(&QTimer::start));
+ connect(m_bookmarkManager, &KBookmarkManager::bookmarksChanged,
+ m_updateBookmarksTimer, static_cast<void(QTimer::*)()>(&QTimer::start));
}
PlacesItemModel::~PlacesItemModel()
@@ -312,9 +313,8 @@ void PlacesItemModel::requestEject(int index)
if (item) {
Solid::OpticalDrive* drive = item->device().parent().as<Solid::OpticalDrive>();
if (drive) {
- connect(drive, SIGNAL(ejectDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)),
- Qt::UniqueConnection);
+ connect(drive, &Solid::OpticalDrive::ejectDone,
+ this, &PlacesItemModel::slotStorageTeardownDone);
drive->eject();
} else {
const QString label = item->text();
@@ -330,9 +330,8 @@ void PlacesItemModel::requestTeardown(int index)
if (item) {
Solid::StorageAccess* access = item->device().as<Solid::StorageAccess>();
if (access) {
- connect(access, SIGNAL(teardownDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageTeardownDone(Solid::ErrorType,QVariant)),
- Qt::UniqueConnection);
+ connect(access, &Solid::StorageAccess::teardownDone,
+ this, &PlacesItemModel::slotStorageTeardownDone);
access->teardown();
}
}
@@ -360,9 +359,8 @@ void PlacesItemModel::requestStorageSetup(int index)
m_storageSetupInProgress[access] = index;
- connect(access, SIGNAL(setupDone(Solid::ErrorType,QVariant,QString)),
- this, SLOT(slotStorageSetupDone(Solid::ErrorType,QVariant,QString)),
- Qt::UniqueConnection);
+ connect(access, &Solid::StorageAccess::setupDone,
+ this, &PlacesItemModel::slotStorageSetupDone);
access->setup();
}
@@ -601,7 +599,6 @@ void PlacesItemModel::slotStorageSetupDone(Solid::ErrorType error,
{
Q_UNUSED(udi);
- Q_ASSERT(!m_storageSetupInProgress.isEmpty());
const int index = m_storageSetupInProgress.take(sender());
const PlacesItem* item = placesItem(index);
if (!item) {
@@ -972,8 +969,8 @@ void PlacesItemModel::initializeAvailableDevices()
Q_ASSERT(m_predicate.isValid());
Solid::DeviceNotifier* notifier = Solid::DeviceNotifier::instance();
- connect(notifier, SIGNAL(deviceAdded(QString)), this, SLOT(slotDeviceAdded(QString)));
- connect(notifier, SIGNAL(deviceRemoved(QString)), this, SLOT(slotDeviceRemoved(QString)));
+ connect(notifier, &Solid::DeviceNotifier::deviceAdded, this, &PlacesItemModel::slotDeviceAdded);
+ connect(notifier, &Solid::DeviceNotifier::deviceRemoved, this, &PlacesItemModel::slotDeviceRemoved);
const QList<Solid::Device>& deviceList = Solid::Device::listFromQuery(m_predicate);
foreach (const Solid::Device& device, deviceList) {
@@ -1231,4 +1228,3 @@ void PlacesItemModel::showModelState()
}
#endif
-#include "placesitemmodel.moc"
diff --git a/src/panels/places/placesitemsignalhandler.cpp b/src/panels/places/placesitemsignalhandler.cpp
index 54a916de7..c9bc0db3f 100644
--- a/src/panels/places/placesitemsignalhandler.cpp
+++ b/src/panels/places/placesitemsignalhandler.cpp
@@ -47,4 +47,3 @@ void PlacesItemSignalHandler::onTrashDirListerCompleted()
}
}
-#include "placesitemsignalhandler.moc"
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index 720e07ce3..37965eb90 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -29,8 +29,11 @@
#include <KDirNotify>
#include <KIcon>
#include <KIO/Job>
+#include <KIO/EmptyTrashJob>
#include <KIO/JobUiDelegate>
+#include <KJobWidgets>
#include <KLocale>
+#include <KIconLoader>
#include <kitemviews/kitemlistcontainer.h>
#include <kitemviews/kitemlistcontroller.h>
#include <kitemviews/kitemlistselectionmanager.h>
@@ -48,6 +51,7 @@
#include <QGraphicsSceneDragDropEvent>
#include <QVBoxLayout>
#include <QShowEvent>
+#include <QMimeData>
PlacesPanel::PlacesPanel(QWidget* parent) :
Panel(parent),
@@ -101,8 +105,8 @@ void PlacesPanel::showEvent(QShowEvent* event)
// used at all and stays invisible.
m_model = new PlacesItemModel(this);
m_model->setGroupedSorting(true);
- connect(m_model, SIGNAL(errorMessage(QString)),
- this, SIGNAL(errorMessage(QString)));
+ connect(m_model, &PlacesItemModel::errorMessage,
+ this, &PlacesPanel::errorMessage);
m_view = new PlacesView();
m_view->setWidgetCreator(new KItemListWidgetCreator<PlacesItemListWidget>());
@@ -114,12 +118,12 @@ void PlacesPanel::showEvent(QShowEvent* event)
readSettings();
- connect(m_controller, SIGNAL(itemActivated(int)), this, SLOT(slotItemActivated(int)));
- connect(m_controller, SIGNAL(itemMiddleClicked(int)), this, SLOT(slotItemMiddleClicked(int)));
- connect(m_controller, SIGNAL(itemContextMenuRequested(int,QPointF)), this, SLOT(slotItemContextMenuRequested(int,QPointF)));
- connect(m_controller, SIGNAL(viewContextMenuRequested(QPointF)), this, SLOT(slotViewContextMenuRequested(QPointF)));
- connect(m_controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
- connect(m_controller, SIGNAL(aboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotAboveItemDropEvent(int,QGraphicsSceneDragDropEvent*)));
+ connect(m_controller, &KItemListController::itemActivated, this, &PlacesPanel::slotItemActivated);
+ connect(m_controller, &KItemListController::itemMiddleClicked, this, &PlacesPanel::slotItemMiddleClicked);
+ connect(m_controller, &KItemListController::itemContextMenuRequested, this, &PlacesPanel::slotItemContextMenuRequested);
+ connect(m_controller, &KItemListController::viewContextMenuRequested, this, &PlacesPanel::slotViewContextMenuRequested);
+ connect(m_controller, &KItemListController::itemDropEvent, this, &PlacesPanel::slotItemDropEvent);
+ connect(m_controller, &KItemListController::aboveItemDropEvent, this, &PlacesPanel::slotAboveItemDropEvent);
KItemListContainer* container = new KItemListContainer(m_controller, this);
container->setEnabledFrame(false);
@@ -340,8 +344,8 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
}
if (m_model->storageSetupNeeded(index)) {
- connect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotItemDropEventStorageSetupDone(int,bool)));
+ connect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotItemDropEventStorageSetupDone);
m_itemDropEventIndex = index;
@@ -379,8 +383,8 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success)
{
- disconnect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotItemDropEventStorageSetupDone(int,bool)));
+ disconnect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotItemDropEventStorageSetupDone);
if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) {
if (success) {
@@ -423,13 +427,14 @@ void PlacesPanel::slotTrashUpdated(KJob* job)
if (job->error()) {
emit errorMessage(job->errorString());
}
- org::kde::KDirNotify::emitFilesAdded("trash:/");
+ // as long as KIO doesn't do this, do it ourselves
+ KNotification::event("Trash: emptied", QString(), QPixmap(), 0, KNotification::DefaultEvent);
}
void PlacesPanel::slotStorageSetupDone(int index, bool success)
{
- disconnect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotStorageSetupDone(int,bool)));
+ disconnect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotStorageSetupDone);
if (m_triggerStorageSetupButton == Qt::NoButton) {
return;
@@ -447,21 +452,12 @@ void PlacesPanel::slotStorageSetupDone(int index, bool success)
void PlacesPanel::emptyTrash()
{
- const QString text = i18nc("@info", "Do you really want to empty the Trash? All items will be deleted.");
- const bool del = KMessageBox::warningContinueCancel(window(),
- text,
- QString(),
- KGuiItem(i18nc("@action:button", "Empty Trash"),
- KIcon("user-trash"))
- ) == KMessageBox::Continue;
- if (del) {
- QByteArray packedArgs;
- QDataStream stream(&packedArgs, QIODevice::WriteOnly);
- stream << int(1);
- KIO::Job *job = KIO::special(KUrl("trash:/"), packedArgs);
- KNotification::event("Trash: emptied", QString() , QPixmap() , 0, KNotification::DefaultEvent);
- job->ui()->setWindow(parentWidget());
- connect(job, SIGNAL(result(KJob*)), SLOT(slotTrashUpdated(KJob*)));
+ KIO::JobUiDelegate uiDelegate;
+ uiDelegate.setWindow(window());
+ if (uiDelegate.askDeleteConfirmation(QList<QUrl>(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) {
+ KIO::Job* job = KIO::emptyTrash();
+ KJobWidgets::setWindow(job, window());
+ connect(job, &KIO::Job::result, this, &PlacesPanel::slotTrashUpdated);
}
}
@@ -524,8 +520,8 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button)
m_triggerStorageSetupButton = button;
m_storageSetupFailedUrl = url();
- connect(m_model, SIGNAL(storageSetupDone(int,bool)),
- this, SLOT(slotStorageSetupDone(int,bool)));
+ connect(m_model, &PlacesItemModel::storageSetupDone,
+ this, &PlacesPanel::slotStorageSetupDone);
m_model->requestStorageSetup(index);
} else {
@@ -543,4 +539,3 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button)
}
-#include "placespanel.moc"
diff --git a/src/panels/places/placesview.cpp b/src/panels/places/placesview.cpp
index a298a5250..7c455b4bc 100644
--- a/src/panels/places/placesview.cpp
+++ b/src/panels/places/placesview.cpp
@@ -49,4 +49,3 @@ int PlacesView::iconSize() const
return option.iconSize;
}
-#include "placesview.moc"