[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepimlibs/akregator_port] krss: Add attribute to determine whether subfolders are supported
From:       Dan_Vrátil <dvratil () redhat ! com>
Date:       2013-03-02 22:21:09
Message-ID: 20130302222109.0B421A604F () git ! kde ! org
[Download RAW message or body]

Git commit 881d86b75916262fee5ddfeb9c27c954e3d29ba3 by Dan Vrátil.
Committed on 02/03/2013 at 23:18.
Pushed by dvratil into branch 'akregator_port'.

Add attribute to determine whether subfolders are supported

The Google Reade and OwnCloud resources only support one level
of folders. To disable the 'New Folder' action in Akregator2 UI,
resources set the 'AllowSubfolders' property to false.

By default, subfolders are allowed.

M  +11   -0    krss/feedcollection.cpp
M  +3    -0    krss/feedcollection.h
M  +12   -0    krss/feedpropertiescollectionattribute.cpp
M  +2    -0    krss/feedpropertiescollectionattribute.h

http://commits.kde.org/kdepimlibs/881d86b75916262fee5ddfeb9c27c954e3d29ba3

diff --git a/krss/feedcollection.cpp b/krss/feedcollection.cpp
index 847cca4..80c7dd7 100644
--- a/krss/feedcollection.cpp
+++ b/krss/feedcollection.cpp
@@ -291,3 +291,14 @@ void FeedCollection::setMaximumItemAge( int m )
 {
     attribute<FeedPropertiesCollectionAttribute>( AddIfMissing )->setMaximumItemAge( m );
 }
+
+bool FeedCollection::allowSubfolders() const
+{
+  const FeedPropertiesCollectionAttribute *attr = attribute<FeedPropertiesCollectionAttribute>();
+    return attr ? attr->allowSubfolders() : true;
+}
+
+void FeedCollection::setAllowSubfolders( bool allow )
+{
+    attribute<FeedPropertiesCollectionAttribute>( AddIfMissing )->setAllowSubfolders( allow );
+}
diff --git a/krss/feedcollection.h b/krss/feedcollection.h
index 6ccea6b..02ff703 100644
--- a/krss/feedcollection.h
+++ b/krss/feedcollection.h
@@ -87,6 +87,9 @@ public:
 
     int maximumItemAge() const;
     void setMaximumItemAge( int );
+
+    bool allowSubfolders() const;
+    void setAllowSubfolders( bool allow );
 };
 
 } // namespace KRss
diff --git a/krss/feedpropertiescollectionattribute.cpp b/krss/feedpropertiescollectionattribute.cpp
index 453a5d8..b516b0d 100644
--- a/krss/feedpropertiescollectionattribute.cpp
+++ b/krss/feedpropertiescollectionattribute.cpp
@@ -193,6 +193,18 @@ void FeedPropertiesCollectionAttribute::setMaximumItemAge( int ma )
     setProperty( MaximumItemAgeKey, QString::number( ma ), QLatin1String("-1") );
 }
 
+static const QString AllowSubfoldersProperty = QLatin1String("AllowSubfolders");
+
+bool FeedPropertiesCollectionAttribute::allowSubfolders() const
+{
+    return (bool) readIntProperty( AllowSubfoldersProperty, 1 );
+}
+
+void FeedPropertiesCollectionAttribute::setAllowSubfolders( bool canHaveSubfolders )
+{
+    setProperty( AllowSubfoldersProperty, QString::number( canHaveSubfolders ), QLatin1String("1") );
+}
+
 static QString ArchiveModeKey = QLatin1String("ArchiveModeKey");
 
 FeedPropertiesCollectionAttribute::ArchiveMode FeedPropertiesCollectionAttribute::archiveMode() const
diff --git a/krss/feedpropertiescollectionattribute.h b/krss/feedpropertiescollectionattribute.h
index 79a0a3b..1a765d2 100644
--- a/krss/feedpropertiescollectionattribute.h
+++ b/krss/feedpropertiescollectionattribute.h
@@ -63,6 +63,8 @@ public:
          */
         int customFetchInterval() const;
         void setCustomFetchInterval( int );
+        bool allowSubfolders() const;
+        void setAllowSubfolders( bool allow );
 
         enum ArchiveMode {
             GlobalDefault,
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic