From f2772c4fe63944f71f797c0d34d2cdb37897a535 Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 16 Jun 2016 15:34:44 +0200 Subject: Fix DnD onto desktop:/ app desktop file. We need to resolve from desktop:/ to file:/ so that DropJob can handle application .desktop files. CCBUG: 363991 --- src/panels/folders/folderspanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/panels') diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 3ad1bf3ff..276cf5672 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -240,7 +240,7 @@ void FoldersPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* eve event->buttons(), event->modifiers()); - KIO::DropJob *job = DragAndDropHelper::dropUrls(destItem.url(), &dropEvent, this); + KIO::DropJob *job = DragAndDropHelper::dropUrls(destItem.mostLocalUrl(), &dropEvent, this); if (job) { connect(job, &KIO::DropJob::result, this, [this](KJob *job) { if (job->error()) emit errorMessage(job->errorString()); }); } -- cgit v1.3.1 From e615bfaed4cd562d31ea0506529f730c414b6ec0 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sat, 25 Jun 2016 16:39:49 +0200 Subject: add_definitions(-DQT_NO_URL_CAST_FROM_STRING) + fix compilation This fixes some URLs built from local paths without scheme. --- CMakeLists.txt | 2 ++ src/dolphinmainwindow.cpp | 2 +- src/dolphinviewcontainer.cpp | 2 +- src/kitemviews/kfileitemmodelrolesupdater.cpp | 10 +++++----- src/panels/places/placesitem.cpp | 6 +++--- src/panels/places/placesitemmodel.cpp | 10 +++++----- src/settings/kcm/kcmdolphingeneral.cpp | 2 +- src/statusbar/mountpointobservercache.cpp | 4 ++-- src/views/dolphinview.cpp | 2 +- 9 files changed, 21 insertions(+), 19 deletions(-) (limited to 'src/panels') diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e6111307..86b06e889 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,6 +102,8 @@ else() ) endif() +add_definitions(-DQT_NO_URL_CAST_FROM_STRING) + add_subdirectory(src) add_subdirectory(doc) diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 3a06d2c0e..34008b5eb 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -83,7 +83,7 @@ namespace { // Used for GeneralSettings::version() to determine whether // an updated version of Dolphin is running. const int CurrentDolphinVersion = 200; -}; +} DolphinMainWindow::DolphinMainWindow() : KXmlGuiWindow(0), diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp index 73ffd5c2d..1c43fc977 100644 --- a/src/dolphinviewcontainer.cpp +++ b/src/dolphinviewcontainer.cpp @@ -95,7 +95,7 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) : m_view = new DolphinView(url, this); connect(m_view, &DolphinView::urlChanged, - m_urlNavigator, &KUrlNavigator::setUrl); + m_urlNavigator, &KUrlNavigator::setLocationUrl); connect(m_view, &DolphinView::urlChanged, m_messageWidget, &KMessageWidget::hide); connect(m_view, &DolphinView::directoryLoadingCompleted, diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index fe30f62f9..92a020003 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -374,9 +374,9 @@ void KFileItemModelRolesUpdater::slotItemsRemoved(const KItemRangeList& itemRang m_balooFileMonitor->clear(); } else { QStringList newFileList; - foreach (const QString& itemUrl, m_balooFileMonitor->files()) { - if (m_model->index(itemUrl) >= 0) { - newFileList.append(itemUrl); + foreach (const QString& file, m_balooFileMonitor->files()) { + if (m_model->index(QUrl::fromLocalFile(file)) >= 0) { + newFileList.append(file); } } m_balooFileMonitor->setFiles(newFileList); @@ -707,10 +707,10 @@ void KFileItemModelRolesUpdater::resolveRecentlyChangedItems() updateChangedItems(); } -void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& itemUrl) +void KFileItemModelRolesUpdater::applyChangedBalooRoles(const QString& file) { #ifdef HAVE_BALOO - const KFileItem item = m_model->fileItem(itemUrl); + const KFileItem item = m_model->fileItem(QUrl::fromLocalFile(file)); if (item.isNull()) { // itemUrl is not in the model anymore, probably because diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index a04064d0b..b32f8204d 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -276,12 +276,12 @@ void PlacesItem::initializeDevice(const QString& udi) Solid::Block *block = m_device.as(); if (block) { const QString device = block->device(); - setUrl(QStringLiteral("audiocd:/?device=%1").arg(device)); + setUrl(QUrl(QStringLiteral("audiocd:/?device=%1").arg(device))); } else { - setUrl(QStringLiteral("audiocd:/")); + setUrl(QUrl(QStringLiteral("audiocd:/"))); } } else if (m_mtp) { - setUrl(QStringLiteral("mtp:udi=%1").arg(m_device.udi())); + setUrl(QUrl(QStringLiteral("mtp:udi=%1").arg(m_device.udi()))); } } diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index a42cb0403..25c4d51f6 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -1099,17 +1099,17 @@ QUrl PlacesItemModel::createTimelineUrl(const QUrl& url) const int year = date.year(); const int month = date.month(); const int day = date.day(); - timelineUrl = "timeline:/" + timelineDateString(year, month) + - '/' + timelineDateString(year, month, day); + timelineUrl = QUrl("timeline:/" + timelineDateString(year, month) + + '/' + timelineDateString(year, month, day)); } else if (path.endsWith(QLatin1String("thismonth"))) { const QDate date = QDate::currentDate(); - timelineUrl = "timeline:/" + timelineDateString(date.year(), date.month()); + timelineUrl = QUrl("timeline:/" + timelineDateString(date.year(), date.month())); } else if (path.endsWith(QLatin1String("lastmonth"))) { const QDate date = QDate::currentDate().addMonths(-1); - timelineUrl = "timeline:/" + timelineDateString(date.year(), date.month()); + timelineUrl = QUrl("timeline:/" + timelineDateString(date.year(), date.month())); } else { Q_ASSERT(path.endsWith(QLatin1String("today"))); - timelineUrl= url; + timelineUrl = url; } return timelineUrl; diff --git a/src/settings/kcm/kcmdolphingeneral.cpp b/src/settings/kcm/kcmdolphingeneral.cpp index 6a02e0297..3cf7e7652 100644 --- a/src/settings/kcm/kcmdolphingeneral.cpp +++ b/src/settings/kcm/kcmdolphingeneral.cpp @@ -48,7 +48,7 @@ DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QV QTabWidget* tabWidget = new QTabWidget(this); // initialize 'Behavior' tab - BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(QDir::homePath(), tabWidget); + BehaviorSettingsPage* behaviorPage = new BehaviorSettingsPage(QUrl::fromLocalFile(QDir::homePath()), tabWidget); tabWidget->addTab(behaviorPage, i18nc("@title:tab Behavior settings", "Behavior")); connect(behaviorPage, &BehaviorSettingsPage::changed, this, static_cast(&DolphinGeneralConfigModule::changed)); diff --git a/src/statusbar/mountpointobservercache.cpp b/src/statusbar/mountpointobservercache.cpp index ab3744eac..48796ac5a 100644 --- a/src/statusbar/mountpointobservercache.cpp +++ b/src/statusbar/mountpointobservercache.cpp @@ -62,10 +62,10 @@ MountPointObserver* MountPointObserverCache::observerForUrl(const QUrl& url) } else { // Even if determining the mount point failed, the observer might still // be able to retrieve information about the url. - cachedObserverUrl = url.toLocalFile(); + cachedObserverUrl = url; } } else { - cachedObserverUrl = url.url(); + cachedObserverUrl = url; } MountPointObserver* observer = m_observerForMountPoint.value(cachedObserverUrl); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 25aad9b51..5466fd38e 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1278,7 +1278,7 @@ QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh if (desktopFile.hasLinkType()) { const QString linkUrl = desktopFile.readUrl(); if (!linkUrl.startsWith(QLatin1String("http"))) { - return linkUrl; + return QUrl::fromUserInput(linkUrl); } } } -- cgit v1.3.1 From 4fad4405a719a43968f0ff5e99b169cd5a81df5c Mon Sep 17 00:00:00 2001 From: Christoph Feck Date: Thu, 14 Jul 2016 17:19:21 +0200 Subject: Give FileMetaDataConfigurationDialog a parent REVIEW: 128439 --- src/panels/information/informationpanelcontent.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/panels') diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 6bfc4ed01..d519ff121 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -314,14 +314,12 @@ void InformationPanelContent::configureSettings(const QList& customCon m_preview->setVisible(isChecked); InformationPanelSettings::setPreviewsShown(isChecked); } else if (action == configureAction) { - FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog(); + FileMetaDataConfigurationDialog* dialog = new FileMetaDataConfigurationDialog(this); dialog->setDescription(i18nc("@label::textbox", "Select which data should be shown in the information panel:")); dialog->setItems(m_metaDataWidget->items()); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->show(); - dialog->raise(); - dialog->activateWindow(); connect(dialog, &FileMetaDataConfigurationDialog::destroyed, this, &InformationPanelContent::refreshMetaData); } } -- cgit v1.3.1 From 676cdcbbdbea031c1bec56230561bf8a0efcd0f6 Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sat, 6 Aug 2016 13:03:48 +0200 Subject: Fix some low-hanging warning fruits --- src/kitemviews/kitemlistwidget.cpp | 4 ++-- src/kitemviews/private/kbaloorolesprovider.h | 2 +- src/panels/places/placesitemlistgroupheader.h | 2 +- src/panels/places/placespanel.h | 2 +- src/tests/kfileitemmodeltest.cpp | 2 +- src/views/dolphinview.cpp | 4 ---- src/views/tooltips/filemetadatatooltip.cpp | 4 +--- 7 files changed, 7 insertions(+), 13 deletions(-) (limited to 'src/panels') diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp index b834e951f..9c31155b3 100644 --- a/src/kitemviews/kitemlistwidget.cpp +++ b/src/kitemviews/kitemlistwidget.cpp @@ -516,10 +516,10 @@ void KItemListWidget::clearHoverCache() void KItemListWidget::drawItemStyleOption(QPainter* painter, QWidget* widget, QStyle::State styleState) { - QStyleOptionViewItemV4 viewItemOption; + QStyleOptionViewItem viewItemOption; viewItemOption.initFrom(widget); viewItemOption.state = styleState; - viewItemOption.viewItemPosition = QStyleOptionViewItemV4::OnlyOne; + viewItemOption.viewItemPosition = QStyleOptionViewItem::OnlyOne; viewItemOption.showDecorationSelected = true; viewItemOption.rect = selectionRect().toRect(); widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &viewItemOption, painter, widget); diff --git a/src/kitemviews/private/kbaloorolesprovider.h b/src/kitemviews/private/kbaloorolesprovider.h index 9673bff4f..a9bd2e8ef 100644 --- a/src/kitemviews/private/kbaloorolesprovider.h +++ b/src/kitemviews/private/kbaloorolesprovider.h @@ -82,7 +82,7 @@ private: QSet m_roles; QHash m_roleForProperty; - friend class KBalooRolesProviderSingleton; + friend struct KBalooRolesProviderSingleton; }; #endif diff --git a/src/panels/places/placesitemlistgroupheader.h b/src/panels/places/placesitemlistgroupheader.h index 7daaba602..ec845e0ae 100644 --- a/src/panels/places/placesitemlistgroupheader.h +++ b/src/panels/places/placesitemlistgroupheader.h @@ -33,7 +33,7 @@ public: protected: virtual void paintSeparator(QPainter* painter, const QColor& color) Q_DECL_OVERRIDE; - virtual QPalette::ColorRole normalTextColorRole() const; + virtual QPalette::ColorRole normalTextColorRole() const Q_DECL_OVERRIDE; }; #endif diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index 81aeedb28..0c8b5f7f2 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -52,7 +52,7 @@ protected: virtual void showEvent(QShowEvent* event) Q_DECL_OVERRIDE; public slots: - virtual void readSettings(); + virtual void readSettings() Q_DECL_OVERRIDE; private slots: void slotItemActivated(int index); diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index eba32e1e1..6c45e114b 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -1674,7 +1674,7 @@ void KFileItemModelTest::testCollapseFolderWhileLoading() const KFileItem fileItemC1 = m_model->fileItem(2); KFileItem fileItemC2 = fileItemC1; QUrl urlC2 = fileItemC2.url(); - urlC2.adjusted(QUrl::RemoveFilename); + urlC2 = urlC2.adjusted(QUrl::RemoveFilename); urlC2.setPath(urlC2.path() + "c2.txt"); fileItemC2.setUrl(urlC2); diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 5466fd38e..a737dd0a6 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -75,10 +75,6 @@ #endif #include -namespace { - const int MaxModeEnum = DolphinView::CompactView; -} - DolphinView::DolphinView(const QUrl& url, QWidget* parent) : QWidget(parent), m_active(true), diff --git a/src/views/tooltips/filemetadatatooltip.cpp b/src/views/tooltips/filemetadatatooltip.cpp index 8fbca290d..0d58717d4 100644 --- a/src/views/tooltips/filemetadatatooltip.cpp +++ b/src/views/tooltips/filemetadatatooltip.cpp @@ -48,7 +48,7 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) : m_fileMetaDataWidget(0) { setAttribute(Qt::WA_TranslucentBackground); - setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint); + setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint); // Create widget for file preview m_preview = new QLabel(this); @@ -174,8 +174,6 @@ void FileMetaDataToolTip::paintEvent(QPaintEvent* event) void FileMetaDataToolTip::showEvent(QShowEvent *) { -#pragma message("TODO: port Plasma::WindowEffects::overrideShadow") - //Plasma::WindowEffects::overrideShadow(winId(), true); KWindowEffects::enableBlurBehind(winId(), true, mask()); } -- cgit v1.3.1