Move code for disabling the paste action into DolphinView::pasteInfo() -> Dolphin KPart now also is aware about the disabled paste action.

@David: Konqueror hides the paste action in the context menu now, but still the action in the edit menu stays enabled

CCMAIL: faure@kde.org

svn path=/trunk/KDE/kdebase/apps/; revision=819116
This commit is contained in:
Peter Penz 2008-06-10 16:23:46 +00:00
parent 875b1c77fb
commit faeafd5b42
2 changed files with 5 additions and 11 deletions

View file

@ -458,16 +458,6 @@ void DolphinMainWindow::updatePasteAction()
QPair<bool, QString> pasteInfo = m_activeViewContainer->view()->pasteInfo();
pasteAction->setEnabled(pasteInfo.first);
pasteAction->setText(pasteInfo.second);
if (pasteAction->isEnabled()) {
// disable the paste action if no writing is supported
const KUrl& url = m_activeViewContainer->view()->url();
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItemList list;
list.append(item);
KonqFileItemCapabilities capabilities(list);
pasteAction->setEnabled(capabilities.supportsWriting());
}
}
void DolphinMainWindow::selectAll()

View file

@ -41,6 +41,7 @@
#include <kmenu.h>
#include <kmessagebox.h>
#include <kmimetyperesolver.h>
#include <konq_fileitemcapabilities.h>
#include <konq_operations.h>
#include <konqmimedata.h>
#include <ktoggleaction.h>
@ -901,7 +902,10 @@ QPair<bool, QString> DolphinView::pasteInfo() const
KUrl::List urls = KUrl::List::fromMimeData(mimeData);
if (!urls.isEmpty()) {
ret.first = true;
// disable the paste action if no writing is supported
KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url());
ret.first = KonqFileItemCapabilities(KFileItemList() << item).supportsWriting();
if (urls.count() == 1) {
const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, urls.first(), true);
ret.second = item.isDir() ? i18nc("@action:inmenu", "Paste One Folder") :