本文整理汇总了C++中KAction::name方法的典型用法代码示例。如果您正苦于以下问题:C++ KAction::name方法的具体用法?C++ KAction::name怎么用?C++ KAction::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAction
的用法示例。
在下文中一共展示了KAction::name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removePlugin
bool MainWindow::removePlugin( const KPluginInfo *info )
{
PluginList::Iterator end = mPlugins.end();
for ( PluginList::Iterator it = mPlugins.begin(); it != end; ++it )
if ( ( *it )->identifier() == info->pluginName() ) {
Plugin *plugin = *it;
KAction *action;
QPtrList<KAction> *actionList = plugin->newActions();
for ( action = actionList->first(); action; action = actionList->next() ) {
kdDebug(5600) << "Unplugging " << action->name() << endl;
action->unplug( mNewActions->popupMenu() );
}
if ( mSyncActionsEnabled ) {
actionList = plugin->syncActions();
for ( action = actionList->first(); action; action = actionList->next() ) {
kdDebug(5600) << "Unplugging " << action->name() << endl;
action->unplug( mSyncActions->popupMenu() );
}
}
removeChildClient( plugin );
if ( mCurrentPlugin == plugin )
mCurrentPlugin = 0;
delete plugin; // removes the part automatically
mPlugins.remove( it );
if ( mCurrentPlugin == 0 ) {
PluginList::Iterator it;
for ( it = mPlugins.begin(); it != mPlugins.end(); ++it ) {
if ( (*it)->showInSideBar() ) {
selectPlugin( *it );
return true;
}
}
}
return true;
}
return false;
}
示例2: loadPlugins
void MainWindow::loadPlugins()
{
QPtrList<Plugin> plugins;
QPtrList<KParts::Part> loadDelayed;
uint i;
KPluginInfo::List::ConstIterator it;
for ( it = mPluginInfos.begin(); it != mPluginInfos.end(); ++it ) {
if ( !(*it)->isPluginEnabled() )
continue;
if ( isPluginLoaded( *it ) ) {
Plugin *plugin = pluginFromInfo( *it );
if ( plugin )
plugin->configUpdated();
continue;
}
kdDebug(5600) << "Loading Plugin: " << (*it)->name() << endl;
Kontact::Plugin *plugin =
KParts::ComponentFactory::createInstanceFromService<Kontact::Plugin>(
(*it)->service(), this );
if ( !plugin )
continue;
plugin->setIdentifier( (*it)->pluginName() );
plugin->setTitle( (*it)->name() );
plugin->setIcon( (*it)->icon() );
QVariant libNameProp = (*it)->property( "X-KDE-KontactPartLibraryName" );
QVariant exeNameProp = (*it)->property( "X-KDE-KontactPartExecutableName" );
QVariant loadOnStart = (*it)->property( "X-KDE-KontactPartLoadOnStart" );
QVariant hasPartProp = (*it)->property( "X-KDE-KontactPluginHasPart" );
if ( !loadOnStart.isNull() && loadOnStart.toBool() )
mDelayedPreload.append( plugin );
kdDebug(5600) << "LIBNAMEPART: " << libNameProp.toString() << endl;
plugin->setPartLibraryName( libNameProp.toString().utf8() );
plugin->setExecutableName( exeNameProp.toString() );
if ( hasPartProp.isValid() )
plugin->setShowInSideBar( hasPartProp.toBool() );
for ( i = 0; i < plugins.count(); ++i ) {
Plugin *p = plugins.at( i );
if ( plugin->weight() < p->weight() )
break;
}
plugins.insert( i, plugin );
}
for ( i = 0; i < plugins.count(); ++ i ) {
Plugin *plugin = plugins.at( i );
KAction *action;
QPtrList<KAction> *actionList = plugin->newActions();
for ( action = actionList->first(); action; action = actionList->next() ) {
kdDebug(5600) << "Plugging " << action->name() << endl;
action->plug( mNewActions->popupMenu() );
}
if ( mSyncActionsEnabled ) {
actionList = plugin->syncActions();
for ( action = actionList->first(); action; action = actionList->next() ) {
kdDebug(5600) << "Plugging " << action->name() << endl;
action->plug( mSyncActions->popupMenu() );
}
}
addPlugin( plugin );
}
mNewActions->setEnabled( mPlugins.size() != 0 );
if ( mSyncActionsEnabled )
mSyncActions->setEnabled( mPlugins.size() != 0 );
}
示例3: slotSelectionChanged
void ActionConfigDialog::slotSelectionChanged(QListViewItem *item)
{
if (currentAction && currentAction->inherits("TagAction"))
{
if ( buttonApply->isEnabled() &&
KMessageBox::questionYesNo(this, i18n("Do you want to save the changes made to this action?"), QString::null, KStdGuiItem::save(), KStdGuiItem::discard()) == KMessageBox::Yes )
{
saveCurrentAction();
}
buttonApply->setEnabled(false);
currentAction = 0L;
}
if (item && item->depth() > 0)
{
TagAction *action = 0L;
KActionCollection *ac = m_mainWindow->actionCollection();
uint acCount = ac->count();
//find the corresponding action
for (uint i = 0; i < acCount; i++)
{
KAction *a = ac->action(i);
QString actionName = a->name();
if (a && actionName == item->text(2) && a->inherits("TagAction"))
{
action = static_cast<TagAction*>(a);
actionProperties->setEnabled(true);
deleteAction->setEnabled(true);
break;
} else
{
actionProperties->setEnabled(false);
deleteAction->setEnabled(false);
}
}
//if we found the action, load the action details
if (action)
{
currentAction = action;
QDomElement el = action->data();
if ( el.hasAttribute("icon") )
{
QString s = el.attribute("icon");
if (!QFileInfo(s).exists())
s = QFileInfo(s).fileName();
actionIcon->setIcon(s);
}
QString actionText = el.attribute("text");
actionText.replace(QRegExp("\\&(?!\\&)"),"");
lineText->setText(actionText);
lineToolTip->setText( el.attribute("tooltip") );
selectedShortcut = action->shortcut();
QString shortcutText = action->shortcut().toString();
if (shortcutText.isEmpty())
{
noShortcut->setChecked(true);
shortcutKeyButton->setText(i18n("None"));
} else
{
customShortcut->setChecked(true);
shortcutKeyButton->setShortcut(action->shortcut(), false);
shortcutKeyButton->setText(shortcutText);
}
//find the container toolbars of this action and add them to the container listbox
toolbarListBox->clear();
int current = 0;
int count = 0;
ToolbarTabWidget *tb = ToolbarTabWidget::ref();
for (int i = 0; i < tb->count(); i++)
{
QString toolbarName = tb->label(i);
QString toolbarId = tb->id(i);
ToolbarEntry *p_toolbar = m_toolbarList[toolbarId];
if (p_toolbar)
{
QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild();
while (!node.isNull())
{
if (node.nodeName() == "Action" &&
node.toElement().attribute("name") == el.attribute("name"))
{
toolbarListBox->insertItem(toolbarName);
if (item->parent()->text(0) == toolbarName)
current = count;
count++;
}
node = node.nextSibling();
}
}
}
toolbarListBox->setCurrentItem(current);
toolbarListBox->setSelected(current, true);
toolbarListBox->sort();
//set the detailed settings pages to their defaults
lineTag->clear();
lineClosingTag->clear();
useClosingTag->setChecked(false);
useActionDialog->setChecked(false);
//.........这里部分代码省略.........
示例4: r
ActionConfigDialog::ActionConfigDialog(const QDict<ToolbarEntry> &toolbarList, KMainWindow* parent, const char* name, bool modal, WFlags fl, const QString& defaultAction )
:ActionConfigDialogS( parent, name, modal, fl )
{
m_mainWindow = parent;
m_toolbarList = toolbarList;
buttonOk->setIconSet(SmallIconSet("button_ok"));
buttonCancel->setIconSet(SmallIconSet("button_cancel"));
buttonApply->setIconSet(SmallIconSet("apply"));
//buttonHelp->setIconSet(SmallIconSet("help"));
currentAction = 0L;
m_toolbarItem = 0L;
connect(actionTreeView, SIGNAL(contextMenu(KListView *,QListViewItem *,const QPoint &)),
SLOT(slotContextMenu(KListView *,QListViewItem *,const QPoint &)));
connect(actionTreeView, SIGNAL(selectionChanged(QListViewItem *)),
SLOT(slotSelectionChanged(QListViewItem *)));
connect(shortcutKeyButton, SIGNAL(capturedShortcut(const KShortcut &)),
SLOT(slotShortcutCaptured(const KShortcut &)));
connect(scriptPath, SIGNAL(activated(const QString&)),
SLOT(slotTextChanged(const QString&)));
connect(this, SIGNAL(addToolbar()), m_mainWindow, SLOT(slotAddToolbar()));
connect(this, SIGNAL(removeToolbar(const QString&)), m_mainWindow, SLOT(slotRemoveToolbar(const QString&)));
connect(this, SIGNAL(deleteUserAction(KAction*)), m_mainWindow, SLOT(slotDeleteAction(KAction*)));
connect(this, SIGNAL(configureToolbars(const QString&)), m_mainWindow, SLOT(slotConfigureToolbars(const QString&)));
//fill up the tree view with the toolbars and actions
actionTreeView->setSorting(-1);
allActionsItem = new KListViewItem(actionTreeView, i18n("All"));
actionTreeView->insertItem(allActionsItem);
QListViewItem *item, *oldItem = allActionsItem;
KAction *action;
QString toolbarName;
QString toolbarId;
ToolbarTabWidget *tb = ToolbarTabWidget::ref();
QRegExp r("\\&(?!\\&)");
KActionCollection *ac = m_mainWindow->actionCollection();
for (int i = 0; i < tb->count(); i++)
{
toolbarName = tb->label(i);
toolbarName.replace(r, "");
item = new KListViewItem(actionTreeView, oldItem, i18n(toolbarName.utf8()));
actionTreeView->insertItem(item);
toolbarId = tb->id(i);
QListViewItem *oldActionItem = 0L;
ToolbarEntry *p_toolbar = m_toolbarList[toolbarId];
if (p_toolbar)
{
QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild();
while (!node.isNull())
{
if (node.nodeName() == "Action")
{
action = ac->action(node.toElement().attribute("name"));
if (action)
{
oldActionItem = new KListViewItem(item, oldActionItem, action->text().replace(r,""), action->shortcut().toString(), action->name());
oldActionItem->setPixmap(0, SmallIcon(action->icon()) );
}
}
node = node.nextSibling();
}
if (tb->label(tb->currentPageIndex()).replace(r, "") == toolbarName)
{
item->setOpen(true);
if (item->firstChild())
{
if (defaultAction.isEmpty())
{
actionTreeView->setCurrentItem(item->firstChild());
} else
{
QListViewItem *actionItem = item->firstChild();
while (actionItem && actionItem->depth() > 0)
{
if (actionItem->text(0) == defaultAction || actionItem->text(0) == defaultAction + "...")
{
actionTreeView->setCurrentItem(actionItem);
break;
}
actionItem = actionItem->nextSibling();
}
}
}
}
}
oldItem = item;
}
uint acCount = ac->count();
for (uint i = 0; i < acCount; i++)
{
action = ac->action(i);
item = new KListViewItem(allActionsItem, action->text().replace(r, ""), action->shortcut().toString(), action->name());
item->setPixmap(0, SmallIcon(action->icon()) );
}
allActionsItem->sortChildItems(0, true);
treeMenu = new KPopupMenu(actionTreeView);
treeMenu->insertItem(i18n("&Add New Toolbar"), this, SLOT(slotAddToolbar()));
treeMenu->insertItem(i18n("&Remove Toolbar"), this, SLOT(slotRemoveToolbar()));
//.........这里部分代码省略.........
示例5: slotEditToolbar
void ActionConfigDialog::slotEditToolbar()
{
QString toolbarName;
QString toolbarId;
QListViewItem *oldItem;
QListViewItem *item = actionTreeView->currentItem();
if (item->parent())
item = item->parent();
toolbarName = item->text(0);
if ( toolbarName != i18n("All"))
{
emit configureToolbars(toolbarName +" <quanta>");
//update the tree view
KAction *action;
KActionCollection *ac = m_mainWindow->actionCollection();
ToolbarTabWidget *tb = ToolbarTabWidget::ref();
for (int i = 0; i < tb->count(); i++)
{
toolbarName = tb->label(i);
toolbarId = tb->id(i);
ToolbarEntry *p_toolbar = m_toolbarList[toolbarId];
if (p_toolbar)
{
oldItem = actionTreeView->findItem(toolbarName, 0);
item = new KListViewItem(actionTreeView, oldItem, toolbarName);
item->setOpen(oldItem->isOpen());
delete oldItem;
QDomNode node = p_toolbar->guiClient->domDocument().firstChild().firstChild().firstChild();
while (!node.isNull())
{
if (node.nodeName() == "Action")
{
action = ac->action(node.toElement().attribute("name"));
if (action)
{
oldItem = new KListViewItem(item, oldItem, action->text().replace(QRegExp("\\&(?!\\&)"),""), action->shortcut().toString(), action->name());
oldItem->setPixmap(0, SmallIcon(action->icon()));
}
}
node = node.nextSibling();
}
}
}
actionTreeView->setCurrentItem(allActionsItem);
actionTreeView->setSelected(allActionsItem, true);
}
}