diff options
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/dolphinview.cpp | 10 | ||||
| -rw-r--r-- | src/views/tooltips/dolphinfilemetadatawidget.cpp | 12 | ||||
| -rw-r--r-- | src/views/tooltips/dolphinfilemetadatawidget.h | 8 | ||||
| -rw-r--r-- | src/views/tooltips/tooltipmanager.cpp | 5 | ||||
| -rw-r--r-- | src/views/viewproperties.cpp | 24 |
5 files changed, 25 insertions, 34 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 1db62b800..40346c169 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -176,8 +176,10 @@ DolphinView::DolphinView(const QUrl& url, QWidget* parent) : connect(selectionManager, &KItemListSelectionManager::selectionChanged, this, &DolphinView::slotSelectionChanged); +#ifdef HAVE_BALOO m_toolTipManager = new ToolTipManager(this); connect(m_toolTipManager, &ToolTipManager::urlActivated, this, &DolphinView::urlActivated); +#endif m_versionControlObserver = new VersionControlObserver(this); m_versionControlObserver->setModel(m_model); @@ -1031,7 +1033,9 @@ void DolphinView::slotItemHovered(int index) const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint()); itemRect.moveTo(pos); +#ifdef HAVE_BALOO m_toolTipManager->showToolTip(item, itemRect, nativeParentWidget()->windowHandle()); +#endif } emit requestItemInfo(item); @@ -1408,9 +1412,11 @@ void DolphinView::updateViewState() void DolphinView::hideToolTip() { +#ifdef HAVE_BALOO if (GeneralSettings::showToolTips()) { m_toolTipManager->hideToolTip(); } +#endif } void DolphinView::calculateItemCount(int& fileCount, @@ -1482,7 +1488,7 @@ void DolphinView::slotRenamingResult(KJob* job) void DolphinView::slotDirectoryLoadingStarted() { // Disable the writestate temporary until it can be determined in a fast way - // in DolphinView::slotLoadingCompleted() + // in DolphinView::slotDirectoryLoadingCompleted() if (m_isFolderWritable) { m_isFolderWritable = false; emit writeStateChanged(m_isFolderWritable); @@ -1563,7 +1569,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con if (role == "text") { const KFileItem oldItem = m_model->fileItem(index); const QString newName = value.toString(); - if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) { + if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1Char('.') && newName != QLatin1String("..")) { const QUrl oldUrl = oldItem.url(); QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename); diff --git a/src/views/tooltips/dolphinfilemetadatawidget.cpp b/src/views/tooltips/dolphinfilemetadatawidget.cpp index 1df6a6673..f4a688ea8 100644 --- a/src/views/tooltips/dolphinfilemetadatawidget.cpp +++ b/src/views/tooltips/dolphinfilemetadatawidget.cpp @@ -24,11 +24,7 @@ #include <KColorScheme> #include <KSeparator> #include <KStringHandler> -#ifndef HAVE_BALOO -#include <KFileMetaDataWidget> -#else #include <Baloo/FileMetaDataWidget> -#endif #include <QLabel> #include <QStyleOptionFrame> @@ -61,19 +57,11 @@ DolphinFileMetaDataWidget::DolphinFileMetaDataWidget(QWidget* parent) : m_name->setMaximumWidth(fontMetrics.averageCharWidth() * 40); // Create widget for the meta data -#ifndef HAVE_BALOO - m_fileMetaDataWidget = new KFileMetaDataWidget(this); - connect(m_fileMetaDataWidget, &KFileMetaDataWidget::metaDataRequestFinished, - this, &DolphinFileMetaDataWidget::metaDataRequestFinished); - connect(m_fileMetaDataWidget, &KFileMetaDataWidget::urlActivated, - this, &DolphinFileMetaDataWidget::urlActivated); -#else m_fileMetaDataWidget = new Baloo::FileMetaDataWidget(this); connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::metaDataRequestFinished, this, &DolphinFileMetaDataWidget::metaDataRequestFinished); connect(m_fileMetaDataWidget, &Baloo::FileMetaDataWidget::urlActivated, this, &DolphinFileMetaDataWidget::urlActivated); -#endif m_fileMetaDataWidget->setForegroundRole(QPalette::ToolTipText); m_fileMetaDataWidget->setReadOnly(true); diff --git a/src/views/tooltips/dolphinfilemetadatawidget.h b/src/views/tooltips/dolphinfilemetadatawidget.h index 1e2cfadb6..b9dbd98a1 100644 --- a/src/views/tooltips/dolphinfilemetadatawidget.h +++ b/src/views/tooltips/dolphinfilemetadatawidget.h @@ -29,13 +29,9 @@ class KFileItemList; class QLabel; -#ifndef HAVE_BALOO -class KFileMetaDataWidget; -#else namespace Baloo { class FileMetaDataWidget; } -#endif /** * @brief Widget that shows the meta information and a preview of one @@ -79,11 +75,7 @@ signals: private: QLabel* m_preview; QLabel* m_name; -#ifndef HAVE_BALOO - KFileMetaDataWidget* m_fileMetaDataWidget; -#else Baloo::FileMetaDataWidget* m_fileMetaDataWidget; -#endif }; #endif diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp index 19c87b084..bb2890138 100644 --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -129,7 +129,10 @@ void ToolTipManager::startContentRetrieval() // Request a preview of the item m_fileMetaDataWidget->setPreview(QPixmap()); - KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << m_item, QSize(256, 256)); + QStringList plugins = KIO::PreviewJob::availablePlugins(); + KIO::PreviewJob* job = new KIO::PreviewJob(KFileItemList() << m_item, + QSize(256, 256), + &plugins); job->setIgnoreMaximumSize(m_item.isLocalFile()); if (job->uiDelegate()) { KJobWidgets::setWindow(job, qApp->activeWindow()); diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index e5d636cd1..d7c6abd65 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -63,17 +63,19 @@ ViewProperties::ViewProperties(const QUrl& url) : useDetailsViewWithPath = true; } else if (url.isLocalFile()) { m_filePath = url.toLocalFile(); - const QFileInfo dirInfo(m_filePath); - const QFileInfo fileInfo(m_filePath + QDir::separator() + ViewPropertiesFileName); - // Check if the directory is writable and check if the ".directory" file exists and - // is read- and writable. - if (!dirInfo.isWritable() - || (fileInfo.exists() && !(fileInfo.isReadable() && fileInfo.isWritable())) - || !isPartOfHome(m_filePath)) { -#ifdef Q_OS_WIN - // m_filePath probably begins with C:/ - the colon is not a valid character for paths though - m_filePath = QDir::separator() + m_filePath.remove(QLatin1Char(':')); -#endif + + bool useDestinationDir = !isPartOfHome(m_filePath); + if (!useDestinationDir) { + const QFileInfo dirInfo(m_filePath); + const QFileInfo fileInfo(m_filePath + QDir::separator() + ViewPropertiesFileName); + useDestinationDir = !dirInfo.isWritable() || (dirInfo.size() > 0 && fileInfo.exists() && !(fileInfo.isReadable() && fileInfo.isWritable())); + } + + if (useDestinationDir) { + #ifdef Q_OS_WIN + // m_filePath probably begins with C:/ - the colon is not a valid character for paths though + m_filePath = QDir::separator() + m_filePath.remove(QLatin1Char(':')); + #endif m_filePath = destinationDir(QStringLiteral("local")) + m_filePath; } } else { |
