akregator/src

dragobjects.h
1 /*
2  This file is part of Akregator.
3 
4  Copyright (C) 2005 Frank Osterfeld <frank.osterfeld@kdemail.net>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 
20  As a special exception, permission is given to link this program
21  with any edition of TQt, and distribute the resulting executable,
22  without including the source code for TQt in the source distribution.
23 */
24 
25 #ifndef AKREGATOR_DRAGOBJECTS_H
26 #define AKREGATOR_DRAGOBJECTS_H
27 
28 #include "article.h"
29 
30 #include <kurl.h>
31 #include <kurldrag.h>
32 
33 #include <tqstring.h>
34 #include <tqvaluelist.h>
35 
36 #include <tqcstring.h>
37 
38 namespace Akregator {
39 
40 class Article;
41 
42 struct ArticleDragItem
43 {
44  TQString feedURL;
45  TQString guid;
46 };
47 
48 class ArticleDrag : public KURLDrag
49 {
50 
51 public:
52 
53  ArticleDrag(const TQValueList<Article>& articles, TQWidget* dragSource=0, const char* name=0);
54 
55  static bool canDecode(const TQMimeSource* e);
56  static bool decode(const TQMimeSource* e, TQValueList<ArticleDragItem>& articles);
57 
58 protected:
59 
60  virtual TQByteArray encodedData(const char* mime) const;
61  virtual const char* format(int i) const;
62 
63 private:
64 
65  static TQValueList<ArticleDragItem> articlesToDragItems(const TQValueList<Article>& articles);
66  static KURL::List articleURLs(const TQValueList<Article>& articles);
67  TQValueList<ArticleDragItem> m_items;
68 };
69 
70 } // namespace Akregator
71 
72 #endif // AKREGATOR_DRAGOBJECTS_H