2 """This controller handles the bookmarks dialog."""
7 from PyQt4
import QtGui
10 from cola
import qtutils
11 from cola
.qobserver
import QObserver
12 from cola
.settings
import SettingsModel
13 from cola
.views
import BookmarkView
16 model
= SettingsModel()
17 bookmark
= os
.getcwd()
18 if bookmark
not in model
.bookmarks
:
19 model
.add_bookmarks(bookmark
)
20 model
.save_all_settings()
21 qtutils
.information("Bookmark Saved")
23 def manage_bookmarks():
24 model
= SettingsModel()
25 view
= BookmarkView(QtGui
.qApp
.activeWindow())
26 ctl
= BookmarkController(model
, view
)
28 if view
.exec_() == QtGui
.QDialog
.Accepted
:
29 model
.save_all_settings()
31 class BookmarkController(QObserver
):
32 def init(self
, model
, view
):
33 self
.add_observables( 'bookmarks' )
34 self
.add_callbacks(button_open
= self
.open,
35 button_delete
= self
.delete
)
39 selection
= qtutils
.get_selection_list(self
.view
.bookmarks
,
43 for item
in selection
:
44 utils
.fork("git", "cola", item
)
47 selection
= qtutils
.get_selection_list(self
.view
.bookmarks
,
51 for item
in selection
:
52 self
.model
.bookmarks
.remove(item
)