[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: File drop popup menu removal
From: Ishai Asa <ishaiasa () 012 ! net ! il>
Date: 2004-09-04 15:18:11
Message-ID: 4139DCB3.80300 () 012 ! net ! il
[Download RAW message or body]
Hello,
Attached are patches (one for kdebase 3.2.2 and the other for kdebase
3.3.0) which removes the popup menu when droping files in konqueror.
The suggested behavior is as follows:
Drop - move
Ctrl-Drop - copy
Ctrl-Shift-Drop - link
Best regards,
Ishai Asa
["diff3.3" (text/plain)]
--- /home/ishai/temp/kdebase-3.3.0/libkonq/konq_operations.cc 2004-07-17 \
20:52:21.000000000 +0300
+++ konq_operations.cc 2004-09-04 18:01:35.283788016 +0300
@@ -575,22 +575,6 @@
else if ( (((m_info->keybstate & ControlMask) == 0) && ((m_info->keybstate & \
ShiftMask) == 0)) || linkOnly )
{
- KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent());
- bool bSetWallpaper = false;
- if (iconView && iconView->maySetWallpaper() &&
- (lst.count() == 1) &&
- ((!KImageIO::type(lst.first().path()).isEmpty()) ||
- (KImageIO::isSupported(KMimeType::findByURL(lst.first())->name(),
- KImageIO::Reading))))
- {
- bSetWallpaper = true;
- }
-
- // Check what the source can do
- KURL url = lst.first(); // we'll assume it's the same for all URLs (hack)
- bool sReading = KProtocolInfo::supportsReading( url );
- bool sDeleting = KProtocolInfo::supportsDeleting( url );
- bool sMoving = KProtocolInfo::supportsMoving( url );
// Check what the destination can do
bool dWriting = KProtocolInfo::supportsWriting( m_destURL );
if ( !dWriting )
@@ -598,37 +582,12 @@
delete this;
return;
}
- //bool sTrash = url.path(1) == KGlobalSettings::trashPath();
- // Nor control nor shift are pressed => show popup menu
-
- QPopupMenu popup;
- if (!mlst.isEmpty() && (sMoving || (sReading && sDeleting)) && !linkOnly )
- popup.insertItem(SmallIconSet("goto"), i18n( "&Move Here" ), 2 );
- if ( sReading && !linkOnly)
- popup.insertItem(SmallIconSet("editcopy"), i18n( "&Copy Here" ), 1 );
- popup.insertItem(SmallIconSet("www"), i18n( "&Link Here" ), 3 );
- if (bSetWallpaper)
- popup.insertItem(SmallIconSet("background"), i18n( "Set as &Wallpaper" \
), 4 );
- popup.insertSeparator();
- popup.insertItem(SmallIconSet("cancel"), i18n( "C&ancel" ), 5);
-
- int result = popup.exec( m_info->mousePos );
-
- switch (result) {
- case 1 : action = QDropEvent::Copy; break;
- case 2 : action = QDropEvent::Move; break;
- case 3 : action = QDropEvent::Link; break;
- case 4 :
- {
- kdDebug(1203) << "setWallpaper iconView=" << iconView << " url=" << \
lst.first().url() << endl;
- if (iconView && iconView->isDesktop() ) \
iconView->setWallpaper(lst.first());
- delete this;
- return;
- }
- case 5 :
- default : delete this; return;
- }
+ action = QDropEvent::Move;
}
+ else if (m_info->keybstate & ControlMask != 0 && m_info->keybstate & ShiftMask == \
0) + action = QDropEvent::Copy;
+ else if (m_info->keybstate & ControlMask != 0 && m_info->keybstate & ShiftMask != \
0) + action = QDropEvent::Link;
KIO::Job * job = 0;
switch ( action ) {
["diff3.2.2" (text/plain)]
--- /home/ishai/temp/kdebase-3.2.2/libkonq/konq_operations.cc 2004-04-04 \
09:43:56.000000000 +0200
+++ konq_operations.cc 2004-09-04 17:52:26.969144512 +0300
@@ -526,6 +526,7 @@
delete this;
}
+
void KonqOperations::doFileCopy()
{
assert(m_info); // setDropInfo - and asyncDrop - should have been called before \
asyncDrop @@ -574,22 +575,6 @@
else if ( (((m_info->keybstate & ControlMask) == 0) && ((m_info->keybstate & \
ShiftMask) == 0)) || linkOnly )
{
- KonqIconViewWidget *iconView = dynamic_cast<KonqIconViewWidget*>(parent());
- bool bSetWallpaper = false;
- if (iconView && iconView->maySetWallpaper() &&
- (lst.count() == 1) &&
- ((!KImageIO::type(lst.first().path()).isEmpty()) ||
- (KImageIO::isSupported(KMimeType::findByURL(lst.first())->name(),
- KImageIO::Reading))))
- {
- bSetWallpaper = true;
- }
-
- // Check what the source can do
- KURL url = lst.first(); // we'll assume it's the same for all URLs (hack)
- bool sReading = KProtocolInfo::supportsReading( url );
- bool sDeleting = KProtocolInfo::supportsDeleting( url );
- bool sMoving = KProtocolInfo::supportsMoving( url );
// Check what the destination can do
bool dWriting = KProtocolInfo::supportsWriting( m_destURL );
if ( !dWriting )
@@ -597,37 +582,13 @@
delete this;
return;
}
- //bool sTrash = url.path(1) == KGlobalSettings::trashPath();
- // Nor control nor shift are pressed => show popup menu
-
- QPopupMenu popup;
- if (!mlst.isEmpty() && (sMoving || (sReading && sDeleting)) && !linkOnly )
- popup.insertItem( i18n( "&Move Here" ), 2 );
- if ( sReading && !linkOnly)
- popup.insertItem(SmallIconSet("editcopy"), i18n( "&Copy Here" ), 1 );
- popup.insertItem(SmallIconSet("www"), i18n( "&Link Here" ), 3 );
- if (bSetWallpaper)
- popup.insertItem(SmallIconSet("background"), i18n( "Set as &Wallpaper" \
), 4 );
- popup.insertSeparator();
- popup.insertItem(SmallIconSet("cancel"), i18n( "C&ancel" ), 5);
-
- int result = popup.exec( m_info->mousePos );
-
- switch (result) {
- case 1 : action = QDropEvent::Copy; break;
- case 2 : action = QDropEvent::Move; break;
- case 3 : action = QDropEvent::Link; break;
- case 4 :
- {
- kdDebug(1203) << "setWallpaper iconView=" << iconView << " url=" << \
lst.first().url() << endl;
- if (iconView && iconView->isDesktop() ) \
iconView->setWallpaper(lst.first());
- delete this;
- return;
- }
- case 5 :
- default : delete this; return;
- }
+ action = QDropEvent::Move;
}
+ else if (m_info->keybstate & ControlMask != 0 && m_info->keybstate & ShiftMask == \
0) { + action = QDropEvent::Copy;
+ } else if (m_info->keybstate & ControlMask != 0 && m_info->keybstate & ShiftMask != \
0) { + action = QDropEvent::Link;
+ }
KIO::Job * job = 0;
switch ( action ) {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic