~ubuntu-branches/ubuntu/quantal/kdepimlibs/quantal-proposed

« back to all changes in this revision

Viewing changes to akonadi/recentcollectionaction_p.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-14 14:37:07 UTC
  • mto: This revision was merged to the branch mainline in revision 112.
  • Revision ID: package-import@ubuntu.com-20111214143707-m0qplh3hsd957ukv
Tags: upstream-4.7.90
ImportĀ upstreamĀ versionĀ 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2011 Laurent Montel <montel@kde.org>
 
3
 * 
 
4
 * This library is free software; you can redistribute it and/or modify it
 
5
 * under the terms of the GNU Library General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or (at your
 
7
 * option) any later version.
 
8
 * This library is distributed in the hope that it will be useful, but WITHOUT
 
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 
11
 * License for more details.
 
12
 *
 
13
 *  You should have received a copy of the GNU Library General Public License
 
14
 *  along with this library; see the file COPYING.LIB.  If not, write to the
 
15
 *  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
16
 *  02110-1301, USA.
 
17
 */
 
18
#ifndef RECENTCOLLECTIONACTION_P_H
 
19
#define RECENTCOLLECTIONACTION_P_H
 
20
 
 
21
#include <QStringList>
 
22
#include <QModelIndex>
 
23
#include <akonadi/collection.h>
 
24
#include <ksharedconfig.h>
 
25
 
 
26
class QMenu;
 
27
class QAbstractItemModel;
 
28
class QAction;
 
29
/**
 
30
 * @short A class to manage recent selected folder.
 
31
 *
 
32
 * @author Montel Laurent <montel@kde.org>
 
33
 * @since 4.8
 
34
 */
 
35
 
 
36
namespace Akonadi {
 
37
class RecentCollectionAction : public QObject
 
38
{
 
39
  Q_OBJECT
 
40
public:
 
41
  /**
 
42
   * Creates a new collection recent action
 
43
   */
 
44
  explicit RecentCollectionAction(const QAbstractItemModel *model, QMenu *menu);
 
45
  /**
 
46
   * Destroys the collection recent action.
 
47
   */
 
48
  ~RecentCollectionAction();
 
49
  
 
50
  /**
 
51
   * Add new collection. Will create a new item.
 
52
   */
 
53
  void addRecentCollection( Akonadi::Collection::Id id);
 
54
  
 
55
  void cleanRecentCollection();
 
56
 
 
57
private:
 
58
  void writeConfig();
 
59
  void fillRecentCollection();
 
60
  QString actionName(QModelIndex index);
 
61
 
 
62
private:
 
63
  QStringList mListRecentCollection;
 
64
  QMenu *mMenu;
 
65
  const QAbstractItemModel *mModel;
 
66
  QAction *mRecentAction;
 
67
  KSharedConfig::Ptr mAkonadiConfig;
 
68
};
 
69
}
 
70
 
 
71
#endif /* RECENTCOLLECTIONACTION_P_H */
 
72