本文整理汇总了C++中KFileItemList::first方法的典型用法代码示例。如果您正苦于以下问题:C++ KFileItemList::first方法的具体用法?C++ KFileItemList::first怎么用?C++ KFileItemList::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KFileItemList
的用法示例。
在下文中一共展示了KFileItemList::first方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setSelection
void InformationPanel::setSelection(const KFileItemList& selection)
{
if (!isVisible()) {
return;
}
if (selection.isEmpty() && m_selection.isEmpty()) {
// The selection has not really changed, only the current index.
// QItemSelectionModel emits a signal in this case and it is less
// expensive doing the check this way instead of patching
// DolphinView::emitSelectionChanged().
return;
}
m_selection = selection;
m_fileItem = KFileItem();
const int count = selection.count();
if (count == 0) {
if (!isEqualToShownUrl(url())) {
m_shownUrl = url();
showItemInfo();
}
} else {
if ((count == 1) && !selection.first().url().isEmpty()) {
m_urlCandidate = selection.first().url();
}
m_infoTimer->start();
}
}
示例2: determineMimeTypeAndGroup
void KFileItemListPropertiesPrivate::determineMimeTypeAndGroup() const
{
if (!m_items.isEmpty()) {
m_mimeType = m_items.first().mimetype();
m_mimeGroup = m_mimeType.left(m_mimeType.indexOf('/'));
}
foreach (const KFileItem &item, m_items) {
const QString itemMimeType = item.mimetype();
// Determine if common mimetype among all items
if (m_mimeType != itemMimeType) {
m_mimeType.clear();
if (m_mimeGroup != itemMimeType.left(itemMimeType.indexOf('/'))) {
m_mimeGroup.clear(); // mimetype groups are different as well!
}
}
}
}
示例3: KonqPopupMenuPlugin
AkregatorMenu::AkregatorMenu( KonqPopupMenu * popupmenu, const char *name, const QStringList& /* list */ )
: KonqPopupMenuPlugin( popupmenu, name), PluginBase(), m_conf(0), m_part(0)
{
kdDebug() << "AkregatorMenu::AkregatorMenu()" << endl;
if ( QCString( kapp->name() ) == "kdesktop" && !kapp->authorize("editable_desktop_icons" ) )
return;
// Do nothing if user has turned us off.
// TODO: Not yet implemented in aKregator settings.
/*m_conf = new KConfig( "akregatorrc" );
m_conf->setGroup( "AkregatorKonqPlugin" );
if ( !m_conf->readBoolEntry( "Enable", true ) )
return;
*/
KHTMLView* view = 0L;
if (popupmenu && popupmenu->parent() && popupmenu->parent()->inherits("KHTMLView"))
view = static_cast<KHTMLView*>(popupmenu->parent());
if (view)
m_part = view->part();
KGlobal::locale()->insertCatalogue("akregator_konqplugin");
m_feedMimeTypes << "text/rss" << "text/rdf" << "text/xml";
// Get the list of URLs clicked on from Konqi.
//KFileItemList m_list = popupmenu->fileItemList();
// See if any are RSS feeds.
KFileItemList list = popupmenu->fileItemList();
KFileItem* it = list.first();
while (it != 0)
{
if (isFeedUrl(it))
{
kdDebug() << "AkregatorMenu: found feed URL " << it->url().prettyURL() << endl;
KAction *action = new KAction( i18n( "Add Feed to Akregator" ), "akregator", 0, this, SLOT( slotAddFeed() ), actionCollection(), "akregatorkonqplugin_mnu" );
addAction( action );
addSeparator();
m_feedURL = it->url().url();
break;
}
it = list.next();
}
}
示例4: foreach
QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) const
{
QList<QAction*> actions;
bool hasNullItems = false;
foreach (const KFileItem& item, items) {
if (item.isNull()) {
kWarning() << "Requesting version-control-actions for empty items";
hasNullItems = true;
break;
}
}
if (!m_model || hasNullItems) {
return actions;
}
KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
if (pluginV2) {
// Use version 2 of the KVersionControlPlugin which allows providing actions
// also for non-versioned directories.
actions = pluginV2->actions(items);
} else if (isVersioned()) {
// Support deprecated interfaces from KVersionControlPlugin version 1.
// Context menu actions where only available for versioned directories.
QString directory;
if (items.count() == 1) {
const KFileItem rootItem = m_model->rootItem();
if (!rootItem.isNull() && items.first().url() == rootItem.url()) {
directory = rootItem.url().path(KUrl::AddTrailingSlash);
}
}
actions = directory.isEmpty() ? m_plugin->contextMenuActions(items)
: m_plugin->contextMenuActions(directory);
}
return actions;
}
示例5: init
void KonqPopupMenuPrivate::init(KonqPopupMenu::Flags kpf, KParts::BrowserExtension::PopupFlags flags)
{
m_itemFlags = flags;
q->setFont(KGlobalSettings::menuFont());
Q_ASSERT(m_popupItemProperties.items().count() >= 1);
bool bTrashIncluded = false;
const KFileItemList lstItems = m_popupItemProperties.items();
KFileItemList::const_iterator it = lstItems.constBegin();
const KFileItemList::const_iterator kend = lstItems.constEnd();
for ( ; it != kend; ++it )
{
const KUrl url = (*it).url();
if ( !bTrashIncluded && (
( url.protocol() == "trash" && url.path().length() <= 1 ) ) ) {
bTrashIncluded = true;
}
}
const bool isDirectory = m_popupItemProperties.isDirectory();
const bool sReading = m_popupItemProperties.supportsReading();
bool sDeleting = (m_itemFlags & KParts::BrowserExtension::NoDeletion) == 0
&& m_popupItemProperties.supportsDeleting();
const bool sWriting = m_popupItemProperties.supportsWriting();
const bool sMoving = sDeleting && m_popupItemProperties.supportsMoving();
const bool isLocal = m_popupItemProperties.isLocal();
KUrl url = m_sViewURL;
url.cleanPath();
bool isTrashLink = false;
bool isCurrentTrash = false;
bool currentDir = false;
bool isSymLink = false;
bool isSymLinkInSameDir = false; // true for "ln -s foo bar", false for links to foo/sub or /foo
//check if url is current directory
if ( lstItems.count() == 1 )
{
KFileItem firstPopupItem( lstItems.first() );
if (firstPopupItem.isLink()) {
isSymLink = true;
isSymLinkInSameDir = !firstPopupItem.linkDest().contains('/');
}
KUrl firstPopupURL( firstPopupItem.url() );
firstPopupURL.cleanPath();
//kDebug(1203) << "View path is " << url.url();
//kDebug(1203) << "First popup path is " << firstPopupURL.url();
currentDir = firstPopupURL.equals( url, KUrl::CompareWithoutTrailingSlash );
if ( firstPopupItem.isDesktopFile() ) {
KDesktopFile desktopFile( firstPopupItem.localPath() );
const KConfigGroup cfg = desktopFile.desktopGroup();
isTrashLink = ( cfg.readEntry("Type") == "Link" && cfg.readEntry("URL") == "trash:/" );
}
if (isTrashLink) {
sDeleting = false;
}
// isCurrentTrash: popup on trash:/ itself, or on the trash.desktop link
isCurrentTrash = (firstPopupURL.protocol() == "trash" && firstPopupURL.path().length() <= 1)
|| isTrashLink;
}
const bool isIntoTrash = (url.protocol() == "trash") && !isCurrentTrash; // trashed file, not trash:/ itself
const bool bIsLink = (m_itemFlags & KParts::BrowserExtension::IsLink);
//kDebug() << "isLocal=" << isLocal << " url=" << url << " isCurrentTrash=" << isCurrentTrash << " isIntoTrash=" << isIntoTrash << " bTrashIncluded=" << bTrashIncluded;
//////////////////////////////////////////////////////////////////////////
addGroup( "topactions" ); // used e.g. for ShowMenuBar. includes a separator at the end
KAction * act;
KAction *actNewWindow = 0;
#if 0 // TODO in the desktop code itself.
if (( flags & KParts::BrowserExtension::ShowProperties ) && isOnDesktop &&
!KAuthorized::authorizeKAction("editable_desktop_icons"))
{
flags &= ~KParts::BrowserExtension::ShowProperties; // remove flag
}
#endif
// Either 'newview' is in the actions we're given (probably in the tabhandling group)
// or we need to insert it ourselves (e.g. for the desktop).
// In the first case, actNewWindow must remain 0.
if ( ((kpf & KonqPopupMenu::ShowNewWindow) != 0) && sReading )
{
const QString openStr = i18n("&Open");
actNewWindow = new KAction(m_parentWidget /*for status tips*/);
m_ownActions.append(actNewWindow);
actNewWindow->setIcon( KIcon("window-new") );
actNewWindow->setText( openStr );
QObject::connect(actNewWindow, SIGNAL(triggered()), q, SLOT(slotPopupNewView()));
}
//.........这里部分代码省略.........