From kde-commits Mon Mar 28 21:14:57 2005 From: David Faure Date: Mon, 28 Mar 2005 21:14:57 +0000 To: kde-commits Subject: kdebase/libkonq Message-Id: <20050328211457.28C7F631 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=111204451326524 CVS commit by faure: GUI: Retitle the Paste action depending on what it's going to paste: file, N files, url, N urls, or "clipboard contents" (#39489) Hmm, should the latter be "Paste clipboard into file"? M +13 -3 konq_dirpart.cc 1.88 --- kdebase/libkonq/konq_dirpart.cc #1.87:1.88 @@ -430,6 +430,16 @@ void KonqDirPart::updatePasteAction() { QMimeSource *data = QApplication::clipboard()->data(); - bool paste = ( data->format() != 0 ); - + bool paste = ( data->format(0) != 0 ); + KURL::List urls; + if ( KURLDrag::canDecode( data ) && KURLDrag::decode( data, urls ) ) { + if ( urls.isEmpty() ) + paste = false; + else if ( urls.first().isLocalFile() ) + emit m_extension->setActionText( "paste", i18n( "&Paste file", "&Paste %n files", urls.count() ) ); + else + emit m_extension->setActionText( "paste", i18n( "&Paste URL", "&Paste %n URLs", urls.count() ) ); + } else if ( paste ) { + emit m_extension->setActionText( "paste", i18n( "&Paste clipboard contents" ) ); + } emit m_extension->enableAction( "paste", paste ); // TODO : if only one url, check that it's a dir }