#include <KDirNotify>
#include <QIcon>
#include <KIO/Job>
+#include <KIO/DropJob>
#include <KIO/EmptyTrashJob>
#include <KIO/JobUiDelegate>
#include <KJobWidgets>
m_controller->setSelectionBehavior(KItemListController::SingleSelection);
m_controller->setSingleClickActivationEnforced(true);
- readSettings();
+ readSettings();
connect(m_controller, &KItemListController::itemActivated, this, &PlacesPanel::slotItemActivated);
connect(m_controller, &KItemListController::itemMiddleClicked, this, &PlacesPanel::slotItemMiddleClicked);
editEntry(index);
} else if (action == removeAction) {
m_model->removeItem(index);
+ m_model->saveBookmarks();
} else if (action == hideAction) {
item->setHidden(hideAction->isChecked());
+ m_model->saveBookmarks();
} else if (action == openInNewTabAction) {
// TriggerItem does set up the storage first and then it will
// emit the slotItemMiddleClicked signal, because of Qt::MiddleButton.
event->buttons(),
event->modifiers());
- QString error;
- DragAndDropHelper::dropUrls(KFileItem(), destUrl, &dropEvent, error);
- if (!error.isEmpty()) {
- emit errorMessage(error);
- }
+ slotUrlsDropped(destUrl, &dropEvent, this);
}
void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success)
if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) {
if (success) {
QUrl destUrl = m_model->placesItem(index)->url();
-
- QString error;
- DragAndDropHelper::dropUrls(KFileItem(), destUrl, m_itemDropEvent, error);
- if (!error.isEmpty()) {
- emit errorMessage(error);
- }
+ slotUrlsDropped(destUrl, m_itemDropEvent, this);
}
delete m_itemDropEventMimeData;
void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event)
{
m_model->dropMimeDataBefore(index, event->mimeData());
+ m_model->saveBookmarks();
}
void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent)
{
- Q_UNUSED(parent);
- QString error;
- DragAndDropHelper::dropUrls(KFileItem(), dest, event, error);
- if (!error.isEmpty()) {
- emit errorMessage(error);
+ KIO::DropJob *job = DragAndDropHelper::dropUrls(dest, event, parent);
+ if (job) {
+ connect(job, &KIO::DropJob::result, this, [this](KJob *job) { if (job->error()) emit errorMessage(job->errorString()); });
}
-
}
void PlacesPanel::slotTrashUpdated(KJob* job)
if (dialog->exec() == QDialog::Accepted) {
PlacesItem* item = m_model->createPlacesItem(dialog->text(), dialog->url(), dialog->icon());
m_model->appendItemToGroup(item);
+ m_model->saveBookmarks();
}
delete dialog;
oldItem->setText(dialog->text());
oldItem->setUrl(dialog->url());
oldItem->setIcon(dialog->icon());
+ m_model->saveBookmarks();
}
}
}
}
}
-
-