当前位置: 首页>>代码示例>>C++>>正文


C++ KAction::setEnabled方法代码示例

本文整理汇总了C++中KAction::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ KAction::setEnabled方法的具体用法?C++ KAction::setEnabled怎么用?C++ KAction::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KAction的用法示例。


在下文中一共展示了KAction::setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: stateChanged

void KXMLGUIClient::stateChanged(const QString &newstate, KXMLGUIClient::ReverseStateChange reverse)
{
  StateChange stateChange = getActionsToChangeForState(newstate);

  bool setTrue = (reverse == StateNoReverse);
  bool setFalse = !setTrue;

  // Enable actions which need to be enabled...
  //
  for ( QStringList::Iterator it = stateChange.actionsToEnable.begin();
        it != stateChange.actionsToEnable.end(); ++it ) {

    KAction *action = actionCollection()->action((*it).latin1());
    if (action) action->setEnabled(setTrue);
  }

  // and disable actions which need to be disabled...
  //
  for ( QStringList::Iterator it = stateChange.actionsToDisable.begin();
        it != stateChange.actionsToDisable.end(); ++it ) {

    KAction *action = actionCollection()->action((*it).latin1());
    if (action) action->setEnabled(setFalse);
  }

}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: actionMenu

KActionMenu* WPAccount::actionMenu()
{
	kdDebug(14170) <<  "WPAccount::actionMenu()" << endl;

	/// How to remove an action from Kopete::Account::actionMenu()? GF

	KActionMenu *theActionMenu = new KActionMenu(accountId() , myself()->onlineStatus().iconFor(this), this);
	theActionMenu->popupMenu()->insertTitle(myself()->onlineStatus().iconFor(this), i18n("WinPopup (%1)").arg(accountId()));

	if (mProtocol)
	{
		KAction *goOnline = new KAction("Online", QIconSet(mProtocol->WPOnline.iconFor(this)), 0,
										 this, SLOT(connect()), theActionMenu, "actionGoAvailable");
		goOnline->setEnabled(isConnected() && isAway());
		theActionMenu->insert(goOnline);

		KAction *goAway = new KAction("Away", QIconSet(mProtocol->WPAway.iconFor(this)), 0,
									  this, SLOT(goAway()), theActionMenu, "actionGoAway");
		goAway->setEnabled(isConnected() && !isAway());
		theActionMenu->insert(goAway);

		/// One can not really go offline manually - appears online as long as samba server is running. GF

		theActionMenu->popupMenu()->insertSeparator();
		theActionMenu->insert(new KAction(i18n("Properties"),  0,
							  this, SLOT(editAccount()), theActionMenu, "actionAccountProperties"));

	}

	return theActionMenu;
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:31,代码来源:wpaccount.cpp

示例3: setupMenuFile

void KUI_project::setupMenuFile()
{
  
  KMenu *fileMenu = new KMenu(i18n("&File"),this);
   
  KAction *action = KStandardAction::openNew(this, SLOT(newProjectDialogSlot()), collection);
  fileMenu->addAction(collection->addAction("new_file", action));
  
  fileMenu->addSeparator();
  
  action = KStandardAction::open(this, SLOT(openFileSlot()), collection);
  fileMenu->addAction(collection->addAction("open_file", action));
  
  action = KStandardAction::save(this, SLOT(saveFileSlot()), collection);
  action->setEnabled(false);
  //fileMenu->addAction(collection->addAction("save_file", action)); 
  
  action = KStandardAction::saveAs(this, SLOT(saveAsFileSlot()), collection);
  action->setEnabled(false);      
  //fileMenu->addAction(collection->addAction("save_as_file", action));
  
  fileMenu->addSeparator();
  
  action = KStandardAction::quit(this, SLOT(close()), collection);
  fileMenu->addAction(collection->addAction("quit", action)); 
  
  menuBar->addMenu(fileMenu);
}
开发者ID:mluscon,项目名称:KDE-Usability-Inspector,代码行数:28,代码来源:KUI_project.cpp

示例4: Plugin

KViewEffects::KViewEffects( QObject* parent, const char* name, const QStringList & )
	: Plugin( parent, name )
	, m_gamma( 0.5 ), m_lastgamma( -1.0 )
	, m_opacity( 50 ), m_lastopacity( -1 )
	, m_intensity( 50 ), m_lastintensity( -1 )
	, m_color( white )
	, m_image( 0 )
{
	QObjectList * viewerList = parent->queryList( 0, "KImageViewer Part", false, false );
	m_pViewer = static_cast<KImageViewer::Viewer *>( viewerList->getFirst() );
	delete viewerList;
	if( m_pViewer )
	{
		KAction * gammaaction = new KAction( i18n( "&Gamma Correction..." ), 0, 0,
				this, SLOT( gamma() ),
				actionCollection(), "plugin_effects_gamma" );
		KAction * blendaction = new KAction( i18n( "&Blend Color..." ), 0, 0,
				this, SLOT( blend() ),
				actionCollection(), "plugin_effects_blend" );
		KAction * intensityaction = new KAction( i18n( "Change &Intensity (Brightness)..." ), 0, 0,
				this, SLOT( intensity() ),
				actionCollection(), "plugin_effects_intensity" );
		gammaaction->setEnabled( m_pViewer->canvas()->image() != 0 );
		blendaction->setEnabled( m_pViewer->canvas()->image() != 0 );
		intensityaction->setEnabled( m_pViewer->canvas()->image() != 0 );
		connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), gammaaction, SLOT( setEnabled( bool ) ) );
		connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), blendaction, SLOT( setEnabled( bool ) ) );
		connect( m_pViewer->widget(), SIGNAL( hasImage( bool ) ), intensityaction, SLOT( setEnabled( bool ) ) );
	}
	else
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:30,代码来源:kvieweffects.cpp

示例5: slotActivePartChanged

void RubyDebuggerPart::slotActivePartChanged( KParts::Part* part )
{
    KAction* action = actionCollection()->action("debug_toggle_breakpoint");
    if(!action)
        return;

    if(!part)
    {
        action->setEnabled(false);
        return;
    }
    KTextEditor::ViewCursorInterface *iface
        = dynamic_cast<KTextEditor::ViewCursorInterface*>(part->widget());
    action->setEnabled( iface != 0 );
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例6: setupActions

void SimonView::setupActions()
{
  connectAction = new KAction(this);
  connectAction->setText(i18n("Connect"));
  connectAction->setCheckable(true);
  connectAction->setIcon(KIcon("network-disconnect"));
  connect(connectAction, SIGNAL(triggered(bool)),
    this, SLOT(toggleConnection()));
  actionCollection()->addAction("connect", connectAction);
  this->trayManager->addAction("connect", connectAction);

  activateAction = new KAction(this);
  activateAction->setText(i18n("Activate"));
  activateAction->setIcon(KIcon("media-playback-start"));
  activateAction->setCheckable(true);
  connect(activateAction, SIGNAL(triggered(bool)),
    this, SLOT(toggleActivation()));
  this->trayManager->addAction("activate", activateAction);
  activateAction->setEnabled(false);
  actionCollection()->addAction("activate", activateAction);
  //must be set after addAction() because of the unique name set in addAction(name,...)
  // deactivated because of KDE bug #307225
  //activateAction->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::Key_Pause));

  disconnectAction = new KAction(this);
  disconnectAction->setText(i18n("Disconnect"));
  disconnectAction->setIcon(KIcon("network-disconnect"));
  connect(disconnectAction, SIGNAL(triggered(bool)),
    control, SLOT(disconnectFromServer()));

  KToolBarPopupAction* connectActivate = new KToolBarPopupAction(KIcon("network-disconnect"), i18n("Connect"), this);
  connectActivate->setCheckable(true);
  connectActivate->setShortcut(Qt::CTRL + Qt::Key_C);

  actionCollection()->addAction("connectActivate", connectActivate);
  connect(connectActivate, SIGNAL(triggered(bool)),
    this, SLOT(toggleConnection()));

  
  KAction* recompile = new KAction(this);
  recompile->setEnabled(control->getStatus() != SimonControl::Disconnected);
  recompile->setText(i18n("Synchronize"));
  recompile->setIcon(KIcon("view-refresh"));
  recompile->setShortcut(Qt::CTRL + Qt::Key_F5);
  actionCollection()->addAction("compileModel", recompile);
  connect(recompile, SIGNAL(triggered(bool)),
    control, SLOT(compileModel()));

  KAction* sendSampleShareAction = new KAction(this);
  sendSampleShareAction->setText(i18n("Contribute samples"));
  sendSampleShareAction->setIcon(KIcon("repository"));
  actionCollection()->addAction("sampleShare", sendSampleShareAction);
  connect(sendSampleShareAction, SIGNAL(triggered(bool)),this, SLOT(showSampleShare()));
  
  actionCollection()->addAction(KStandardAction::Preferences, "configuration",
    this, SLOT(showSystemDialog()));

  KStandardAction::quit(this, SLOT(closeSimon()),
    actionCollection());
}
开发者ID:KDE,项目名称:simon,代码行数:60,代码来源:simonview.cpp

示例7: KMainWindow

KMiniEdit::KMiniEdit() : KMainWindow(0)
{
  edit = new QMultiLineEdit(this);
  setCentralWidget(edit);

  KStdAction::openNew(this, SLOT(fileNew()), actionCollection());
  KStdAction::open(this, SLOT(fileOpen()), actionCollection());

  recentAction = KStdAction::openRecent(0, 0, actionCollection());
  recentAction->loadEntries(KGlobal::config());
  connect(recentAction, SIGNAL(urlSelected(const KURL &)), this, SLOT(fileOpenRecent(const KURL &)));

  saveAction = KStdAction::save(this, SLOT(fileSave()), actionCollection());
  checkEdited();
  connect(edit, SIGNAL(textChanged()), this, SLOT(checkEdited()));

  KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection());
  KStdAction::close(this, SLOT(fileClose()), actionCollection());

  KAction *a;

  a = KStdAction::undo(edit, SLOT(undo()), actionCollection());
  a->setEnabled(false);
  connect(edit, SIGNAL(undoAvailable(bool)), a, SLOT(setEnabled(bool)));
  
  a = KStdAction::redo(edit, SLOT(redo()), actionCollection());
  a->setEnabled(false);
  connect(edit, SIGNAL(redoAvailable(bool)), a, SLOT(setEnabled(bool)));

  a = KStdAction::cut(edit, SLOT(cut()), actionCollection());
  a->setEnabled(false);
  connect(edit, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)));

  a = KStdAction::copy(edit, SLOT(copy()), actionCollection());
  a->setEnabled(false);
  connect(edit, SIGNAL(copyAvailable(bool)), a, SLOT(setEnabled(bool)));

  pasteAction = KStdAction::paste(edit, SLOT(paste()), actionCollection());
  checkClipboard();
  connect(kapp->clipboard(), SIGNAL(dataChanged()), this, SLOT(checkClipboard()));

  KStdAction::selectAll(edit, SLOT(selectAll()), actionCollection());

  createGUI();
}
开发者ID:acpanna,项目名称:coding,代码行数:45,代码来源:kminiedit.cpp

