コード例 #1
0
BookmarkManager::BookmarkManager(QObject *parent)
    : QObject(parent)
    , m_manager(0)
    , m_owner(0)
    , m_actionCollection(new KActionCollection(this))
{
    m_manager = KBookmarkManager::userBookmarksManager();

    connect(m_manager, SIGNAL(changed(QString,QString)), this, SLOT(slotBookmarksChanged()));

    // setup menu
    m_owner = new BookmarkOwner(m_manager, this);
    connect(m_owner, SIGNAL(openUrl(KUrl,Rekonq::OpenType)), this, SIGNAL(openUrl(KUrl,Rekonq::OpenType)));

    // bookmarks loading
    connect(this, SIGNAL(openUrl(KUrl,Rekonq::OpenType)), rApp, SLOT(loadUrl(KUrl,Rekonq::OpenType)));
}
コード例 #2
0
KBookmarkBar::KBookmarkBar( KBookmarkManager* mgr,
                            KonqBookmarkOwner *_owner, KToolBar *_toolBar,
                            QObject *parent )
    : QObject( parent ), m_pOwner(_owner), m_toolBar(_toolBar),
      m_pManager( mgr ), d( new KBookmarkBarPrivate )
{
    m_toolBar->setAcceptDrops( true );
    m_toolBar->installEventFilter( this ); // for drops

    if (d->m_contextMenu)
    {
        m_toolBar->setContextMenuPolicy(Qt::CustomContextMenu);
        connect(m_toolBar, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenu(QPoint)));
    }

    connect( mgr, SIGNAL(changed(QString,QString)),
             SLOT(slotBookmarksChanged(QString)) );
    connect( mgr, SIGNAL(configChanged()),
             SLOT(slotConfigChanged()) );

    KBookmarkGroup toolbar = getToolbar();
    fillBookmarkBar( toolbar );
    m_toolBarSeparator = new KAction(this);
}
コード例 #3
0
KonqSidebarBookmarkModule::KonqSidebarBookmarkModule( KonqSidebarTree * parentTree )
    : QObject( 0L ), KonqSidebarTreeModule( parentTree ),
      m_topLevelItem( 0L ), m_ignoreOpenChange(true)
{
    if (!s_bookmarkManager)
        s_bookmarkManager = KBookmarkManager::userBookmarksManager();

    // formats handled by K3BookmarkDrag:
    QStringList formats;
    formats << "text/uri-list" << "application/x-xbel" << "text/plain";
    tree()->setDropFormats(formats);

    connect(tree(), SIGNAL(moved(Q3ListViewItem*,Q3ListViewItem*,Q3ListViewItem*)),
            this,  SLOT(slotMoved(Q3ListViewItem*,Q3ListViewItem*,Q3ListViewItem*)));
    connect(tree(), SIGNAL(dropped(K3ListView*,QDropEvent*,Q3ListViewItem*,Q3ListViewItem*)),
            this,  SLOT(slotDropped(K3ListView*,QDropEvent*,Q3ListViewItem*,Q3ListViewItem*)));

    connect(tree(), SIGNAL(expanded(Q3ListViewItem*)),
            this,  SLOT(slotOpenChange(Q3ListViewItem*)));
    connect(tree(), SIGNAL(collapsed(Q3ListViewItem*)),
            this,  SLOT(slotOpenChange(Q3ListViewItem*)));

    m_collection = new KActionCollection( this );
    QAction *action = m_collection->addAction("create_folder");
    action->setIcon( KIcon("folder-new") );
    action->setText( i18n("&Create New Folder") );
    connect(action, SIGNAL(triggered(bool)), SLOT(slotCreateFolder()));
    action = m_collection->addAction("delete_folder");
    action->setIcon( KIcon("edit-delete") );
    action->setText( i18n("Delete Folder") );
    connect(action, SIGNAL(triggered(bool)), SLOT(slotDelete()));
    action = m_collection->addAction("delete_bookmark");
    action->setIcon( KIcon("edit-delete") );
    action->setText( i18n("Delete Bookmark") );
    connect(action, SIGNAL(triggered(bool)), SLOT(slotDelete()));
    action = m_collection->addAction("item_properties");
    action->setIcon( KIcon("document-properties") );
    action->setText( i18n("Properties") );
    connect(action, SIGNAL(triggered(bool)), SLOT(slotProperties()));
    action = m_collection->addAction("open_window");
    action->setIcon( KIcon("window-new") );
    action->setText( i18n("Open in New Window") );
    connect(action, SIGNAL(triggered(bool)), SLOT(slotOpenNewWindow()));
    action = m_collection->addAction("open_tab");
    action->setIcon( KIcon("tab-new") );
    action->setText( i18n("Open in New Tab") );
    connect(action, SIGNAL(triggered(bool)), SLOT(slotOpenTab()));
    action = m_collection->addAction("folder_open_tabs");
    action->setIcon( KIcon("tab-new") );
    action->setText( i18n("Open Folder in Tabs") );
    connect(action, SIGNAL(triggered(bool)), SLOT(slotOpenTab()));
    action = m_collection->addAction("copy_location");
    action->setIcon( KIcon("edit-copy") );
    action->setText( i18n("Copy Link Address") );
    connect(action, SIGNAL(triggered(bool)), SLOT(slotCopyLocation()));

    m_collection->addAction( "edit_bookmarks",
                             KStandardAction::editBookmarks( s_bookmarkManager,
                                                             SLOT(slotEditBookmarks()), this ) );

    connect( s_bookmarkManager, SIGNAL(changed(QString,QString)),
             SLOT(slotBookmarksChanged(QString)) );
}
コード例 #4
0
ファイル: bookmarklist.cpp プロジェクト: Axure/okular
BookmarkList::BookmarkList( Okular::Document *document, QWidget *parent )
    : QWidget( parent ), m_document( document ), m_currentDocumentItem( 0 )
{
    QVBoxLayout *mainlay = new QVBoxLayout( this );
    mainlay->setMargin( 0 );
    mainlay->setSpacing( 6 );

    m_searchLine = new KTreeWidgetSearchLine( this );
    mainlay->addWidget( m_searchLine );

    m_tree = new QTreeWidget( this );
    mainlay->addWidget( m_tree );
    QStringList cols;
    cols.append( "Bookmarks" );
    m_tree->setContextMenuPolicy(  Qt::CustomContextMenu );
    m_tree->setHeaderLabels( cols );
    m_tree->setSortingEnabled( false );
    m_tree->setRootIsDecorated( true );
    m_tree->setAlternatingRowColors( true );
    m_tree->setItemDelegate( new PageItemDelegate( m_tree ) );
    m_tree->header()->hide();
    m_tree->setSelectionBehavior( QAbstractItemView::SelectRows );
    m_tree->setEditTriggers( QAbstractItemView::EditKeyPressed );
    connect( m_tree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(slotExecuted(QTreeWidgetItem*)) );
    connect( m_tree, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotContextMenu(QPoint)) );
    m_searchLine->addTreeWidget( m_tree );

    QToolBar * bookmarkController = new QToolBar( this );
    mainlay->addWidget( bookmarkController );
    bookmarkController->setObjectName( QLatin1String( "BookmarkControlBar" ) );
    // change toolbar appearance
    bookmarkController->setIconSize( QSize( 16, 16 ) );
    bookmarkController->setMovable( false );
    QSizePolicy sp = bookmarkController->sizePolicy();
    sp.setVerticalPolicy( QSizePolicy::Minimum );
    bookmarkController->setSizePolicy( sp );
    // insert a togglebutton [show only bookmarks in the current document]
    m_showBoomarkOnlyAction = bookmarkController->addAction( KIcon( "bookmarks" ), i18n( "Current document only" ) );
    m_showBoomarkOnlyAction->setCheckable( true );
    connect( m_showBoomarkOnlyAction, SIGNAL(toggled(bool)), this, SLOT(slotFilterBookmarks(bool)) );

    connect( m_document->bookmarkManager(), SIGNAL(bookmarksChanged(KUrl)), this, SLOT(slotBookmarksChanged(KUrl)) );

    rebuildTree( m_showBoomarkOnlyAction->isChecked() );
}