Commit 15764fdc authored by Andreas Kling's avatar Andreas Kling
Browse files

Close Konqueror's context menus when one or more of the selected files disappear.

Added an "itemsRemoved( const KFileItemList & )" signal to KParts::BrowserExtension
to facilitate notification of such events.

(Forward-port of revision 581700 for bug 129288.)

svn path=/trunk/KDE/kdebase/konqueror/; revision=583257
parent 2d41f39e
......@@ -1025,6 +1025,10 @@ void KonqKfmIconView::slotNewItems( const KFileItemList& entries )
void KonqKfmIconView::slotDeleteItem( KFileItem * _fileitem )
{
KFileItemList list;
list.append(_fileitem);
emit m_extension->itemsRemoved(list);
if ( _fileitem == m_dirLister->rootItem() )
{
m_pIconView->stopImagePreview();
......
......@@ -4752,6 +4752,14 @@ void KonqMainWindow::slotPopupMenu( KXMLGUIClient *client, const QPoint &_global
if ( client )
pPopupMenu->factory()->addClient( client );
KParts::BrowserExtension *be = ::qobject_cast<KParts::BrowserExtension *>(sender());
if (be) {
QObject::connect( this, SIGNAL(popupItemsDisturbed()), pPopupMenu, SLOT(close()) );
QObject::connect( be, SIGNAL(itemsRemoved(const KFileItemList &)),
this, SLOT(slotItemsRemoved(const KFileItemList &)) );
}
QObject::disconnect( m_pMenuNew->menu(), SIGNAL(aboutToShow()),
this, SLOT(slotFileNewAboutToShow()) );
......@@ -4760,6 +4768,12 @@ void KonqMainWindow::slotPopupMenu( KXMLGUIClient *client, const QPoint &_global
QObject::connect( m_pMenuNew->menu(), SIGNAL(aboutToShow()),
this, SLOT(slotFileNewAboutToShow()) );
if (be) {
QObject::disconnect( this, SIGNAL(popupItemsDisturbed()), pPopupMenu, SLOT(close()) );
QObject::disconnect( be, SIGNAL(itemsRemoved(const KFileItemList &)),
this, SLOT(slotItemsRemoved(const KFileItemList &)) );
}
delete pPopupMenu;
delete konqyMenuClient;
......@@ -4804,6 +4818,17 @@ void KonqMainWindow::slotPopupMenu( KXMLGUIClient *client, const QPoint &_global
}
}
void KonqMainWindow::slotItemsRemoved(const KFileItemList &items)
{
QListIterator<KFileItem *> it(items);
while (it.hasNext()) {
if (popupItems.contains(it.next())) {
emit popupItemsDisturbed();
return;
}
}
}
void KonqMainWindow::slotOpenEmbedded()
{
QString name = sender()->objectName();
......
......@@ -330,6 +330,7 @@ public:
Q_SIGNALS:
void viewAdded( KonqView *view );
void viewRemoved( KonqView *view );
void popupItemsDisturbed();
public Q_SLOTS:
void slotCtrlTabPressed();
......@@ -545,6 +546,7 @@ private Q_SLOTS:
void slotRequesterClicked( KUrlRequester * );
void slotIntro();
void slotItemsRemoved(const KFileItemList &);
/**
* Loads the url displayed currently in the lineedit of the locationbar, by
* emulating a enter key press event.
......
......@@ -1175,6 +1175,10 @@ void KonqBaseListViewWidget::slotNewItems( const KFileItemList & entries )
void KonqBaseListViewWidget::slotDeleteItem( KFileItem * _fileitem )
{
KFileItemList list;
list.append(_fileitem);
emit m_pBrowserView->extension()->itemsRemoved(list);
iterator it = begin();
for( ; it != end(); ++it )
if ( (*it).item() == _fileitem )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment