Corrected the compile fix commit, rev 965fc6b3.

This commit is contained in:
Dawit Alemayehu 2012-09-12 15:54:37 -04:00
parent fa255857a0
commit 0b918c3f82
5 changed files with 175 additions and 118 deletions

View file

@ -131,6 +131,13 @@ set(dolphinpart_SRCS
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})

View file

@ -40,6 +40,11 @@
#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"
@ -664,86 +669,4 @@ KFileItemList DolphinPartFileInfoExtension::queryFor(KParts::FileInfoExtension::
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"

View file

@ -20,16 +20,10 @@
#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;
@ -287,34 +281,4 @@ protected:
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 */

107
src/dolphinpart_ext.cpp Normal file
View file

@ -0,0 +1,107 @@
/* 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"

56
src/dolphinpart_ext.h Normal file
View file

@ -0,0 +1,56 @@
/* 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