[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 128980] Context menu needs "copy path to clipboard"
From: Max Howell <max.howell () methylblue ! com>
Date: 2006-08-15 23:45:05
Message-ID: 20060815234505.21432.qmail () ktown ! kde ! org
[Download RAW message or body]
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
http://bugs.kde.org/show_bug.cgi?id=128980
max.howell methylblue com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From max.howell methylblue com 2006-08-16 01:44 -------
SVN commit 573393 by mhowell:
Add a copy to clipboard menu item to right click menu for segments.
BUG: 128980
M +1 -0 TODO
M +6 -6 src/part/part.cpp
M +53 -44 src/part/radialMap/widgetEvents.cpp [POSSIBLY UNSAFE: \
KRun::runCommand]
--- trunk/extragear/utils/filelight/TODO #573392:573393
@ -1,6 +1,7 @
1.1
If scanning a partition show free space
if the view is square shrink the map slightly as a slightly rectangular view is \
preferable + use kdirwatcher, then move rescan to scan menu, rename force rescan
1.0
better summary screen, use mtab properly, remove horrid codebase
--- trunk/extragear/utils/filelight/src/part/part.cpp #573392:573393
@ -39,12 +39,12 @
Part::Part( QWidget *parentWidget, const char *widgetName, QObject *parent, const \
char *name, const QStringList& )
- : ReadOnlyPart( parent, name )
- , m_ext( new BrowserExtension( this ) )
- , m_statusbar( new StatusBarExtension( this ) )
- , m_map( 0 )
- , m_manager( new ScanManager( this ) )
- , m_started( false )
+ : ReadOnlyPart( parent, name )
+ , m_ext( new BrowserExtension( this ) )
+ , m_statusbar( new StatusBarExtension( this ) )
+ , m_map( 0 )
+ , m_manager( new ScanManager( this ) )
+ , m_started( false )
{
QPixmap::setDefaultOptimization( QPixmap::BestOptim );
--- trunk/extragear/utils/filelight/src/part/radialMap/widgetEvents.cpp \
#573392:573393 @ -5,6 +5,7 @
#include "radialMap.h" //class Segment
#include "widget.h"
+#include <cmath> //::segmentAt()
#include <kcursor.h> //::mouseMoveEvent()
#include <kiconeffect.h> //::mousePressEvent()
#include <kiconloader.h> //::mousePressEvent()
@ -13,8 +14,9 @
#include <kmessagebox.h> //::mousePressEvent()
#include <kpopupmenu.h> //::mousePressEvent()
#include <krun.h> //::mousePressEvent()
-#include <math.h> //::segmentAt()
+#include <kurldrag.h>
#include <qapplication.h>//QApplication::setOverrideCursor()
+#include <qclipboard.h>
#include <qpainter.h>
#include <qtimer.h> //::resizeEvent()
@ -147,6 +149,8 @
//m_tip is hidden already by event filter
//m_focus is set correctly (I've been strict, I assure you it is correct!)
+ enum { Konqueror, Konsole, Center, Open, Copy, Delete };
+
if( m_focus && !m_focus->isFake() )
{
const KURL url = Widget::url( m_focus->file() );
@ -157,74 +161,79 @
KPopupMenu popup;
popup.insertTitle( m_focus->file()->fullPath( m_tree ) );
- if( isDir )
- {
- popup.insertItem( SmallIconSet( "konqueror" ), i18n( "Open &Konqueror \
Here" ), 0 ); + if (isDir) {
+ popup.insertItem( SmallIconSet( "konqueror" ), i18n( "Open &Konqueror \
Here" ), Konqueror ); +
if( url.protocol() == "file" )
- popup.insertItem( SmallIconSet( "konsole" ), i18n( "Open &Konsole \
Here" ), 1 ); + popup.insertItem( SmallIconSet( "konsole" ), i18n( \
"Open &Konsole Here" ), Konsole );
- if( m_focus->file() != m_tree )
- {
+ if (m_focus->file() != m_tree) {
popup.insertSeparator();
- popup.insertItem( SmallIconSet( "viewmag" ), i18n( "&Center Map Here" \
), 2 ); + popup.insertItem( SmallIconSet( "viewmag" ), i18n( "&Center \
Map Here" ), Center ); }
}
- else popup.insertItem( SmallIconSet( "fileopen" ), i18n( "&Open" ), 3 );
+ else
+ popup.insertItem( SmallIconSet( "fileopen" ), i18n( "&Open" ), Open );
popup.insertSeparator();
- popup.insertItem( SmallIconSet( "editdelete" ), i18n( "&Delete" ), 4 );
+ popup.insertItem( SmallIconSet( "editcopy" ), i18n( "&Copy to clipboard" ), \
Copy );
- switch( popup.exec( e->globalPos(), 1 ) ) {
- case 0:
- //KRun::runCommand will show an error message if there was trouble
- KRun::runCommand( QString( "kfmclient openURL \"%1\"" ).arg( url.url() ) \
);
- break;
+ popup.insertSeparator();
+ popup.insertItem( SmallIconSet( "editdelete" ), i18n( "&Delete" ), Delete \
);
- case 1:
- // --workdir only works for local file paths
- KRun::runCommand( QString( "konsole --workdir \"%1\"" ).arg( url.path() \
) );
- break;
+ switch (popup.exec( e->globalPos(), 1 )) {
+ case Konqueror:
+ //KRun::runCommand will show an error message if there was trouble
+ KRun::runCommand( QString( "kfmclient openURL \"%1\"" ).arg( \
url.url() ) ); + break;
- case 2:
- case 3:
- goto sectionTwo;
+ case Konsole:
+ // --workdir only works for local file paths
+ KRun::runCommand( QString( "konsole --workdir \"%1\"" ).arg( \
url.path() ) ); + break;
- case 4:
- {
- const KURL url = Widget::url( m_focus->file() );
- const QString message = ( m_focus->file()->isDirectory()
- ? i18n( "<qt>The directory at <i>'%1'</i> will be <b>recursively</b> \
and <b>permanently</b> deleted." )
- : i18n( "<qt><i>'%1'</i> will be <b>permanently</b> deleted." )).arg( \
url.prettyURL() );
- const int userIntention = KMessageBox::warningContinueCancel( this, \
message, QString::null, KGuiItem( i18n("&Delete"), "editdelete" ) ); + \
case Center: + case Open:
+ goto section_two;
- if( userIntention == KMessageBox::Continue ) {
- KIO::Job *job = KIO::del( url );
- job->setWindow( this );
- connect( job, SIGNAL(result( KIO::Job* )), SLOT(deleteJobFinished( \
KIO::Job* )) );
- QApplication::setOverrideCursor( KCursor::workingCursor() );
+ case Copy:
+ QApplication::clipboard()->setData( new KURLDrag( KURL::List( url ) \
) ); + break;
+
+ case Delete:
+ {
+ const KURL url = Widget::url( m_focus->file() );
+ const QString message = ( m_focus->file()->isDirectory()
+ ? i18n( "<qt>The directory at <i>'%1'</i> will be <b>recursively</b> \
and <b>permanently</b> deleted." ) + : i18n( "<qt><i>'%1'</i> will be \
<b>permanently</b> deleted." )).arg( url.prettyURL() ); + const int \
userIntention = KMessageBox::warningContinueCancel( this, message, QString::null, \
KGuiItem( i18n("&Delete"), "editdelete" ) ); +
+ if( userIntention == KMessageBox::Continue ) {
+ KIO::Job *job = KIO::del( url );
+ job->setWindow( this );
+ connect( job, SIGNAL(result( KIO::Job* )), SLOT(deleteJobFinished( \
KIO::Job* )) ); + QApplication::setOverrideCursor( \
KCursor::workingCursor() ); + }
}
- }
- default:
- //ensure m_focus is set for new mouse position
- sendFakeMouseEvent();
+ default:
+ //ensure m_focus is set for new mouse position
+ sendFakeMouseEvent();
}
} else {
- sectionTwo:
-
+ section_two:
const QRect rect( e->x() - 20, e->y() - 20, 40, 40 );
m_tip->hide(); //user expects this
- if( !isDir || e->button() == Qt::MidButton )
- {
+ if (!isDir || e->button() == Qt::MidButton) {
KIconEffect::visualActivate( this, rect );
new KRun( url, this, true ); //FIXME see above
}
- else if( m_focus->file() != m_tree ) //is left mouse button
- {
+ else if (m_focus->file() != m_tree) {
+ //is left mouse button
KIconEffect::visualActivate( this, rect );
emit activated( url ); //activate first, this will cause UI to prepare \
itself createFromCache( (Directory *)m_focus->file() );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic