예제 #1
0
void Logbook::deleteBookmark(const BookmarkItem &item) {
   if ( item.id != LINK_ITEM_ID_UNDEFINED ) {
      deleteBookmark(item.id);
   } else {
      deleteBookmark(item.url);
   }
}
예제 #2
0
BookmarksManager::~BookmarksManager()
{
	for (int i = 0; i < m_bookmarks.count(); ++i)
	{
		deleteBookmark(m_bookmarks.at(i), false);
	}
}
예제 #3
0
bool BookmarksManager::deleteBookmark(BookmarkInformation *bookmark, bool notify)
{
	if (!bookmark || !m_allBookmarks.contains(bookmark))
	{
		return false;
	}

	const int folder = bookmark->parent;

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

	m_bookmarks.removeAll(bookmark);
	m_allBookmarks.removeAll(bookmark);
	m_pointers[folder]->children.removeAll(bookmark);

	if (bookmark->type == FolderBookmark)
	{
		m_pointers.remove(bookmark->identifier);
	}

	delete bookmark;

	if (notify)
	{
		save();
		updateUrls();

		emit m_instance->folderModified(folder);
	}

	return true;
}
예제 #4
0
void BookmarksPanel::setup()
{
    UrlPanel::setup();

    connect(panelTreeView(), SIGNAL(delKeyPressed()), this, SLOT(deleteBookmark()));
    connect(panelTreeView(), SIGNAL(collapsed(QModelIndex)), this, SLOT(onCollapse(QModelIndex)));
    connect(panelTreeView(), SIGNAL(expanded(QModelIndex)), this, SLOT(onExpand(QModelIndex)));

    loadFoldedState();
}
예제 #5
0
void BookmarksDialog::connectSlots()
{
	connect( m_ui->chooseButton, SIGNAL(clicked()), this, SLOT(chooseBookmark()) );
	connect( m_ui->sourceButton, SIGNAL(clicked()), this, SLOT(addSourceBookmark()) );
	connect( m_ui->targetButton, SIGNAL(clicked()), this, SLOT(addTargetBookmark()) );
	connect( m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteBookmark()) );
#ifndef Q_WS_MAEMO_5
	connect( m_ui->bookmarkList->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(currentItemChanged(QItemSelection,QItemSelection)));