示例8:

void
Controller::setActionsEnabled( bool enable )
{   //pausing last.fm streams doesn't do anything good
    Pana::actionCollection()->action( "play_pause" )->setEnabled( !enable );
    Pana::actionCollection()->action( "pause" )->setEnabled( !enable );

    KAction* action;
    for( action = m_actionList.first(); action; action = m_actionList.next() )
        action->setEnabled( enable );
}
开发者ID:delight,项目名称:Pana,代码行数:10,代码来源:lastfm.cpp

示例9: validatePluginActions

void KMCupsJobManager::validatePluginActions(KActionCollection *coll, const QPtrList<KMJob>& joblist)
{
	QPtrListIterator<KMJob>	it(joblist);
	bool	flag(true);
	for (; it.current(); ++it)
	{
		flag = (flag && it.current()->type() == KMJob::System
		        && (it.current()->state() == KMJob::Queued || it.current()->state() == KMJob::Held)
			/*&& !it.current()->isRemote()*/);
	}
	flag = (flag && joblist.count() > 0);
	KAction *a;
	if ( ( a = coll->action( "plugin_ipp" ) ) )
		a->setEnabled( joblist.count() == 1 );
	if ( ( a = coll->action( "plugin_prioup" ) ) )
		a->setEnabled( flag );
	if ( ( a = coll->action( "plugin_priodown" ) ) )
		a->setEnabled( flag );
	if ( ( a = coll->action( "plugin_editjob" ) ) )
		a->setEnabled( flag && ( joblist.count() == 1 ) );
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例10: MyDirOperator

    MyDirOperator( const KURL &url, QWidget *parent ) : KDirOperator( url, parent ) {
        setDirLister( new MyDirLister( true ) );
//the delete key event was being eaten with the file browser open
//so folks couldn't use the del key to remove items from the playlist
//refer to KDirOperator::setupActions() to understand this code
        KActionCollection* dirActionCollection = static_cast<KActionCollection*>(KDirOperator::child("KDirOperator::myActionCollection"));
        if(dirActionCollection)
        {
            KAction* trash = dirActionCollection->action("trash");
            if(trash)
                trash->setEnabled(false);
        }
    }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例11: fillActionMenu

void IRCAccount::fillActionMenu( KActionMenu *actionMenu )
{
	Kopete::Account::fillActionMenu( actionMenu );

	actionMenu->addSeparator();

	KAction *action;

	action = new KAction (KIcon("irc_showvideo"), i18n ("Show my own video..."), actionMenu );
        //, "actionShowVideo");
	QObject::connect( action, SIGNAL(triggered(bool)), this, SLOT(slotShowVideo()) );
	actionMenu->addAction(action);
	action->setEnabled( isConnected() );
}
开发者ID:harshcrop,项目名称:kopete,代码行数:14,代码来源:ircaccount.cpp

示例12: displayGPSuccessDialogue

void KKameraConfig::displayGPSuccessDialogue(void)
{
	// set the kcontrol module buttons
	setButtons(Help | Apply | Cancel | Ok);

	// create a layout with two vertical boxes
	QVBoxLayout *topLayout = new QVBoxLayout(this, 0, 0);
	topLayout->setAutoAdd(true);
	
	m_toolbar = new KToolBar(this, "ToolBar");
	m_toolbar->setMovingEnabled(false);
	
	// create list of devices
	m_deviceSel = new KIconView(this);

	connect(m_deviceSel, SIGNAL(rightButtonClicked(QIconViewItem *, const QPoint &)),
		SLOT(slot_deviceMenu(QIconViewItem *, const QPoint &)));
	connect(m_deviceSel, SIGNAL(doubleClicked(QIconViewItem *)),
		SLOT(slot_configureCamera()));
	connect(m_deviceSel, SIGNAL(selectionChanged(QIconViewItem *)),
		SLOT(slot_deviceSelected(QIconViewItem *)));

	m_deviceSel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
	
	// create actions
	KAction *act;
	
	act = new KAction(i18n("Add"), "camera", 0, this, SLOT(slot_addCamera()), m_actions, "camera_add");
	act->setWhatsThis(i18n("Click this button to add a new camera."));
	act->plug(m_toolbar);
	m_toolbar->insertLineSeparator();
	act = new KAction(i18n("Test"), "camera_test", 0, this, SLOT(slot_testCamera()), m_actions, "camera_test");
	act->setWhatsThis(i18n("Click this button to remove the selected camera from the list."));
	act->plug(m_toolbar);
	act = new KAction(i18n("Remove"), "edittrash", 0, this, SLOT(slot_removeCamera()), m_actions, "camera_remove");
	act->setWhatsThis(i18n("Click this button to remove the selected camera from the list."));
	act->plug(m_toolbar);
	act = new KAction(i18n("Configure..."), "configure", 0, this, SLOT(slot_configureCamera()), m_actions, "camera_configure");
	act->setWhatsThis(i18n("Click this button to change the configuration of the selected camera.<br><br>The availability of this feature and the contents of the Configuration dialog depend on the camera model."));
	act->plug(m_toolbar);
	act = new KAction(i18n("Information"), "hwinfo", 0, this, SLOT(slot_cameraSummary()), m_actions, "camera_summary");
	act->setWhatsThis(i18n("Click this button to view a summary of the current status of the selected camera.<br><br>The availability of this feature and the contents of the Configuration dialog depend on the camera model."));
	act->plug(m_toolbar);
	m_toolbar->insertLineSeparator();
	act = new KAction(i18n("Cancel"), "stop", 0, this, SLOT(slot_cancelOperation()), m_actions, "camera_cancel");
	act->setWhatsThis(i18n("Click this button to cancel the current camera operation."));
	act->setEnabled(false);
	act->plug(m_toolbar);
}
开发者ID:serghei,项目名称:kde3-kdegraphics,代码行数:49,代码来源:kamera.cpp

示例13: slotUpdateUndoAndRedoInContextMenu

void AnnotWindow::slotUpdateUndoAndRedoInContextMenu(QMenu* menu)
{
    if (!menu) return;

    QList<QAction *> actionList = menu->actions();
    enum { UndoAct, RedoAct, CutAct, CopyAct, PasteAct, ClearAct, SelectAllAct, NCountActs };

    KAction *kundo = KStandardAction::create( KStandardAction::Undo, m_document, SLOT(undo()), menu);
    KAction *kredo = KStandardAction::create( KStandardAction::Redo, m_document, SLOT(redo()), menu);
    connect(m_document, SIGNAL(canUndoChanged(bool)), kundo, SLOT(setEnabled(bool)));
    connect(m_document, SIGNAL(canRedoChanged(bool)), kredo, SLOT(setEnabled(bool)));
    kundo->setEnabled(m_document->canUndo());
    kredo->setEnabled(m_document->canRedo());

    QAction *oldUndo, *oldRedo;
    oldUndo = actionList[UndoAct];
    oldRedo = actionList[RedoAct];

    menu->insertAction(oldUndo, kundo);
    menu->insertAction(oldRedo, kredo);

    menu->removeAction(oldUndo);
    menu->removeAction(oldRedo);
}
开发者ID:Axure,项目名称:okular,代码行数:24,代码来源:annotwindow.cpp

示例14: KAction

HistoryPlugin::HistoryPlugin( QObject *parent, const char *name, const QStringList & /* args */ )
: Kopete::Plugin( HistoryPluginFactory::instance(), parent, name ), m_loggerFactory( this )
{
	KAction *viewMetaContactHistory = new KAction( i18n("View &History" ),
		QString::fromLatin1( "history" ), 0, this, SLOT(slotViewHistory()),
		actionCollection(), "viewMetaContactHistory" );
	viewMetaContactHistory->setEnabled(
		Kopete::ContactList::self()->selectedMetaContacts().count() == 1 );

	connect(Kopete::ContactList::self(), SIGNAL(metaContactSelected(bool)),
		viewMetaContactHistory, SLOT(setEnabled(bool)));

	connect(Kopete::ChatSessionManager::self(), SIGNAL(viewCreated(KopeteView*)),
		this, SLOT(slotViewCreated(KopeteView*)));

	connect(this, SIGNAL(settingsChanged()), this, SLOT(slotSettingsChanged()));

	setXMLFile("historyui.rc");
	if(detectOldHistory())
	{
		if(
			KMessageBox::questionYesNo(Kopete::UI::Global::mainWidget(),
				i18n( "Old history files from Kopete 0.6.x or older has been detected.\n"
				"Do you want to import and convert it to the new history format?" ),
				i18n( "History Plugin" ), i18n("Import && Convert"), i18n("Do Not Import") ) == KMessageBox::Yes )
		{
			convertOldHistory();
		}
	}

	// Add GUI action to all existing kmm objects
	// (Needed if the plugin is enabled while kopete is already running)
	QValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions();
	for (QValueListIterator<Kopete::ChatSession*> it= sessions.begin(); it!=sessions.end() ; ++it)
	{
	  if(!m_loggers.contains(*it))
		{
			m_loggers.insert(*it, new HistoryGUIClient( *it ) );
			connect( *it, SIGNAL(closing(Kopete::ChatSession*)),
				this, SLOT(slotKMMClosed(Kopete::ChatSession*)));
		}
	}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:42,代码来源:historyplugin.cpp

示例15: testChildActionStateChangeComboMode

void KSelectAction_UnitTest::testChildActionStateChangeComboMode()
{
    KSelectAction selectAction("selectAction", 0);
    selectAction.setToolBarMode(KSelectAction::ComboBoxMode);
    QWidget parent;
    QWidget* widget = selectAction.requestWidget(&parent);
    KComboBox* comboBox = qobject_cast<KComboBox*>(widget);
    QVERIFY(comboBox);
    const QString itemText = "foo";
    KAction* childAction = selectAction.addAction(itemText);
    QCOMPARE(comboBox->itemText(0), itemText);
    childAction->setEnabled(false);
    // There's no API for item-is-enabled, need to go via the internal model like kselectaction does...
    QStandardItemModel *model = qobject_cast<QStandardItemModel *>(comboBox->model());
    QVERIFY(model);
    QVERIFY(!model->item(0)->isEnabled());

    // Now remove the action
    selectAction.removeAction(childAction);
    QCOMPARE(comboBox->count(), 0);
}
开发者ID:fluxer,项目名称:kdelibs,代码行数:21,代码来源:kselectaction_unittest.cpp


注:本文中的KAction::setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。