本文整理汇总了C++中KAction::plug方法的典型用法代码示例。如果您正苦于以下问题:C++ KAction::plug方法的具体用法?C++ KAction::plug怎么用?C++ KAction::plug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAction
的用法示例。
在下文中一共展示了KAction::plug方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KBookmarkHandler
//.........这里部分代码省略.........
static_cast<QFrame*>(m_dir->viewWidget())->setFrameStyle( QFrame::NoFrame );
static_cast<QIconView*>(m_dir->viewWidget())->setSpacing( 1 );
actionCollection = m_dir->actionCollection();
searchPane = new SearchPane( this );
setStretchFactor( container, 2 );
}
{
QPopupMenu* const menu = static_cast<KActionMenu*>(actionCollection->action("popupMenu"))->popupMenu();
menu->clear();
menu->insertItem( SmallIconSet( Pana::icon( "files" ) ), i18n( "&Load" ), MakePlaylist );
menu->insertItem( SmallIconSet( Pana::icon( "add_playlist" ) ), i18n( "&Append to Playlist" ), AppendToPlaylist );
menu->insertItem( SmallIconSet( Pana::icon( "queue_track" ) ), i18n( "&Queue Track" ), QueueTrack );
menu->insertItem( SmallIconSet( Pana::icon( "queue_track" ) ), i18n( "&Queue Tracks" ), QueueTracks );
menu->insertItem( SmallIconSet( Pana::icon( "save" ) ), i18n( "&Save as Playlist..." ), SavePlaylist );
menu->insertSeparator();
if (!m_medium)
menu->insertItem( SmallIconSet( Pana::icon( "device" ) ), i18n( "&Transfer to Media Device" ), MediaDevice );
menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Organize Files..." ), OrganizeFiles );
menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Copy Files to Collection..." ), CopyToCollection );
menu->insertItem( SmallIconSet( Pana::icon( "collection" ) ), i18n( "&Move Files to Collection..." ), MoveToCollection );
menu->insertItem( SmallIconSet( Pana::icon( "burn" ) ), i18n("Burn to CD..."), BurnCd );
menu->insertSeparator();
menu->insertItem( i18n( "&Select All Files" ), SelectAllFiles );
menu->insertSeparator();
actionCollection->action( "delete" )->setIcon( Pana::icon( "remove" ) );
actionCollection->action( "delete" )->plug( menu );
menu->insertSeparator();
menu->insertItem( SmallIconSet( Pana::icon( "info" ) ), i18n( "Edit Track &Information..." ), EditTags );
actionCollection->action( "properties" )->plug( menu );
menu->setItemEnabled( BurnCd, K3bExporter::isAvailable() );
connect( menu, SIGNAL(aboutToShow()), SLOT(prepareContextMenu()) );
connect( menu, SIGNAL(activated( int )), SLOT(contextMenuActivated( int )) );
}
{
KActionMenu *a;
a = static_cast<KActionMenu*>( actionCollection->action( "sorting menu" ) );
a->setIcon( Pana::icon( "configure" ) );
a->setDelayed( false ); //TODO should be done by KDirOperator
actionCollection->action( "delete" )->setShortcut( KShortcut( SHIFT + Key_Delete ) );
a = new KActionMenu( i18n("Bookmarks"), "bookmark", actionCollection, "bookmarks" );
a->setDelayed( false );
new KBookmarkHandler( m_dir, a->popupMenu() );
}
{
if ( KAction *a = actionCollection->action( "up" ) )
a->plug( toolbar );
if ( KAction *a = actionCollection->action( "back" ) )
a->plug( toolbar );
if ( KAction *a = actionCollection->action( "forward" ) )
a->plug( toolbar );
示例2: loadServices
//.........这里部分代码省略.........
if(protocol != url.protocol()){
continue;
}
}
else if(url.protocol() == "trash"){
continue;
}
if(cfg.hasKey("X-KDE-Require")){
const QStringList capabilities = cfg.readListEntry( "X-KDE-Require" );
if (capabilities.contains( "Write" )){
continue;
}
}
if ( cfg.hasKey( "Actions" ) && cfg.hasKey( "ServiceTypes" ) ){
const QStringList types = cfg.readListEntry( "ServiceTypes" );
const QStringList excludeTypes = cfg.readListEntry( "ExcludeServiceTypes" );
bool ok = false;
for (QStringList::ConstIterator it = types.begin(); it != types.end() && !ok; ++it){
bool checkTheMimetypes = false;
if(matchAll){
// first check if we have an all mimetype
if (*it == "all/all" || *it == "allfiles"){
checkTheMimetypes = true;
}
// next, do we match all files?
if (!ok && !item.isDir() && *it == "all/allfiles"){
checkTheMimetypes = true;
}
}
// if we have a mimetype, see if we have an exact or a type globbed match
if(!ok && (!mimeType.isEmpty() && *it == mimeType) ||
(!mimeGroup.isEmpty() && ((*it).right(1) == "*" && (*it).left((*it).find('/')) == mimeGroup)))
{
checkTheMimetypes = true;
}
if(checkTheMimetypes){
ok = true;
for(QStringList::ConstIterator itex = excludeTypes.begin(); itex != excludeTypes.end(); ++itex){
if( ((*itex).right(1) == "*" && (*itex).left((*itex).find('/')) == mimeGroup) ||
((*itex) == mimeType))
{
ok = false;
break;
}
}
}
}
if (ok){
const QString priority = cfg.readEntry("X-KDE-Priority");
const QString submenuName = cfg.readEntry( "X-KDE-Submenu" );
bool usePopup = false;
KPopupMenu *popup;
if(!submenuName.isEmpty()){
usePopup = true;
if(popups[submenuName]){
popup = popups[submenuName];
}
else{
MetabarWidget::addEntry(html, submenuName, "servicepopup://" + idString, "1rightarrow", "popup" + idString, count < maxActions ? QString::null : QString("hiddenaction"), count >= maxActions);
popup = new KPopupMenu();
popups.insert(idString, popup);
count++;
}
}
QValueList<KDEDesktopMimeType::Service> list = KDEDesktopMimeType::userDefinedServices( *dit + *eit, url.isLocalFile());
for (QValueList<KDEDesktopMimeType::Service>::iterator it = list.begin(); it != list.end(); ++it){
if(usePopup){
KAction *action = new KAction((*it).m_strName, (*it).m_strIcon, KShortcut(), this, SLOT(runAction()), popup, idString.utf8());
action->plug(popup);
}
else{
MetabarWidget::addEntry(html, (*it).m_strName, "service://" + idString, (*it).m_strIcon, QString::null, count < maxActions ? QString::null : QString("hiddenaction"), count >= maxActions);
count++;
}
services.insert(idString, *it);
id++;
idString.setNum(id);
}
}
}
}
}
}
示例3: mousePressEvent
void SystemTray::mousePressEvent(QMouseEvent *event)
{
if (event->button() & Qt::LeftButton) { // Prepare drag
m_pressPos = event->globalPos();
m_canDrag = true;
event->accept();
} else if (event->button() & Qt::MidButton) { // Paste
Global::bnpView->currentBasket()->setInsertPopupMenu();
Global::bnpView->currentBasket()->pasteNote(QClipboard::Selection);
Global::bnpView->currentBasket()->cancelInsertPopupMenu();
if (Settings::usePassivePopup())
Global::bnpView->showPassiveDropped(i18n("Pasted selection to basket <i>%1</i>"));
event->accept();
} else if (event->button() & Qt::RightButton) { // Popup menu
KMenu menu(this);
menu.addTitle( SmallIcon("basket"), KGlobal::mainComponent().aboutData()->programName() );
Global::bnpView->actNewBasket->plug(&menu);
Global::bnpView->actNewSubBasket->plug(&menu);
Global::bnpView->actNewSiblingBasket->plug(&menu);
menu.insertSeparator();
Global::bnpView->m_actPaste->plug(&menu);
Global::bnpView->m_actGrabScreenshot->plug(&menu);
Global::bnpView->m_actColorPicker->plug(&menu);
if(!Global::bnpView->isPart())
{
KAction* action;
menu.insertSeparator();
action = Global::bnpView->actionCollection()->action("options_configure_global_keybinding");
if(action)
action->plug(&menu);
action = Global::bnpView->actionCollection()->action("options_configure");
if(action)
action->plug(&menu);
menu.insertSeparator();
// Minimize / restore : since we manage the popup menu by ourself, we should do that work :
action = Global::bnpView->actionCollection()->action("minimizeRestore");
if(action)
{
if (Global::mainWindow()->isVisible())
action->setText(i18n("&Minimize"));
else
action->setText(i18n("&Restore"));
action->plug(&menu);
}
action = Global::bnpView->actionCollection()->action("file_quit");
if(action)
action->plug(&menu);
}
Global::bnpView->currentBasket()->setInsertPopupMenu();
connect( &menu, SIGNAL(aboutToHide()), Global::bnpView->currentBasket(), SLOT(delayedCancelInsertPopupMenu()) );
menu.exec(event->globalPos());
event->accept();
} else
event->ignore();
}
示例4: init
// Initialise Toolbar, Menus ScrollBar and other
void ktvschedule::init()
{
// Creates central widgets
tvgridbox = new QGroupBox ( this ); // Group box
tvgridbox->setInsideMargin ( 15 );
t_TVGrid=new TvGuideTable(this->tvgridbox, "t_TVGrid"); // Add TvGuideTable custom QTable
QGridLayout *tvgridboxLayout = new QGridLayout( tvgridbox->layout() ); //Layout
tvgridboxLayout->setAlignment ( Qt::AlignTop );
tvgridboxLayout->addWidget ( t_TVGrid , 0 , 0 );
setCentralWidget( tvgridbox );
tvgridbox->show();
////////////////////////////////
//Check for home directory, if it does not exist, create it
QString qstr(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule"); //for some reason this only works with gcc 3.3 and not the previous version
QDir d(qstr);
if ( !d.exists() )
{
d.mkdir(qstr);
}
/*QDir d( QString(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule") );
if ( !d.exists() )
{
d.mkdir(QString(QDir::homeDirPath()+"/.kde/share/apps/ktvschedule"));
}*/ // This worked for gcc 3.4 but not for 3.3
//setRightJustification( TRUE );
////////////////////////////////
this->setIcon( KGlobal::iconLoader()->loadIcon("ktvschedule", KIcon::Desktop) );
// Creates the ToolBar
KToolBar * TvToolBar = new KToolBar( this, KMainWindow::Top );
//////////////////////////////
// Creates a QDateEdit Widget for future use
date_show = new QDateEdit( QDate::currentDate() , TvToolBar );
date_show->setOrder(QDateEdit::DMY);
////////////////////////////////
// Define KActions
//KAction *actionGoHome = new KAction ( "Now Playing", KGlobal::iconLoader()->loadIcon("gohome", KIcon::NoGroup), CTRL+Key_P , t_TVGrid, SLOT (SetToCurrentTime() ), collector, "Now Playing");
KAction *actionGoHome = new KAction ( i18n("Now &Playing"), "gohome", CTRL+Key_P , this, SLOT (SetToCurrentTime() ), actionCollection(), "Now Playing");
KAction *actionRefreshGuide = new KAction ( i18n("&Refresh Guide"), "reload", CTRL+Key_R , this, SLOT (RefreshXMLGuide() ), actionCollection(), "Refresh Guide");
KAction *actionManageChannels = new KAction ( i18n("&Manage Channels"), "toggle_log", CTRL+Key_M , this, SLOT (channelList() ), actionCollection(), "Manage Channels");
KAction *actionConfigure = new KAction ( i18n("&Configure"), "configure", CTRL+Key_C , this, SLOT (runConfig() ), actionCollection(), "Configure");
KAction *actionExit = KStdAction::quit(this, SLOT(close()), 0);
KAction *actionPrevious = new KAction ( i18n("Pre&vious Day"), "previous", CTRL+Key_V , date_show, SLOT ( stepDown() ), actionCollection(), "PreviousDay");
KAction *actionNext = new KAction ( i18n("&Next Day"), "forward", CTRL+Key_N , date_show, SLOT ( stepUp() ), actionCollection(), "NextDay");
KAction *actionEvent = KStdAction::configureNotifications(this, SLOT( notificationsEvent() ), actionCollection(), "settings_notifications" );
KAction *actionFindCategory = new KAction (i18n("&Find Next Show"), "find", CTRL+Key_F , this, SLOT( findNextCategory() ), actionCollection(), "findnextshow");
//////////////////////////////////
// Plug actions to ToolBar
actionGoHome->plug ( TvToolBar);
actionRefreshGuide->plug (TvToolBar);
actionExit->plug (TvToolBar);
TvToolBar->insertLineSeparator();
actionManageChannels->plug (TvToolBar);
actionConfigure->plug (TvToolBar);
TvToolBar->insertLineSeparator();
actionPrevious->plug (TvToolBar);
// Add a QDateEdit widget for the ToolBar
TvToolBar->insertWidget (actionCollection()->count()+1,13, date_show );
actionNext->plug (TvToolBar);
// Creates the KComboBox and adds it to the Toolbar
combo_Categories = new KComboBox(TvToolBar);
combo_Categories->setMinimumWidth( combo_Categories->width ()+60);
combo_Categories->insertStringList(Categories);
//.........这里部分代码省略.........