dolphinpart.cpp
)
+# Add dolphinpart_ext.cpp conditionally, only with KDE > 4.9.1.
+if (${KDE_VERSION} VERSION_GREATER "4.9.1")
+set(dolphinpart_SRCS
+ ${dolphinpart_SRCS}
+ dolphinpart_ext.cpp)
+endif (${KDE_VERSION} VERSION_GREATER "4.9.1")
+
kde4_add_plugin(dolphinpart ${dolphinpart_SRCS})
target_link_libraries(dolphinpart dolphinprivate konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS})
#include <KMenu>
#include <KInputDialog>
#include <KProtocolInfo>
+#include <kdeversion.h>
+
+#if KDE_IS_VERSION(4, 9, 2)
+#include "dolphinpart_ext.h"
+#endif
#include "views/dolphinview.h"
#include "views/dolphinviewactionhandler.h"
return list;
}
-#if KDE_IS_VERSION(4, 9, 2)
-
-DolphinPartListingFilterExtension::DolphinPartListingFilterExtension (DolphinPart* part)
- : KParts::ListingFilterExtension(part)
- , m_part(part)
-{
-}
-
-KParts::ListingFilterExtension::FilterModes DolphinPartListingFilterExtension::supportedFilterModes() const
-{
- return (KParts::ListingFilterExtension::MimeType |
- KParts::ListingFilterExtension::SubString |
- KParts::ListingFilterExtension::WildCard);
-}
-
-bool DolphinPartListingFilterExtension::supportsMultipleFilters (KParts::ListingFilterExtension::FilterMode mode) const
-{
- if (mode == KParts::ListingFilterExtension::MimeType)
- return true;
-
- return false;
-}
-
-QVariant DolphinPartListingFilterExtension::filter (KParts::ListingFilterExtension::FilterMode mode) const
-{
- QVariant result;
-
- switch (mode) {
- case KParts::ListingFilterExtension::MimeType:
- result = m_part->view()->mimeTypeFilters();
- break;
- case KParts::ListingFilterExtension::SubString:
- case KParts::ListingFilterExtension::WildCard:
- result = m_part->view()->nameFilter();
- break;
- default:
- break;
- }
-
- return result;
-}
-
-void DolphinPartListingFilterExtension::setFilter (KParts::ListingFilterExtension::FilterMode mode, const QVariant& filter)
-{
- switch (mode) {
- case KParts::ListingFilterExtension::MimeType:
- m_part->view()->setMimeTypeFilters(filter.toStringList());
- break;
- case KParts::ListingFilterExtension::SubString:
- case KParts::ListingFilterExtension::WildCard:
- m_part->view()->setNameFilter(filter.toString());
- break;
- default:
- break;
- }
-}
-
-////
-
-DolphinPartListingNotificationExtension::DolphinPartListingNotificationExtension(DolphinPart* part)
- :KParts::ListingNotificationExtension(part)
-{
-}
-
-KParts::ListingNotificationExtension::NotificationEventTypes DolphinPartListingNotificationExtension::supportedNotificationEventTypes() const
-{
- return (KParts::ListingNotificationExtension::ItemsAdded |
- KParts::ListingNotificationExtension::ItemsDeleted);
-}
-
-void DolphinPartListingNotificationExtension::slotNewItems(const KFileItemList& items)
-{
- emit listingEvent(KParts::ListingNotificationExtension::ItemsAdded, items);
-}
-
-void DolphinPartListingNotificationExtension::slotItemsDeleted(const KFileItemList& items)
-{
- emit listingEvent(KParts::ListingNotificationExtension::ItemsDeleted, items);
-}
-
-#endif
-
#include "dolphinpart.moc"
#ifndef DOLPHINPART_H
#define DOLPHINPART_H
-#include <kdeversion.h>
-
#include <kparts/part.h>
#include <kparts/browserextension.h>
#include <kparts/fileinfoextension.h>
-#if KDE_IS_VERSION(4, 9, 2)
-#include <kparts/listingextension.h>
-#endif
-
#include <QItemSelectionModel>
class KNewFileMenu;
DolphinPart* part() const;
};
-#if KDE_IS_VERSION(4, 9, 2)
-class DolphinPartListingFilterExtension : public KParts::ListingFilterExtension
-{
- Q_OBJECT
-
-public:
- DolphinPartListingFilterExtension (DolphinPart* part);
- virtual FilterModes supportedFilterModes() const;
- virtual bool supportsMultipleFilters (FilterMode mode) const;
- virtual QVariant filter (FilterMode mode) const;
- virtual void setFilter (FilterMode mode, const QVariant& filter);
-
-private:
- DolphinPart* m_part;
-};
-
-class DolphinPartListingNotificationExtension : public KParts::ListingNotificationExtension
-{
- Q_OBJECT
-
-public:
- DolphinPartListingNotificationExtension(DolphinPart* part);
- virtual NotificationEventTypes supportedNotificationEventTypes() const;
-
-public Q_SLOTS:
- void slotNewItems(const KFileItemList&);
- void slotItemsDeleted(const KFileItemList&);
-};
-#endif
-
#endif /* DOLPHINPART_H */
--- /dev/null
+/* This file is part of the KDE project
+ * Copyright (c) 2012 Dawit Alemayehu <adawit@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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 "dolphinpart_ext.h"
+
+#include "dolphinpart.h"
+#include "views/dolphinview.h"
+
+#include <QVariant>
+
+#include <KFileItemList>
+
+DolphinPartListingFilterExtension::DolphinPartListingFilterExtension(DolphinPart* part)
+ : KParts::ListingFilterExtension(part)
+ , m_part(part)
+{
+}
+
+KParts::ListingFilterExtension::FilterModes DolphinPartListingFilterExtension::supportedFilterModes() const
+{
+ return (KParts::ListingFilterExtension::MimeType |
+ KParts::ListingFilterExtension::SubString |
+ KParts::ListingFilterExtension::WildCard);
+}
+
+bool DolphinPartListingFilterExtension::supportsMultipleFilters(KParts::ListingFilterExtension::FilterMode mode) const
+{
+ if (mode == KParts::ListingFilterExtension::MimeType)
+ return true;
+
+ return false;
+}
+
+QVariant DolphinPartListingFilterExtension::filter(KParts::ListingFilterExtension::FilterMode mode) const
+{
+ QVariant result;
+
+ switch (mode) {
+ case KParts::ListingFilterExtension::MimeType:
+ result = m_part->view()->mimeTypeFilters();
+ break;
+ case KParts::ListingFilterExtension::SubString:
+ case KParts::ListingFilterExtension::WildCard:
+ result = m_part->view()->nameFilter();
+ break;
+ default:
+ break;
+ }
+
+ return result;
+}
+
+void DolphinPartListingFilterExtension::setFilter(KParts::ListingFilterExtension::FilterMode mode, const QVariant& filter)
+{
+ switch (mode) {
+ case KParts::ListingFilterExtension::MimeType:
+ m_part->view()->setMimeTypeFilters(filter.toStringList());
+ break;
+ case KParts::ListingFilterExtension::SubString:
+ case KParts::ListingFilterExtension::WildCard:
+ m_part->view()->setNameFilter(filter.toString());
+ break;
+ default:
+ break;
+ }
+}
+
+////
+
+DolphinPartListingNotificationExtension::DolphinPartListingNotificationExtension(DolphinPart* part)
+ : KParts::ListingNotificationExtension(part)
+{
+}
+
+KParts::ListingNotificationExtension::NotificationEventTypes DolphinPartListingNotificationExtension::supportedNotificationEventTypes() const
+{
+ return (KParts::ListingNotificationExtension::ItemsAdded |
+ KParts::ListingNotificationExtension::ItemsDeleted);
+}
+
+void DolphinPartListingNotificationExtension::slotNewItems(const KFileItemList& items)
+{
+ emit listingEvent(KParts::ListingNotificationExtension::ItemsAdded, items);
+}
+
+void DolphinPartListingNotificationExtension::slotItemsDeleted(const KFileItemList& items)
+{
+ emit listingEvent(KParts::ListingNotificationExtension::ItemsDeleted, items);
+}
+
+#include "dolphinpart_ext.moc"
--- /dev/null
+/* This file is part of the KDE project
+ * Copyright (c) 2012 Dawit Alemayehu <adawit@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * 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 DOLPHINPART_EXT_H
+#define DOLPHINPART_EXT_H
+
+
+#include <kparts/listingextension.h>
+
+class DolphinPart;
+
+class DolphinPartListingFilterExtension : public KParts::ListingFilterExtension
+{
+ Q_OBJECT
+
+public:
+ DolphinPartListingFilterExtension(DolphinPart* part);
+ virtual FilterModes supportedFilterModes() const;
+ virtual bool supportsMultipleFilters(FilterMode mode) const;
+ virtual QVariant filter(FilterMode mode) const;
+ virtual void setFilter(FilterMode mode, const QVariant& filter);
+
+private:
+ DolphinPart* m_part;
+};
+
+class DolphinPartListingNotificationExtension : public KParts::ListingNotificationExtension
+{
+ Q_OBJECT
+
+public:
+ DolphinPartListingNotificationExtension(DolphinPart* part);
+ virtual NotificationEventTypes supportedNotificationEventTypes() const;
+
+public Q_SLOTS:
+ void slotNewItems(const KFileItemList&);
+ void slotItemsDeleted(const KFileItemList&);
+};
+
+#endif