CVS commit by faure: Retitle the Paste action depending on what it's going to paste: file, N files, url, N urls, or "clipboard contents". Hmm, should the latter be "Paste clipboard into file"? FEATURE: 39489 The downside of this is the huge text for people using text-under-toolbar-icons, but that's a separate KAction problem. M +17 -0 konq_mainwindow.cc 1.1410 M +4 -2 konq_mainwindow.h 1.460 M +15 -3 konq_view.cc 1.365 M +5 -4 konq_view.h 1.175 --- kdebase/konqueror/konq_mainwindow.cc #1.1409:1.1410 @@ -4144,4 +4144,7 @@ void KonqMainWindow::connectExtension( K connect( act, SIGNAL( activated() ), ext, it.data() /* SLOT(slot name) */ ); act->setEnabled( ext->isActionEnabled( it.key() ) ); + const QString text = ext->actionText( it.key() ); + if ( !text.isEmpty() ) + act->setText( text ); } else act->setEnabled(false); @@ -4209,4 +4212,16 @@ void KonqMainWindow::enableAction( const } +void KonqMainWindow::setActionText( const char * name, const QString& text ) +{ + KAction * act = actionCollection()->action( name ); + if (!act) + kdWarning(1202) << "Unknown action " << name << " - can't enable" << endl; + else + { + kdDebug(1202) << "KonqMainWindow::setActionText " << name << " " << text << endl; + act->setText( text ); + } +} + void KonqMainWindow::currentProfileChanged() { @@ -4950,4 +4965,6 @@ void KonqMainWindow::updateViewModeActio #ifndef NDEBUG + // Note that this can happen (map not empty) when a inode/directory view is removed, + // and remains in the KConfig file. Q_ASSERT( preferredServiceMap.isEmpty() ); QMap::Iterator debugIt = preferredServiceMap.begin(); --- kdebase/konqueror/konq_mainwindow.h #1.459:1.460 @@ -1,3 +1,4 @@ -/* This file is part of the KDE project +/* -*- c-basic-offset:2 -*- + This file is part of the KDE project Copyright (C) 1998, 1999 Simon Hausmann Copyright (C) 2000-2004 David Faure @@ -237,4 +238,5 @@ public: void enableAction( const char * name, bool enabled ); + void setActionText( const char * name, const QString& text ); /** --- kdebase/konqueror/konq_view.cc #1.364:1.365 @@ -1,4 +1,5 @@ -/* This file is part of the KDE project - Copyright (C) 1998, 1999 David Faure +/* -*- c-basic-offset: 2 -*- + This file is part of the KDE project + Copyright (C) 1998-2005 David Faure This program is free software; you can redistribute it and/or @@ -428,4 +429,7 @@ void KonqView::connectPart( ) this, SLOT( slotEnableAction( const char *, bool ) ) ); + connect( ext, SIGNAL( setActionText( const char *, const QString& ) ), + this, SLOT( slotSetActionText( const char *, const QString& ) ) ); + connect( ext, SIGNAL( moveTopLevelWidget( int, int ) ), this, SLOT( slotMoveTopLevelWidget( int, int ) ) ); @@ -487,4 +491,12 @@ void KonqView::slotEnableAction( const c } +void KonqView::slotSetActionText( const char* name, const QString& text ) +{ + if ( m_pMainWindow->currentView() == this ) + m_pMainWindow->setActionText( name, text ); + // Otherwise, we don't have to do anything, the state of the action is + // stored inside the browser-extension. +} + void KonqView::slotMoveTopLevelWidget( int x, int y ) { --- kdebase/konqueror/konq_view.h #1.174:1.175 @@ -1,5 +1,5 @@ -/* +/* -*- c-basic-offset: 2 -*- * This file is part of the KDE project - * Copyright (C) 1998, 1999 David Faure + * Copyright (C) 1998-2005 David Faure * * This program is free software; you can redistribute it and/or modify @@ -376,4 +376,5 @@ protected slots: void slotOpenURLNotify(); void slotEnableAction( const char * name, bool enabled ); + void slotSetActionText( const char* name, const QString& text ); void slotMoveTopLevelWidget( int x, int y ); void slotResizeTopLevelWidget( int w, int h );