From a7692611315065b308cd8243563cc50d40bd0f71 Mon Sep 17 00:00:00 2001 From: Christophe Giboudeaux Date: Sun, 29 Jun 2014 10:36:32 +0200 Subject: Remove the automoc noise --- src/views/dolphinfileitemlistwidget.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/views/dolphinfileitemlistwidget.cpp') diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp index 33ee6a277..f4efa5233 100644 --- a/src/views/dolphinfileitemlistwidget.cpp +++ b/src/views/dolphinfileitemlistwidget.cpp @@ -126,4 +126,3 @@ QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemV return KIcon(iconName).pixmap(QSize(overlayHeight, overlayHeight)); } -#include "dolphinfileitemlistwidget.moc" -- cgit v1.3 From 4de8cf43e62e23b766d9d457e060670401ce6128 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Fri, 12 Sep 2014 13:02:43 +0200 Subject: Ported KIcon to QIcon REVIEW: 120159 --- src/dolphinmainwindow.cpp | 4 ++-- src/dolphinmainwindow.h | 2 +- src/dolphintabbar.cpp | 10 ++++---- src/filterbar/filterbar.cpp | 10 ++++---- src/kitemviews/kfileitemlistview.cpp | 4 ++-- src/kitemviews/kstandarditemlistwidget.cpp | 4 ++-- src/panels/folders/treeviewcontextmenu.cpp | 16 ++++++------- src/panels/information/informationpanelcontent.cpp | 12 ++++++---- src/panels/information/phononwidget.cpp | 6 ++--- src/panels/places/placesitem.cpp | 2 +- src/panels/places/placesitemmodel.cpp | 6 ++--- src/panels/places/placespanel.cpp | 16 ++++++------- src/search/dolphinsearchbox.cpp | 6 ++--- src/settings/dolphinsettingsdialog.cpp | 14 +++++------ src/settings/kcm/kcmdolphinviewmodes.cpp | 8 +++---- src/settings/serviceitemdelegate.cpp | 6 ++--- src/settings/services/servicessettingspage.cpp | 2 +- src/statusbar/dolphinstatusbar.cpp | 4 ++-- src/views/dolphinfileitemlistwidget.cpp | 4 ++-- src/views/dolphinremoteencoding.cpp | 4 ++-- src/views/dolphinviewactionhandler.cpp | 28 +++++++++++----------- src/views/tooltips/tooltipmanager.cpp | 4 ++-- 22 files changed, 87 insertions(+), 85 deletions(-) (limited to 'src/views/dolphinfileitemlistwidget.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index f9ebe33ac..5e5eeb031 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1461,11 +1461,11 @@ void DolphinMainWindow::updateSplitAction() if (tabPage->primaryViewActive()) { splitAction->setText(i18nc("@action:intoolbar Close left view", "Close")); splitAction->setToolTip(i18nc("@info", "Close left view")); - splitAction->setIcon(KIcon("view-left-close")); + splitAction->setIcon(QIcon::fromTheme("view-left-close")); } else { splitAction->setText(i18nc("@action:intoolbar Close right view", "Close")); splitAction->setToolTip(i18nc("@info", "Close right view")); - splitAction->setIcon(KIcon("view-right-close")); + splitAction->setIcon(QIcon::fromTheme("view-right-close")); } } else { splitAction->setText(i18nc("@action:intoolbar Split view", "Split")); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index fd231cf0b..ae3019794 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/dolphintabbar.cpp b/src/dolphintabbar.cpp index 78bd5edcb..c72168431 100644 --- a/src/dolphintabbar.cpp +++ b/src/dolphintabbar.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include DolphinTabBar::DolphinTabBar(QWidget* parent) : @@ -124,10 +124,10 @@ void DolphinTabBar::contextMenuEvent(QContextMenuEvent* event) // Tab context menu KMenu menu(this); - QAction* newTabAction = menu.addAction(KIcon("tab-new"), i18nc("@action:inmenu", "New Tab")); - QAction* detachTabAction = menu.addAction(KIcon("tab-detach"), i18nc("@action:inmenu", "Detach Tab")); - QAction* closeOtherTabsAction = menu.addAction(KIcon("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs")); - QAction* closeTabAction = menu.addAction(KIcon("tab-close"), i18nc("@action:inmenu", "Close Tab")); + QAction* newTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@action:inmenu", "New Tab")); + QAction* detachTabAction = menu.addAction(QIcon::fromTheme("tab-detach"), i18nc("@action:inmenu", "Detach Tab")); + QAction* closeOtherTabsAction = menu.addAction(QIcon::fromTheme("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs")); + QAction* closeTabAction = menu.addAction(QIcon::fromTheme("tab-close"), i18nc("@action:inmenu", "Close Tab")); QAction* selectedAction = menu.exec(event->globalPos()); if (selectedAction == newTabAction) { diff --git a/src/filterbar/filterbar.cpp b/src/filterbar/filterbar.cpp index 827721360..720a5a76a 100644 --- a/src/filterbar/filterbar.cpp +++ b/src/filterbar/filterbar.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -36,7 +36,7 @@ FilterBar::FilterBar(QWidget* parent) : // Create close button QToolButton *closeButton = new QToolButton(this); closeButton->setAutoRaise(true); - closeButton->setIcon(KIcon("dialog-close")); + closeButton->setIcon(QIcon::fromTheme("dialog-close")); closeButton->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar")); connect(closeButton, &QToolButton::clicked, this, &FilterBar::closeRequest); @@ -44,7 +44,7 @@ FilterBar::FilterBar(QWidget* parent) : m_lockButton = new QToolButton(this); m_lockButton->setAutoRaise(true); m_lockButton->setCheckable(true); - m_lockButton->setIcon(KIcon("object-unlocked")); + m_lockButton->setIcon(QIcon::fromTheme("object-unlocked")); m_lockButton->setToolTip(i18nc("@info:tooltip", "Keep Filter When Changing Folders")); connect(m_lockButton, &QToolButton::toggled, this, &FilterBar::slotToggleLockButton); @@ -103,9 +103,9 @@ void FilterBar::slotUrlChanged() void FilterBar::slotToggleLockButton(bool checked) { if (checked) { - m_lockButton->setIcon(KIcon("object-locked")); + m_lockButton->setIcon(QIcon::fromTheme("object-locked")); } else { - m_lockButton->setIcon(KIcon("object-unlocked")); + m_lockButton->setIcon(QIcon::fromTheme("object-unlocked")); clear(); } } diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp index 0a92e75e5..aee10b5bd 100644 --- a/src/kitemviews/kfileitemlistview.cpp +++ b/src/kitemviews/kfileitemlistview.cpp @@ -27,7 +27,7 @@ #include "private/kpixmapmodifier.h" #include -#include +#include #include #include #include @@ -171,7 +171,7 @@ QPixmap KFileItemListView::createDragPixmap(const KItemSet& indexes) const foreach (int index, indexes) { QPixmap pixmap = model()->data(index).value("iconPixmap").value(); if (pixmap.isNull()) { - KIcon icon(model()->data(index).value("iconName").toString()); + QIcon icon = QIcon::fromTheme(model()->data(index).value("iconName").toString()); pixmap = icon.pixmap(size, size); } else { KPixmapModifier::scale(pixmap, QSize(size, size)); diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index 8633a2571..eaed056e5 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -22,7 +22,7 @@ #include "kfileitemlistview.h" #include "kfileitemmodel.h" -#include +#include #include #include #include @@ -1440,7 +1440,7 @@ QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStrin QPixmap pixmap; if (!QPixmapCache::find(key, pixmap)) { - const KIcon icon(name); + const QIcon icon = QIcon::fromTheme(name); int requestedSize; if (size <= KIconLoader::SizeSmall) { diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index 9450d3e17..35e39c14a 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -64,15 +64,15 @@ void TreeViewContextMenu::open() KFileItemListProperties capabilities(KFileItemList() << m_fileItem); // insert 'Cut', 'Copy' and 'Paste' - QAction* cutAction = new QAction(KIcon("edit-cut"), i18nc("@action:inmenu", "Cut"), this); + QAction* cutAction = new QAction(QIcon::fromTheme("edit-cut"), i18nc("@action:inmenu", "Cut"), this); cutAction->setEnabled(capabilities.supportsMoving()); connect(cutAction, &QAction::triggered, this, &TreeViewContextMenu::cut); - QAction* copyAction = new QAction(KIcon("edit-copy"), i18nc("@action:inmenu", "Copy"), this); + QAction* copyAction = new QAction(QIcon::fromTheme("edit-copy"), i18nc("@action:inmenu", "Copy"), this); connect(copyAction, &QAction::triggered, this, &TreeViewContextMenu::copy); const QPair pasteInfo = KonqOperations::pasteInfo(m_fileItem.url()); - QAction* pasteAction = new QAction(KIcon("edit-paste"), pasteInfo.second, this); + QAction* pasteAction = new QAction(QIcon::fromTheme("edit-paste"), pasteInfo.second, this); connect(pasteAction, &QAction::triggered, this, &TreeViewContextMenu::paste); pasteAction->setEnabled(pasteInfo.first); @@ -84,7 +84,7 @@ void TreeViewContextMenu::open() // insert 'Rename' QAction* renameAction = new QAction(i18nc("@action:inmenu", "Rename..."), this); renameAction->setEnabled(capabilities.supportsMoving()); - renameAction->setIcon(KIcon("edit-rename")); + renameAction->setIcon(QIcon::fromTheme("edit-rename")); connect(renameAction, &QAction::triggered, this, &TreeViewContextMenu::rename); popup->addAction(renameAction); @@ -95,7 +95,7 @@ void TreeViewContextMenu::open() const KUrl url = m_fileItem.url(); if (url.isLocalFile()) { - QAction* moveToTrashAction = new QAction(KIcon("user-trash"), + QAction* moveToTrashAction = new QAction(QIcon::fromTheme("user-trash"), i18nc("@action:inmenu", "Move to Trash"), this); const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving(); moveToTrashAction->setEnabled(enableMoveToTrash); @@ -106,7 +106,7 @@ void TreeViewContextMenu::open() } if (showDeleteCommand) { - QAction* deleteAction = new QAction(KIcon("edit-delete"), i18nc("@action:inmenu", "Delete"), this); + QAction* deleteAction = new QAction(QIcon::fromTheme("edit-delete"), i18nc("@action:inmenu", "Delete"), this); deleteAction->setEnabled(capabilities.supportsDeleting()); connect(deleteAction, &QAction::triggered, this, &TreeViewContextMenu::deleteItem); popup->addAction(deleteAction); @@ -134,7 +134,7 @@ void TreeViewContextMenu::open() if (!m_fileItem.isNull()) { // insert 'Properties' entry QAction* propertiesAction = new QAction(i18nc("@action:inmenu", "Properties"), this); - propertiesAction->setIcon(KIcon("document-properties")); + propertiesAction->setIcon(QIcon::fromTheme("document-properties")); connect(propertiesAction, &QAction::triggered, this, &TreeViewContextMenu::showProperties); popup->addAction(propertiesAction); } diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index 75052021b..327e72ba9 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -297,7 +297,7 @@ void InformationPanelContent::configureSettings(const QList& customCon previewAction->setChecked(InformationPanelSettings::previewsShown()); QAction* configureAction = popup.addAction(i18nc("@action:inmenu", "Configure...")); - configureAction->setIcon(KIcon("configure")); + configureAction->setIcon(QIcon::fromTheme("configure")); popup.addSeparator(); foreach (QAction* action, customContextMenuActions) { @@ -332,8 +332,10 @@ void InformationPanelContent::showIcon(const KFileItem& item) { m_outdatedPreviewTimer->stop(); if (!applyPlace(item.targetUrl())) { - KIcon icon(item.iconName(), KIconLoader::global(), item.overlays()); - m_preview->setPixmap(icon.pixmap(KIconLoader::SizeEnormous)); + const QPixmap icon = KIconLoader::global()->loadIcon(item.iconName(), KIconLoader::Desktop, + KIconLoader::SizeEnormous, KIconLoader::DefaultState, + item.overlays()); + m_preview->setPixmap(icon); } } @@ -376,7 +378,7 @@ bool InformationPanelContent::applyPlace(const KUrl& url) const PlacesItem* item = m_placesItemModel->placesItem(i); if (item->url().equals(url, KUrl::CompareWithoutTrailingSlash)) { setNameLabelText(item->text()); - m_preview->setPixmap(KIcon(item->icon()).pixmap(128, 128)); + m_preview->setPixmap(QIcon::fromTheme(item->icon()).pixmap(128, 128)); return true; } } diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp index 4b2cc28c5..16dbabfed 100644 --- a/src/panels/information/phononwidget.cpp +++ b/src/panels/information/phononwidget.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include @@ -129,13 +129,13 @@ void PhononWidget::showEvent(QShowEvent *event) m_playButton->setToolTip(i18n("play")); m_playButton->setIconSize(buttonSize); - m_playButton->setIcon(KIcon("media-playback-start")); + m_playButton->setIcon(QIcon::fromTheme("media-playback-start")); m_playButton->setAutoRaise(true); connect(m_playButton, &QToolButton::clicked, this, &PhononWidget::play); m_stopButton->setToolTip(i18n("stop")); m_stopButton->setIconSize(buttonSize); - m_stopButton->setIcon(KIcon("media-playback-stop")); + m_stopButton->setIcon(QIcon::fromTheme("media-playback-stop")); m_stopButton->setAutoRaise(true); m_stopButton->hide(); connect(m_stopButton, &QToolButton::clicked, this, &PhononWidget::stop); diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index 0fd430abc..b82e50256 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include "placesitemsignalhandler.h" #include diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 3eedec5e6..8eb79a8a8 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -255,7 +255,7 @@ QAction* PlacesItemModel::ejectAction(int index) const { const PlacesItem* item = placesItem(index); if (item && item->device().is()) { - return new QAction(KIcon("media-eject"), i18nc("@item", "Eject '%1'", item->text()), 0); + return new QAction(QIcon::fromTheme("media-eject"), i18nc("@item", "Eject '%1'", item->text()), 0); } return 0; @@ -304,7 +304,7 @@ QAction* PlacesItemModel::teardownAction(int index) const return new QAction(text, 0); } - return new QAction(KIcon(iconName), text, 0); + return new QAction(QIcon::fromTheme(iconName), text, 0); } void PlacesItemModel::requestEject(int index) diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 37965eb90..0c111390c 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -185,25 +185,25 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) } } else { if (item->url() == KUrl("trash:/")) { - emptyTrashAction = menu.addAction(KIcon("trash-empty"), i18nc("@action:inmenu", "Empty Trash")); + emptyTrashAction = menu.addAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash")); emptyTrashAction->setEnabled(item->icon() == "user-trash-full"); menu.addSeparator(); } - addAction = menu.addAction(KIcon("document-new"), i18nc("@item:inmenu", "Add Entry...")); + addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry...")); mainSeparator = menu.addSeparator(); - editAction = menu.addAction(KIcon("document-properties"), i18nc("@item:inmenu", "Edit '%1'...", label)); + editAction = menu.addAction(QIcon::fromTheme("document-properties"), i18nc("@item:inmenu", "Edit '%1'...", label)); } if (!addAction) { - addAction = menu.addAction(KIcon("document-new"), i18nc("@item:inmenu", "Add Entry...")); + addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry...")); } QAction* openInNewTabAction = menu.addAction(i18nc("@item:inmenu", "Open '%1' in New Tab", label)); - openInNewTabAction->setIcon(KIcon("tab-new")); + openInNewTabAction->setIcon(QIcon::fromTheme("tab-new")); QAction* removeAction = 0; if (!isDevice && !item->isSystemItem()) { - removeAction = menu.addAction(KIcon("edit-delete"), i18nc("@item:inmenu", "Remove '%1'", label)); + removeAction = menu.addAction(QIcon::fromTheme("edit-delete"), i18nc("@item:inmenu", "Remove '%1'", label)); } QAction* hideAction = menu.addAction(i18nc("@item:inmenu", "Hide '%1'", label)); @@ -305,7 +305,7 @@ void PlacesPanel::slotViewContextMenuRequested(const QPointF& pos) { KMenu menu(this); - QAction* addAction = menu.addAction(KIcon("document-new"), i18nc("@item:inmenu", "Add Entry...")); + QAction* addAction = menu.addAction(QIcon::fromTheme("document-new"), i18nc("@item:inmenu", "Add Entry...")); QAction* showAllAction = 0; if (m_model->hiddenCount() > 0) { diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp index 0ab4d86cd..0fb1e41d7 100644 --- a/src/search/dolphinsearchbox.cpp +++ b/src/search/dolphinsearchbox.cpp @@ -22,7 +22,7 @@ #include "dolphin_searchsettings.h" #include "dolphinfacetswidget.h" -#include +#include #include #include #include @@ -332,7 +332,7 @@ void DolphinSearchBox::init() // Create close button QToolButton* closeButton = new QToolButton(this); closeButton->setAutoRaise(true); - closeButton->setIcon(KIcon("dialog-close")); + closeButton->setIcon(QIcon::fromTheme("dialog-close")); closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching")); connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest); @@ -534,7 +534,7 @@ void DolphinSearchBox::updateFacetsToggleButton() { const bool facetsIsVisible = SearchSettings::showFacetsWidget(); m_facetsToggleButton->setChecked(facetsIsVisible ? true : false); - m_facetsToggleButton->setIcon(KIcon(facetsIsVisible ? "arrow-up-double" : "arrow-down-double")); + m_facetsToggleButton->setIcon(QIcon::fromTheme(facetsIsVisible ? "arrow-up-double" : "arrow-down-double")); m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options")); } diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp index 8c20a9148..533a7f089 100644 --- a/src/settings/dolphinsettingsdialog.cpp +++ b/src/settings/dolphinsettingsdialog.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include @@ -61,42 +61,42 @@ DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) : StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(url, this); KPageWidgetItem* startupSettingsFrame = addPage(startupSettingsPage, i18nc("@title:group", "Startup")); - startupSettingsFrame->setIcon(KIcon("go-home")); + startupSettingsFrame->setIcon(QIcon::fromTheme("go-home")); connect(startupSettingsPage, &StartupSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // View Modes ViewSettingsPage* viewSettingsPage = new ViewSettingsPage(this); KPageWidgetItem* viewSettingsFrame = addPage(viewSettingsPage, i18nc("@title:group", "View Modes")); - viewSettingsFrame->setIcon(KIcon("view-choose")); + viewSettingsFrame->setIcon(QIcon::fromTheme("view-choose")); connect(viewSettingsPage, &ViewSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // Navigation NavigationSettingsPage* navigationSettingsPage = new NavigationSettingsPage(this); KPageWidgetItem* navigationSettingsFrame = addPage(navigationSettingsPage, i18nc("@title:group", "Navigation")); - navigationSettingsFrame->setIcon(KIcon("input-mouse")); + navigationSettingsFrame->setIcon(QIcon::fromTheme("input-mouse")); connect(navigationSettingsPage, &NavigationSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // Services ServicesSettingsPage* servicesSettingsPage = new ServicesSettingsPage(this); KPageWidgetItem* servicesSettingsFrame = addPage(servicesSettingsPage, i18nc("@title:group", "Services")); - servicesSettingsFrame->setIcon(KIcon("services")); + servicesSettingsFrame->setIcon(QIcon::fromTheme("services")); connect(servicesSettingsPage, &ServicesSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // Trash TrashSettingsPage* trashSettingsPage = new TrashSettingsPage(this); KPageWidgetItem* trashSettingsFrame = addPage(trashSettingsPage, i18nc("@title:group", "Trash")); - trashSettingsFrame->setIcon(KIcon("user-trash")); + trashSettingsFrame->setIcon(QIcon::fromTheme("user-trash")); connect(trashSettingsPage, &TrashSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); // General GeneralSettingsPage* generalSettingsPage = new GeneralSettingsPage(url, this); KPageWidgetItem* generalSettingsFrame = addPage(generalSettingsPage, i18nc("@title:group General settings", "General")); - generalSettingsFrame->setIcon(KIcon("system-run")); + generalSettingsFrame->setIcon(QIcon::fromTheme("system-run")); connect(generalSettingsPage, &GeneralSettingsPage::changed, this, &DolphinSettingsDialog::enableApply); const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "SettingsDialog"); diff --git a/src/settings/kcm/kcmdolphinviewmodes.cpp b/src/settings/kcm/kcmdolphinviewmodes.cpp index 44a551544..ec862957b 100644 --- a/src/settings/kcm/kcmdolphinviewmodes.cpp +++ b/src/settings/kcm/kcmdolphinviewmodes.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -56,17 +56,17 @@ DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget* parent, cons // Initialize 'Icons' tab ViewSettingsTab* iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget); - tabWidget->addTab(iconsTab, KIcon("view-list-icons"), i18nc("@title:tab", "Icons")); + tabWidget->addTab(iconsTab, QIcon::fromTheme("view-list-icons"), i18nc("@title:tab", "Icons")); connect(iconsTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged); // Initialize 'Compact' tab ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget); - tabWidget->addTab(compactTab, KIcon("view-list-details"), i18nc("@title:tab", "Compact")); + tabWidget->addTab(compactTab, QIcon::fromTheme("view-list-details"), i18nc("@title:tab", "Compact")); connect(compactTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged); // Initialize 'Details' tab ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget); - tabWidget->addTab(detailsTab, KIcon("view-list-tree"), i18nc("@title:tab", "Details")); + tabWidget->addTab(detailsTab, QIcon::fromTheme("view-list-tree"), i18nc("@title:tab", "Details")); connect(detailsTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged); m_tabs.append(iconsTab); diff --git a/src/settings/serviceitemdelegate.cpp b/src/settings/serviceitemdelegate.cpp index 43406eeda..9b2cbd890 100644 --- a/src/settings/serviceitemdelegate.cpp +++ b/src/settings/serviceitemdelegate.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include "servicemodel.h" @@ -94,7 +94,7 @@ void ServiceItemDelegate::updateItemWidgets(const QList widgets, checkBox->setText(model->data(index).toString()); const QString iconName = model->data(index, Qt::DecorationRole).toString(); if (!iconName.isEmpty()) { - checkBox->setIcon(KIcon(iconName)); + checkBox->setIcon(QIcon::fromTheme(iconName)); } checkBox->setChecked(model->data(index, Qt::CheckStateRole).toBool()); @@ -110,7 +110,7 @@ void ServiceItemDelegate::updateItemWidgets(const QList widgets, // Update the configuration button if (configurable) { configureButton->setEnabled(checkBox->isChecked()); - configureButton->setIcon(KIcon("configure")); + configureButton->setIcon(QIcon::fromTheme("configure")); configureButton->resize(configureButton->sizeHint()); configureButton->move(option.rect.right() - configureButton->width(), (itemHeight - configureButton->height()) / 2); diff --git a/src/settings/services/servicessettingspage.cpp b/src/settings/services/servicessettingspage.cpp index 481c8af4a..78a865d43 100644 --- a/src/settings/services/servicessettingspage.cpp +++ b/src/settings/services/servicessettingspage.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp index ea94e68b4..050550396 100644 --- a/src/statusbar/dolphinstatusbar.cpp +++ b/src/statusbar/dolphinstatusbar.cpp @@ -22,7 +22,7 @@ #include "dolphin_generalsettings.h" #include -#include +#include #include #include #include @@ -81,7 +81,7 @@ DolphinStatusBar::DolphinStatusBar(QWidget* parent) : // Initialize progress information m_stopButton = new QToolButton(this); - m_stopButton->setIcon(KIcon("process-stop")); + m_stopButton->setIcon(QIcon::fromTheme("process-stop")); m_stopButton->setAccessibleName(i18n("Stop")); m_stopButton->setAutoRaise(true); m_stopButton->setToolTip(i18nc("@tooltip", "Stop loading")); diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp index f4efa5233..de927d91f 100644 --- a/src/views/dolphinfileitemlistwidget.cpp +++ b/src/views/dolphinfileitemlistwidget.cpp @@ -19,7 +19,7 @@ #include "dolphinfileitemlistwidget.h" -#include +#include #include #include #include @@ -123,6 +123,6 @@ QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemV break; } - return KIcon(iconName).pixmap(QSize(overlayHeight, overlayHeight)); + return QIcon::fromTheme(iconName).pixmap(QSize(overlayHeight, overlayHeight)); } diff --git a/src/views/dolphinremoteencoding.cpp b/src/views/dolphinremoteencoding.cpp index ceb189494..9a1560003 100644 --- a/src/views/dolphinremoteencoding.cpp +++ b/src/views/dolphinremoteencoding.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -49,7 +49,7 @@ DolphinRemoteEncoding::DolphinRemoteEncoding(QObject* parent, DolphinViewActionH m_loaded(false), m_idDefault(0) { - m_menu = new KActionMenu(KIcon("character-set"), i18n("Select Remote Charset"), this); + m_menu = new KActionMenu(QIcon::fromTheme("character-set"), i18n("Select Remote Charset"), this); m_actionHandler->actionCollection()->addAction("change_remote_encoding", m_menu); connect(m_menu->menu(), &QMenu::aboutToShow, this, &DolphinRemoteEncoding::slotAboutToShow); diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 2879d51d5..028a0a763 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include @@ -101,7 +101,7 @@ void DolphinViewActionHandler::createActions() QAction* newDirAction = m_actionCollection->addAction("create_dir"); newDirAction->setText(i18nc("@action", "Create Folder...")); newDirAction->setShortcut(Qt::Key_F10); - newDirAction->setIcon(KIcon("folder-new")); + newDirAction->setIcon(QIcon::fromTheme("folder-new")); newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectory); @@ -110,18 +110,18 @@ void DolphinViewActionHandler::createActions() QAction* rename = m_actionCollection->addAction("rename"); rename->setText(i18nc("@action:inmenu File", "Rename...")); rename->setShortcut(Qt::Key_F2); - rename->setIcon(KIcon("edit-rename")); + rename->setIcon(QIcon::fromTheme("edit-rename")); connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename); QAction* moveToTrash = m_actionCollection->addAction("move_to_trash"); moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash")); - moveToTrash->setIcon(KIcon("user-trash")); + moveToTrash->setIcon(QIcon::fromTheme("user-trash")); moveToTrash->setShortcut(QKeySequence::Delete); connect(moveToTrash, &QAction::triggered, this, &DolphinViewActionHandler::slotTrashActivated); QAction* deleteAction = m_actionCollection->addAction("delete"); - deleteAction->setIcon(KIcon("edit-delete")); + deleteAction->setIcon(QIcon::fromTheme("edit-delete")); deleteAction->setText(i18nc("@action:inmenu File", "Delete")); deleteAction->setShortcut(Qt::SHIFT | Qt::Key_Delete); connect(deleteAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems); @@ -140,7 +140,7 @@ void DolphinViewActionHandler::createActions() QAction *propertiesAction = m_actionCollection->addAction( "properties" ); // Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :) propertiesAction->setText( i18nc("@action:inmenu File", "Properties") ); - propertiesAction->setIcon(KIcon("document-properties")); + propertiesAction->setIcon(QIcon::fromTheme("document-properties")); propertiesAction->setShortcuts(QList() << Qt::ALT + Qt::Key_Return << Qt::ALT + Qt::Key_Enter); connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties); @@ -168,7 +168,7 @@ void DolphinViewActionHandler::createActions() KToggleAction* showPreview = m_actionCollection->add("show_preview"); showPreview->setText(i18nc("@action:intoolbar", "Preview")); showPreview->setToolTip(i18nc("@info", "Show preview of files and folders")); - showPreview->setIcon(KIcon("view-preview")); + showPreview->setIcon(QIcon::fromTheme("view-preview")); connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview); KToggleAction* sortDescending = m_actionCollection->add("descending"); @@ -205,7 +205,7 @@ void DolphinViewActionHandler::createActions() } KToggleAction* showInGroups = m_actionCollection->add("show_in_groups"); - showInGroups->setIcon(KIcon("view-group")); + showInGroups->setIcon(QIcon::fromTheme("view-group")); showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups")); connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting); @@ -302,7 +302,7 @@ void DolphinViewActionHandler::slotViewModeActionTriggered(QAction* action) m_currentView->setMode(mode); QAction* viewModeMenu = m_actionCollection->action("view_mode"); - viewModeMenu->setIcon(KIcon(action->icon())); + viewModeMenu->setIcon(action->icon()); } void DolphinViewActionHandler::slotRename() @@ -365,7 +365,7 @@ void DolphinViewActionHandler::updateViewActions() viewModeAction->setChecked(true); QAction* viewModeMenu = m_actionCollection->action("view_mode"); - viewModeMenu->setIcon(KIcon(viewModeAction->icon())); + viewModeMenu->setIcon(viewModeAction->icon()); } QAction* showPreviewAction = m_actionCollection->action("show_preview"); @@ -493,7 +493,7 @@ KToggleAction* DolphinViewActionHandler::iconsModeAction() iconsView->setText(i18nc("@action:inmenu View Mode", "Icons")); iconsView->setToolTip(i18nc("@info", "Icons view mode")); iconsView->setShortcut(Qt::CTRL | Qt::Key_1); - iconsView->setIcon(KIcon("view-list-icons")); + iconsView->setIcon(QIcon::fromTheme("view-list-icons")); iconsView->setData(QVariant::fromValue(DolphinView::IconsView)); return iconsView; } @@ -504,7 +504,7 @@ KToggleAction* DolphinViewActionHandler::compactModeAction() iconsView->setText(i18nc("@action:inmenu View Mode", "Compact")); iconsView->setToolTip(i18nc("@info", "Compact view mode")); iconsView->setShortcut(Qt::CTRL | Qt::Key_2); - iconsView->setIcon(KIcon("view-list-details")); // TODO: discuss with Oxygen-team the wrong (?) name + iconsView->setIcon(QIcon::fromTheme("view-list-details")); // TODO: discuss with Oxygen-team the wrong (?) name iconsView->setData(QVariant::fromValue(DolphinView::CompactView)); return iconsView; } @@ -515,7 +515,7 @@ KToggleAction* DolphinViewActionHandler::detailsModeAction() detailsView->setText(i18nc("@action:inmenu View Mode", "Details")); detailsView->setToolTip(i18nc("@info", "Details view mode")); detailsView->setShortcut(Qt::CTRL | Qt::Key_3); - detailsView->setIcon(KIcon("view-list-tree")); + detailsView->setIcon(QIcon::fromTheme("view-list-tree")); detailsView->setData(QVariant::fromValue(DolphinView::DetailsView)); return detailsView; } @@ -528,7 +528,7 @@ void DolphinViewActionHandler::slotSortRoleChanged(const QByteArray& role) if (!action->icon().isNull()) { QAction* sortByMenu = m_actionCollection->action("sort"); - sortByMenu->setIcon(KIcon(action->icon())); + sortByMenu->setIcon(action->icon()); } } } diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp index c005979d5..25fa8e0ed 100644 --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -20,7 +20,7 @@ #include "tooltipmanager.h" #include "filemetadatatooltip.h" -#include +#include #include #include #include @@ -167,7 +167,7 @@ void ToolTipManager::previewFailed() return; } - const QPixmap pixmap = KIcon(m_item.iconName()).pixmap(128, 128); + const QPixmap pixmap = QIcon::fromTheme(m_item.iconName()).pixmap(128, 128); m_fileMetaDataToolTip->setPreview(pixmap); if (!m_showToolTipTimer->isActive()) { showToolTip(); -- cgit v1.3 From 169cca55b9621689712321da8c0425f8002d0008 Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Tue, 24 Feb 2015 13:07:35 +0100 Subject: Replace kDebug/kWarning by categorized logging (org.kde.dolphin) --- src/CMakeLists.txt | 1 + src/dolphindebug.cpp | 22 +++++++++++ src/dolphindebug.h | 27 +++++++++++++ src/dolphinpart.cpp | 8 ++-- src/kitemviews/kfileitemmodel.cpp | 44 +++++++++++----------- src/kitemviews/kitemlistview.cpp | 8 ++-- src/kitemviews/private/kitemlistviewlayouter.cpp | 4 +- src/main.cpp | 6 +-- src/panels/folders/folderspanel.cpp | 2 +- src/panels/places/placesitem.cpp | 2 +- src/panels/places/placesitemeditdialog.cpp | 2 +- src/panels/places/placesitemmodel.cpp | 30 +++++++-------- src/panels/places/placespanel.cpp | 2 +- src/settings/serviceitemdelegate.cpp | 2 +- src/tests/kstandarditemmodeltest.cpp | 4 +- src/views/dolphinfileitemlistwidget.cpp | 2 +- src/views/dolphinremoteencoding.cpp | 8 ++-- src/views/dolphinviewactionhandler.cpp | 2 +- .../versioncontrol/versioncontrolobserver.cpp | 4 +- src/views/viewproperties.cpp | 6 +-- 20 files changed, 118 insertions(+), 68 deletions(-) create mode 100644 src/dolphindebug.cpp create mode 100644 src/dolphindebug.h (limited to 'src/views/dolphinfileitemlistwidget.cpp') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 17ac9cd21..4637e09d0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -72,6 +72,7 @@ set(dolphinprivate_LIB_SRCS views/zoomlevelinfo.cpp dolphinremoveaction.cpp dolphinnewfilemenu.cpp + dolphindebug.cpp ) if(HAVE_BALOO) diff --git a/src/dolphindebug.cpp b/src/dolphindebug.cpp new file mode 100644 index 000000000..17f108427 --- /dev/null +++ b/src/dolphindebug.cpp @@ -0,0 +1,22 @@ +/*************************************************************************** + * Copyright (C) 2015 by Emmanuel Pescosta * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "dolphindebug.h" + +Q_LOGGING_CATEGORY(DolphinDebug, "org.kde.dolphin") diff --git a/src/dolphindebug.h b/src/dolphindebug.h new file mode 100644 index 000000000..9b4554b49 --- /dev/null +++ b/src/dolphindebug.h @@ -0,0 +1,27 @@ +/*************************************************************************** + * Copyright (C) 2015 by Emmanuel Pescosta * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DOLPHIN_DEBUG_H +#define DOLPHIN_DEBUG_H + +#include + +Q_DECLARE_LOGGING_CATEGORY(DolphinDebug) + +#endif // DOLPHIN_DEBUG_H diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp index cd1ac52b8..3473218e5 100644 --- a/src/dolphinpart.cpp +++ b/src/dolphinpart.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include "dolphindebug.h" #include #include #include @@ -138,7 +138,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems); connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted); } else { - kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; + qCWarning(DolphinDebug) << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported"; } createActions(); @@ -340,7 +340,7 @@ void DolphinPart::slotMessage(const QString& msg) void DolphinPart::slotErrorMessage(const QString& msg) { - kDebug() << msg; + qCDebug(DolphinDebug) << msg; emit canceled(msg); //KMessageBox::error(m_view, msg); } @@ -471,7 +471,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos, void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl) { - //kDebug() << oldUrl << newUrl << "currentUrl=" << url(); + //qCDebug(DolphinDebug) << oldUrl << newUrl << "currentUrl=" << url(); if (oldUrl.matches(url(), QUrl::StripTrailingSlash /* #207572 */)) { KParts::ReadOnlyPart::setUrl(newUrl); const QString prettyUrl = newUrl.toDisplayString(QUrl::PreferLocalFile); diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 222a940a9..eac3ddf8b 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -24,7 +24,7 @@ #include "dolphin_generalsettings.h" #include -#include +#include "dolphindebug.h" #include "private/kfileitemmodelsortalgorithm.h" #include "private/kfileitemmodeldirlister.h" @@ -339,7 +339,7 @@ QList > KFileItemModel::groups() const } #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "[TIME] Calculating groups for" << count() << "items:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] Calculating groups for" << count() << "items:" << timer.elapsed(); #endif } @@ -408,9 +408,9 @@ int KFileItemModel::index(const QUrl& url) const if (m_items.count() != m_itemData.count() && printDebugInfo) { printDebugInfo = false; - kWarning() << "The model is in an inconsistent state."; - kWarning() << "m_items.count() ==" << m_items.count(); - kWarning() << "m_itemData.count() ==" << m_itemData.count(); + qCWarning(DolphinDebug) << "The model is in an inconsistent state."; + qCWarning(DolphinDebug) << "m_items.count() ==" << m_items.count(); + qCWarning(DolphinDebug) << "m_itemData.count() ==" << m_itemData.count(); // Check if there are multiple items with the same URL. QMultiHash indexesForUrl; @@ -420,12 +420,12 @@ int KFileItemModel::index(const QUrl& url) const foreach (const QUrl& url, indexesForUrl.uniqueKeys()) { if (indexesForUrl.count(url) > 1) { - kWarning() << "Multiple items found with the URL" << url; + qCWarning(DolphinDebug) << "Multiple items found with the URL" << url; foreach (int index, indexesForUrl.values(url)) { const ItemData* data = m_itemData.at(index); - kWarning() << "index" << index << ":" << data->item; + qCWarning(DolphinDebug) << "index" << index << ":" << data->item; if (data->parent) { - kWarning() << "parent" << data->parent->item; + qCWarning(DolphinDebug) << "parent" << data->parent->item; } } } @@ -795,8 +795,8 @@ void KFileItemModel::resortAllItems() #ifdef KFILEITEMMODEL_DEBUG QElapsedTimer timer; timer.start(); - kDebug() << "==========================================================="; - kDebug() << "Resorting" << itemCount << "items"; + qCDebug(DolphinDebug) << "==========================================================="; + qCDebug(DolphinDebug) << "Resorting" << itemCount << "items"; #endif // Remember the order of the current URLs so @@ -858,7 +858,7 @@ void KFileItemModel::resortAllItems() } #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "[TIME] Resorting of" << itemCount << "items:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] Resorting of" << itemCount << "items:" << timer.elapsed(); #endif } @@ -1013,7 +1013,7 @@ void KFileItemModel::slotRefreshItems(const QList >& { Q_ASSERT(!items.isEmpty()); #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "Refreshing" << items.count() << "items"; + qCDebug(DolphinDebug) << "Refreshing" << items.count() << "items"; #endif // Get the indexes of all items that have been refreshed @@ -1079,7 +1079,7 @@ void KFileItemModel::slotRefreshItems(const QList >& void KFileItemModel::slotClear() { #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "Clearing all items"; + qCDebug(DolphinDebug) << "Clearing all items"; #endif qDeleteAll(m_filteredItems.values()); @@ -1126,8 +1126,8 @@ void KFileItemModel::insertItems(QList& newItems) #ifdef KFILEITEMMODEL_DEBUG QElapsedTimer timer; timer.start(); - kDebug() << "==========================================================="; - kDebug() << "Inserting" << newItems.count() << "items"; + qCDebug(DolphinDebug) << "==========================================================="; + qCDebug(DolphinDebug) << "Inserting" << newItems.count() << "items"; #endif m_groups.clear(); @@ -1144,7 +1144,7 @@ void KFileItemModel::insertItems(QList& newItems) sort(newItems.begin(), newItems.end()); #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "[TIME] Sorting:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] Sorting:" << timer.elapsed(); #endif KItemRangeList itemRanges; @@ -1208,7 +1208,7 @@ void KFileItemModel::insertItems(QList& newItems) emit itemsInserted(itemRanges); #ifdef KFILEITEMMODEL_DEBUG - kDebug() << "[TIME] Inserting of" << newItems.count() << "items:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] Inserting of" << newItems.count() << "items:" << timer.elapsed(); #endif } @@ -2213,19 +2213,19 @@ bool KFileItemModel::isConsistent() const // Check if m_items and m_itemData are consistent. const KFileItem item = fileItem(i); if (item.isNull()) { - qWarning() << "Item" << i << "is null"; + qCWarning(DolphinDebug) << "Item" << i << "is null"; return false; } const int itemIndex = index(item); if (itemIndex != i) { - qWarning() << "Item" << i << "has a wrong index:" << itemIndex; + qCWarning(DolphinDebug) << "Item" << i << "has a wrong index:" << itemIndex; return false; } // Check if the items are sorted correctly. if (i > 0 && !lessThan(m_itemData.at(i - 1), m_itemData.at(i), m_collator)) { - qWarning() << "The order of items" << i - 1 << "and" << i << "is wrong:" + qCWarning(DolphinDebug) << "The order of items" << i - 1 << "and" << i << "is wrong:" << fileItem(i - 1) << fileItem(i); return false; } @@ -2235,13 +2235,13 @@ bool KFileItemModel::isConsistent() const const ItemData* parent = data->parent; if (parent) { if (expandedParentsCount(data) != expandedParentsCount(parent) + 1) { - qWarning() << "expandedParentsCount is inconsistent for parent" << parent->item << "and child" << data->item; + qCWarning(DolphinDebug) << "expandedParentsCount is inconsistent for parent" << parent->item << "and child" << data->item; return false; } const int parentIndex = index(parent->item); if (parentIndex >= i) { - qWarning() << "Index" << parentIndex << "of parent" << parent->item << "is not smaller than index" << i << "of child" << data->item; + qCWarning(DolphinDebug) << "Index" << parentIndex << "of parent" << parent->item << "is not smaller than index" << i << "of child" << data->item; return false; } } diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 0d0304afc..9416f0dd7 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -22,7 +22,7 @@ #include "kitemlistview.h" -#include +#include "dolphindebug.h" #include "kitemlistcontainer.h" #include "kitemlistcontroller.h" #include "kitemlistheader.h" @@ -543,7 +543,7 @@ void KItemListView::endTransaction() --m_activeTransactions; if (m_activeTransactions < 0) { m_activeTransactions = 0; - qWarning() << "Mismatch between beginTransaction()/endTransaction()"; + qCWarning(DolphinDebug) << "Mismatch between beginTransaction()/endTransaction()"; } if (m_activeTransactions == 0) { @@ -1006,7 +1006,7 @@ void KItemListView::slotItemsInserted(const KItemRangeList& itemRanges) const int index = range.index + previouslyInsertedCount; const int count = range.count; if (index < 0 || count <= 0) { - qWarning() << "Invalid item range (index:" << index << ", count:" << count << ")"; + qCWarning(DolphinDebug) << "Invalid item range (index:" << index << ", count:" << count << ")"; continue; } previouslyInsertedCount += count; @@ -1114,7 +1114,7 @@ void KItemListView::slotItemsRemoved(const KItemRangeList& itemRanges) const int index = range.index; const int count = range.count; if (index < 0 || count <= 0) { - qWarning() << "Invalid item range (index:" << index << ", count:" << count << ")"; + qCWarning(DolphinDebug) << "Invalid item range (index:" << index << ", count:" << count << ")"; continue; } diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp index e2dcc62e7..d54457908 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.cpp +++ b/src/kitemviews/private/kitemlistviewlayouter.cpp @@ -22,7 +22,7 @@ #include #include "kitemlistsizehintresolver.h" -#include +#include "dolphindebug.h" // #define KITEMLISTVIEWLAYOUTER_DEBUG @@ -516,7 +516,7 @@ void KItemListViewLayouter::doLayout() } #ifdef KITEMLISTVIEWLAYOUTER_DEBUG - kDebug() << "[TIME] doLayout() for " << m_model->count() << "items:" << timer.elapsed(); + qCDebug(DolphinDebug) << "[TIME] doLayout() for " << m_model->count() << "items:" << timer.elapsed(); #endif m_dirty = false; } diff --git a/src/main.cpp b/src/main.cpp index 14529005f..4291d2fa3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include "dolphindebug.h" #include extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) @@ -109,7 +109,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) if (url.isValid()) { urls.append(url); } else { - qWarning() << "Invalid URL: " << str; + qCWarning(DolphinDebug) << "Invalid URL: " << str; } } @@ -152,7 +152,7 @@ extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv) if (className == QLatin1String("DolphinMainWindow")) { m_mainWindow->restore(1); } else { - kWarning() << "Unknown class " << className << " in session saved data!"; + qCWarning(DolphinDebug) << "Unknown class " << className << " in session saved data!"; } } diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 9169ee9e3..e99c673bc 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -49,7 +49,7 @@ #include -#include +#include "dolphindebug.h" FoldersPanel::FoldersPanel(QWidget* parent) : Panel(parent), diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index 59c2ed733..638d59ec0 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -23,7 +23,7 @@ #include "placesitem.h" #include -#include +#include "dolphindebug.h" #include #include #include "placesitemsignalhandler.h" diff --git a/src/panels/places/placesitemeditdialog.cpp b/src/panels/places/placesitemeditdialog.cpp index cd04ea3f1..d5ca4bf4f 100644 --- a/src/panels/places/placesitemeditdialog.cpp +++ b/src/panels/places/placesitemeditdialog.cpp @@ -24,7 +24,7 @@ #include "placesitemeditdialog.h" #include -#include +#include "dolphindebug.h" #include #include #include diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 95a913e82..28244c645 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include "dolphindebug.h" #include #include #include @@ -191,7 +191,7 @@ void PlacesItemModel::setHiddenItemsShown(bool show) } #ifdef PLACESITEMMODEL_DEBUG - kDebug() << "Changed visibility of hidden items"; + qCDebug(DolphinDebug) << "Changed visibility of hidden items"; showModelState(); #endif } @@ -496,7 +496,7 @@ void PlacesItemModel::onItemInserted(int index) } #ifdef PLACESITEMMODEL_DEBUG - kDebug() << "Inserted item" << index; + qCDebug(DolphinDebug) << "Inserted item" << index; showModelState(); #endif } @@ -514,7 +514,7 @@ void PlacesItemModel::onItemRemoved(int index, KStandardItem* removedItem) m_bookmarkedItems.removeAt(boomarkIndex); #ifdef PLACESITEMMODEL_DEBUG - kDebug() << "Removed item" << index; + qCDebug(DolphinDebug) << "Removed item" << index; showModelState(); #endif } @@ -807,7 +807,7 @@ void PlacesItemModel::loadBookmarks() } #ifdef PLACESITEMMODEL_DEBUG - kDebug() << "Loaded bookmarks"; + qCDebug(DolphinDebug) << "Loaded bookmarks"; showModelState(); #endif } @@ -1176,25 +1176,25 @@ QUrl PlacesItemModel::searchUrlForType(const QString& type) #ifdef PLACESITEMMODEL_DEBUG void PlacesItemModel::showModelState() { - kDebug() << "================================="; - kDebug() << "Model:"; - kDebug() << "hidden-index model-index text"; + qCDebug(DolphinDebug) << "================================="; + qCDebug(DolphinDebug) << "Model:"; + qCDebug(DolphinDebug) << "hidden-index model-index text"; int modelIndex = 0; for (int i = 0; i < m_bookmarkedItems.count(); ++i) { if (m_bookmarkedItems[i]) { - kDebug() << i << "(Hidden) " << " " << m_bookmarkedItems[i]->dataValue("text").toString(); + qCDebug(DolphinDebug) << i << "(Hidden) " << " " << m_bookmarkedItems[i]->dataValue("text").toString(); } else { if (item(modelIndex)) { - kDebug() << i << " " << modelIndex << " " << item(modelIndex)->dataValue("text").toString(); + qCDebug(DolphinDebug) << i << " " << modelIndex << " " << item(modelIndex)->dataValue("text").toString(); } else { - kDebug() << i << " " << modelIndex << " " << "(not available yet)"; + qCDebug(DolphinDebug) << i << " " << modelIndex << " " << "(not available yet)"; } ++modelIndex; } } - kDebug(); - kDebug() << "Bookmarks:"; + qCDebug(DolphinDebug); + qCDebug(DolphinDebug) << "Bookmarks:"; int bookmarkIndex = 0; KBookmarkGroup root = m_bookmarkManager->root(); @@ -1203,9 +1203,9 @@ void PlacesItemModel::showModelState() const QString udi = bookmark.metaDataItem("UDI"); const QString text = udi.isEmpty() ? bookmark.text() : udi; if (bookmark.metaDataItem("IsHidden") == QLatin1String("true")) { - kDebug() << bookmarkIndex << "(Hidden)" << text; + qCDebug(DolphinDebug) << bookmarkIndex << "(Hidden)" << text; } else { - kDebug() << bookmarkIndex << " " << text; + qCDebug(DolphinDebug) << bookmarkIndex << " " << text; } bookmark = root.next(bookmark); diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 5618cee21..50ed7e73a 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -26,7 +26,7 @@ #include "dolphin_generalsettings.h" #include -#include +#include "dolphindebug.h" #include #include #include diff --git a/src/settings/serviceitemdelegate.cpp b/src/settings/serviceitemdelegate.cpp index 774ea78ae..a72dd9ec8 100644 --- a/src/settings/serviceitemdelegate.cpp +++ b/src/settings/serviceitemdelegate.cpp @@ -19,7 +19,7 @@ #include "serviceitemdelegate.h" -#include +#include "dolphindebug.h" #include #include diff --git a/src/tests/kstandarditemmodeltest.cpp b/src/tests/kstandarditemmodeltest.cpp index e83e2031d..ea65cc4ce 100644 --- a/src/tests/kstandarditemmodeltest.cpp +++ b/src/tests/kstandarditemmodeltest.cpp @@ -98,13 +98,13 @@ bool KStandardItemModelTest::isModelConsistent() const for (int i = 0; i < m_model->count(); ++i) { const KStandardItem* item = m_model->item(i); if (!item) { - qWarning() << "Item" << i << "is null"; + qCWarning(DolphinDebug) << "Item" << i << "is null"; return false; } const int itemIndex = m_model->index(item); if (itemIndex != i) { - qWarning() << "Item" << i << "has a wrong index:" << itemIndex; + qCWarning(DolphinDebug) << "Item" << i << "has a wrong index:" << itemIndex; return false; } } diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp index de927d91f..e8345435e 100644 --- a/src/views/dolphinfileitemlistwidget.cpp +++ b/src/views/dolphinfileitemlistwidget.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include "dolphindebug.h" DolphinFileItemListWidget::DolphinFileItemListWidget(KItemListWidgetInformant* informant, QGraphicsItem* parent) : diff --git a/src/views/dolphinremoteencoding.cpp b/src/views/dolphinremoteencoding.cpp index fbf21c08f..961a7c800 100644 --- a/src/views/dolphinremoteencoding.cpp +++ b/src/views/dolphinremoteencoding.cpp @@ -26,7 +26,7 @@ #include "dolphinremoteencoding.h" #include "dolphinviewactionhandler.h" -#include +#include "dolphindebug.h" #include #include #include @@ -141,10 +141,10 @@ void DolphinRemoteEncoding::updateMenu() } } - kDebug() << "URL=" << m_currentURL << " charset=" << charset; + qCDebug(DolphinDebug) << "URL=" << m_currentURL << " charset=" << charset; if (!isFound) { - kWarning() << "could not find entry for charset=" << charset ; + qCWarning(DolphinDebug) << "could not find entry for charset=" << charset ; } else { m_menu->menu()->actions().at(id)->setChecked(true); } @@ -211,7 +211,7 @@ void DolphinRemoteEncoding::slotDefault() } for (QStringList::const_iterator it = domains.constBegin(); it != domains.constEnd();++it) { - kDebug() << "Domain to remove: " << *it; + qCDebug(DolphinDebug) << "Domain to remove: " << *it; if (config.hasGroup(*it)) { config.deleteGroup(*it); } else if (config.group("").hasKey(*it)) { diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp index 4eec88ff8..ac538a648 100644 --- a/src/views/dolphinviewactionhandler.cpp +++ b/src/views/dolphinviewactionhandler.cpp @@ -39,7 +39,7 @@ #include #include -#include +#include "dolphindebug.h" #ifdef HAVE_BALOO #include diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index 79ba8dcc4..47e3da357 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include "dolphindebug.h" #include #include #include @@ -94,7 +94,7 @@ QList VersionControlObserver::actions(const KFileItemList& items) cons bool hasNullItems = false; foreach (const KFileItem& item, items) { if (item.isNull()) { - kWarning() << "Requesting version-control-actions for empty items"; + qCWarning(DolphinDebug) << "Requesting version-control-actions for empty items"; hasNullItems = true; break; } diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp index c8d92be6d..05c993585 100644 --- a/src/views/viewproperties.cpp +++ b/src/views/viewproperties.cpp @@ -24,7 +24,7 @@ #include "dolphin_generalsettings.h" #include -#include +#include "dolphindebug.h" #include #include @@ -359,7 +359,7 @@ void ViewProperties::update() void ViewProperties::save() { - kDebug() << "Saving view-properties to" << m_filePath; + qCDebug(DolphinDebug) << "Saving view-properties to" << m_filePath; QDir dir; dir.mkpath(m_filePath); m_node->setVersion(CurrentViewPropertiesVersion); @@ -388,7 +388,7 @@ QString ViewProperties::viewModePrefix() const case DolphinView::IconsView: prefix = "Icons_"; break; case DolphinView::CompactView: prefix = "Compact_"; break; case DolphinView::DetailsView: prefix = "Details_"; break; - default: kWarning() << "Unknown view-mode of the view properties"; + default: qCWarning(DolphinDebug) << "Unknown view-mode of the view properties"; } return prefix; -- cgit v1.3 From 25751088c33ce507096a3e25ee1eeaa7de38c76b Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Wed, 25 Feb 2015 12:12:55 +0100 Subject: Move the KVersionControlPlugin2 interface from konqlib to Dolphin and remove the deprecated KVersionControlPlugin interface from konqlib REVIEW: 122687 --- CMakeLists.txt | 42 +++- DolphinVcsConfig.cmake.in | 6 + src/CMakeLists.txt | 50 ++++- src/dolphinnewfilemenu.h | 4 +- src/dolphinremoveaction.h | 4 +- src/kitemviews/kfileitemlistview.h | 4 +- src/kitemviews/kfileitemlistwidget.h | 6 +- src/kitemviews/kfileitemmodel.h | 4 +- src/kitemviews/kfileitemmodelrolesupdater.cpp | 1 + src/kitemviews/kfileitemmodelrolesupdater.h | 4 +- src/kitemviews/kitemlistcontainer.h | 4 +- src/kitemviews/kitemlistcontroller.h | 4 +- src/kitemviews/kitemlistgroupheader.h | 4 +- src/kitemviews/kitemlistheader.h | 4 +- src/kitemviews/kitemlistselectionmanager.h | 4 +- src/kitemviews/kitemliststyleoption.h | 4 +- src/kitemviews/kitemlistview.h | 10 +- src/kitemviews/kitemlistviewaccessible.h | 8 +- src/kitemviews/kitemlistwidget.h | 6 +- src/kitemviews/kitemmodelbase.h | 4 +- src/kitemviews/kstandarditem.h | 4 +- src/kitemviews/kstandarditemlistgroupheader.h | 4 +- src/kitemviews/kstandarditemlistview.h | 4 +- src/kitemviews/kstandarditemlistwidget.h | 6 +- src/kitemviews/kstandarditemmodel.h | 4 +- src/kitemviews/private/kbaloorolesprovider.h | 4 +- src/kitemviews/private/kfileitemclipboard.h | 4 +- src/kitemviews/private/kfileitemmodeldirlister.h | 4 +- src/kitemviews/private/kfileitemmodelfilter.h | 4 +- src/kitemviews/private/kitemlistheaderwidget.h | 4 +- .../private/kitemlistkeyboardsearchmanager.h | 4 +- src/kitemviews/private/kitemlistroleeditor.h | 4 +- src/kitemviews/private/kitemlistrubberband.h | 4 +- src/kitemviews/private/kitemlistselectiontoggle.h | 4 +- src/kitemviews/private/kitemlistsizehintresolver.h | 4 +- src/kitemviews/private/kitemlistsmoothscroller.h | 4 +- src/kitemviews/private/kitemlistviewanimation.h | 4 +- src/kitemviews/private/kitemlistviewlayouter.h | 4 +- src/kitemviews/private/kpixmapmodifier.h | 4 +- src/settings/viewpropertiesdialog.h | 4 +- src/tests/CMakeLists.txt | 2 +- src/views/dolphinfileitemlistwidget.cpp | 29 ++- src/views/dolphinfileitemlistwidget.h | 8 +- src/views/dolphinitemlistview.h | 4 +- src/views/dolphinnewfilemenuobserver.h | 4 +- src/views/dolphinremoteencoding.h | 4 +- src/views/dolphinview.h | 4 +- src/views/dolphinviewactionhandler.h | 4 +- src/views/draganddrophelper.h | 4 +- src/views/renamedialog.h | 4 +- src/views/versioncontrol/kversioncontrolplugin.cpp | 29 +++ src/views/versioncontrol/kversioncontrolplugin.h | 223 +++++++++++++++++++++ .../versioncontrol/updateitemstatesthread.cpp | 20 +- src/views/versioncontrol/updateitemstatesthread.h | 6 +- .../versioncontrol/versioncontrolobserver.cpp | 41 +--- src/views/versioncontrol/versioncontrolobserver.h | 10 +- src/views/viewmodecontroller.h | 4 +- src/views/viewproperties.h | 4 +- 58 files changed, 469 insertions(+), 194 deletions(-) create mode 100644 DolphinVcsConfig.cmake.in create mode 100644 src/views/versioncontrol/kversioncontrolplugin.cpp create mode 100644 src/views/versioncontrol/kversioncontrolplugin.h (limited to 'src/views/dolphinfileitemlistwidget.cpp') diff --git a/CMakeLists.txt b/CMakeLists.txt index 570910497..3a3ab6d4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,18 +3,25 @@ cmake_minimum_required(VERSION 2.8.12) project(Dolphin) # ECM setup -find_package(ECM 1.2.0 CONFIG REQUIRED) +find_package(ECM 1.6.0 CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) set(DOLPHIN_VERSION "4.97.0") include(ECMSetupVersion) +include(ECMGenerateHeaders) include(GenerateExportHeader) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings) +ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINVCS + VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/dolphinvcs_version.h" + PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfigVersion.cmake" + SOVERSION 5 +) + ecm_setup_version(${DOLPHIN_VERSION} VARIABLE_PREFIX DOLPHINPRIVATE SOVERSION 5 ) @@ -24,12 +31,6 @@ find_package(KF5 COMPONENTS Activities) find_package(Phonon4Qt5 CONFIG REQUIRED) -if ("${CMAKE_SOURCE_DIR}" STREQUAL "${Dolphin_SOURCE_DIR}") - find_package(KF5Konq CONFIG REQUIRED) -else() - include_directories(${LibKonq_SOURCE_DIR}/src) -endif() - find_package(KF5Baloo 4.97) set_package_properties(KF5Baloo PROPERTIES DESCRIPTION "Baloo Core libraries" URL "http://www.kde.org" @@ -58,6 +59,33 @@ endif() add_subdirectory(src) add_subdirectory(docs) +# CMake files +set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Dolphin") + +ecm_configure_package_config_file( + "${CMAKE_CURRENT_SOURCE_DIR}/DolphinVcsConfig.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfig.cmake" + INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/DolphinVcsConfigVersion.cmake" + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + COMPONENT Devel +) + +install(EXPORT DolphinVcsTargets + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + FILE DolphinVcsTargets.cmake +) + +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/dolphinvcs_version.h" + DESTINATION "${KDE_INSTALL_INCLUDEDIR}/Dolphin" + COMPONENT Devel +) + # TODO Remove the if/endif lines if Dolphin is split. if ("${CMAKE_SOURCE_DIR}" STREQUAL "${Dolphin_SOURCE_DIR}") feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/DolphinVcsConfig.cmake.in b/DolphinVcsConfig.cmake.in new file mode 100644 index 000000000..7e7a2296f --- /dev/null +++ b/DolphinVcsConfig.cmake.in @@ -0,0 +1,6 @@ +@PACKAGE_INIT@ + +find_dependency(Qt5Widgets) +find_dependency(KF5KIO) + +include("${CMAKE_CURRENT_LIST_DIR}/DolphinVcsTargets.cmake") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ea21f1af2..2b65671da 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -12,6 +12,42 @@ endif() configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h) +########################################## + +set(dolphinvcs_LIB_SRCS + views/versioncontrol/kversioncontrolplugin.cpp +) + +add_library(dolphinvcs ${dolphinvcs_LIB_SRCS}) + +generate_export_header(dolphinvcs BASE_NAME dolphin) + +target_link_libraries( + dolphinvcs PUBLIC + Qt5::Widgets + KF5::KIOCore +) + +set_target_properties(dolphinvcs PROPERTIES + VERSION ${DOLPHINVCS_VERSION_STRING} + SOVERSION ${DOLPHINVCS_SOVERSION} + EXPORT_NAME DolphinVcs +) + +ecm_generate_headers(dolphinvcs_LIB_HEADERS + HEADER_NAMES + KVersionControlPlugin + + RELATIVE "views/versioncontrol" + REQUIRED_HEADERS dolphinvcs_LIB_HEADERS +) + +install(TARGETS dolphinvcs EXPORT DolphinVcsTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) + +install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dolphin_export.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} COMPONENT Devel) +install(FILES ${dolphinvcs_LIB_HEADERS} DESTINATION "${KDE_INSTALL_INCLUDEDIR}/Dolphin" COMPONENT Devel) + ########### next target ############### set(dolphinprivate_LIB_SRCS @@ -93,13 +129,10 @@ kconfig_add_kcfg_files(dolphinprivate_LIB_SRCS GENERATE_MOC add_library(dolphinprivate ${dolphinprivate_LIB_SRCS}) -generate_export_header(dolphinprivate BASE_NAME libdolphinprivate - EXPORT_FILE_NAME libdolphin_export.h) - target_link_libraries( dolphinprivate PUBLIC + dolphinvcs KF5::KDELibs4Support - KF5::Konq KF5::NewStuff ) @@ -122,7 +155,7 @@ set_target_properties(dolphinprivate PROPERTIES SOVERSION ${DOLPHINPRIVATE_SOVERSION} ) -install(TARGETS dolphinprivate ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS dolphinprivate ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## @@ -136,7 +169,6 @@ add_library(dolphinpart MODULE ${dolphinpart_SRCS}) target_link_libraries(dolphinpart dolphinprivate - KF5::Konq KF5::KDELibs4Support ) @@ -144,7 +176,6 @@ install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES dolphinpart.rc DESTINATION ${CMAKE_INSTALL_KXMLGUI5DIR}/dolphinpart) install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR}) -install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) ########################################## @@ -230,7 +261,6 @@ kf5_add_kdeinit_executable(dolphin ${dolphin_SRCS}) target_include_directories(kdeinit_dolphin PRIVATE ${PHONON_INCLUDES}) target_link_libraries(kdeinit_dolphin - KF5::Konq dolphinprivate KF5::NewStuff KF5::Parts @@ -251,8 +281,8 @@ if (KF5Activities_FOUND) ) endif() -install(TARGETS kdeinit_dolphin ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) -install(TARGETS dolphin ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS kdeinit_dolphin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) +install(TARGETS dolphin ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########################################## diff --git a/src/dolphinnewfilemenu.h b/src/dolphinnewfilemenu.h index 254571eb9..9f1cb5599 100644 --- a/src/dolphinnewfilemenu.h +++ b/src/dolphinnewfilemenu.h @@ -23,7 +23,7 @@ #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class KJob; @@ -35,7 +35,7 @@ class KJob; * All errors are shown in the status bar of Dolphin * instead as modal error dialog with an OK button. */ -class LIBDOLPHINPRIVATE_EXPORT DolphinNewFileMenu : public KNewFileMenu +class DOLPHIN_EXPORT DolphinNewFileMenu : public KNewFileMenu { Q_OBJECT diff --git a/src/dolphinremoveaction.h b/src/dolphinremoveaction.h index 1a123ace5..85f404318 100644 --- a/src/dolphinremoveaction.h +++ b/src/dolphinremoveaction.h @@ -20,7 +20,7 @@ #ifndef DOLPHINREMOVEACTION_H #define DOLPHINREMOVEACTION_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -34,7 +34,7 @@ * This class expects the presence of both the "move_to_trash" and "delete" * actions in @ref collection. */ -class LIBDOLPHINPRIVATE_EXPORT DolphinRemoveAction : public QAction +class DOLPHIN_EXPORT DolphinRemoveAction : public QAction { Q_OBJECT public: diff --git a/src/kitemviews/kfileitemlistview.h b/src/kitemviews/kfileitemlistview.h index 72688893e..84aa17d89 100644 --- a/src/kitemviews/kfileitemlistview.h +++ b/src/kitemviews/kfileitemlistview.h @@ -20,7 +20,7 @@ #ifndef KFILEITEMLISTVIEW_H #define KFILEITEMLISTVIEW_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -36,7 +36,7 @@ class QTimer; * KItemListView::setWidgetCreator() and KItemListView::setGroupHeaderCreator() * to apply customized generators. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemListView : public KStandardItemListView +class DOLPHIN_EXPORT KFileItemListView : public KStandardItemListView { Q_OBJECT diff --git a/src/kitemviews/kfileitemlistwidget.h b/src/kitemviews/kfileitemlistwidget.h index 32959e4f6..07ca59b44 100644 --- a/src/kitemviews/kfileitemlistwidget.h +++ b/src/kitemviews/kfileitemlistwidget.h @@ -20,11 +20,11 @@ #ifndef KFILEITEMLISTWIDGET_H #define KFILEITEMLISTWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include -class LIBDOLPHINPRIVATE_EXPORT KFileItemListWidgetInformant : public KStandardItemListWidgetInformant +class DOLPHIN_EXPORT KFileItemListWidgetInformant : public KStandardItemListWidgetInformant { public: KFileItemListWidgetInformant(); @@ -37,7 +37,7 @@ protected: virtual QFont customizedFontForLinks(const QFont& baseFont) const Q_DECL_OVERRIDE; }; -class LIBDOLPHINPRIVATE_EXPORT KFileItemListWidget : public KStandardItemListWidget +class DOLPHIN_EXPORT KFileItemListWidget : public KStandardItemListWidget { Q_OBJECT diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 8e36294e9..167f508cf 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -20,7 +20,7 @@ #ifndef KFILEITEMMODEL_H #define KFILEITEMMODEL_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include @@ -43,7 +43,7 @@ class QTimer; * Recursive expansion of sub-directories is supported by * KFileItemModel::setExpanded(). */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModel : public KItemModelBase +class DOLPHIN_EXPORT KFileItemModel : public KItemModelBase { Q_OBJECT diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index f17a77e0a..c18d65892 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h index 6c82dbe4a..216b0a501 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.h +++ b/src/kitemviews/kfileitemmodelrolesupdater.h @@ -25,7 +25,7 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -87,7 +87,7 @@ namespace KIO { * 3. Finally, the entire process is repeated for any items that might have * changed in the mean time. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModelRolesUpdater : public QObject +class DOLPHIN_EXPORT KFileItemModelRolesUpdater : public QObject { Q_OBJECT diff --git a/src/kitemviews/kitemlistcontainer.h b/src/kitemviews/kitemlistcontainer.h index 6f2851b3e..9fc3d4957 100644 --- a/src/kitemviews/kitemlistcontainer.h +++ b/src/kitemviews/kitemlistcontainer.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTCONTAINER_H #define KITEMLISTCONTAINER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -39,7 +39,7 @@ class KItemModelBase; * * @see KItemListController */ -class LIBDOLPHINPRIVATE_EXPORT KItemListContainer : public QAbstractScrollArea +class DOLPHIN_EXPORT KItemListContainer : public QAbstractScrollArea { Q_OBJECT diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index 2824a1fc9..b8a93edac 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTCONTROLLER_H #define KITEMLISTCONTROLLER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include "kitemset.h" @@ -56,7 +56,7 @@ class QTransform; * @see KItemModelBase * @see KItemListSelectionManager */ -class LIBDOLPHINPRIVATE_EXPORT KItemListController : public QObject +class DOLPHIN_EXPORT KItemListController : public QObject { Q_OBJECT Q_ENUMS(SelectionBehavior) diff --git a/src/kitemviews/kitemlistgroupheader.h b/src/kitemviews/kitemlistgroupheader.h index c89da5027..4612bc4da 100644 --- a/src/kitemviews/kitemlistgroupheader.h +++ b/src/kitemviews/kitemlistgroupheader.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTGROUPHEADER_H #define KITEMLISTGROUPHEADER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -37,7 +37,7 @@ class KItemListView; * the method paint() and draw the role within the given roleBounds() with * the color roleColor(). */ -class LIBDOLPHINPRIVATE_EXPORT KItemListGroupHeader : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListGroupHeader : public QGraphicsWidget { Q_OBJECT diff --git a/src/kitemviews/kitemlistheader.h b/src/kitemviews/kitemlistheader.h index b361b912b..cc2b74793 100644 --- a/src/kitemviews/kitemlistheader.h +++ b/src/kitemviews/kitemlistheader.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTHEADER_H #define KITEMLISTHEADER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -33,7 +33,7 @@ class KItemListView; * Each column of the header represents a visible role * accessible by KItemListView::visibleRoles(). */ -class LIBDOLPHINPRIVATE_EXPORT KItemListHeader : public QObject +class DOLPHIN_EXPORT KItemListHeader : public QObject { Q_OBJECT diff --git a/src/kitemviews/kitemlistselectionmanager.h b/src/kitemviews/kitemlistselectionmanager.h index a8318388c..16761428b 100644 --- a/src/kitemviews/kitemlistselectionmanager.h +++ b/src/kitemviews/kitemlistselectionmanager.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTSELECTIONMANAGER_H #define KITEMLISTSELECTIONMANAGER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -35,7 +35,7 @@ class KItemModelBase; /** * @brief Allows to select and deselect items of a KItemListView. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListSelectionManager : public QObject +class DOLPHIN_EXPORT KItemListSelectionManager : public QObject { Q_OBJECT diff --git a/src/kitemviews/kitemliststyleoption.h b/src/kitemviews/kitemliststyleoption.h index 9290dc341..09b787c27 100644 --- a/src/kitemviews/kitemliststyleoption.h +++ b/src/kitemviews/kitemliststyleoption.h @@ -20,14 +20,14 @@ #ifndef KITEMLISTSTYLEOPTION_H #define KITEMLISTSTYLEOPTION_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include #include -class LIBDOLPHINPRIVATE_EXPORT KItemListStyleOption +class DOLPHIN_EXPORT KItemListStyleOption { public: KItemListStyleOption(); diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 8130e45ed..f20180289 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTVIEW_H #define KITEMLISTVIEW_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -59,7 +59,7 @@ class QTimer; * @see KItemListWidget * @see KItemModelBase */ -class LIBDOLPHINPRIVATE_EXPORT KItemListView : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListView : public QGraphicsWidget { Q_OBJECT @@ -769,7 +769,7 @@ private: * KItemListWidgetCreatorBase and KItemListGroupHeaderCreatorBase. * @internal */ -class LIBDOLPHINPRIVATE_EXPORT KItemListCreatorBase +class DOLPHIN_EXPORT KItemListCreatorBase { public: virtual ~KItemListCreatorBase(); @@ -793,7 +793,7 @@ private: * expensive instantiations and deletions of KItemListWidgets by recycling existing widget * instances. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListWidgetCreatorBase : public KItemListCreatorBase +class DOLPHIN_EXPORT KItemListWidgetCreatorBase : public KItemListCreatorBase { public: virtual ~KItemListWidgetCreatorBase(); @@ -875,7 +875,7 @@ qreal KItemListWidgetCreator::preferredRoleColumnWidth(const QByteArray& role * The intention of the group-header creator is to prevent repetitive and expensive instantiations and * deletions of KItemListGroupHeaders by recycling existing header instances. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListGroupHeaderCreatorBase : public KItemListCreatorBase +class DOLPHIN_EXPORT KItemListGroupHeaderCreatorBase : public KItemListCreatorBase { public: virtual ~KItemListGroupHeaderCreatorBase(); diff --git a/src/kitemviews/kitemlistviewaccessible.h b/src/kitemviews/kitemlistviewaccessible.h index 28b0be4e6..afef2d5fe 100644 --- a/src/kitemviews/kitemlistviewaccessible.h +++ b/src/kitemviews/kitemlistviewaccessible.h @@ -22,7 +22,7 @@ #ifndef QT_NO_ACCESSIBILITY -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -32,7 +32,7 @@ class KItemListView; class KItemListContainer; -class LIBDOLPHINPRIVATE_EXPORT KItemListViewAccessible: public QAccessibleObject, public QAccessibleTableInterface +class DOLPHIN_EXPORT KItemListViewAccessible: public QAccessibleObject, public QAccessibleTableInterface { public: explicit KItemListViewAccessible(KItemListView* view); @@ -89,7 +89,7 @@ private: mutable QVector m_cells; }; -class LIBDOLPHINPRIVATE_EXPORT KItemListAccessibleCell: public QAccessibleInterface, public QAccessibleTableCellInterface +class DOLPHIN_EXPORT KItemListAccessibleCell: public QAccessibleInterface, public QAccessibleTableCellInterface { public: KItemListAccessibleCell(KItemListView* view, int m_index); @@ -128,7 +128,7 @@ private: int m_index; }; -class LIBDOLPHINPRIVATE_EXPORT KItemListContainerAccessible : public QAccessibleWidget +class DOLPHIN_EXPORT KItemListContainerAccessible : public QAccessibleWidget { public: explicit KItemListContainerAccessible(KItemListContainer* container); diff --git a/src/kitemviews/kitemlistwidget.h b/src/kitemviews/kitemlistwidget.h index 723847c43..ae99a1f29 100644 --- a/src/kitemviews/kitemlistwidget.h +++ b/src/kitemviews/kitemlistwidget.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTWIDGET_H #define KITEMLISTWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -43,7 +43,7 @@ class QPropertyAnimation; * size for the invisible items must be accessible. KItemListWidgetInformant * provides this information. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListWidgetInformant +class DOLPHIN_EXPORT KItemListWidgetInformant { public: KItemListWidgetInformant(); @@ -63,7 +63,7 @@ public: * All properties are set by KItemListView, for each property there is a corresponding * virtual protected method that allows to react on property changes. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListWidget : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListWidget : public QGraphicsWidget { Q_OBJECT diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h index e46d761fc..bd5ca1d65 100644 --- a/src/kitemviews/kitemmodelbase.h +++ b/src/kitemviews/kitemmodelbase.h @@ -23,7 +23,7 @@ #ifndef KITEMMODELBASE_H #define KITEMMODELBASE_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -49,7 +49,7 @@ class QMimeData; * Also optionally it is possible to provide a tree of items by implementing the methods * setExpanded(), isExpanded(), isExpandable() and expandedParentsCount(). */ -class LIBDOLPHINPRIVATE_EXPORT KItemModelBase : public QObject +class DOLPHIN_EXPORT KItemModelBase : public QObject { Q_OBJECT diff --git a/src/kitemviews/kstandarditem.h b/src/kitemviews/kstandarditem.h index b1d5edf2e..5bb2bb36f 100644 --- a/src/kitemviews/kstandarditem.h +++ b/src/kitemviews/kstandarditem.h @@ -20,7 +20,7 @@ #ifndef KSTANDARDITEM_H #define KSTANDARDITEM_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -36,7 +36,7 @@ class KStandardItemModel; * used roles. It is possible to assign values for custom * roles by using setDataValue(). */ -class LIBDOLPHINPRIVATE_EXPORT KStandardItem +class DOLPHIN_EXPORT KStandardItem { public: diff --git a/src/kitemviews/kstandarditemlistgroupheader.h b/src/kitemviews/kstandarditemlistgroupheader.h index caf906ddf..f0eacfd49 100644 --- a/src/kitemviews/kstandarditemlistgroupheader.h +++ b/src/kitemviews/kstandarditemlistgroupheader.h @@ -20,14 +20,14 @@ #ifndef KSTANDARDITEMLISTGROUPHEADER_H #define KSTANDARDITEMLISTGROUPHEADER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include -class LIBDOLPHINPRIVATE_EXPORT KStandardItemListGroupHeader : public KItemListGroupHeader +class DOLPHIN_EXPORT KStandardItemListGroupHeader : public KItemListGroupHeader { Q_OBJECT diff --git a/src/kitemviews/kstandarditemlistview.h b/src/kitemviews/kstandarditemlistview.h index 9fc43a940..2e4c7a0a0 100644 --- a/src/kitemviews/kstandarditemlistview.h +++ b/src/kitemviews/kstandarditemlistview.h @@ -20,7 +20,7 @@ #ifndef KSTANDARDITEMLISTVIEW_H #define KSTANDARDITEMLISTVIEW_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -40,7 +40,7 @@ * KItemListContainer* container = new KItemListContainer(controller, parentWidget); * */ -class LIBDOLPHINPRIVATE_EXPORT KStandardItemListView : public KItemListView +class DOLPHIN_EXPORT KStandardItemListView : public KItemListView { Q_OBJECT diff --git a/src/kitemviews/kstandarditemlistwidget.h b/src/kitemviews/kstandarditemlistwidget.h index 8e61d06b4..826452255 100644 --- a/src/kitemviews/kstandarditemlistwidget.h +++ b/src/kitemviews/kstandarditemlistwidget.h @@ -20,7 +20,7 @@ #ifndef KSTANDARDITEMLISTWIDGET_H #define KSTANDARDITEMLISTWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -32,7 +32,7 @@ class KItemListRoleEditor; class KItemListStyleOption; class KItemListView; -class LIBDOLPHINPRIVATE_EXPORT KStandardItemListWidgetInformant : public KItemListWidgetInformant +class DOLPHIN_EXPORT KStandardItemListWidgetInformant : public KItemListWidgetInformant { public: KStandardItemListWidgetInformant(); @@ -83,7 +83,7 @@ protected: /** * @brief Itemlist widget implementation for KStandardItemView and KStandardItemModel. */ -class LIBDOLPHINPRIVATE_EXPORT KStandardItemListWidget : public KItemListWidget +class DOLPHIN_EXPORT KStandardItemListWidget : public KItemListWidget { Q_OBJECT diff --git a/src/kitemviews/kstandarditemmodel.h b/src/kitemviews/kstandarditemmodel.h index 3b5f5bd39..58c5a5d88 100644 --- a/src/kitemviews/kstandarditemmodel.h +++ b/src/kitemviews/kstandarditemmodel.h @@ -20,7 +20,7 @@ #ifndef KSTANDARDITEMMODEL_H #define KSTANDARDITEMMODEL_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include @@ -35,7 +35,7 @@ class KStandardItem; * * @see KStandardItem */ -class LIBDOLPHINPRIVATE_EXPORT KStandardItemModel : public KItemModelBase +class DOLPHIN_EXPORT KStandardItemModel : public KItemModelBase { Q_OBJECT diff --git a/src/kitemviews/private/kbaloorolesprovider.h b/src/kitemviews/private/kbaloorolesprovider.h index ef073a367..9673bff4f 100644 --- a/src/kitemviews/private/kbaloorolesprovider.h +++ b/src/kitemviews/private/kbaloorolesprovider.h @@ -21,7 +21,7 @@ #ifndef KBALOO_ROLESPROVIDER_H #define KBALOO_ROLESPROVIDER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -36,7 +36,7 @@ namespace Baloo { * Is a helper class for KFileItemModelRolesUpdater to retrieve roles that * are only accessible with Baloo. */ -class LIBDOLPHINPRIVATE_EXPORT KBalooRolesProvider +class DOLPHIN_EXPORT KBalooRolesProvider { public: static KBalooRolesProvider& instance(); diff --git a/src/kitemviews/private/kfileitemclipboard.h b/src/kitemviews/private/kfileitemclipboard.h index d02fc0d47..3ee50d661 100644 --- a/src/kitemviews/private/kfileitemclipboard.h +++ b/src/kitemviews/private/kfileitemclipboard.h @@ -25,13 +25,13 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" /** * @brief Wrapper for QClipboard to provide fast access for checking * whether a KFileItem has been clipped. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemClipboard : public QObject +class DOLPHIN_EXPORT KFileItemClipboard : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h index a9c8c845a..c2c621aed 100644 --- a/src/kitemviews/private/kfileitemmodeldirlister.h +++ b/src/kitemviews/private/kfileitemmodeldirlister.h @@ -20,7 +20,7 @@ #ifndef KFILEITEMMODELDIRLISTER_H #define KFILEITEMMODELDIRLISTER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -29,7 +29,7 @@ * error occurred instead of showing an error dialog. * KDirLister::autoErrorHandlingEnabled() is set to false. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModelDirLister : public KDirLister +class DOLPHIN_EXPORT KFileItemModelDirLister : public KDirLister { Q_OBJECT diff --git a/src/kitemviews/private/kfileitemmodelfilter.h b/src/kitemviews/private/kfileitemmodelfilter.h index b26e31a00..67c1c280c 100644 --- a/src/kitemviews/private/kfileitemmodelfilter.h +++ b/src/kitemviews/private/kfileitemmodelfilter.h @@ -21,7 +21,7 @@ #ifndef KFILEITEMMODELFILTER_H #define KFILEITEMMODELFILTER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include class KFileItem; @@ -35,7 +35,7 @@ class QRegExp; * property of the KFileItem, but this might get extended in * future. */ -class LIBDOLPHINPRIVATE_EXPORT KFileItemModelFilter +class DOLPHIN_EXPORT KFileItemModelFilter { public: diff --git a/src/kitemviews/private/kitemlistheaderwidget.h b/src/kitemviews/private/kitemlistheaderwidget.h index 74c9ac518..307def74d 100644 --- a/src/kitemviews/private/kitemlistheaderwidget.h +++ b/src/kitemviews/private/kitemlistheaderwidget.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTHEADERWIDGET_H #define KITEMLISTHEADERWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include @@ -33,7 +33,7 @@ class KItemModelBase; * The widget is an internal API, the user of KItemListView may only access the * class KItemListHeader. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListHeaderWidget : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListHeaderWidget : public QGraphicsWidget { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h index 1f315dabd..2a14ca470 100644 --- a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h +++ b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h @@ -23,7 +23,7 @@ #ifndef KITEMLISTKEYBOARDSEARCHMANAGER_H #define KITEMLISTKEYBOARDSEARCHMANAGER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -35,7 +35,7 @@ * @see KItemListController * @see KItemModelBase */ -class LIBDOLPHINPRIVATE_EXPORT KItemListKeyboardSearchManager : public QObject +class DOLPHIN_EXPORT KItemListKeyboardSearchManager : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistroleeditor.h b/src/kitemviews/private/kitemlistroleeditor.h index 7c2b61e2d..3b8f96865 100644 --- a/src/kitemviews/private/kitemlistroleeditor.h +++ b/src/kitemviews/private/kitemlistroleeditor.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTROLEEDITOR_H #define KITEMLISTROLEEDITOR_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -33,7 +33,7 @@ * * The size automatically gets increased if the text does not fit. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListRoleEditor : public KTextEdit +class DOLPHIN_EXPORT KItemListRoleEditor : public KTextEdit { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistrubberband.h b/src/kitemviews/private/kitemlistrubberband.h index 39c7573ae..b47c30c1f 100644 --- a/src/kitemviews/private/kitemlistrubberband.h +++ b/src/kitemviews/private/kitemlistrubberband.h @@ -20,14 +20,14 @@ #ifndef KITEMLISTRUBBERBAND_H #define KITEMLISTRUBBERBAND_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include /** * @brief Manages the rubberband when selecting items. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListRubberBand : public QObject +class DOLPHIN_EXPORT KItemListRubberBand : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistselectiontoggle.h b/src/kitemviews/private/kitemlistselectiontoggle.h index bd64879af..d058ee988 100644 --- a/src/kitemviews/private/kitemlistselectiontoggle.h +++ b/src/kitemviews/private/kitemlistselectiontoggle.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTSELECTIONTOGGLE_H #define KITEMLISTSELECTIONTOGGLE_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -29,7 +29,7 @@ /** * @brief Allows to toggle between the selected and unselected state of an item. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListSelectionToggle : public QGraphicsWidget +class DOLPHIN_EXPORT KItemListSelectionToggle : public QGraphicsWidget { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistsizehintresolver.h b/src/kitemviews/private/kitemlistsizehintresolver.h index 3bd2319dd..ff17f2de2 100644 --- a/src/kitemviews/private/kitemlistsizehintresolver.h +++ b/src/kitemviews/private/kitemlistsizehintresolver.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTSIZEHINTRESOLVER_H #define KITEMLISTSIZEHINTRESOLVER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -31,7 +31,7 @@ class KItemListView; /** * @brief Calculates and caches the sizehints of items in KItemListView. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListSizeHintResolver +class DOLPHIN_EXPORT KItemListSizeHintResolver { public: KItemListSizeHintResolver(const KItemListView* itemListView); diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h index 963cf7b24..fca4b0c53 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.h +++ b/src/kitemviews/private/kitemlistsmoothscroller.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTSMOOTHSCROLLER_H #define KITEMLISTSMOOTHSCROLLER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -33,7 +33,7 @@ class QWheelEvent; * @brief Helper class for KItemListContainer to have a smooth * scrolling when adjusting the scrollbars. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListSmoothScroller : public QObject +class DOLPHIN_EXPORT KItemListSmoothScroller : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistviewanimation.h b/src/kitemviews/private/kitemlistviewanimation.h index ed4ec4902..06c81c9b8 100644 --- a/src/kitemviews/private/kitemlistviewanimation.h +++ b/src/kitemviews/private/kitemlistviewanimation.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTVIEWANIMATION_H #define KITEMLISTVIEWANIMATION_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -36,7 +36,7 @@ class QPropertyAnimation; * Supports item animations for moving, creating, deleting and resizing * an item. Several applications can be applied to one item in parallel. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListViewAnimation : public QObject +class DOLPHIN_EXPORT KItemListViewAnimation : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kitemlistviewlayouter.h b/src/kitemviews/private/kitemlistviewlayouter.h index fc82d6061..3f1cf68d4 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.h +++ b/src/kitemviews/private/kitemlistviewlayouter.h @@ -20,7 +20,7 @@ #ifndef KITEMLISTVIEWLAYOUTER_H #define KITEMLISTVIEWLAYOUTER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -45,7 +45,7 @@ class KItemListSizeHintResolver; * changing properties of the layouter is not expensive, only the * first read of a property can get expensive. */ -class LIBDOLPHINPRIVATE_EXPORT KItemListViewLayouter : public QObject +class DOLPHIN_EXPORT KItemListViewLayouter : public QObject { Q_OBJECT diff --git a/src/kitemviews/private/kpixmapmodifier.h b/src/kitemviews/private/kpixmapmodifier.h index b5eec6542..e8ca11ac1 100644 --- a/src/kitemviews/private/kpixmapmodifier.h +++ b/src/kitemviews/private/kpixmapmodifier.h @@ -20,12 +20,12 @@ #ifndef KPIXMAPMODIFIER_H #define KPIXMAPMODIFIER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" class QPixmap; class QSize; -class LIBDOLPHINPRIVATE_EXPORT KPixmapModifier +class DOLPHIN_EXPORT KPixmapModifier { public: static void scale(QPixmap& pixmap, const QSize& scaledSize); diff --git a/src/settings/viewpropertiesdialog.h b/src/settings/viewpropertiesdialog.h index 63c534b30..5490be85b 100644 --- a/src/settings/viewpropertiesdialog.h +++ b/src/settings/viewpropertiesdialog.h @@ -21,7 +21,7 @@ #ifndef VIEWPROPERTIESDIALOG_H #define VIEWPROPERTIESDIALOG_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include @@ -39,7 +39,7 @@ class DolphinView; * and previews should be shown. The properties can be assigned to the current folder, * or recursively to all sub folders. */ -class LIBDOLPHINPRIVATE_EXPORT ViewPropertiesDialog : public QDialog +class DOLPHIN_EXPORT ViewPropertiesDialog : public QDialog { Q_OBJECT diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 1c6c5b40c..22a8b4849 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -4,7 +4,7 @@ find_package(Qt5Test CONFIG REQUIRED) include(ECMMarkAsTest) # needed on windows to correctly use the files from dolphinprivate -add_definitions(-DLIBDOLPHINPRIVATE_EXPORT=) +add_definitions(-DDOLPHIN_EXPORT=) # KItemSetTest set(kitemsettest_SRCS diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp index e8345435e..f15230841 100644 --- a/src/views/dolphinfileitemlistwidget.cpp +++ b/src/views/dolphinfileitemlistwidget.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include "dolphindebug.h" @@ -43,7 +42,7 @@ void DolphinFileItemListWidget::refreshCache() if (values.contains("version")) { // The item is under version control. Apply the text color corresponding // to its version state. - const KVersionControlPlugin2::ItemVersion version = static_cast(values.value("version").toInt()); + const KVersionControlPlugin::ItemVersion version = static_cast(values.value("version").toInt()); const QColor textColor = styleOption().palette.text().color(); QColor tintColor = textColor; @@ -51,16 +50,16 @@ void DolphinFileItemListWidget::refreshCache() // as tint colors and are mixed with the current set text color. The tint colors // have been optimized for the base colors of the corresponding Oxygen emblems. switch (version) { - case KVersionControlPlugin2::UpdateRequiredVersion: tintColor = Qt::yellow; break; - case KVersionControlPlugin2::LocallyModifiedUnstagedVersion: tintColor = Qt::green; break; - case KVersionControlPlugin2::LocallyModifiedVersion: tintColor = Qt::green; break; - case KVersionControlPlugin2::AddedVersion: tintColor = Qt::green; break; - case KVersionControlPlugin2::RemovedVersion: tintColor = Qt::darkRed; break; - case KVersionControlPlugin2::ConflictingVersion: tintColor = Qt::red; break; - case KVersionControlPlugin2::IgnoredVersion: tintColor = Qt::white; break; - case KVersionControlPlugin2::MissingVersion: tintColor = Qt::red; break; - case KVersionControlPlugin2::NormalVersion: - case KVersionControlPlugin2::UnversionedVersion: + case KVersionControlPlugin::UpdateRequiredVersion: tintColor = Qt::yellow; break; + case KVersionControlPlugin::LocallyModifiedUnstagedVersion: tintColor = Qt::green; break; + case KVersionControlPlugin::LocallyModifiedVersion: tintColor = Qt::green; break; + case KVersionControlPlugin::AddedVersion: tintColor = Qt::green; break; + case KVersionControlPlugin::RemovedVersion: tintColor = Qt::darkRed; break; + case KVersionControlPlugin::ConflictingVersion: tintColor = Qt::red; break; + case KVersionControlPlugin::IgnoredVersion: tintColor = Qt::white; break; + case KVersionControlPlugin::MissingVersion: tintColor = Qt::red; break; + case KVersionControlPlugin::NormalVersion: + case KVersionControlPlugin::UnversionedVersion: default: break; } @@ -78,7 +77,7 @@ void DolphinFileItemListWidget::refreshCache() setTextColor(color); } -QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemVersion version, int size) +QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin::ItemVersion version, int size) { int overlayHeight = KIconLoader::SizeSmall; if (size >= KIconLoader::SizeEnormous) { @@ -115,8 +114,8 @@ QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemV iconName = "vcs-conflicting"; break; case KVersionControlPlugin::UnversionedVersion: - case KVersionControlPlugin2::IgnoredVersion: - case KVersionControlPlugin2::MissingVersion: + case KVersionControlPlugin::IgnoredVersion: + case KVersionControlPlugin::MissingVersion: break; default: Q_ASSERT(false); diff --git a/src/views/dolphinfileitemlistwidget.h b/src/views/dolphinfileitemlistwidget.h index 5f9cc3a5a..af73ac937 100644 --- a/src/views/dolphinfileitemlistwidget.h +++ b/src/views/dolphinfileitemlistwidget.h @@ -20,10 +20,10 @@ #ifndef DOLPHINFILEITEMLISTWIDGET_H #define DOLPHINFILEITEMLISTWIDGET_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include -#include +#include "versioncontrol/kversioncontrolplugin.h" /** * @brief Extends KFileItemListWidget to handle the "version" role. @@ -31,7 +31,7 @@ * The "version" role is set if version-control-plugins have been enabled. * @see KVersionControlPlugin */ -class LIBDOLPHINPRIVATE_EXPORT DolphinFileItemListWidget : public KFileItemListWidget +class DOLPHIN_EXPORT DolphinFileItemListWidget : public KFileItemListWidget { Q_OBJECT @@ -43,7 +43,7 @@ protected: virtual void refreshCache() Q_DECL_OVERRIDE; private: - static QPixmap overlayForState(KVersionControlPlugin2::ItemVersion version, int size); + static QPixmap overlayForState(KVersionControlPlugin::ItemVersion version, int size); }; diff --git a/src/views/dolphinitemlistview.h b/src/views/dolphinitemlistview.h index 2b16825f4..7eec6f17a 100644 --- a/src/views/dolphinitemlistview.h +++ b/src/views/dolphinitemlistview.h @@ -23,7 +23,7 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class KFileItemListView; @@ -34,7 +34,7 @@ class KFileItemListView; * the view-properties into the corresponding KItemListView * properties. */ -class LIBDOLPHINPRIVATE_EXPORT DolphinItemListView : public KFileItemListView +class DOLPHIN_EXPORT DolphinItemListView : public KFileItemListView { Q_OBJECT diff --git a/src/views/dolphinnewfilemenuobserver.h b/src/views/dolphinnewfilemenuobserver.h index b9b18e229..df4621f17 100644 --- a/src/views/dolphinnewfilemenuobserver.h +++ b/src/views/dolphinnewfilemenuobserver.h @@ -22,7 +22,7 @@ #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class DolphinNewFileMenu; @@ -33,7 +33,7 @@ class DolphinNewFileMenu; * As soon as a DolphinNewFileMenu instance created a new item, * the observer will emit the signal itemCreated(). */ -class LIBDOLPHINPRIVATE_EXPORT DolphinNewFileMenuObserver : public QObject +class DOLPHIN_EXPORT DolphinNewFileMenuObserver : public QObject { Q_OBJECT diff --git a/src/views/dolphinremoteencoding.h b/src/views/dolphinremoteencoding.h index 0351abad7..28ff52cb3 100644 --- a/src/views/dolphinremoteencoding.h +++ b/src/views/dolphinremoteencoding.h @@ -23,7 +23,7 @@ #include #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class KActionMenu; @@ -35,7 +35,7 @@ class DolphinViewActionHandler; * When browsing remote url, its possible to change encoding from Tools Menu. */ -class LIBDOLPHINPRIVATE_EXPORT DolphinRemoteEncoding: public QObject +class DOLPHIN_EXPORT DolphinRemoteEncoding: public QObject { Q_OBJECT public: diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index aa4492bc3..24b560f10 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -23,7 +23,7 @@ #include -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -57,7 +57,7 @@ class QRegExp; * - show previews * - enable grouping */ -class LIBDOLPHINPRIVATE_EXPORT DolphinView : public QWidget +class DOLPHIN_EXPORT DolphinView : public QWidget { Q_OBJECT diff --git a/src/views/dolphinviewactionhandler.h b/src/views/dolphinviewactionhandler.h index bf664f731..eb375b5c9 100644 --- a/src/views/dolphinviewactionhandler.h +++ b/src/views/dolphinviewactionhandler.h @@ -22,7 +22,7 @@ #ifndef DOLPHINVIEWACTIONHANDLER_H #define DOLPHINVIEWACTIONHANDLER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include "views/dolphinview.h" #include @@ -46,7 +46,7 @@ class KActionCollection; * @see DolphinMainWindow * @see DolphinPart */ -class LIBDOLPHINPRIVATE_EXPORT DolphinViewActionHandler : public QObject +class DOLPHIN_EXPORT DolphinViewActionHandler : public QObject { Q_OBJECT diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h index 0fbe3a128..fe77b1e6e 100644 --- a/src/views/draganddrophelper.h +++ b/src/views/draganddrophelper.h @@ -21,7 +21,7 @@ #ifndef DRAGANDDROPHELPER_H #define DRAGANDDROPHELPER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" class QUrl; @@ -29,7 +29,7 @@ class QDropEvent; class QWidget; namespace KIO { class DropJob; } -class LIBDOLPHINPRIVATE_EXPORT DragAndDropHelper +class DOLPHIN_EXPORT DragAndDropHelper { public: /** diff --git a/src/views/renamedialog.h b/src/views/renamedialog.h index 7c02d1b87..a1953e8b3 100644 --- a/src/views/renamedialog.h +++ b/src/views/renamedialog.h @@ -20,7 +20,7 @@ #ifndef RENAMEDIALOG_H #define RENAMEDIALOG_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include @@ -33,7 +33,7 @@ class QPushButton; /** * @brief Dialog for renaming a variable number of files. */ -class LIBDOLPHINPRIVATE_EXPORT RenameDialog : public QDialog +class DOLPHIN_EXPORT RenameDialog : public QDialog { Q_OBJECT diff --git a/src/views/versioncontrol/kversioncontrolplugin.cpp b/src/views/versioncontrol/kversioncontrolplugin.cpp new file mode 100644 index 000000000..2c0632878 --- /dev/null +++ b/src/views/versioncontrol/kversioncontrolplugin.cpp @@ -0,0 +1,29 @@ +/***************************************************************************** + * Copyright (C) 2011 by Vishesh Yadav * + * Copyright (C) 2011 by Peter Penz * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License version 2 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public License * + * along with this library; see the file COPYING.LIB. If not, write to * + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301, USA. * + *****************************************************************************/ + +#include "kversioncontrolplugin.h" + +KVersionControlPlugin::KVersionControlPlugin(QObject* parent) : + QObject(parent) +{ +} + +KVersionControlPlugin::~KVersionControlPlugin() +{ +} diff --git a/src/views/versioncontrol/kversioncontrolplugin.h b/src/views/versioncontrol/kversioncontrolplugin.h new file mode 100644 index 000000000..e5a267848 --- /dev/null +++ b/src/views/versioncontrol/kversioncontrolplugin.h @@ -0,0 +1,223 @@ +/***************************************************************************** + * Copyright (C) 2011 by Vishesh Yadav * + * Copyright (C) 2011 by Peter Penz * + * * + * This library is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Library General Public * + * License version 2 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Library General Public License for more details. * + * * + * You should have received a copy of the GNU Library General Public License * + * along with this library; see the file COPYING.LIB. If not, write to * + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301, USA. * + *****************************************************************************/ + +#ifndef KVERSIONCONTROLPLUGIN_H +#define KVERSIONCONTROLPLUGIN_H + +#include + +#include +#include +#include + +/** + * @brief Base class for version control plugins. + * + * Enables the file manager to show the version state + * of a versioned file. To write a custom plugin, the following + * steps are required (in the example below it is assumed that a plugin for + * Subversion will be written): + * + * - Create a fileviewsvnplugin.desktop file with the following content: + * + * [Desktop Entry] + * Type=Service + * Name=Subversion + * X-KDE-ServiceTypes=FileViewVersionControlPlugin + * MimeType=text/plain; + * X-KDE-Library=fileviewsvnplugin + * + * + * - Create a class FileViewSvnPlugin derived from KVersionControlPlugin and + * implement all abstract interfaces (fileviewsvnplugin.h, fileviewsvnplugin.cpp). + * + * - Take care that the constructor has the following signature: + * + * FileViewSvnPlugin(QObject* parent, const QList& args); + * + * + * - Add the following lines at the top of fileviewsvnplugin.cpp: + * + * #include + * #include + * K_PLUGIN_FACTORY(FileViewSvnPluginFactory, registerPlugin();) + * K_EXPORT_PLUGIN(FileViewSvnPluginFactory("fileviewsvnplugin")) + * + * + * - Add the following lines to your CMakeLists.txt file: + * + * kde4_add_plugin(fileviewsvnplugin fileviewsvnplugin.cpp) + * target_link_libraries(fileviewsvnplugin konq) + * install(FILES fileviewsvnplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR}) + * + * + * General implementation notes: + * + * - The implementations of beginRetrieval(), endRetrieval() and versionState() + * can contain blocking operations, as Dolphin will execute + * those methods in a separate thread. It is assured that + * all other methods are invoked in a serialized way, so that it is not necessary for + * the plugin to use any mutex. + * + * - Dolphin keeps only one instance of the plugin, which is instantiated shortly after + * starting Dolphin. Take care that the constructor does no expensive and time + * consuming operations. + * + * @since 4.8 + */ +class DOLPHIN_EXPORT KVersionControlPlugin : public QObject +{ + Q_OBJECT + +public: + enum ItemVersion + { + /** The file is not under version control. */ + UnversionedVersion, + /** + * The file is under version control and represents + * the latest version. + */ + NormalVersion, + /** + * The file is under version control and a newer + * version exists on the main branch. + */ + UpdateRequiredVersion, + /** + * The file is under version control and has been + * modified locally. All modifications will be part + * of the next commit. + */ + LocallyModifiedVersion, + /** + * The file has not been under version control but + * has been marked to get added with the next commit. + */ + AddedVersion, + /** + * The file is under version control but has been marked + * for getting removed with the next commit. + */ + RemovedVersion, + /** + * The file is under version control and has been locally + * modified. A modification has also been done on the main + * branch. + */ + ConflictingVersion, + /** + * The file is under version control and has local + * modifications, which will not be part of the next + * commit (or are "unstaged" in git jargon). + * @since 4.6 + */ + LocallyModifiedUnstagedVersion, + /** + * The file is not under version control and is listed + * in the ignore list of the version control system. + * @since 4.8 + */ + IgnoredVersion, + /** + * The file is is tracked by the version control system, but + * is missing in the directory (e.g. by deleted without using + * a version control command). + * @since 4.8 + */ + MissingVersion + }; + + KVersionControlPlugin(QObject* parent = 0); + virtual ~KVersionControlPlugin(); + + /** + * Returns the name of the file which stores + * the version controls information. + * (e. g. .svn, .cvs, .git). + */ + virtual QString fileName() const = 0; + + /** + * Is invoked whenever the version control + * information will get retrieved for the directory + * \p directory. It is assured that the directory + * contains a trailing slash. + */ + virtual bool beginRetrieval(const QString& directory) = 0; + + /** + * Is invoked after the version control information has been + * received. It is assured that + * KVersionControlPluginV2::beginInfoRetrieval() has been + * invoked before. + */ + virtual void endRetrieval() = 0; + + /** + * @return The version for the item \p item. + * It is assured that KVersionControlPlugin::beginInfoRetrieval() has been + * invoked before and that the file is part of the directory specified + * in beginInfoRetrieval(). + */ + virtual ItemVersion itemVersion(const KFileItem& item) const = 0; + + /** + * @return List of actions that are available for the items \p items. + * It is recommended to keep the number of returned actions small + * in case if an item is an unversioned directory that is not + * inside the hierarchy tree of the version control system. This + * prevents having a cluttered context menu for directories + * outside the version control system. + */ + virtual QList actions(const KFileItemList& items) const = 0; + +Q_SIGNALS: + /** + * Should be emitted when the version state of items might have been changed + * after the last retrieval (e. g. by executing a context menu action + * of the version control plugin). The file manager will be triggered to + * update the version states of the directory \p directory by invoking + * KVersionControlPlugin::beginRetrieval(), + * KVersionControlPlugin::itemVersion() and + * KVersionControlPlugin::endRetrieval(). + */ + void itemVersionsChanged(); + + /** + * Is emitted if an information message with the content \a msg + * should be shown. + */ + void infoMessage(const QString& msg); + + /** + * Is emitted if an error message with the content \a msg + * should be shown. + */ + void errorMessage(const QString& msg); + + /** + * Is emitted if an "operation completed" message with the content \a msg + * should be shown. + */ + void operationCompletedMessage(const QString& msg); +}; + +#endif // KVERSIONCONTROLPLUGIN_H + diff --git a/src/views/versioncontrol/updateitemstatesthread.cpp b/src/views/versioncontrol/updateitemstatesthread.cpp index 4f0122e0f..e4413fabf 100644 --- a/src/views/versioncontrol/updateitemstatesthread.cpp +++ b/src/views/versioncontrol/updateitemstatesthread.cpp @@ -19,9 +19,7 @@ #include "updateitemstatesthread.h" -#include #include - #include UpdateItemStatesThread::UpdateItemStatesThread(KVersionControlPlugin* plugin, @@ -53,20 +51,10 @@ void UpdateItemStatesThread::run() if (m_plugin->beginRetrieval(it.key())) { QVector& items = it.value(); const int count = items.count(); - - KVersionControlPlugin2* pluginV2 = qobject_cast(m_plugin); - if (pluginV2) { - for (int i = 0; i < count; ++i) { - const KFileItem& item = items.at(i).first; - const KVersionControlPlugin2::ItemVersion version = pluginV2->itemVersion(item); - items[i].second = version; - } - } else { - for (int i = 0; i < count; ++i) { - const KFileItem& item = items.at(i).first; - const KVersionControlPlugin::VersionState state = m_plugin->versionState(item); - items[i].second = static_cast(state); - } + for (int i = 0; i < count; ++i) { + const KFileItem& item = items.at(i).first; + const KVersionControlPlugin::ItemVersion version = m_plugin->itemVersion(item); + items[i].second = version; } } diff --git a/src/views/versioncontrol/updateitemstatesthread.h b/src/views/versioncontrol/updateitemstatesthread.h index 92a9d59c9..3dc03fc75 100644 --- a/src/views/versioncontrol/updateitemstatesthread.h +++ b/src/views/versioncontrol/updateitemstatesthread.h @@ -20,20 +20,18 @@ #ifndef UPDATEITEMSTATESTHREAD_H #define UPDATEITEMSTATESTHREAD_H -#include "libdolphin_export.h" +#include "dolphin_export.h" #include #include #include -class KVersionControlPlugin; - /** * The performance of updating the version state of items depends * on the used plugin. To prevent that Dolphin gets blocked by a * slow plugin, the updating is delegated to a thread. */ -class LIBDOLPHINPRIVATE_EXPORT UpdateItemStatesThread : public QThread +class DOLPHIN_EXPORT UpdateItemStatesThread : public QThread { Q_OBJECT diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index 47e3da357..13481cc7a 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -26,7 +26,6 @@ #include "dolphindebug.h" #include #include -#include #include "updateitemstatesthread.h" @@ -89,8 +88,6 @@ KFileItemModel* VersionControlObserver::model() const QList VersionControlObserver::actions(const KFileItemList& items) const { - QList actions; - bool hasNullItems = false; foreach (const KFileItem& item, items) { if (item.isNull()) { @@ -101,30 +98,10 @@ QList VersionControlObserver::actions(const KFileItemList& items) cons } if (!m_model || hasNullItems) { - return actions; - } - - KVersionControlPlugin2* pluginV2 = qobject_cast(m_plugin); - if (pluginV2) { - // Use version 2 of the KVersionControlPlugin which allows providing actions - // also for non-versioned directories. - actions = pluginV2->actions(items); - } else if (isVersioned()) { - // Support deprecated interfaces from KVersionControlPlugin version 1. - // Context menu actions where only available for versioned directories. - QString directory; - if (items.count() == 1) { - const KFileItem rootItem = m_model->rootItem(); - if (!rootItem.isNull() && items.first().url() == rootItem.url()) { - directory = rootItem.url().path(); - } - } - - actions = directory.isEmpty() ? m_plugin->contextMenuActions(items) - : m_plugin->contextMenuActions(directory); + return {}; } - return actions; + return m_plugin->actions(items); } void VersionControlObserver::delayedDirectoryVerification() @@ -156,14 +133,8 @@ void VersionControlObserver::verifyDirectory() m_plugin = searchPlugin(rootItem.url()); if (m_plugin) { - KVersionControlPlugin2* pluginV2 = qobject_cast(m_plugin); - if (pluginV2) { - connect(pluginV2, &KVersionControlPlugin2::itemVersionsChanged, - this, &VersionControlObserver::silentDirectoryVerification); - } else { - connect(m_plugin, &KVersionControlPlugin::versionStatesChanged, - this, &VersionControlObserver::silentDirectoryVerification); - } + connect(m_plugin, &KVersionControlPlugin::itemVersionsChanged, + this, &VersionControlObserver::silentDirectoryVerification); connect(m_plugin, &KVersionControlPlugin::infoMessage, this, &VersionControlObserver::infoMessage); connect(m_plugin, &KVersionControlPlugin::errorMessage, @@ -205,7 +176,7 @@ void VersionControlObserver::slotThreadFinished() foreach (const ItemState& item, items) { const KFileItem& fileItem = item.first; - const KVersionControlPlugin2::ItemVersion version = item.second; + const KVersionControlPlugin::ItemVersion version = item.second; QHash values; values.insert("version", QVariant(version)); m_model->setData(m_model->index(fileItem), values); @@ -268,7 +239,7 @@ int VersionControlObserver::createItemStatesList(QMapfileItem(index); - itemState.second = KVersionControlPlugin2::UnversionedVersion; + itemState.second = KVersionControlPlugin::UnversionedVersion; items.append(itemState); } else if (expansionLevel > currentExpansionLevel) { diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h index a43dc3415..c817c2187 100644 --- a/src/views/versioncontrol/versioncontrolobserver.h +++ b/src/views/versioncontrol/versioncontrolobserver.h @@ -20,11 +20,13 @@ #ifndef VERSIONCONTROLOBSERVER_H #define VERSIONCONTROLOBSERVER_H -#include "libdolphin_export.h" +#include "dolphin_export.h" + +#include "kversioncontrolplugin.h" #include + #include -#include #include #include #include @@ -43,7 +45,7 @@ class UpdateItemStatesThread; * * @see VersionControlPlugin */ -class LIBDOLPHINPRIVATE_EXPORT VersionControlObserver : public QObject +class DOLPHIN_EXPORT VersionControlObserver : public QObject { Q_OBJECT @@ -100,7 +102,7 @@ private slots: void slotThreadFinished(); private: - typedef QPair ItemState; + typedef QPair ItemState; void updateItemStates(); diff --git a/src/views/viewmodecontroller.h b/src/views/viewmodecontroller.h index 89f1020b5..4b1ff2083 100644 --- a/src/views/viewmodecontroller.h +++ b/src/views/viewmodecontroller.h @@ -22,7 +22,7 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" #include /** @@ -33,7 +33,7 @@ * connect to signals of the ViewModeController to react on changes. The view * implementations get only read-access to the ViewModeController. */ -class LIBDOLPHINPRIVATE_EXPORT ViewModeController : public QObject +class DOLPHIN_EXPORT ViewModeController : public QObject { Q_OBJECT diff --git a/src/views/viewproperties.h b/src/views/viewproperties.h index b9c2fa546..dc118e2d7 100644 --- a/src/views/viewproperties.h +++ b/src/views/viewproperties.h @@ -23,7 +23,7 @@ #include #include -#include "libdolphin_export.h" +#include "dolphin_export.h" class ViewPropertySettings; /** @@ -47,7 +47,7 @@ class ViewPropertySettings; * (see GeneralSettings::globalViewMode()), the values from the global .directory file * are used for initialization. */ -class LIBDOLPHINPRIVATE_EXPORT ViewProperties +class DOLPHIN_EXPORT ViewProperties { public: explicit ViewProperties(const QUrl& url); -- cgit v1.3