#endif
}
예제 #6
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);
}
예제 #7
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()));

}
예제 #8
0
KAction* BookmarkOwner::createAction(const KBookmark &bookmark, const BookmarkAction &bmAction)
{
    switch (bmAction)
    {
    case OPEN:
        return createAction(i18n("Open"), "tab-new",
                            i18n("Open bookmark in current tab"), SLOT(loadBookmark(KBookmark)), bookmark);
    case OPEN_IN_TAB:
        return createAction(i18n("Open in New Tab"), "tab-new",
                            i18n("Open bookmark in new tab"), SLOT(loadBookmarkInNewTab(KBookmark)), bookmark);
    case OPEN_IN_WINDOW:
        return createAction(i18n("Open in New Window"), "window-new",
                            i18n("Open bookmark in new window"), SLOT(loadBookmarkInNewWindow(KBookmark)), bookmark);
    case OPEN_FOLDER:
        return createAction(i18n("Open Folder in Tabs"), "tab-new",
                            i18n("Open all the bookmarks in folder in tabs"), SLOT(loadBookmarkFolder(KBookmark)), bookmark);
    case BOOKMARK_PAGE:
        return createAction(i18n("Add Bookmark"), "bookmark-new",
                            i18n("Bookmark current page"), SLOT(bookmarkCurrentPage(KBookmark)), bookmark);
    case NEW_FOLDER:
        return createAction(i18n("New Folder"), "folder-new",
                            i18n("Create a new bookmark folder"), SLOT(newBookmarkFolder(KBookmark)), bookmark);
    case NEW_SEPARATOR:
        return createAction(i18n("New Separator"), "edit-clear",
                            i18n("Create a new bookmark separator"), SLOT(newSeparator(KBookmark)), bookmark);
    case COPY:
        return createAction(i18n("Copy Link"), "edit-copy",
                            i18n("Copy the bookmark's link address"), SLOT(copyLink(KBookmark)), bookmark);
    case EDIT:
        return createAction(i18n("Edit"), "configure",
                            i18n("Edit the bookmark"), SLOT(editBookmark(KBookmark)), bookmark);
    case DELETE:
        return  createAction(i18n("Delete"), "edit-delete",
                             i18n("Delete the bookmark"), SLOT(deleteBookmark(KBookmark)), bookmark);
    case SET_TOOLBAR_FOLDER:
        return  createAction(i18n("Set as toolbar folder"), "bookmark-toolbar",
                             "", SLOT(setToolBarFolder(KBookmark)), bookmark);
    case UNSET_TOOLBAR_FOLDER:
        return  createAction(i18n("Unset this folder as the toolbar folder"), "bookmark-toolbar",
                             "", SLOT(unsetToolBarFolder()), bookmark);
    default:
        ASSERT_NOT_REACHED(unknown BookmarkAction);
        return 0;
    }
}
예제 #9
0
void Bookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) {
    // Add menus/actions
    auto bookmarkAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::BookmarkLocation);
    QObject::connect(bookmarkAction, SIGNAL(triggered()), this, SLOT(bookmarkLocation()), Qt::QueuedConnection);
    _bookmarksMenu = menu->addMenu(MenuOption::Bookmarks);
    _deleteBookmarksAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::DeleteBookmark);
    QObject::connect(_deleteBookmarksAction, SIGNAL(triggered()), this, SLOT(deleteBookmark()), Qt::QueuedConnection);
    
    // Enable/Disable menus as needed
    enableMenuItems(_bookmarks.count() > 0);
    
    // Load bookmarks
    for (auto it = _bookmarks.begin(); it != _bookmarks.end(); ++it ) {
        QString bookmarkName = it.key();
        QString bookmarkAddress = it.value().toString();
        addLocationToMenu(menubar, bookmarkName, bookmarkAddress);
    }
}
예제 #10
0
bool BookmarksManager::deleteBookmark(const QUrl &url)
{
	if (!hasBookmark(url))
	{
		return false;
	}

	const QString bookmarkUrl = url.toString(QUrl::RemovePassword);

	for (int i = 0; i < m_allBookmarks.count(); ++i)
	{
		if (m_allBookmarks.at(i) && m_allBookmarks.at(i)->type == UrlBookmark && m_allBookmarks.at(i)->url == bookmarkUrl)
		{
			deleteBookmark(m_allBookmarks.at(i));
		}
	}

	return true;
}
예제 #11
0
DialogBookmarks::DialogBookmarks(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogBookmarks)
{
    ui->setupUi(this);

    //setWindowFlags(Qt::WindowTitleHint);

    connect(ui->listWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(selectedBookmark()));
    connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(newBookmark()));
    connect(ui->pushButton_2, SIGNAL(clicked()), SLOT(deleteBookmark()));

    connect(ui->lineEdit, SIGNAL(textEdited(QString)), this, SLOT(saveBookmark()));
    connect(ui->lineEdit_2, SIGNAL(textEdited(QString)), this, SLOT(saveBookmark()));
    connect(ui->lineEdit_3, SIGNAL(textEdited(QString)), this, SLOT(saveBookmark()));
    connect(ui->lineEdit_4, SIGNAL(textEdited(QString)), this, SLOT(saveBookmark()));

    connect(this, SIGNAL(finished(int)), this, SLOT(saveBookmark()));

    loadBookmarks();
}
예제 #12
0
// -----------------------------------------------------------------------------
// Removes any bookmarked entries in [node] from the list
// -----------------------------------------------------------------------------
bool ArchiveManager::deleteBookmarksInDir(ArchiveTreeNode* node)
{
	// Go through bookmarks
	auto archive = node->archive();
	bool removed = deleteBookmark(node->dirEntry());
	for (unsigned a = 0; a < bookmarks_.size(); ++a)
	{
		// Check bookmarked entry's parent archive
		if (bookmarks_[a]->parent() == archive)
		{
			// Now check if the bookmarked entry is within
			// the removed dir or one of its descendants
			auto anode  = bookmarks_[a]->parentDir();
			bool remove = false;
			while (anode != archive->rootDir() && !remove)
			{
				if (anode == node)
					remove = true;
				else
					anode = (ArchiveTreeNode*)anode->parent();
			}
			if (remove)
			{
				bookmarks_.erase(bookmarks_.begin() + a);
				--a;
				removed = true;
			}
		}
	}

	if (removed)
	{
		// Announce
		announce("bookmarks_changed");
		return true;
	}
	else
		return false;
}