diff --git a/kdesktop/kdiconview.cc b/kdesktop/kdiconview.cc index 5648e70e59..9aec4f73db 100644 --- a/kdesktop/kdiconview.cc +++ b/kdesktop/kdiconview.cc @@ -1,1609 +1,1611 @@ /* This file is part of the KDE project Copyright (C) 1998, 1999 Torben Weis Copyright (C) 2000, 2001 David Faure This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "kdiconview.h" #include "krootwm.h" #include "desktop.h" #include "kdesktopsettings.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //Added by qt3to4: #include #include #include #include #include #include #include #include #include "kshadowengine.h" #include "kdesktopshadowsettings.h" #include "kfileividesktop.h" // for multihead extern int kdesktop_screen_number; #define saveIconPosition(config, _x, _y, iconArea) \ do { \ int x = _x; int y = _y; \ x -= iconArea.x(); \ y -= iconArea.y(); \ if (x > ((iconArea.width()*3) / 4)) x -= iconArea.width(); \ if (y > ((iconArea.height()*3) / 4)) y -= iconArea.height(); \ (config)->writeEntry("X", x); (config)->writeEntry("Y", y); \ (config)->writeEntry(X_w, x); (config)->writeEntry(Y_h, y); \ } while(false) #define readIconPosition(config, x, y, iconArea) \ do { \ x = (config)->readEntry( X_w, -9999 ); \ if ( x == -9999 ) x = (config)->readEntry( "X", 0 ); \ if (x < 0) x += iconArea.width(); \ y = (config)->readEntry( Y_h, -9999 ); \ if ( y == -9999 ) y = (config)->readEntry( "Y", 0 ); \ if (y < 0) y += iconArea.height(); \ x += iconArea.x(); \ y += iconArea.y(); \ } while(false) static QRect desktopRect() { return ( kdesktop_screen_number == 0 ) ? QApplication::desktop()->geometry() // simple case, or xinerama : QApplication::desktop()->screenGeometry( kdesktop_screen_number ); // multi-head } KDIconView::KDIconView( QWidget *parent, const char* name ) : KonqIconViewWidget( parent, name, Qt::WResizeNoErase, true ), m_actionCollection( this ), m_bNeedRepaint( false ), m_bNeedSave( false ), m_autoAlign( false ), m_hasExistingPos( false ), m_bEditableDesktopIcons( KAuthorized::authorizeKAction("editable_desktop_icons") ), m_bShowDot( false ), m_bVertAlign( true ), m_dirLister( 0L ), m_mergeDirs(), m_dotDirectory( 0L ), m_lastDeletedIconPos(), m_eSortCriterion( NameCaseInsensitive ), m_bSortDirectoriesFirst( true ), m_itemsAlwaysFirst() { setResizeMode( Fixed ); // Initialise the shadow data objects... m_shadowEngine = new KShadowEngine(new KDesktopShadowSettings(KGlobal::config())); connect( QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slotClipboardDataChanged()) ); setUrl( desktopUrl() ); // sets m_url m_desktopDirs = KGlobal::dirs()->findDirs( "appdata", "Desktop" ); initDotDirectories(); connect( this, SIGNAL( executed( Q3IconViewItem * ) ), SLOT( slotExecuted( Q3IconViewItem * ) ) ); connect( this, SIGNAL( returnPressed( Q3IconViewItem * ) ), SLOT( slotReturnPressed( Q3IconViewItem * ) ) ); connect( this, SIGNAL( mouseButtonPressed(int, Q3IconViewItem*, const QPoint&)), SLOT( slotMouseButtonPressed(int, Q3IconViewItem*, const QPoint&)) ); connect( this, SIGNAL( mouseButtonClicked(int, Q3IconViewItem*, const QPoint&)), SLOT( slotMouseButtonClickedKDesktop(int, Q3IconViewItem*, const QPoint&)) ); connect( this, SIGNAL( contextMenuRequested(Q3IconViewItem*, const QPoint&)), SLOT( slotContextMenuRequested(Q3IconViewItem*, const QPoint&)) ); connect( this, SIGNAL( enableAction( const char * , bool ) ), SLOT( slotEnableAction( const char * , bool ) ) ); // Hack: KonqIconViewWidget::slotItemRenamed is not virtual :-( disconnect( this, SIGNAL(itemRenamed(Q3IconViewItem *, const QString &)), this, SLOT(slotItemRenamed(Q3IconViewItem *, const QString &)) ); connect( this, SIGNAL(itemRenamed(Q3IconViewItem *, const QString &)), this, SLOT(slotItemRenamed(Q3IconViewItem *, const QString &)) ); if (!m_bEditableDesktopIcons) { setItemsMovable(false); setAcceptDrops(false); viewport()->setAcceptDrops(false); } connect( kapp->desktop(), SIGNAL( resized( int )), SLOT( desktopResized())); OrgKdeKDirNotifyInterface *kdirnotify = new OrgKdeKDirNotifyInterface( QString(), QString(), QDBusConnection::sessionBus() ); kdirnotify->setParent(this); connect(kdirnotify, SIGNAL(FilesAdded(QString)), SLOT(slotFilesAdded(QString))); connect(kdirnotify, SIGNAL(FilesChanged(QStringList)), SLOT(slotFilesChanged(QStringList))); connect(kdirnotify, SIGNAL(FilesRemoved(QStringList)), SLOT(slotFilesRemoved(QStringList))); } KDIconView::~KDIconView() { if (m_dotDirectory && !m_bEditableDesktopIcons) m_dotDirectory->rollback(false); // Don't save positions delete m_dotDirectory; delete m_dirLister; delete m_shadowEngine; } void KDIconView::initDotDirectories() { QStringList dirs = m_desktopDirs; KUrl u = desktopUrl(); if (u.isLocalFile()) dirs.prepend(u.path()); QString prefix = iconPositionGroupPrefix(); QString dotFileName = KStandardDirs::locateLocal("appdata", "IconPositions"); if (kdesktop_screen_number != 0) dotFileName += "_Desktop" + QString::number(kdesktop_screen_number); if (m_dotDirectory && !m_bEditableDesktopIcons) m_dotDirectory->rollback(false); // Don't save positions delete m_dotDirectory; m_dotDirectory = new KSimpleConfig( dotFileName ); // If we don't allow editable desktop icons, empty m_dotDirectory if (!m_bEditableDesktopIcons) { QStringList groups = m_dotDirectory->groupList(); QStringList::ConstIterator gIt = groups.begin(); QStringList::ConstIterator gEnd = groups.end(); for (; gIt != gEnd; ++gIt ) { m_dotDirectory->deleteGroup(*gIt); } } QRect desk = desktopRect(); QString X_w = QString( "X %1" ).arg( desk.width() ); QString Y_h = QString( "Y %1" ).arg( desk.height() ); for ( QStringList::ConstIterator it = dirs.begin() ; it != dirs.end() ; ++it ) { kDebug(1204) << "KDIconView::initDotDirectories found dir " << *it << endl; QString dotFileName = *it + "/.directory"; if (QFile::exists(dotFileName)) { KSimpleConfig dotDir(dotFileName, true); // Read only QStringList groups = dotDir.groupList(); QStringList::ConstIterator gIt = groups.begin(); QStringList::ConstIterator gEnd = groups.end(); for (; gIt != gEnd; ++gIt ) { if ( (*gIt).startsWith(prefix) ) { dotDir.setGroup( *gIt ); m_dotDirectory->setGroup( *gIt ); if (!m_dotDirectory->hasKey( X_w )) { int x,y; readIconPosition(&dotDir, x, y, iconArea()); m_dotDirectory->writeEntry( X_w, x ); m_dotDirectory->writeEntry( Y_h, y ); // Not persistant! } } } } } } void KDIconView::initConfig( bool init ) { //kDebug() << "initConfig " << init << endl; if ( !init ) { KonqFMSettings::reparseConfiguration(); KDesktopSettings::self()->readConfig(); } KConfig * config = KGlobal::config(); if ( !init ) { KDesktopShadowSettings *shadowSettings = static_cast(m_shadowEngine->shadowSettings()); shadowSettings->setConfig(config); } setMaySetWallpaper(!config->isImmutable() && !KGlobal::dirs()->isRestrictedResource("wallpaper")); m_bShowDot = KDesktopSettings::showHidden(); m_bVertAlign = KDesktopSettings::vertAlign(); QStringList oldPreview = previewSettings(); setPreviewSettings( KDesktopSettings::preview() ); // read arrange configuration m_eSortCriterion = (SortCriterion)KDesktopSettings::sortCriterion(); m_bSortDirectoriesFirst = KDesktopSettings::directoriesFirst(); m_itemsAlwaysFirst = KDesktopSettings::alwaysFirstItems(); // Distributor plug-in if (KProtocolInfo::isKnownProtocol(QLatin1String("media"))) m_enableMedia=KDesktopSettings::mediaEnabled(); else m_enableMedia=false; QString tmpList=KDesktopSettings::exclude(); kDebug(1204)<<"m_excludeList"<setShowingDotFiles( m_bShowDot ); m_dirLister->emitChanges(); } setArrangement(m_bVertAlign ? TopToBottom : LeftToRight); if ( KonqIconViewWidget::initConfig( init ) ) lineupIcons(); // called if the font changed. setAutoArrange( false ); if ( previewSettings().count() ) { for ( QStringList::ConstIterator it = oldPreview.begin(); it != oldPreview.end(); ++it) if ( !previewSettings().contains( *it ) ){ kDebug(1204) << "Disabling preview for " << *it << endl; if ( *it == "audio/" ) disableSoundPreviews(); else { KService::Ptr serv = KService::serviceByDesktopName( *it ); Q_ASSERT( serv ); if ( serv ) { setIcons( iconSize( ), serv->property("MimeTypes").toStringList() /* revert no-longer wanted previews to icons */ ); } } } startImagePreview( QStringList(), true ); } else { stopImagePreview(); setIcons( iconSize(), QStringList(QLatin1String("*")) /* stopImagePreview */ ); } if ( !init ) updateContents(); } void KDIconView::start() { // We can only start once Q_ASSERT(!m_dirLister); if (m_dirLister) return; kDebug(1204) << "KDIconView::start" << endl; // Create the directory lister m_dirLister = new KDirLister(); m_bNeedSave = false; connect( m_dirLister, SIGNAL( clear() ), this, SLOT( slotClear() ) ); connect( m_dirLister, SIGNAL( started(const KUrl&) ), this, SLOT( slotStarted(const KUrl&) ) ); connect( m_dirLister, SIGNAL( completed() ), this, SLOT( slotCompleted() ) ); connect( m_dirLister, SIGNAL( newItems( const KFileItemList & ) ), this, SLOT( slotNewItems( const KFileItemList & ) ) ); connect( m_dirLister, SIGNAL( deleteItem( KFileItem * ) ), this, SLOT( slotDeleteItem( KFileItem * ) ) ); connect( m_dirLister, SIGNAL( refreshItems( const KFileItemList & ) ), this, SLOT( slotRefreshItems( const KFileItemList & ) ) ); // Start the directory lister ! m_dirLister->setShowingDotFiles( m_bShowDot ); KAuthorized::allowUrlAction("list", KUrl(), url()); m_dirLister->openUrl( url() ); // Gather the list of directories to merge into the desktop // (the main URL is desktopUrl(), no need for it in the m_mergeDirs list) m_mergeDirs.clear(); for ( QStringList::ConstIterator it = m_desktopDirs.begin() ; it != m_desktopDirs.end() ; ++it ) { kDebug(1204) << "KDIconView::start found merge dir " << *it << endl; KUrl u; u.setPath( *it ); m_mergeDirs.append( u ); // And start listing this dir right now KAuthorized::allowUrlAction("list", KUrl(), u); m_dirLister->openUrl( u, true ); } configureMedia(); createActions(); } void KDIconView::configureMedia() { kDebug(1204) << "***********KDIconView::configureMedia() " <setMimeExcludeFilter(m_excludedMedia); m_dirLister->emitChanges(); updateContents(); if (m_enableMedia) { for (KUrl::List::Iterator it1=m_mergeDirs.begin();it1!=m_mergeDirs.end();++it1) { if ((*it1).url()=="media:/") return; } m_mergeDirs.append(KUrl("media:/")); m_dirLister->openUrl(KUrl("media:/"),true); } else { for (KUrl::List::Iterator it2=m_mergeDirs.begin();it2!=m_mergeDirs.end();++it2) { if ((*it2).url()=="media:/") { delete m_dirLister; m_dirLister=0; start(); // m_mergeDirs.remove(it2); // m_dirLister->stop("media"); return; } } return; } } void KDIconView::createActions() { if (m_bEditableDesktopIcons) { KAction *undo = KStdAction::undo( KonqUndoManager::self(), SLOT( undo() ), &m_actionCollection, "undo" ); connect( KonqUndoManager::self(), SIGNAL( undoAvailable( bool ) ), undo, SLOT( setEnabled( bool ) ) ); connect( KonqUndoManager::self(), SIGNAL( undoTextChanged( const QString & ) ), this, SLOT( slotUndoTextChanged( const QString & ) ) ); undo->setEnabled( KonqUndoManager::self()->undoAvailable() ); KAction* paCut = KStdAction::cut( this, SLOT( slotCut() ), &m_actionCollection, "cut" ); KShortcut cutShortCut = paCut->shortcut(); cutShortCut.remove( Qt::SHIFT + Qt::Key_Delete ); // used for deleting files paCut->setShortcut( cutShortCut ); KStdAction::copy( this, SLOT( slotCopy() ), &m_actionCollection, "copy" ); KStdAction::paste( this, SLOT( slotPaste() ), &m_actionCollection, "paste" ); KAction *pasteTo = KStdAction::paste( this, SLOT( slotPopupPasteTo() ), &m_actionCollection, "pasteto" ); pasteTo->setEnabled( false ); // only enabled during popupMenu() + KStdAction::redisplay( this, SLOT(refreshIcons()), &m_actionCollection, "reload" ); + KAction *action = new KAction( i18n( "&Rename" ), &m_actionCollection, "rename" ); - connect(action, SIGNAL(triggered(bool) ), SLOT( renameSelectedItem() )); + connect(action, SIGNAL(triggered(bool)), SLOT(renameSelectedItem())); action->setShortcut(Qt::Key_F2); action = new KAction( i18n( "&Properties" ), &m_actionCollection, "properties" ); - connect(action, SIGNAL(triggered(bool) ), SLOT( slotProperties() )); + connect(action, SIGNAL(triggered(bool)), SLOT(slotProperties())); action->setShortcut(Qt::ALT+Qt::Key_Return); KAction* trash = new KAction( KIcon("edittrash"), i18n( "&Move to Trash" ), &m_actionCollection, "trash" ); trash->setShortcut(Qt::Key_Delete); connect(trash, SIGNAL(triggered(bool)), SLOT(slotTrash())); KConfig config("kdeglobals", true, false); config.setGroup( "KDE" ); action = new KAction(KIcon("editdelete"), i18n( "&Delete" ), &m_actionCollection, "del" ); connect(action, SIGNAL(triggered(bool)), SLOT( slotDelete() )); action->setShortcut(Qt::SHIFT+Qt::Key_Delete); // Initial state of the actions (cut/copy/paste/...) slotSelectionChanged(); //init paste action slotClipboardDataChanged(); } } void KDIconView::slotUndoTextChanged( const QString &text ) { KAction* undo = m_actionCollection.action( "undo" ); undo->setText( text ); } void KDIconView::rearrangeIcons( SortCriterion sc, bool bSortDirectoriesFirst ) { m_eSortCriterion = sc; m_bSortDirectoriesFirst = bSortDirectoriesFirst; rearrangeIcons(); } void KDIconView::rearrangeIcons() { setupSortKeys(); sort(); if ( m_autoAlign ) lineupIcons( m_bVertAlign ? Q3IconView::TopToBottom : Q3IconView::LeftToRight ); else arrangeItemsInGrid(); saveIconPositions(); } void KDIconView::lineupIcons() { KonqIconViewWidget::lineupIcons(); saveIconPositions(); } void KDIconView::setAutoAlign( bool b ) { m_autoAlign = b; // Auto line-up icons if ( b ) { lineupIcons(); connect( this, SIGNAL( iconMoved() ), this, SLOT( lineupIcons() ) ); } else { // change maxItemWidth, because when grid-align was active, it changed this for the grid int sz = iconSize() ? iconSize() : KGlobal::iconLoader()->currentSize( K3Icon::Desktop ); setMaxItemWidth( qMax( qMax( sz, previewIconSize( iconSize() ) ), KonqFMSettings::settings()->iconTextWidth() ) ); setFont( font() ); // Force calcRect() disconnect( this, SIGNAL( iconMoved() ), this, SLOT( lineupIcons() ) ); } } void KDIconView::desktopResized() { saveIconPositions(); resize( kapp->desktop()->size() ); slotClear(); m_dirLister->openUrl( url() ); // list all desktop dirs m_mergeDirs.clear(); for ( QStringList::ConstIterator it = m_desktopDirs.begin() ; it != m_desktopDirs.end() ; ++it ) { kDebug(1204) << "KDIconView::desktopResized found merge dir " << *it << endl; KUrl u; u.setPath( *it ); m_mergeDirs.append( u ); // And start listing this dir right now KAuthorized::allowUrlAction("list", KUrl(), u); m_dirLister->openUrl( u, true ); } configureMedia(); } void KDIconView::lineupIcons(Q3IconView::Arrangement align) { m_bVertAlign = ( align == Q3IconView::TopToBottom ); setArrangement( m_bVertAlign ? TopToBottom : LeftToRight ); if ( m_autoAlign ) KonqIconViewWidget::lineupIcons( align ); else rearrangeIcons(); KDesktopSettings::setVertAlign( m_bVertAlign ); KDesktopSettings::writeConfig(); } // Only used for DCOP QStringList KDIconView::selectedUrls() { QStringList seq; Q3IconViewItem *it = firstItem(); for (; it; it = it->nextItem() ) if ( it->isSelected() ) { KFileItem *fItem = ((KFileIVI *)it)->item(); seq.append( fItem->url().url() ); // copy the URL } return seq; } void KDIconView::recheckDesktopUrl() { // Did someone change the path to the desktop ? kDebug(1204) << desktopUrl().url() << endl; kDebug(1204) << url().url() << endl; if ( desktopUrl() != url() ) { kDebug(1204) << "Desktop path changed from " << url().url() << " to " << desktopUrl().url() << endl; setUrl( desktopUrl() ); // sets m_url initDotDirectories(); m_dirLister->openUrl( url() ); } } KUrl KDIconView::desktopUrl() { // Support both paths and URLs QString desktopPath = KGlobalSettings::desktopPath(); if (kdesktop_screen_number != 0) { QString dn = "Desktop"; dn += QString::number(kdesktop_screen_number); desktopPath.replace("Desktop", dn); } KUrl desktopURL; if (desktopPath[0] == '/') desktopURL.setPath(desktopPath); else desktopURL = desktopPath; Q_ASSERT( desktopURL.isValid() ); if ( !desktopURL.isValid() ) { // should never happen KUrl u; u.setPath( QDir::homePath() + '/' + "Desktop" + '/' ); return u; } return desktopURL; } void KDIconView::contentsMousePressEvent( QMouseEvent *e ) { if (!m_dirLister) return; //kDebug(1204) << "KDIconView::contentsMousePressEvent" << endl; // QIconView, as of Qt 2.2, doesn't emit mouseButtonPressed for LMB on background if ( e->button() == Qt::LeftButton && KRootWm::self()->hasLeftButtonMenu() ) { Q3IconViewItem *item = findItem( e->pos() ); if ( !item ) { // Left click menu KRootWm::self()->mousePressed( e->globalPos(), e->button() ); return; } } KonqIconViewWidget::contentsMousePressEvent( e ); } void KDIconView::mousePressEvent( QMouseEvent *e ) { KRootWm::self()->mousePressed( e->globalPos(), e->button() ); } void KDIconView::wheelEvent( QWheelEvent* e ) { if (!m_dirLister) return; //kDebug(1204) << "KDIconView::wheelEvent" << endl; Q3IconViewItem *item = findItem( e->pos() ); if ( !item ) { emit wheelRolled( e->delta() ); return; } KonqIconViewWidget::wheelEvent( e ); } void KDIconView::slotProperties() { (void) new KPropertiesDialog( selectedFileItems() ); } void KDIconView::slotContextMenuRequested(Q3IconViewItem *_item, const QPoint& _global) { if (_item) { ((KFileIVI*)_item)->setSelected( true ); popupMenu( _global, selectedFileItems() ); } } void KDIconView::slotMouseButtonPressed(int _button, Q3IconViewItem* _item, const QPoint& _global) { //kDebug(1204) << "KDIconView::slotMouseButtonPressed" << endl; if (!m_dirLister) return; m_lastDeletedIconPos = QPoint(); // user action -> not renaming an icon if(!_item) KRootWm::self()->mousePressed( _global, _button ); } void KDIconView::slotMouseButtonClickedKDesktop(int _button, Q3IconViewItem* _item, const QPoint&) { if (!m_dirLister) return; //kDebug(1204) << "KDIconView::slotMouseButtonClickedKDesktop" << endl; if ( _item && _button == Qt::MidButton ) slotExecuted(_item); } // ----------------------------------------------------------------------------- void KDIconView::slotReturnPressed( Q3IconViewItem *item ) { if (item && item->isSelected()) slotExecuted(item); } // ----------------------------------------------------------------------------- void KDIconView::slotExecuted( Q3IconViewItem *item ) { KWorkSpace::propagateSessionManager(); m_lastDeletedIconPos = QPoint(); // user action -> not renaming an icon if (item) { visualActivate(item); ((KFileIVI*)item)->returnPressed(); } } // ----------------------------------------------------------------------------- void KDIconView::slotCut() { cutSelection(); } // ----------------------------------------------------------------------------- void KDIconView::slotCopy() { copySelection(); } // ----------------------------------------------------------------------------- void KDIconView::slotPaste() { KonqOperations::doPaste(this, url(), KRootWm::self()->desktopMenuPosition()); } void KDIconView::slotPopupPasteTo() { Q_ASSERT( !m_popupURL.isEmpty() ); if ( !m_popupURL.isEmpty() ) paste( m_popupURL ); } /** * The files on the desktop come from a variety of sources. * If an attempt is made to delete a .desktop file that does * not originate from the users own Desktop directory then * a .desktop file with "Hidden=true" is written to the users * own Desktop directory to hide the file. * * Returns true if all selected items have been deleted. * Returns false if there are selected items remaining that * still need to be deleted in a regular fashion. */ bool KDIconView::deleteGlobalDesktopFiles() { KUrl desktop_URL = desktopUrl(); if (!desktop_URL.isLocalFile()) return false; // Dunno how to do this. QString desktopPath = desktop_URL.path(); bool itemsLeft = false; Q3IconViewItem *it = 0; Q3IconViewItem *nextIt = firstItem(); for (; (it = nextIt); ) { nextIt = it->nextItem(); if ( !it->isSelected() ) continue; KFileItem *fItem = ((KFileIVI *)it)->item(); if (fItem->url().path().startsWith(desktopPath)) { itemsLeft = true; continue; // File is in users own Desktop directory } if (!isDesktopFile(fItem)) { itemsLeft = true; continue; // Not a .desktop file } KDesktopFile df(desktopPath + fItem->url().fileName()); df.writeEntry("Hidden", true); df.sync(); delete it; } return !itemsLeft; } void KDIconView::slotTrash() { if (deleteGlobalDesktopFiles()) return; // All items deleted if ( QApplication::keyboardModifiers() & Qt::ShiftModifier ) KonqOperations::del(this, KonqOperations::DEL, selectedUrls()); else KonqOperations::del(this, KonqOperations::TRASH, selectedUrls()); } void KDIconView::slotDelete() { if (deleteGlobalDesktopFiles()) return; // All items deleted KonqOperations::del(this, KonqOperations::DEL, selectedUrls()); } // ----------------------------------------------------------------------------- // This method is called when right-clicking over one or more items // Not to be confused with the global popup-menu, KRootWm, when doing RMB on the desktop void KDIconView::popupMenu( const QPoint &_global, const KFileItemList& _items ) { if (!KAuthorized::authorizeKAction("action/kdesktop_rmb")) return; if (!m_dirLister) return; if ( _items.count() == 1 ) m_popupURL = _items.first()->url(); KAction* pasteTo = m_actionCollection.action( "pasteto" ); if (pasteTo) pasteTo->setEnabled( m_actionCollection.action( "paste" )->isEnabled() ); bool hasMediaFiles = false; KFileItemList::const_iterator it = _items.begin(); const KFileItemList::const_iterator end = _items.end(); for (; it != end && !hasMediaFiles; ++it) { hasMediaFiles = (*it)->url().protocol() == "media"; } KParts::BrowserExtension::PopupFlags itemFlags = KParts::BrowserExtension::DefaultPopupItems; if ( hasMediaFiles ) itemFlags |= KParts::BrowserExtension::NoDeletion; KonqPopupMenu * popupMenu = new KonqPopupMenu( KonqBookmarkManager::self(), _items, url(), m_actionCollection, KRootWm::self()->newMenu(), this, KonqPopupMenu::ShowProperties | KonqPopupMenu::ShowNewWindow, itemFlags ); popupMenu->exec( _global ); delete popupMenu; m_popupURL = KUrl(); if (pasteTo) pasteTo->setEnabled( false ); } void KDIconView::slotNewMenuActivated() { //kDebug(1204) << "KDIconView::slotNewMenuActivated" << endl; // New /