void BookmarksDialog::createDialogContent() { ui->setupUi(dialog); //Signals and slots connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint))); connect(ui->addBookmarkButton, SIGNAL(clicked()), this, SLOT(addBookmarkButtonPressed())); connect(ui->removeBookmarkButton, SIGNAL(clicked()), this, SLOT(removeBookmarkButtonPressed())); connect(ui->goToButton, SIGNAL(clicked()), this, SLOT(goToBookmarkButtonPressed())); connect(ui->clearBookmarksButton, SIGNAL(clicked()), this, SLOT(clearBookmarksButtonPressed())); connect(ui->bookmarksTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(selectCurrentBookmark(QModelIndex))); connect(ui->clearHighlightsButton, SIGNAL(clicked()), this, SLOT(clearHighlightsButtonPressed())); connect(ui->highlightBookmarksButton, SIGNAL(clicked()), this, SLOT(highlightBookrmarksButtonPressed())); connect(ui->importBookmarksButton, SIGNAL(clicked()), this, SLOT(importBookmarks())); connect(ui->exportBookmarksButton, SIGNAL(clicked()), this, SLOT(exportBookmarks())); //Initializing the list of bookmarks bookmarksListModel->setColumnCount(ColumnCount); setBookmarksHeaderNames(); ui->bookmarksTreeView->setModel(bookmarksListModel); ui->bookmarksTreeView->header()->setSectionsMovable(false); ui->bookmarksTreeView->header()->setSectionResizeMode(ColumnName, QHeaderView::ResizeToContents); ui->bookmarksTreeView->header()->setStretchLastSection(true); ui->bookmarksTreeView->hideColumn(ColumnUUID); loadBookmarks(); }
BrowsingLibrary::BrowsingLibrary(BrowserWindow* window, QWidget* parent) : QWidget(parent) , ui(new Ui::BrowsingLibrary) , m_historyManager(new HistoryManager(window)) , m_bookmarksManager(new BookmarksManager(window)) , m_rssManager(mApp->rssManager()) , m_rssLoaded(false) { ui->setupUi(this); Settings settings; settings.beginGroup("BrowsingLibrary"); resize(settings.value("size", QSize(760, 470)).toSize()); m_historyManager->restoreState(settings.value("historyState", QByteArray()).toByteArray()); settings.endGroup(); QzTools::centerWidgetOnScreen(this); ui->tabs->AddTab(m_historyManager, QIcon(":/icons/other/bighistory.png"), tr("History")); ui->tabs->AddTab(m_bookmarksManager, QIcon(":/icons/other/bigstar.png"), tr("Bookmarks")); ui->tabs->AddTab(m_rssManager, QIcon(":/icons/other/feed.png"), tr("RSS")); ui->tabs->SetMode(FancyTabWidget::Mode_LargeSidebar); ui->tabs->setFocus(); QMenu* m = new QMenu(this); m->addAction(tr("Import Bookmarks..."), this, SLOT(importBookmarks())); m->addAction(tr("Export Bookmarks..."), this, SLOT(exportBookmarks())); ui->importExport->setMenu(m); connect(ui->tabs, SIGNAL(CurrentChanged(int)), this, SLOT(currentIndexChanged(int))); connect(ui->searchLine, SIGNAL(textChanged(QString)), this, SLOT(search())); QzTools::setWmClass("Browsing Library", this); }
BookmarkManagerWidget::BookmarkManagerWidget(BookmarkModel *sourceModel, QWidget *parent) : QWidget(parent) , bookmarkModel(sourceModel) { TRACE_OBJ ui.setupUi(this); ui.treeView->setModel(bookmarkModel); ui.treeView->expandAll(); ui.treeView->installEventFilter(this); ui.treeView->viewport()->installEventFilter(this); ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint))); connect(ui.remove, SIGNAL(clicked()), this, SLOT(removeItem())); connect(ui.lineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString))); new QShortcut(QKeySequence::Find, ui.lineEdit, SLOT(setFocus())); importExportMenu.addAction(tr("Import..."), this, SLOT(importBookmarks())); importExportMenu.addAction(tr("Export..."), this, SLOT(exportBookmarks())); ui.importExport->setMenu(&importExportMenu); new QShortcut(QKeySequence::FindNext, this, SLOT(findNext())); new QShortcut(QKeySequence::FindPrevious, this, SLOT(findPrevious())); connect(bookmarkModel, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(refeshBookmarkCache())); connect(bookmarkModel, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(refeshBookmarkCache())); connect(bookmarkModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, SLOT(refeshBookmarkCache())); ui.treeView->setCurrentIndex(ui.treeView->indexAt(QPoint(2, 2))); }
/** Initializes the view. */ void CBookmarkIndex::initView() { //qDebug("CBookmarkIndex::initView"); header()->hide(); setFocusPolicy(Qt::WheelFocus); //d'n'd related settings setDragEnabled( true ); setAcceptDrops( true ); setDragDropMode(QAbstractItemView::DragDrop); viewport()->setAcceptDrops(true); setAutoScroll(true); setAutoExpandDelay(800); setItemsExpandable(true); setRootIsDecorated(true); setAllColumnsShowFocus(true); setSelectionMode(QAbstractItemView::ExtendedSelection); //setup the popup menu m_popup = new QMenu(viewport()); m_popup->setTitle(tr("Bookmarks")); m_actions.newFolder = newQAction(tr("New folder"), CResMgr::mainIndex::newFolder::icon, 0, this, SLOT(createNewFolder()), this); m_actions.changeFolder = newQAction(tr("Rename folder"),CResMgr::mainIndex::changeFolder::icon, 0, this, SLOT(changeFolder()), this); m_actions.changeBookmark = newQAction(tr("Change bookmark description..."), CResMgr::mainIndex::changeBookmark::icon, 0, this, SLOT(changeBookmark()), this); m_actions.importBookmarks = newQAction(tr("Import to folder..."), CResMgr::mainIndex::importBookmarks::icon, 0, this, SLOT(importBookmarks()), this); m_actions.exportBookmarks = newQAction(tr("Export from folder..."), CResMgr::mainIndex::exportBookmarks::icon, 0, this, SLOT(exportBookmarks()), this); m_actions.printBookmarks = newQAction(tr("Print bookmarks..."), CResMgr::mainIndex::printBookmarks::icon, 0, this, SLOT(printBookmarks()), this); m_actions.deleteEntries = newQAction(tr("Remove selected items..."), CResMgr::mainIndex::deleteItems::icon, 0, this, SLOT(deleteEntries()), this); //fill the popup menu itself m_popup->addAction(m_actions.newFolder); m_popup->addAction(m_actions.changeFolder); QAction* separator = new QAction(this); separator->setSeparator(true); m_popup->addAction(separator); m_popup->addAction(m_actions.changeBookmark); m_popup->addAction(m_actions.importBookmarks); m_popup->addAction(m_actions.exportBookmarks); m_popup->addAction(m_actions.printBookmarks); separator = new QAction(this); separator->setSeparator(true); m_popup->addAction(separator); m_popup->addAction(m_actions.deleteEntries); //qDebug("CBookmarkIndex::initView end"); }