From e9670c51fef2c8447a04a30778a24646df4ef915 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Tue, 23 Mar 2010 22:56:26 +0100 Subject: A lot of fix and improvements for the bookmark and the history panels --- src/bookmarks/bookmarkstreemodel.h | 51 ++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 13 deletions(-) (limited to 'src/bookmarks/bookmarkstreemodel.h') diff --git a/src/bookmarks/bookmarkstreemodel.h b/src/bookmarks/bookmarkstreemodel.h index dfad52ba..4ff19e5f 100644 --- a/src/bookmarks/bookmarkstreemodel.h +++ b/src/bookmarks/bookmarkstreemodel.h @@ -38,6 +38,26 @@ // Qt Includes #include +class BtmItem +{ +public: + BtmItem(const KBookmark &bm); + ~BtmItem(); + QVariant data( int role = Qt::DisplayRole ) const; + int row() const; + int childCount() const; + BtmItem* child( int n ); + BtmItem* parent() const; + void appendChild(BtmItem *child); + void clear(); + KBookmark getBkm() const; + +private: + BtmItem *m_parent; + QList< BtmItem* > m_children; + KBookmark m_kbm; +}; + class REKONQ_TESTS_EXPORT BookmarksTreeModel : public QAbstractItemModel { @@ -48,28 +68,33 @@ public: explicit BookmarksTreeModel(QObject *parent = 0); ~BookmarksTreeModel(); - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; + virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; + virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; virtual QModelIndex parent(const QModelIndex &index) const; - virtual QVariant data(const QModelIndex &index, int role) const; -// virtual bool setData(const QModelIndex &index, const QVariant &value, int role); + virtual QVariant data(const QModelIndex &index, int role) const; -private slots: - void bookmarksChanged( const QString &groupAddress ); + virtual QStringList mimeTypes () const; + virtual bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent); + virtual Qt::DropActions supportedDropActions () const; + virtual QMimeData *mimeData( const QModelIndexList & indexes ) const; -private: - class BtmItem; - BtmItem *m_root; +private slots: + void bookmarksChanged( const QString &groupAddress ); - void resetModel(); +signals: + void bookmarkChangedFinished(); +private: + BtmItem *m_root; + void resetModel(); void setRoot(KBookmarkGroup bmg); - void populate( BtmItem *node, KBookmarkGroup bmg); + void populate( BtmItem *node, KBookmarkGroup bmg); + KBookmark bookmarkForIndex(const QModelIndex index) const; }; #endif // BOOKMARKSTREEMODEL_H -- cgit v1.2.1 From 632389517ca496031bb1cbe468d904884961bf57 Mon Sep 17 00:00:00 2001 From: Yoann Laissus Date: Sat, 27 Mar 2010 19:04:11 +0100 Subject: - Fix a crash when the cancel button of the add bookmark menu is clicked - Use the same behaviour for delete bookmark as the toolbar - Some strings changed - Keep the selection of a folder when it's expanded/collapsed - Fix the name of some methods and properties - Code cleaned a bit --- src/bookmarks/bookmarkstreemodel.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/bookmarks/bookmarkstreemodel.h') diff --git a/src/bookmarks/bookmarkstreemodel.h b/src/bookmarks/bookmarkstreemodel.h index 4ff19e5f..b312ab2d 100644 --- a/src/bookmarks/bookmarkstreemodel.h +++ b/src/bookmarks/bookmarkstreemodel.h @@ -84,13 +84,16 @@ public: virtual QMimeData *mimeData( const QModelIndexList & indexes ) const; private slots: - void bookmarksChanged( const QString &groupAddress ); + void bookmarksChanged(); + void saveOnly(); + void reconnectManager(); signals: - void bookmarkChangedFinished(); + void bookmarksUpdated(); private: BtmItem *m_root; + void resetModel(); void setRoot(KBookmarkGroup bmg); void populate( BtmItem *node, KBookmarkGroup bmg); -- cgit v1.2.1