Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
3a1cbd97
Commit
3a1cbd97
authored
Jun 24, 2009
by
kh
Browse files
Sync with Assistant code.
parent
2a959f47
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/shared/help/bookmarkmanager.cpp
View file @
3a1cbd97
...
...
@@ -50,7 +50,7 @@
BookmarkDialog
::
BookmarkDialog
(
BookmarkManager
*
manager
,
const
QString
&
title
,
const
QString
&
url
,
QWidget
*
parent
)
const
QString
&
url
,
QWidget
*
parent
)
:
QDialog
(
parent
)
,
m_url
(
url
)
,
m_title
(
title
)
...
...
@@ -82,21 +82,21 @@ BookmarkDialog::BookmarkDialog(BookmarkManager *manager, const QString &title,
connect
(
ui
.
buttonBox
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
addAccepted
()));
connect
(
ui
.
newFolderButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
addNewFolder
()));
connect
(
ui
.
toolButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
toolButtonClicked
()));
connect
(
ui
.
bookmarkEdit
,
SIGNAL
(
textChanged
(
const
QString
&
)),
this
,
SLOT
(
textChanged
(
const
QString
&
)));
connect
(
ui
.
bookmarkEdit
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
textChanged
(
QString
)));
connect
(
bookmarkManager
->
treeBookmarkModel
(),
SIGNAL
(
itemChanged
(
QStandardItem
*
)),
connect
(
bookmarkManager
->
treeBookmarkModel
(),
SIGNAL
(
itemChanged
(
QStandardItem
*
)),
this
,
SLOT
(
itemChanged
(
QStandardItem
*
)));
connect
(
ui
.
bookmarkFolders
,
SIGNAL
(
currentIndexChanged
(
const
QString
&
)),
this
,
SLOT
(
selectBookmarkFolder
(
const
QString
&
)));
connect
(
ui
.
bookmarkFolders
,
SIGNAL
(
currentIndexChanged
(
QString
)),
this
,
SLOT
(
selectBookmarkFolder
(
QString
)));
connect
(
ui
.
treeView
,
SIGNAL
(
customContextMenuRequested
(
const
QPoint
&
)),
this
,
SLOT
(
customContextMenuRequested
(
const
QPoint
&
)));
connect
(
ui
.
treeView
,
SIGNAL
(
customContextMenuRequested
(
QPoint
)),
this
,
SLOT
(
customContextMenuRequested
(
QPoint
)));
connect
(
ui
.
treeView
->
selectionModel
(),
SIGNAL
(
currentChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
)),
this
,
SLOT
(
currentChanged
(
const
QModelIndex
&
,
const
QModelIndex
&
)));
connect
(
ui
.
treeView
->
selectionModel
(),
SIGNAL
(
currentChanged
(
QModelIndex
,
QModelIndex
)),
this
,
SLOT
(
currentChanged
(
QModelIndex
)));
}
BookmarkDialog
::~
BookmarkDialog
()
...
...
@@ -105,8 +105,8 @@ BookmarkDialog::~BookmarkDialog()
void
BookmarkDialog
::
addAccepted
()
{
const
QItemSelection
selection
=
ui
.
treeView
->
selectionModel
()
->
selection
()
;
const
QModelIndexList
list
=
selection
.
indexes
();
QItemSelection
Model
*
model
=
ui
.
treeView
->
selectionModel
();
const
QModelIndexList
&
list
=
model
->
selection
()
.
indexes
();
QModelIndex
index
;
if
(
!
list
.
isEmpty
())
...
...
@@ -118,8 +118,8 @@ void BookmarkDialog::addAccepted()
void
BookmarkDialog
::
addNewFolder
()
{
const
QItemSelection
selection
=
ui
.
treeView
->
selectionModel
()
->
selection
()
;
const
QModelIndexList
list
=
selection
.
indexes
();
QItemSelection
Model
*
model
=
ui
.
treeView
->
selectionModel
();
const
QModelIndexList
&
list
=
model
->
selection
()
.
indexes
();
QModelIndex
index
;
if
(
!
list
.
isEmpty
())
...
...
@@ -130,13 +130,12 @@ void BookmarkDialog::addNewFolder()
if
(
newFolder
.
isValid
())
{
ui
.
treeView
->
expand
(
index
);
const
QModelIndex
&
index
=
proxyModel
->
mapFromSource
(
newFolder
);
ui
.
treeView
->
selectionModel
()
->
setCurrentIndex
(
index
,
QItemSelectionModel
::
ClearAndSelect
);
model
->
setCurrentIndex
(
index
,
QItemSelectionModel
::
ClearAndSelect
);
ui
.
bookmarkFolders
->
clear
();
ui
.
bookmarkFolders
->
addItems
(
bookmarkManager
->
bookmarkFolders
());
const
QString
name
=
index
.
data
().
toString
();
const
QString
&
name
=
index
.
data
().
toString
();
ui
.
bookmarkFolders
->
setCurrentIndex
(
ui
.
bookmarkFolders
->
findText
(
name
));
}
ui
.
treeView
->
setFocus
();
...
...
@@ -196,9 +195,12 @@ void BookmarkDialog::selectBookmarkFolder(const QString &folderName)
QList
<
QStandardItem
*>
list
=
model
->
findItems
(
folderName
,
Qt
::
MatchCaseSensitive
|
Qt
::
MatchRecursive
,
0
);
if
(
!
list
.
isEmpty
())
{
QModelIndex
index
=
model
->
indexFromItem
(
list
.
at
(
0
));
ui
.
treeView
->
selectionModel
()
->
setCurrentIndex
(
proxyModel
->
mapFromSource
(
index
),
QItemSelectionModel
::
ClearAndSelect
);
const
QModelIndex
&
index
=
model
->
indexFromItem
(
list
.
at
(
0
));
QItemSelectionModel
*
model
=
ui
.
treeView
->
selectionModel
();
if
(
model
)
{
model
->
setCurrentIndex
(
proxyModel
->
mapFromSource
(
index
),
QItemSelectionModel
::
ClearAndSelect
);
}
}
}
...
...
@@ -213,13 +215,13 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point)
QAction
*
removeItem
=
menu
.
addAction
(
tr
(
"Delete Folder"
));
QAction
*
renameItem
=
menu
.
addAction
(
tr
(
"Rename Folder"
));
QAction
*
picked
_action
=
menu
.
exec
(
ui
.
treeView
->
mapToGlobal
(
point
));
if
(
!
picked
_action
)
QAction
*
picked
=
menu
.
exec
(
ui
.
treeView
->
mapToGlobal
(
point
));
if
(
!
picked
)
return
;
if
(
picked_action
==
removeItem
)
{
bookmarkManager
->
removeBookmarkItem
(
ui
.
treeView
,
proxyModel
->
mapToSource
(
i
ndex
)
)
;
const
QModelIndex
&
proxyIndex
=
proxyModel
->
mapToSource
(
index
);
if
(
picked
==
removeItem
)
{
bookmarkManager
->
removeBookmarkItem
(
ui
.
treeView
,
proxyI
ndex
);
ui
.
bookmarkFolders
->
clear
();
ui
.
bookmarkFolders
->
addItems
(
bookmarkManager
->
bookmarkFolders
());
...
...
@@ -229,10 +231,9 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point)
name
=
index
.
data
().
toString
();
ui
.
bookmarkFolders
->
setCurrentIndex
(
ui
.
bookmarkFolders
->
findText
(
name
));
}
else
if
(
picked_action
==
renameItem
)
{
QStandardItem
*
item
=
bookmarkManager
->
treeBookmarkModel
()
->
itemFromIndex
(
proxyModel
->
mapToSource
(
index
));
if
(
item
)
{
else
if
(
picked
==
renameItem
)
{
BookmarkModel
*
model
=
bookmarkManager
->
treeBookmarkModel
();
if
(
QStandardItem
*
item
=
model
->
itemFromIndex
(
proxyIndex
))
{
item
->
setEditable
(
true
);
ui
.
treeView
->
edit
(
index
);
item
->
setEditable
(
false
);
...
...
@@ -240,19 +241,12 @@ void BookmarkDialog::customContextMenuRequested(const QPoint &point)
}
}
void
BookmarkDialog
::
currentChanged
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
)
void
BookmarkDialog
::
currentChanged
(
const
QModelIndex
&
current
)
{
Q_UNUSED
(
previous
)
if
(
!
current
.
isValid
())
{
ui
.
bookmarkFolders
->
setCurrentIndex
(
ui
.
bookmarkFolders
->
findText
(
tr
(
"Bookmarks"
)));
return
;
}
ui
.
bookmarkFolders
->
setCurrentIndex
(
ui
.
bookmarkFolders
->
findText
(
current
.
data
().
toString
()));
QString
text
=
tr
(
"Bookmarks"
);
if
(
current
.
isValid
())
text
=
current
.
data
().
toString
();
ui
.
bookmarkFolders
->
setCurrentIndex
(
ui
.
bookmarkFolders
->
findText
(
text
));
}
bool
BookmarkDialog
::
eventFilter
(
QObject
*
object
,
QEvent
*
e
)
...
...
@@ -263,7 +257,7 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
QModelIndex
index
=
ui
.
treeView
->
currentIndex
();
switch
(
ke
->
key
())
{
case
Qt
::
Key_F2
:
{
const
QModelIndex
&
source
=
proxyModel
->
mapToSource
(
index
);
const
QModelIndex
&
source
=
proxyModel
->
mapToSource
(
index
);
QStandardItem
*
item
=
bookmarkManager
->
treeBookmarkModel
()
->
itemFromIndex
(
source
);
if
(
item
)
{
...
...
@@ -294,10 +288,11 @@ bool BookmarkDialog::eventFilter(QObject *object, QEvent *e)
}
// #pragma mark -- BookmarkWidget
BookmarkWidget
::
BookmarkWidget
(
BookmarkManager
*
manager
,
QWidget
*
parent
,
bool
showButtons
)
bool
showButtons
)
:
QWidget
(
parent
)
,
addButton
(
0
)
,
removeButton
(
0
)
...
...
@@ -339,7 +334,7 @@ void BookmarkWidget::filterChanged()
filterBookmarkModel
->
setFilterRegExp
(
regExp
);
QModelIndex
index
=
treeView
->
indexAt
(
QPoint
(
1
,
1
));
const
QModelIndex
&
index
=
treeView
->
indexAt
(
QPoint
(
1
,
1
));
if
(
index
.
isValid
())
treeView
->
setCurrentIndex
(
index
);
...
...
@@ -350,7 +345,8 @@ void BookmarkWidget::filterChanged()
void
BookmarkWidget
::
expand
(
const
QModelIndex
&
index
)
{
const
QModelIndex
&
source
=
filterBookmarkModel
->
mapToSource
(
index
);
QStandardItem
*
item
=
bookmarkManager
->
treeBookmarkModel
()
->
itemFromIndex
(
source
);
QStandardItem
*
item
=
bookmarkManager
->
treeBookmarkModel
()
->
itemFromIndex
(
source
);
if
(
item
)
item
->
setData
(
treeView
->
isExpanded
(
index
),
Qt
::
UserRole
+
11
);
}
...
...
@@ -391,22 +387,22 @@ void BookmarkWidget::customContextMenuRequested(const QPoint &point)
}
}
QAction
*
picked
_a
ction
=
menu
.
exec
(
treeView
->
mapToGlobal
(
point
));
if
(
!
picked
_a
ction
)
QAction
*
picked
A
ction
=
menu
.
exec
(
treeView
->
mapToGlobal
(
point
));
if
(
!
picked
A
ction
)
return
;
if
(
picked
_a
ction
==
showItem
)
{
if
(
picked
A
ction
==
showItem
)
{
emit
requestShowLink
(
data
);
}
else
if
(
picked
_a
ction
==
showItemNewTab
)
{
else
if
(
picked
A
ction
==
showItemNewTab
)
{
Help
::
Internal
::
CentralWidget
::
instance
()
->
setSourceInNewTab
(
data
);
}
else
if
(
picked
_a
ction
==
removeItem
)
{
else
if
(
picked
A
ction
==
removeItem
)
{
bookmarkManager
->
removeBookmarkItem
(
treeView
,
filterBookmarkModel
->
mapToSource
(
index
));
}
else
if
(
picked
_a
ction
==
renameItem
)
{
const
QModelIndex
&
source
=
filterBookmarkModel
->
mapToSource
(
index
);
else
if
(
picked
A
ction
==
renameItem
)
{
const
QModelIndex
&
source
=
filterBookmarkModel
->
mapToSource
(
index
);
QStandardItem
*
item
=
bookmarkManager
->
treeBookmarkModel
()
->
itemFromIndex
(
source
);
if
(
item
)
{
...
...
@@ -452,8 +448,8 @@ void BookmarkWidget::setup(bool showButtons)
addButton
=
new
QToolButton
(
this
);
addButton
->
setText
(
tr
(
"Add"
));
addButton
->
setIcon
(
QIcon
(
Q
String
::
fromLatin1
(
":/trolltech/assistant/images/"
SYSTEM
"/addtab.png"
)));
addButton
->
setIcon
(
QIcon
(
Q
Latin1String
(
":/trolltech/assistant/images/"
SYSTEM
"/addtab.png"
)));
addButton
->
setAutoRaise
(
true
);
addButton
->
setToolButtonStyle
(
Qt
::
ToolButtonTextBesideIcon
);
hlayout
->
addWidget
(
addButton
);
...
...
@@ -461,8 +457,8 @@ void BookmarkWidget::setup(bool showButtons)
removeButton
=
new
QToolButton
(
this
);
removeButton
->
setText
(
tr
(
"Remove"
));
removeButton
->
setIcon
(
QIcon
(
Q
String
::
fromLatin1
(
":/trolltech/assistant/images/"
SYSTEM
"/closetab.png"
)));
removeButton
->
setIcon
(
QIcon
(
Q
Latin1String
(
":/trolltech/assistant/images/"
SYSTEM
"/closetab.png"
)));
removeButton
->
setAutoRaise
(
true
);
removeButton
->
setToolButtonStyle
(
Qt
::
ToolButtonTextBesideIcon
);
hlayout
->
addWidget
(
removeButton
);
...
...
@@ -480,17 +476,14 @@ void BookmarkWidget::setup(bool showButtons)
treeView
->
viewport
()
->
installEventFilter
(
this
);
treeView
->
setContextMenuPolicy
(
Qt
::
CustomContextMenu
);
connect
(
treeView
,
SIGNAL
(
expanded
(
const
QModelIndex
&
)),
this
,
SLOT
(
expand
(
const
QModelIndex
&
)));
connect
(
treeView
,
SIGNAL
(
collapsed
(
const
QModelIndex
&
)),
this
,
SLOT
(
expand
(
const
QModelIndex
&
)));
connect
(
treeView
,
SIGNAL
(
activated
(
const
QModelIndex
&
)),
this
,
SLOT
(
activated
(
const
QModelIndex
&
)));
connect
(
treeView
,
SIGNAL
(
customContextMenuRequested
(
const
QPoint
&
)),
this
,
SLOT
(
customContextMenuRequested
(
const
QPoint
&
)));
connect
(
treeView
,
SIGNAL
(
expanded
(
QModelIndex
)),
this
,
SLOT
(
expand
(
QModelIndex
)));
connect
(
treeView
,
SIGNAL
(
collapsed
(
QModelIndex
)),
this
,
SLOT
(
expand
(
QModelIndex
)));
connect
(
treeView
,
SIGNAL
(
activated
(
QModelIndex
)),
this
,
SLOT
(
activated
(
QModelIndex
)));
connect
(
treeView
,
SIGNAL
(
customContextMenuRequested
(
QPoint
)),
this
,
SLOT
(
customContextMenuRequested
(
QPoint
)));
filterBookmarkModel
->
setFilterKeyColumn
(
0
);
filterBookmarkModel
->
setDynamicSortFilter
(
true
);
...
...
@@ -518,17 +511,17 @@ bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
if
(
e
->
type
()
==
QEvent
::
KeyPress
)
{
QKeyEvent
*
ke
=
static_cast
<
QKeyEvent
*>
(
e
);
if
(
index
.
isValid
()
&&
searchField
->
text
().
isEmpty
())
{
const
QModelIndex
&
src
=
filterBookmarkModel
->
mapToSource
(
index
);
if
(
ke
->
key
()
==
Qt
::
Key_F2
)
{
QStandardItem
*
item
=
bookmarkManager
->
treeBookmarkModel
()
->
itemFromIndex
(
filterBookmarkModel
->
mapToSource
(
index
)
);
QStandardItem
*
item
=
bookmarkManager
->
treeBookmarkModel
()
->
itemFromIndex
(
src
);
if
(
item
)
{
item
->
setEditable
(
true
);
treeView
->
edit
(
index
);
item
->
setEditable
(
false
);
}
}
else
if
(
ke
->
key
()
==
Qt
::
Key_Delete
)
{
bookmarkManager
->
removeBookmarkItem
(
treeView
,
filterBookmarkModel
->
mapToSource
(
index
));
bookmarkManager
->
removeBookmarkItem
(
treeView
,
src
);
}
}
...
...
@@ -579,6 +572,7 @@ bool BookmarkWidget::eventFilter(QObject *object, QEvent *e)
}
// #pragma mark -- BookmarkModel
BookmarkModel
::
BookmarkModel
(
int
rows
,
int
columns
,
QObject
*
parent
)
...
...
@@ -598,13 +592,15 @@ Qt::DropActions BookmarkModel::supportedDropActions() const
Qt
::
ItemFlags
BookmarkModel
::
flags
(
const
QModelIndex
&
index
)
const
{
Qt
::
ItemFlags
defaultFlags
=
QStandardItemModel
::
flags
(
index
);
if
(
index
.
data
(
Qt
::
UserRole
+
10
).
toString
()
==
QLatin1String
(
"Folder"
))
if
((
!
index
.
isValid
())
// can only happen for the invisible root item
||
index
.
data
(
Qt
::
UserRole
+
10
).
toString
()
==
QLatin1String
(
"Folder"
))
return
(
Qt
::
ItemIsDropEnabled
|
defaultFlags
)
&~
Qt
::
ItemIsDragEnabled
;
return
(
Qt
::
ItemIsDragEnabled
|
defaultFlags
)
&~
Qt
::
ItemIsDropEnabled
;
}
// #pragma mark -- BookmarkManager
BookmarkManager
::
BookmarkManager
(
QHelpEngineCore
*
_helpEngine
)
...
...
@@ -612,10 +608,9 @@ BookmarkManager::BookmarkManager(QHelpEngineCore* _helpEngine)
,
listModel
(
new
BookmarkModel
(
0
,
1
,
this
))
,
helpEngine
(
_helpEngine
)
{
bookmarkIcon
=
QIcon
(
QLatin1String
(
":/help/images/bookmark.png"
));
folderIcon
=
QApplication
::
style
()
->
standardIcon
(
QStyle
::
SP_DirClosedIcon
);
treeModel
->
setHeaderData
(
0
,
Qt
::
Horizontal
,
tr
(
"Bookmark"
));
listModel
->
setHeaderData
(
0
,
Qt
::
Horizontal
,
tr
(
"Bookmark"
));
connect
(
treeModel
,
SIGNAL
(
itemChanged
(
QStandardItem
*
)),
this
,
SLOT
(
itemChanged
(
QStandardItem
*
)));
}
...
...
@@ -638,22 +633,10 @@ BookmarkModel* BookmarkManager::listBookmarkModel()
void
BookmarkManager
::
saveBookmarks
()
{
qint32
depth
=
0
;
QByteArray
bookmarks
;
QDataStream
stream
(
&
bookmarks
,
QIODevice
::
WriteOnly
);
QStandardItem
*
root
=
treeModel
->
invisibleRootItem
();
for
(
int
i
=
0
;
i
<
root
->
rowCount
();
++
i
)
{
const
QStandardItem
*
item
=
root
->
child
(
i
);
stream
<<
depth
;
// root
stream
<<
item
->
data
(
Qt
::
DisplayRole
).
toString
();
stream
<<
item
->
data
(
Qt
::
UserRole
+
10
).
toString
();
stream
<<
item
->
data
(
Qt
::
UserRole
+
11
).
toBool
();
if
(
item
->
rowCount
()
>
0
)
{
readBookmarksRecursive
(
item
,
stream
,
(
depth
+
1
));
}
}
readBookmarksRecursive
(
treeModel
->
invisibleRootItem
(),
stream
,
0
);
helpEngine
->
setCustomValue
(
QLatin1String
(
"Bookmarks"
),
bookmarks
);
}
...
...
@@ -689,16 +672,17 @@ QModelIndex BookmarkManager::addNewFolder(const QModelIndex& index)
return
treeModel
->
indexFromItem
(
item
);
}
void
BookmarkManager
::
removeBookmarkItem
(
QTreeView
*
treeView
,
const
QModelIndex
&
index
)
void
BookmarkManager
::
removeBookmarkItem
(
QTreeView
*
treeView
,
const
QModelIndex
&
index
)
{
QStandardItem
*
item
=
treeModel
->
itemFromIndex
(
index
);
if
(
item
)
{
QString
data
=
index
.
data
(
Qt
::
UserRole
+
10
).
toString
();
if
(
data
==
QLatin1String
(
"Folder"
)
&&
item
->
rowCount
()
>
0
)
{
int
value
=
QMessageBox
::
question
(
treeView
,
tr
(
"Remove"
),
tr
(
"You are going to delete a Folder which will also<br>"
"remove its content. Are you sure you would like to continue?"
),
QMessageBox
::
Yes
|
QMessageBox
::
Cancel
,
QMessageBox
::
Cancel
);
tr
(
"You are going to delete a Folder which will also<br>"
"remove its content. Are you sure you would like to continue?"
),
QMessageBox
::
Yes
|
QMessageBox
::
Cancel
,
QMessageBox
::
Cancel
);
if
(
value
==
QMessageBox
::
Cancel
)
return
;
...
...
@@ -720,27 +704,25 @@ void BookmarkManager::removeBookmarkItem(QTreeView *treeView, const QModelIndex&
}
void
BookmarkManager
::
showBookmarkDialog
(
QWidget
*
parent
,
const
QString
&
name
,
const
QString
&
url
)
const
QString
&
url
)
{
BookmarkDialog
dialog
(
this
,
name
,
url
,
parent
);
dialog
.
exec
();
}
void
BookmarkManager
::
addNewBookmark
(
const
QModelIndex
&
index
,
const
QString
&
name
,
const
QString
&
url
)
const
QString
&
name
,
const
QString
&
url
)
{
QStandardItem
*
item
=
new
QStandardItem
(
name
);
item
->
setEditable
(
false
);
item
->
setData
(
false
,
Qt
::
UserRole
+
11
);
item
->
setData
(
url
,
Qt
::
UserRole
+
10
);
if
(
index
.
isValid
())
{
if
(
index
.
isValid
())
treeModel
->
itemFromIndex
(
index
)
->
appendRow
(
item
);
listModel
->
appendRow
(
item
->
clone
());
}
else
{
else
treeModel
->
appendRow
(
item
);
listModel
->
appendRow
(
item
->
clone
());
}
listModel
->
appendRow
(
item
->
clone
());
}
void
BookmarkManager
::
itemChanged
(
QStandardItem
*
item
)
...
...
@@ -771,7 +753,8 @@ void BookmarkManager::setupBookmarkModels()
QList
<
int
>
lastDepths
;
QList
<
QStandardItem
*>
parents
;
QByteArray
ba
=
helpEngine
->
customValue
(
QLatin1String
(
"Bookmarks"
)).
toByteArray
();
QByteArray
ba
=
helpEngine
->
customValue
(
QLatin1String
(
"Bookmarks"
)).
toByteArray
();
QDataStream
stream
(
ba
);
while
(
!
stream
.
atEnd
())
{
stream
>>
depth
>>
name
>>
type
>>
expanded
;
...
...
@@ -796,10 +779,12 @@ void BookmarkManager::setupBookmarkModels()
}
}
if
(
type
==
QLatin1String
(
"Folder"
))
item
->
setIcon
(
folderIcon
);
else
if
(
type
!=
QLatin1String
(
"Folder"
))
{
item
->
setIcon
(
bookmarkIcon
);
listModel
->
appendRow
(
item
->
clone
());
}
else
{
item
->
setIcon
(
folderIcon
);
}
}
}
...
...
@@ -841,8 +826,7 @@ void BookmarkManager::removeBookmarkFolderItems(QStandardItem *item)
}
void
BookmarkManager
::
readBookmarksRecursive
(
const
QStandardItem
*
item
,
QDataStream
&
stream
,
const
qint32
depth
)
const
QDataStream
&
stream
,
const
qint32
depth
)
const
{
for
(
int
j
=
0
;
j
<
item
->
rowCount
();
++
j
)
{
const
QStandardItem
*
child
=
item
->
child
(
j
);
...
...
src/shared/help/bookmarkmanager.h
View file @
3a1cbd97
...
...
@@ -76,7 +76,7 @@ private slots:
void
textChanged
(
const
QString
&
string
);
void
selectBookmarkFolder
(
const
QString
&
folderName
);
void
customContextMenuRequested
(
const
QPoint
&
point
);
void
currentChanged
(
const
QModelIndex
&
current
,
const
QModelIndex
&
previous
);
void
currentChanged
(
const
QModelIndex
&
current
);
private:
bool
eventFilter
(
QObject
*
object
,
QEvent
*
e
);
...
...
@@ -184,7 +184,8 @@ private:
private:
QString
oldText
;
QIcon
folderIcon
;
QIcon
bookmarkIcon
;
BookmarkModel
*
treeModel
;
BookmarkModel
*
listModel
;
QStandardItem
*
renameItem
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment