Exemplo n.º 1
0
void BookmarksManager::addBookmark()
{
    BookmarkItem* item = new BookmarkItem(BookmarkItem::Url);
    item->setTitle(tr("New Bookmark"));
    item->setUrl(QUrl("http://"));
    addBookmark(item);
}
bool HelpDialogBase::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: languageChange(); break;
    case 1: init(); break;
    case 2: destroy(); break;
    case 3: addBookmark(); break;
    case 4: currentBookmarkChanged((QListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 5: currentIndexChanged((QListBoxItem*)static_QUType_ptr.get(_o+1)); break;
    case 6: currentTabChanged((const QString&)static_QUType_QString.get(_o+1)); break;
    case 7: loadIndexFile(); break;
    case 8: currentContentsChanged((QListViewItem*)static_QUType_ptr.get(_o+1)); break;
    case 9: removeBookmark(); break;
    case 10: searchInIndex((const QString&)static_QUType_QString.get(_o+1)); break;
    case 11: showTopic(); break;
    case 12: showTopic((int)static_QUType_int.get(_o+1),(QListBoxItem*)static_QUType_ptr.get(_o+2),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+3))); break;
    case 13: showSearchHelp(); break;
    case 14: startSearch(); break;
    case 15: showResultPage((QListBoxItem*)static_QUType_ptr.get(_o+1)); break;
    case 16: showResultPage((int)static_QUType_int.get(_o+1),(QListBoxItem*)static_QUType_ptr.get(_o+2),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+3))); break;
    case 17: showResultPage((int)static_QUType_int.get(_o+1),(QListViewItem*)static_QUType_ptr.get(_o+2),(const QPoint&)*((const QPoint*)static_QUType_ptr.get(_o+3))); break;
    default:
	return QWidget::qt_invoke( _id, _o );
    }
    return TRUE;
}
Exemplo n.º 3
0
void SearchListView::onCustomContextMenu(const QPoint &pos)
{
    QModelIndex index = ui->bookmarks->indexAt(pos);
    TreeItem *item = model()->getItem(index);
    if (index.isValid())
    {
        QAction *action = NULL;

        switch(item->getType())
        {
        case ModelUtil::Folder:
            {
                // Context menu for folders
                QMenu *contextMenu = new QMenu(this);

                contextMenu->addAction(ui->actionAddBookmark);
                contextMenu->addAction(ui->actionRemoveBookmark);
                contextMenu->addSeparator();
                contextMenu->addAction(ui->actionAddFolder);
                contextMenu->addAction(ui->actionRemoveFolder);

                action = contextMenu->exec(ui->bookmarks->mapToGlobal(pos));

                break;
            }
        case ModelUtil::Link:
            {
                // Context menu for links
                QMenu *contextMenu = new QMenu(this);
                contextMenu->addAction(ui->actionAddBookmark);
                contextMenu->addAction(ui->actionRemoveBookmark);
                action = contextMenu->exec(ui->bookmarks->mapToGlobal(pos));

                // New bookmark will be created in same folder!
                index = index.parent();

                break;
            }
        default:
            break;
        }

        if(action == ui->actionAddBookmark)
        {
            emit addBookmark(index);
        }
        else if(action == ui->actionRemoveBookmark)
        {
            emit removeBookmark(index);
        }
        else if(action == ui->actionAddFolder)
        {
            emit addFolder(index);
        }
        else if(action == ui->actionRemoveFolder)
        {
            emit removeFolder(index);
        }
    }
}
Exemplo n.º 4
0
void MainWindow::saveBookmark()
{
    std::set<unsigned int> currentSelection = ui->glwidget->getCurrentSelection();
    QString name = ui->nameLineEdit->text();
    QString comments = ui->informationTextEdit->toPlainText();

    if (currentSelection.size() == 0)
    {
        // Alert: Nothing selected.
        QMessageBox msgBox;
        msgBox.setText("No faces selected.");
        msgBox.exec();
    }
    else if (ui->nameLineEdit->text().length() == 0)
    {
        // Alert: No name.
        QMessageBox msgBox;
        msgBox.setText("Please complete name field.");
        msgBox.exec();
    }
    else
    {
        if ( ui->listWidget->currentRow() == 0 ) // Add bookmark
            addBookmark(name, comments, currentSelection);
        else
            updateBookmark(name, comments, currentSelection);

        // Configure cursor.
        setCursor(Qt::ArrowCursor);

        showListPanel();
    }
}
Exemplo n.º 5
0
bool BookmarksModel::dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent)
{
	const BookmarkType type = static_cast<BookmarkType>(parent.data(TypeRole).toInt());

	if (type == FolderBookmark || type == RootBookmark || type == TrashBookmark)
	{
		const QModelIndex index = data->property("x-item-index").toModelIndex();

		if (index.isValid())
		{
			return moveBookmark(getBookmark(index), getBookmark(parent), row);
		}
		else if (data->hasUrls())
		{
			const QList<QUrl> urls(data->urls());

			for (int i = 0; i < urls.count(); ++i)
			{
				addBookmark(UrlBookmark, 0, urls.at(i), (data->property("x-url-title").toString().isEmpty() ? urls.at(i).toString() : data->property("x-url-title").toString()), getBookmark(parent), row);
			}

			return true;
		}

		return QStandardItemModel::dropMimeData(data, action, row, column, parent);
	}

	return false;
}
Exemplo n.º 6
0
void BookmarkEditDlg::OnItemModify(void) 
{
    if (mListCtrl.GetSelectedCount() > 0)
    {
        xpr_sint_t sIndex = mListCtrl.GetSelectionMark();
        BookmarkItem *sBookmarkItem = (BookmarkItem *)mListCtrl.GetItemData(sIndex);

        BookmarkItemEditDlg sDlg;
        sDlg.add(sBookmarkItem);
        if (sDlg.DoModal() == IDOK)
        {
            if (sDlg.mBookmark.mPath.empty() == XPR_FALSE)
            {
                sDlg.copyBookmark(sBookmarkItem);

                sBookmarkItem->newSignature();
                sBookmarkItem->destroyIcon();

                mListCtrl.SetItemData(sIndex, XPR_NULL);
                mListCtrl.DeleteItem(sIndex);
                addBookmark(sBookmarkItem, IconReqShellIcon, sIndex);

                setItemFocus(sIndex);
            }
        }
    }

    updateStatus();
}
Exemplo n.º 7
0
void BookmarkEditDlg::OnDefault(void)
{
    const xpr_tchar_t *sMsg = gApp.loadString(XPR_STRING_LITERAL("popup.bookmark_edit.msg.question_default"));
    xpr_sint_t sMsgId = MessageBox(sMsg, XPR_NULL, MB_YESNO | MB_ICONQUESTION);
    if (sMsgId == IDNO)
        return;

    CWaitCursor sWaitCursor;

    mListCtrl.DeleteAllItems();

    BookmarkMgr::BookmarkDeque sBookmarkDeque;
    BookmarkMgr::getDefaultBookmark(sBookmarkDeque);

    BookmarkItem *sBookmarkItem;
    BookmarkMgr::BookmarkDeque::iterator sIterator;

    sIterator = sBookmarkDeque.begin();
    for (; sIterator != sBookmarkDeque.end(); ++sIterator)
    {
        sBookmarkItem = *sIterator;
        addBookmark(sBookmarkItem, IconReqShellIcon);
    }

    sBookmarkDeque.clear();

    if (mListCtrl.GetItemCount() > 0)
        setItemFocus(0);

    updateStatus();
}
Exemplo n.º 8
0
void ProfileGraphicsView::contextMenuEvent(QContextMenuEvent* event)
{
	if (selected_dive == -1)
		return;
	QMenu m;
	QMenu *gasChange = m.addMenu(tr("Add Gas Change"));
	GasSelectionModel *model = GasSelectionModel::instance();
	model->repopulate();
	int rowCount = model->rowCount();
	for (int i = 0; i < rowCount; i++) {
		QAction *action = new QAction(&m);
		action->setText( model->data(model->index(i, 0),Qt::DisplayRole).toString());
		connect(action, SIGNAL(triggered(bool)), this, SLOT(changeGas()));
		action->setData(event->globalPos());
		gasChange->addAction(action);
	}
	QAction *action = m.addAction(tr("Add Bookmark"), this, SLOT(addBookmark()));
	action->setData(event->globalPos());
	QList<QGraphicsItem*> itemsAtPos = scene()->items(mapToScene(mapFromGlobal(event->globalPos())));
	Q_FOREACH(QGraphicsItem *i, itemsAtPos) {
		EventItem *item = dynamic_cast<EventItem*>(i);
		if (!item)
			continue;
		action = new QAction(&m);
		action->setText(tr("Remove Event"));
		action->setData(QVariant::fromValue<void*>(item)); // so we know what to remove.
		connect(action, SIGNAL(triggered(bool)), this, SLOT(removeEvent()));
		m.addAction(action);
		action = new QAction(&m);
		action->setText(tr("Hide similar events"));
		action->setData(QVariant::fromValue<void*>(item));
		connect(action, SIGNAL(triggered(bool)), this, SLOT(hideEvents()));
		m.addAction(action);
		break;
	}
Exemplo n.º 9
0
void BookmarkEditDlg::OnItemAdd(void) 
{
    if (mListCtrl.GetItemCount() > MAX_BOOKMARK)
    {
        xpr_tchar_t sMsg[0xff] = {0};
        _stprintf(sMsg, gApp.loadFormatString(XPR_STRING_LITERAL("popup.bookmark_edit.msg.excess_max_count"), XPR_STRING_LITERAL("%d")), MAX_BOOKMARK);
        MessageBox(sMsg, XPR_NULL, MB_OK | MB_ICONSTOP);
        return;
    }

    BookmarkItemEditDlg sDlg;
    if (sDlg.DoModal() == IDOK)
    {
        if (sDlg.mBookmark.mPath.empty() == XPR_FALSE)
        {
            BookmarkItem *sBookmarkItem = new BookmarkItem;

            sDlg.copyBookmark(sBookmarkItem);
            addBookmark(sBookmarkItem, IconReqShellIcon);

            setItemFocus(mListCtrl.GetItemCount() - 1);
        }
    }

    updateStatus();
}
Exemplo n.º 10
0
void BookmarksSideBar::changeBookmarkParent(const QString &name, const QByteArray &imageData, int id,
        const QUrl &url, const QString &oldParent, const QString &newParent)
{
    if (!newParent.isEmpty() && newParent != QLatin1String("unsorted")
            && newParent != _bookmarksUnsorted && !oldParent.isEmpty()
            && oldParent != QLatin1String("unsorted")
            && oldParent != _bookmarksUnsorted) { // old and new parent are not invisibleRootItem()
        QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(newParent, Qt::MatchExactly);
        if (list.isEmpty()) { // newParent is a subfolder
            list = ui->bookmarksTree->findItems(oldParent, Qt::MatchExactly);
            if (list.isEmpty()) { // oldParent is a subfolder
                return; // item was reparented from bookmarkToolbar(subfolder) to subfolder(bookmarkToolbar)
            }
        }
    }

    QList<QTreeWidgetItem*> list = ui->bookmarksTree->findItems(name, Qt::MatchExactly | Qt::MatchRecursive);

    QTreeWidgetItem* item = 0;
    foreach (item, list) {
        if (id == item->data(0, Qt::UserRole + 10).toInt()) {
            break;
        }
    }

    if (!item || id != item->data(0, Qt::UserRole + 10).toInt()) { // list is empty or item with 'id' was not found
        // bookmark's oldParent was bookmarkToolbar(subfolder)
        Bookmark bookmark;
        bookmark.id =  id;
        bookmark.url = url;
        bookmark.title = name;
        bookmark.folder = BookmarksModel::fromTranslatedFolder(newParent.isEmpty() ? QLatin1String("unsorted") : newParent);
        bookmark.image = QImage::fromData(imageData);
        bookmark.inSubfolder = false;
        addBookmark(bookmark);
        return;
    }

    QTreeWidgetItem* parent = 0;
    if (newParent.isEmpty() || newParent == QLatin1String("unsorted") || newParent == _bookmarksUnsorted) {
        parent = ui->bookmarksTree->invisibleRootItem();
    }
    item->parent() ? item->parent()->removeChild(item) : ui->bookmarksTree->invisibleRootItem()->removeChild(item);

    if (!parent) {
        list = ui->bookmarksTree->findItems(newParent, Qt::MatchExactly);
        if (list.count() == 0) {
            return;
        }

        parent = list.at(0);
        if (!parent) {
            return;
        }
    }

    parent->addChild(item);
}
Exemplo n.º 11
0
void KrBookmarkHandler::bookmarkCurrent(QUrl url)
{
    QPointer<KrAddBookmarkDlg> dlg = new KrAddBookmarkDlg(_mainWindow->widget(), url);
    if (dlg->exec() == QDialog::Accepted) {
        KrBookmark *bm = new KrBookmark(dlg->name(), dlg->url(), _collection);
        addBookmark(bm, dlg->folder());
    }
    delete dlg;
}
BookmarksContentsWidget::BookmarksContentsWidget(Window *window) : ContentsWidget(window),
	m_ui(new Ui::BookmarksContentsWidget)
{
	m_ui->setupUi(this);

	QMenu *addMenu(new QMenu(m_ui->addButton));
	addMenu->addAction(ThemesManager::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder()));
	addMenu->addAction(tr("Add Bookmark"), this, SLOT(addBookmark()));
	addMenu->addAction(tr("Add Separator"), this, SLOT(addSeparator()));

	QSet<int> filterRoles;
	filterRoles << BookmarksModel::UrlRole << BookmarksModel::TitleRole << BookmarksModel::DescriptionRole << BookmarksModel::KeywordRole;

	QList<QPair<QString, int> > rolesMapping;
	rolesMapping << qMakePair(tr("Title"), BookmarksModel::TitleRole) << qMakePair(tr("Address"), BookmarksModel::UrlRole) << qMakePair(tr("Description"), BookmarksModel::DescriptionRole) << qMakePair(tr("Keyword"), BookmarksModel::KeywordRole) << qMakePair(tr("Added"), BookmarksModel::TimeAddedRole) << qMakePair(tr("Modified"), BookmarksModel::TimeModifiedRole) << qMakePair(tr("Visited"), BookmarksModel::TimeVisitedRole) << qMakePair(tr("Visits"), BookmarksModel::VisitsRole);

	ProxyModel *model(new ProxyModel(BookmarksManager::getModel(), rolesMapping, this));

	m_ui->addButton->setMenu(addMenu);
	m_ui->bookmarksViewWidget->setViewMode(ItemViewWidget::TreeViewMode);
	m_ui->bookmarksViewWidget->setModel(model);
	m_ui->bookmarksViewWidget->setExpanded(m_ui->bookmarksViewWidget->model()->index(0, 0), true);
	m_ui->bookmarksViewWidget->setFilterRoles(filterRoles);
	m_ui->bookmarksViewWidget->installEventFilter(this);
	m_ui->bookmarksViewWidget->viewport()->installEventFilter(this);
	m_ui->bookmarksViewWidget->viewport()->setMouseTracking(true);
	m_ui->filterLineEdit->installEventFilter(this);

	if (!window)
	{
		m_ui->detailsWidget->hide();
	}

	connect(BookmarksManager::getModel(), SIGNAL(modelReset()), this, SLOT(updateActions()));
	connect(m_ui->propertiesButton, SIGNAL(clicked()), this, SLOT(bookmarkProperties()));
	connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeBookmark()));
	connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(addBookmark()));
	connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), m_ui->bookmarksViewWidget, SLOT(setFilterString(QString)));
	connect(m_ui->bookmarksViewWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openBookmark(QModelIndex)));
	connect(m_ui->bookmarksViewWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
	connect(m_ui->bookmarksViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActions()));
}
Exemplo n.º 13
0
void Logbook::setHome(const QString &url) {
   BookmarkItem *item = getBookmark(url);
   if ( !item ) {
      addBookmark(QString(), url);
      item = getBookmark(url);
   }
   if ( item ) { // Ensuring the item actually exists
      setHome(*item);
      delete item;
   }
}
Exemplo n.º 14
0
BookmarksContentsWidget::BookmarksContentsWidget(Window *window) : ContentsWidget(window),
	m_model(new QStandardItemModel(this)),
	m_isLoading(true),
	m_ui(new Ui::BookmarksContentsWidget)
{
	m_ui->setupUi(this);

	QMenu *addMenu = new QMenu(m_ui->addButton);
	addMenu->addAction(Utils::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder()));
	addMenu->addAction(tr("Add Bookmark"), this, SLOT(addBookmark()));
	addMenu->addAction(tr("Add Separator"), this, SLOT(addSeparator()));

	m_ui->addButton->setMenu(addMenu);

	QTimer::singleShot(100, this, SLOT(populateBookmarks()));

	connect(m_ui->propertiesButton, SIGNAL(clicked()), this, SLOT(bookmarkProperties()));
	connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeBookmark()));
	connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(addBookmark()));
}
Exemplo n.º 15
0
void BookmarksSideBar::changeFolderParent(const QString &name, bool isSubfolder)
{
    if (isSubfolder) { // folder moved to _bookmarksToolbar as a subfolder
        removeFolder(name);
    }
    else {
        addFolder(name);
        QVector<Bookmark> bookmarksList = m_bookmarksModel->folderBookmarks(name);
        foreach (const Bookmark &b, bookmarksList) {
            addBookmark(b);
        }
    }
Exemplo n.º 16
0
void TextFrame::toggleBookmark()
{
    wxStyledTextCtrl* txt = getCurrentTextCtrl();
    if(txt)
    {
        int line = txt->GetCurrentLine();
        BookmarkList& list = getDocument()->getBookmarks();
        if(list.has(line))
            remBookmark(line);
        else
            addBookmark(line);
    }
}
BookmarksContentsWidget::BookmarksContentsWidget(Window *window) : ContentsWidget(window),
	m_ui(new Ui::BookmarksContentsWidget)
{
	m_ui->setupUi(this);

	QMenu *addMenu = new QMenu(m_ui->addButton);
	addMenu->addAction(Utils::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder()));
	addMenu->addAction(tr("Add Bookmark"), this, SLOT(addBookmark()));
	addMenu->addAction(tr("Add Separator"), this, SLOT(addSeparator()));

	QSet<int> filterRoles;
	filterRoles << BookmarksModel::UrlRole << BookmarksModel::TitleRole << BookmarksModel::DescriptionRole << BookmarksModel::KeywordRole;

	m_ui->addButton->setMenu(addMenu);
	m_ui->bookmarksViewWidget->setViewMode(ItemViewWidget::TreeViewMode);
	m_ui->bookmarksViewWidget->setModel(BookmarksManager::getModel());
	m_ui->bookmarksViewWidget->setItemDelegate(new ItemDelegate(this));
	m_ui->bookmarksViewWidget->setExpanded(BookmarksManager::getModel()->getRootItem()->index(), true);
	m_ui->bookmarksViewWidget->setFilterRoles(filterRoles);
	m_ui->bookmarksViewWidget->installEventFilter(this);
	m_ui->bookmarksViewWidget->viewport()->installEventFilter(this);
	m_ui->bookmarksViewWidget->viewport()->setMouseTracking(true);
	m_ui->filterLineEdit->installEventFilter(this);

	if (!window)
	{
		m_ui->detailsWidget->hide();
	}

	connect(BookmarksManager::getModel(), SIGNAL(modelReset()), this, SLOT(updateActions()));
	connect(m_ui->propertiesButton, SIGNAL(clicked()), this, SLOT(bookmarkProperties()));
	connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeBookmark()));
	connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(addBookmark()));
	connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), m_ui->bookmarksViewWidget, SLOT(setFilterString(QString)));
	connect(m_ui->bookmarksViewWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openBookmark(QModelIndex)));
	connect(m_ui->bookmarksViewWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint)));
	connect(m_ui->bookmarksViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActions()));
}
Exemplo n.º 18
0
void AvatarBookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) {
    // Add menus/actions
    auto bookmarkAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::BookmarkAvatar);
    QObject::connect(bookmarkAction, SIGNAL(triggered()), this, SLOT(addBookmark()), Qt::QueuedConnection);
    _bookmarksMenu = menu->addMenu(MenuOption::AvatarBookmarks);
    _deleteBookmarksAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::DeleteAvatarBookmark);
    QObject::connect(_deleteBookmarksAction, SIGNAL(triggered()), this, SLOT(deleteBookmark()), Qt::QueuedConnection);

    for (auto it = _bookmarks.begin(); it != _bookmarks.end(); ++it) {
        addBookmarkToMenu(menubar, it.key(), it.value());
    }

    Bookmarks::sortActions(menubar, _bookmarksMenu);
}
Exemplo n.º 19
0
/// Adds or removes a bookmark from a given address
/// @param hwnd HWND of the emu window
/// @param address Address of the bookmark
int toggleBookmark(HWND hwnd, uint32 address)
{
	int val = findBookmark(address);
	
	// If there's no bookmark at the given address add one.
	if (val == -1)
	{
		return addBookmark(hwnd, address);
	}
	else // else remove the bookmark
	{
		removeBookmark(val);
		return 0;
	}
}
Exemplo n.º 20
0
void tpMainWindow::createActions()
{

    //tray
    open = new QAction(tr("&Open"), this);
    connect(open, SIGNAL(triggered()), this, SLOT(show()));


    close = new QAction(tr("&Quit"), this);
    connect(close, SIGNAL(triggered()), this, SLOT(myQuit()));

    open_in_browser = new QAction(tr("&Open in Browser"), this);
    connect(open_in_browser, SIGNAL(triggered()), this, SLOT(openStreamBrowser()));


    open_in_hexchat = new QAction(tr("Open &Chat"), this);
    connect(open_in_hexchat, SIGNAL(triggered()), this, SLOT(openChatHexChat()));

    open_in_hexchat_bookmark = new QAction(tr("Open &Chat"), this);
    connect(open_in_hexchat_bookmark, SIGNAL(triggered()), this, SLOT(openChatHexChatBookmark()));


    open_in_browser_bookmark = new QAction(tr("&Open in Browser"), this);
    connect(open_in_browser_bookmark, SIGNAL(triggered()), this, SLOT(openStreamBrowserBookmark()));

    add_hosted_bookmark = new QAction(tr("&Add Hosted to Bookmarks"), this);
    connect(add_hosted_bookmark, SIGNAL(triggered()), this, SLOT(addBookmarkHosted()));

    delete_bookmark = new QAction(tr("&Remove"), this);
    connect(delete_bookmark, SIGNAL(triggered()), this, SLOT(deleteBookmark()));

    add_bookmark = new QAction(tr("&Add"), this);
    connect(add_bookmark, SIGNAL(triggered()), this, SLOT(addBookmark()));

    add_follow = new QAction(tr("&Follow Channel..."), this);
    connect(add_follow, SIGNAL(triggered()), this, SLOT(addFollow()));

    add_follower_bookmark = new QAction(tr("Follow Channel"), this);
    connect(add_follower_bookmark, SIGNAL(triggered()), this, SLOT(addFollowerBookmark()));

    delete_follower = new QAction(tr("Unfollow Channel"), this);
    connect(delete_follower, SIGNAL(triggered()), this, SLOT(deleteFollower()));

    copy_streamurl = new QAction(tr("Copy URL"), this);
    copy_streamurl->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    connect(copy_streamurl, SIGNAL(triggered()), this, SLOT(copyUrl()));

}
Exemplo n.º 21
0
void BookmarkEditDlg::OnItemMoveDown(void) 
{
    if (mListCtrl.GetSelectedCount() > 0)
    {
        xpr_sint_t sIndex = mListCtrl.GetSelectionMark();
        if (sIndex == (mListCtrl.GetItemCount()-1))
            return;

        BookmarkItem *sBookmarkItem = (BookmarkItem *)mListCtrl.GetItemData(sIndex);
        mListCtrl.SetItemData(sIndex, XPR_NULL);
        mListCtrl.DeleteItem(sIndex++);

        addBookmark(sBookmarkItem, IconReqNone, sIndex);

        setItemFocus(sIndex);
    }
}
Exemplo n.º 22
0
void BookmarksContentsWidget::addBookmark(BookmarkInformation *bookmark, QStandardItem *parent)
{
	if (!bookmark)
	{
		return;
	}

	if (!parent)
	{
		parent = findFolder(bookmark->parent);
	}

	if (!parent)
	{
		return;
	}

	QStandardItem *item = NULL;

	switch (bookmark->type)
	{
		case FolderBookmark:
			item = new QStandardItem(Utils::getIcon(QLatin1String("inode-directory")), (bookmark->title.isEmpty() ? tr("(Untitled)") : bookmark->title));

			for (int i = 0; i < bookmark->children.count(); ++i)
			{
				addBookmark(bookmark->children.at(i), item);
			}

			break;
		case UrlBookmark:
			item = new QStandardItem(WebBackendsManager::getBackend()->getIconForUrl(QUrl(bookmark->url)), (bookmark->title.isEmpty() ? tr("(Untitled)") : bookmark->title));

			break;
		default:
			item = new QStandardItem();
			item->setData(QLatin1String("separator"), Qt::AccessibleDescriptionRole);

			break;
	}

	item->setData(qVariantFromValue((void*) bookmark), Qt::UserRole);

	parent->appendRow(item);
}
Exemplo n.º 23
0
void BookmarksContentsWidget::updateFolder(int folder)
{
	QStandardItem *item = findFolder(folder);

	if (!item)
	{
		return;
	}

	item->removeRows(0, item->rowCount());

	const QList<BookmarkInformation*> bookmarks = BookmarksManager::getFolder(folder);

	for (int i = 0; i < bookmarks.count(); ++i)
	{
		addBookmark(bookmarks.at(i), item);
	}
}
Exemplo n.º 24
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow), model(this)
{
    ui->setupUi(this);

    connect(ui->actionQuit,          SIGNAL(triggered()),                      SLOT(close()));

    connect(ui->actionViewToolbar,   SIGNAL(triggered(bool)), ui->mainToolBar, SLOT(setVisible(bool)));
    connect(ui->actionViewLog,       SIGNAL(triggered(bool)), ui->listLog,     SLOT(setVisible(bool)));
    connect(ui->actionViewStatusbar, SIGNAL(triggered(bool)), ui->statusBar,   SLOT(setVisible(bool)));

    connect(ui->actionAddBookmark,   SIGNAL(triggered()),                      SLOT(addBookmark()));
    connect(ui->treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(currentTreeItemChanged(QModelIndex, QModelIndex)));

    ui->treeView->setModel(&model);
    model.restoreFromXml(::DefaultWorkspaceFilename());
}
Exemplo n.º 25
0
bool HelpWindow::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0:
        setBackwardAvailable((bool)static_QUType_bool.get(_o+1));
        break;
    case 1:
        setForwardAvailable((bool)static_QUType_bool.get(_o+1));
        break;
    case 2:
        sourceChanged((const QString&)static_QUType_QString.get(_o+1));
        break;
    case 3:
        about();
        break;
    case 4:
        aboutQt();
        break;
    case 5:
        openFile();
        break;
    case 6:
        newWindow();
        break;
    case 7:
        print();
        break;
    case 8:
        pathSelected((const QString&)static_QUType_QString.get(_o+1));
        break;
    case 9:
        histChosen((int)static_QUType_int.get(_o+1));
        break;
    case 10:
        bookmChosen((int)static_QUType_int.get(_o+1));
        break;
    case 11:
        addBookmark();
        break;
    default:
        return QMainWindow::qt_invoke( _id, _o );
    }
    return TRUE;
}
Exemplo n.º 26
0
void BookmarksManager::importBookmarks()
{
    QString fileName = QFileDialog::getOpenFileName(0, tr("Open File"),
                                                     QString(),
                                                     tr("XBEL (*.xbel *.xml)"));
    if (fileName.isEmpty())
        return;

    XbelReader reader;
    BookmarkNode *importRootNode = reader.read(fileName);
    if (reader.error() != QXmlStreamReader::NoError) {
        QMessageBox::warning(0, QLatin1String("Loading Bookmark"),
            tr("Error when loading bookmarks on line %1, column %2:\n"
               "%3").arg(reader.lineNumber()).arg(reader.columnNumber()).arg(reader.errorString()));
    }

    importRootNode->setType(BookmarkNode::Folder);
    importRootNode->title = (tr("Imported %1").arg(QDate::currentDate().toString(Qt::SystemLocaleShortDate)));
    addBookmark(menu(), importRootNode);
}
Exemplo n.º 27
0
void BookmarksManager::createContextMenu(const QPoint &pos)
{
    QMenu menu;
    QAction* actNewTab = menu.addAction(QIcon::fromTheme("tab-new", QIcon(":/icons/menu/tab-new.png")), tr("Open in new tab"));
    QAction* actNewWindow = menu.addAction(QIcon::fromTheme("window-new"), tr("Open in new window"));
    QAction* actNewPrivateWindow = menu.addAction(QIcon(":icons/locationbar/privatebrowsing.png"), tr("Open in new private window"));

    menu.addSeparator();
    menu.addAction(tr("New Bookmark"), this, SLOT(addBookmark()));
    menu.addAction(tr("New Folder"), this, SLOT(addFolder()));
    menu.addAction(tr("New Separator"), this, SLOT(addSeparator()));
    menu.addSeparator();
    QAction* actDelete = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));

    connect(actNewTab, SIGNAL(triggered()), this, SLOT(openBookmarkInNewTab()));
    connect(actNewWindow, SIGNAL(triggered()), this, SLOT(openBookmarkInNewWindow()));
    connect(actNewPrivateWindow, SIGNAL(triggered()), this, SLOT(openBookmarkInNewPrivateWindow()));
    connect(actDelete, SIGNAL(triggered()), this, SLOT(deleteBookmarks()));

    bool canBeDeleted = false;
    QList<BookmarkItem*> items = ui->tree->selectedBookmarks();

    foreach (BookmarkItem* item, items) {
        if (m_bookmarks->canBeModified(item)) {
            canBeDeleted = true;
            break;
        }
    }

    if (!canBeDeleted) {
        actDelete->setDisabled(true);
    }

    if (!m_selectedBookmark || !m_selectedBookmark->isUrl()) {
        actNewTab->setDisabled(true);
        actNewWindow->setDisabled(true);
        actNewPrivateWindow->setDisabled(true);
    }

    menu.exec(pos);
}
Exemplo n.º 28
0
void MainWindow::customizeActions()
{
    ui->actionOpen->setIcon(QIcon::fromTheme("document-open",
                                QIcon(":/images/document-open.svg")));
    ui->actionOpen->setShortcut(QKeySequence("CTRL+O"));
    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));

    ui->actionExit->setIcon(QIcon::fromTheme("application-exit",
                                QIcon(":/images/application-exit.svg")));
    ui->actionExit->setShortcut(QKeySequence("CTRL+Q"));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));

    ui->actionAddBookmark->setIcon(QIcon::fromTheme("bookmark",
                                          QIcon(":/images/bookmark.png")));
    ui->actionAddBookmark->setShortcut(QKeySequence("CTRL+B"));
    connect(ui->actionAddBookmark, SIGNAL(triggered()), this, SLOT(addBookmark()));

    ui->actionChooseBookmark->setIcon(QIcon(":/images/emblem-choose.svg"));
    ui->actionChooseBookmark->setShortcut(QKeySequence("CTRL+C"));
    connect(ui->actionChooseBookmark, SIGNAL(triggered()), this, SLOT(chooseBookmark()));

    ui->actionDisplayWords->setIcon(QIcon(":/images/list.svg"));
    ui->actionDisplayWords->setShortcut(QKeySequence("CTRL+L"));
    connect(ui->actionDisplayWords, SIGNAL(triggered()), this, SLOT(displayWords()));

    ui->actionAboutQt->setIcon(QIcon(":/images/qt-logo.png"));
    connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

    ui->actionAboutProgram->setIcon(QIcon(":/images/mainwindow-icon.svg"));
    connect(ui->actionAboutProgram, SIGNAL(triggered()), this, SLOT(about()));

    connect(ui->textEdit->actionAdd, SIGNAL(triggered(bool)), this,
            SLOT(addTranslate()));
    connect(ui->textEdit->actionAddBookmark, SIGNAL(triggered(bool)), this,
            SLOT(addBookmark()));

    ui->mainToolBar->addAction(ui->actionOpen);
    ui->mainToolBar->addAction(ui->actionAddBookmark);
    ui->mainToolBar->addAction(ui->actionChooseBookmark);
    ui->mainToolBar->addAction(ui->actionDisplayWords);
}
Exemplo n.º 29
0
void ResourcesBrowser::loadLayout( QSettings& settings )
{
   // begin serialization
   settings.beginGroup( "ResourcesBrowser/layoutSettings" );

   // deserialize the list of bookmarks
   {
      std::string bookmarks = settings.value( "bookmarks" ).toString().toStdString();
      std::vector< std::string > arrBookmarks;
      StringUtils::tokenize( bookmarks, ";", arrBookmarks );

      uint count = arrBookmarks.size();
      for ( uint i = 0; i < count; ++i )
      {
         addBookmark( FilePath( arrBookmarks[i] ) );
      }
   }

   // finish serialization
   settings.endGroup();
}
Exemplo n.º 30
0
void BookmarksToolbar::bookmarkEdited(const BookmarksModel::Bookmark &before, const BookmarksModel::Bookmark &after)
{
    if (before.folder == QLatin1String("bookmarksToolbar") && after.folder != QLatin1String("bookmarksToolbar")) {
        // Editing from toolbar folder to other folder -> Remove bookmark
        removeBookmark(before);
    }
    else if (before.folder != QLatin1String("bookmarksToolbar") && after.folder == QLatin1String("bookmarksToolbar")) {
        // Editing from other folder to toolbar folder -> Add bookmark
        addBookmark(after);
    }
    else {
        // Editing bookmark already in toolbar
        for (int i = 0; i < m_layout->count(); i++) {
            ToolButton* button = qobject_cast<ToolButton*>(m_layout->itemAt(i)->widget());
            if (!button) {
                continue;
            }

            Bookmark book = button->data().value<Bookmark>();

            if (book == before) {
                QString title = after.title;
                if (title.length() > 15) {
                    title.truncate(13);
                    title += "..";
                }

                QVariant v;
                v.setValue<Bookmark>(after);

                button->setText(title);
                button->setData(v);
                button->setIcon(qIconProvider->iconFromImage(after.image));
                button->setToolTip(after.url.toEncoded());
                return;
            }
        }
    }
}