KBookmarks

kbookmarkimporter.h
1 // -*- c-basic-offset:4; indent-tabs-mode:nil -*-
2 /*
3  This file is part of the KDE libraries
4  SPDX-FileCopyrightText: 2000 David Faure <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-only
7 */
8 
9 #ifndef __kbookmarkimporter_h
10 #define __kbookmarkimporter_h
11 
12 #include <QObject>
13 
14 #include "kbookmark.h"
15 
16 /**
17  * A class for importing NS bookmarks
18  * KEditBookmarks uses it to insert bookmarks into its DOM tree,
19  * and KActionMenu uses it to create actions directly.
20  */
21 class KBOOKMARKS_EXPORT KBookmarkImporterBase : public QObject
22 {
23  Q_OBJECT
24 public:
26  {
27  }
28  ~KBookmarkImporterBase() override
29  {
30  }
31 
32  void setFilename(const QString &filename)
33  {
34  m_fileName = filename;
35  }
36 
37  virtual void parse() = 0;
38  virtual QString findDefaultLocation(bool forSaving = false) const = 0;
39 
40  // TODO - make this static?
41  void setupSignalForwards(QObject *src, QObject *dst);
42  static KBookmarkImporterBase *factory(const QString &type);
43 
44 Q_SIGNALS:
45  /**
46  * Notify about a new bookmark
47  * Use "html" for the icon
48  */
49  void newBookmark(const QString &text, const QString &url, const QString &additionalInfo);
50 
51  /**
52  * Notify about a new folder
53  * Use "bookmark_folder" for the icon
54  */
55  void newFolder(const QString &text, bool open, const QString &additionalInfo);
56 
57  /**
58  * Notify about a new separator
59  */
60  void newSeparator();
61 
62  /**
63  * Tell the outside world that we're going down
64  * one menu
65  */
66  void endFolder();
67 
68 protected:
69  QString m_fileName;
70 
71 private:
72  class KBookmarkImporterBasePrivate *d;
73 };
74 
75 /**
76  * A class for importing XBEL files
77  */
78 class KBOOKMARKS_EXPORT KXBELBookmarkImporterImpl : public KBookmarkImporterBase, protected KBookmarkGroupTraverser
79 {
80  Q_OBJECT
81 public:
83  {
84  }
85  void parse() override;
86  QString findDefaultLocation(bool = false) const override
87  {
88  return QString();
89  }
90 
91 protected:
92  void visit(const KBookmark &) override;
93  void visitEnter(const KBookmarkGroup &) override;
94  void visitLeave(const KBookmarkGroup &) override;
95 
96 private:
97  class KXBELBookmarkImporterImplPrivate *d;
98 };
99 
100 #endif
A class to traverse bookarm groups.
Definition: kbookmark.h:433
Q_SIGNALSQ_SIGNALS
A class for importing XBEL files.
A class for importing NS bookmarks KEditBookmarks uses it to insert bookmarks into its DOM tree,...
A group of bookmarks.
Definition: kbookmark.h:322
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 03:59:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.