Ejemplo n.º 1
0
PanelRemoveButtonMenu::PanelRemoveButtonMenu( ContainerArea* cArea,
                                              QWidget *parent, const char *name )
    : QPopupMenu( parent, name ), containerArea( cArea )
{
    connect(this, SIGNAL(activated(int)), SLOT(slotExec(int)));
    connect(this, SIGNAL(aboutToShow()), SLOT(slotAboutToShow()));
}
Ejemplo n.º 2
0
BtMenuView::BtMenuView(QWidget *parent)
    : QMenu(parent), m_model(0), m_parentIndex(QModelIndex()), m_actions(0)
{
    connect(this, SIGNAL(aboutToShow()),
            this, SLOT(slotAboutToShow()));
    connect(this, SIGNAL(triggered(QAction*)),
            this, SLOT(slotActionTriggered(QAction*)));
}
Ejemplo n.º 3
0
void KPrintAction::initialize(PrinterType type, QWidget *parentWidget)
{
	connect(popupMenu(), SIGNAL(aboutToShow()), SLOT(slotAboutToShow()));
	connect(popupMenu(), SIGNAL(activated(int)), SLOT(slotActivated(int)));

	d->type = type;
	d->parentWidget = parentWidget;
}
Ejemplo n.º 4
0
HotkeysTreeViewContextMenu::HotkeysTreeViewContextMenu( const QModelIndex &index, HotkeysTreeView *parent )
        : QMenu(parent)
         ,_index(index)
         ,_view(parent)
    {
    setTitle( i18n("Test") );

    connect(this, SIGNAL(aboutToShow()),
            SLOT(slotAboutToShow()));
    }
Ejemplo n.º 5
0
void KateModeMenu::init()
{
  m_doc = 0;

  connect( menu(), SIGNAL(triggered(QAction*)), this, SLOT(setType(QAction*)) );

  connect(menu(),SIGNAL(aboutToShow()),this,SLOT(slotAboutToShow()));

  m_actionGroup = new QActionGroup(menu());
}
Ejemplo n.º 6
0
FreezerMenu::FreezerMenu( QWidget * parent, const QString & title)
: QMenu( title, parent )
{
	connect( this, SIGNAL( aboutToShow() ), SLOT( slotAboutToShow() ) );
	connect( this, SIGNAL( triggered( QAction * ) ), SLOT( slotActionTriggered( QAction * ) ) );
	MainWindow * mw = qobject_cast<MainWindow*>(parent->window());
	if( mw ) {
		connect( mw, SIGNAL( currentViewChanged( FreezerView * ) ), SLOT( slotCurrentViewChanged( FreezerView * ) ), Qt::QueuedConnection );
	} else
		LOG_1( "Unable to cast window to MainWindow pointer, window is of type: " + QString(parent->window()->metaObject()->className()) );
}
Ejemplo n.º 7
0
DirHistoryButton::DirHistoryButton(DirHistoryQueue* hQ, QWidget *parent) : QToolButton(parent)
{
    setAutoRaise(true);
    setIcon(QIcon::fromTheme("chronometer"));
    setText(i18n("Open the directory history list"));
    setToolTip(i18n("Open the directory history list"));
    setPopupMode(QToolButton::InstantPopup);
    setAcceptDrops(false);

    popupMenu = new QMenu(this);
    Q_CHECK_PTR(popupMenu);

    setMenu(popupMenu);

    historyQueue = hQ;

    connect(popupMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShow()));
    connect(popupMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotPopupActivated(QAction *)));
}
Ejemplo n.º 8
0
KlipperPopup::KlipperPopup( History* history )
    : m_dirty( true ),
      m_textForEmptyHistory( i18n( "<empty clipboard>" ) ),
      m_textForNoMatch( i18n( "<no matches>" ) ),
      m_history( history ),
      m_helpMenu( new KHelpMenu( this, Klipper::aboutData(), false ) ),
      m_popupProxy( 0 ),
      m_filterWidget( 0 ),
      m_filterWidgetAction( 0 ),
      m_nHistoryItems( 0 )
{
    KWindowInfo windowInfo = KWindowSystem::windowInfo( winId(), NET::WMGeometry );
    QRect geometry = windowInfo.geometry();
    QRect screen = KGlobalSettings::desktopGeometry(geometry.center());
    int menuHeight = ( screen.height() ) * 3/4;
    int menuWidth = ( screen.width() )  * 1/3;

    m_popupProxy = new PopupProxy( this, menuHeight, menuWidth );

    connect( this, SIGNAL(aboutToShow()), SLOT(slotAboutToShow()) );
}
Ejemplo n.º 9
0
QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark)
{
    if (bookmark.isGroup())
    {
        KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bookmark, this);
        BookmarkMenu *menu = new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address());
        // An hack to get rid of bug 219274
        connect(actionMenu, SIGNAL(hovered()), menu, SLOT(slotAboutToShow()));
        return actionMenu;
    }
    else if (bookmark.isSeparator())
    {
        return KBookmarkMenu::actionForBookmark(bookmark);
    }
    else
    {
        KBookmarkAction *action = new KBookmarkAction(bookmark, owner(), this);
        action->setIcon(IconManager::self()->iconForUrl(KUrl(bookmark.url())));
        return action;
    }
}
TreeViewHeaderContextMenu::TreeViewHeaderContextMenu( QObject *parent, QTreeView *widget, int style, QVector<int> excludedColumns )
  : QObject( parent ),
    mWidget( widget ),
    mContextMenu( 0 ),
    mStyle( style ),
    mExcludedColumns( excludedColumns )
{
    kDebug(5970) << "Entering function";
    if (mWidget)
    {
        mWidget->header()->setContextMenuPolicy( Qt::CustomContextMenu );
        connect( mWidget->header(), SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(slotCustomContextMenuRequested(const QPoint&)) );

        mContextMenu = new KMenu( mWidget );
        mContextMenu->addTitle( i18n("Columns") );
        connect( mContextMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotTriggered(QAction*)) );
        connect( mContextMenu, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShow()) );
        updateActions();
    }
    kDebug(5970) << "Leaving function";
}
Ejemplo n.º 11
0
int PopupProxy::insertFromSpill( int index ) {

    const History* history = parent()->history();
    // This menu is going to be filled, so we don't need the aboutToShow()
    // signal anymore
    disconnect( m_proxy_for_menu, 0, this, 0 );

    // Insert history items into the current m_proxy_for_menu,
    // discarding any that doesn't match the current filter.
    // stop when the total number of items equal m_itemsPerMenu;
    int count = 0;
    int remainingHeight = m_menu_height - m_proxy_for_menu->sizeHint().height();
    const HistoryItem* item = history->find(m_spill_uuid);
    if (!item) {
        return count;
    }
    do {
        if ( m_filter.indexIn( item->text() ) != -1) {
            tryInsertItem( item, remainingHeight, index++ );
            count++;
        }
        item = history->find(item->next_uuid());
    } while ( item && history->first() != item && remainingHeight >= 0);
    m_spill_uuid = item->uuid();

    // If there is more items in the history, insert a new "More..." menu and
    // make *this a proxy for that menu ('s content).
    if (history->first() && m_spill_uuid != history->first()->uuid()) {
        KMenu* moreMenu = new KMenu(i18n("&More"), m_proxy_for_menu);
        connect(moreMenu, SIGNAL(aboutToShow()), SLOT(slotAboutToShow()));
        QAction *before = index < m_proxy_for_menu->actions().count() ? m_proxy_for_menu->actions().at(index) : 0;
        m_proxy_for_menu->insertMenu(before, moreMenu);
        m_proxy_for_menu = moreMenu;
    }

    // Return the number of items inserted.
    return count;

}
Ejemplo n.º 12
0
void HotkeysTreeViewContextMenu::slotAboutToShowForCurrent()
    {
    _index = _view->currentIndex();

    slotAboutToShow();
    }
GraphiteLoadMenu::GraphiteLoadMenu( const QString & title, QWidget * parent )
: QMenu( title, parent )
{
	connect( this, SIGNAL( aboutToShow() ), SLOT( slotAboutToShow() ) );
}
Ejemplo n.º 14
0
KateSessionsAction::KateSessionsAction(const QString &text, QObject *parent, const char *name) : KActionMenu(text, parent, name)
{
    connect(popupMenu(), SIGNAL(aboutToShow()), this, SLOT(slotAboutToShow()));
}
Ejemplo n.º 15
0
toEditMenu::toEditMenu()
    : QMenu(tr("&Edit"), NULL)
    , m_clipboardContent(false)
    , m_pasteSupported(false)
{
    QClipboard const *clipBoard = QApplication::clipboard();
    QMimeData const *mimeData = clipBoard->mimeData();
    connect(clipBoard, SIGNAL(dataChanged()), this, SLOT(clipBoardChanged()));
    connect(this, SIGNAL(aboutToShow()), this, SLOT(slotAboutToShow()));

    m_clipboardContent = mimeData->hasText() && !clipBoard->text().isEmpty();

    undoAct = new QAction(QPixmap(const_cast<const char**>(undo_xpm)), tr("&Undo"), this);
    undoAct->setShortcut(QKeySequence::Undo);

    redoAct = new QAction(QPixmap(const_cast<const char**>(redo_xpm)), tr("&Redo"), this);
    redoAct->setShortcut(QKeySequence::Redo);

    cutAct = new QAction(QPixmap(const_cast<const char**>(cut_xpm)), tr("Cu&t"), this);
    cutAct->setShortcut(QKeySequence::Cut);
    cutAct->setToolTip(tr("Cut to clipboard"));

    copyAct = new QAction(QPixmap(const_cast<const char**>(copy_xpm)), tr("&Copy"), this);
    copyAct->setShortcut(QKeySequence::Copy);
    copyAct->setToolTip(tr("Copy to clipboard"));

    pasteAct = new QAction(QPixmap(const_cast<const char**>(paste_xpm)), tr("&Paste"), this);
    pasteAct->setShortcut(QKeySequence::Paste);
    pasteAct->setToolTip(tr("Paste from clipboard"));

    searchReplaceAct = new QAction(QPixmap(const_cast<const char**>(search_xpm)), tr("&Search && Replace..."), this);
    searchReplaceAct->setShortcut(QKeySequence::Find);
    searchReplaceAct->setToolTip(tr("Search & replace"));

    searchNextAct = new QAction(tr("Search &Next"), this);
    searchNextAct->setShortcut(QKeySequence::FindNext);

    selectAllAct = new QAction(tr("Select &All"), this);
    selectAllAct->setShortcut(QKeySequence::SelectAll);

#if 0
    // TODO: this part is waiting for QScintilla backend feature (yet unimplemented).
    selectBlockAct = new QAction(tr("Block Selection"), this);
    selectBlockAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_B);
    selectBlockAct->setCheckable(true);
#endif

    readAllAct = new QAction(tr("Read All &Items"), this);

    prefsAct = new QAction(tr("&Preferences..."), this);

    addAction(undoAct);
    addAction(redoAct);
    addSeparator();

    addAction(cutAct);
    addAction(copyAct);
    addAction(pasteAct);
    addSeparator();

    addAction(searchReplaceAct);
    addAction(searchNextAct);
    addAction(selectAllAct);
#if 0
// TODO: this part is waiting for QScintilla backend feature (yet unimplemented).
    addAction(selectBlockAct);
#endif
    addAction(readAllAct);
    addSeparator();

    addAction(prefsAct);

    disableAll();
}
Ejemplo n.º 16
0
void FreezerMenu::slotCurrentViewChanged( FreezerView * view )
{
	if( view && isTearOffMenuVisible() )
		slotAboutToShow();
	setEnabled( view );
}
Ejemplo n.º 17
0
void KBookmarkMenu::ensureUpToDate()
{
    slotAboutToShow();
}