Merging branches/work/kaction-cleanup-branch, done by Kevin and me.

This removes some usage of KAction in our public API so that one can use QActions
with KDE classes, too, and it removes some use of deprecated API in the apps.

svn path=/trunk/KDE/kdebase/libkonq/; revision=610651
This commit is contained in:
Simon Hausmann 2006-12-04 20:44:12 +00:00
parent f96425c11b
commit 009dc1a355
10 changed files with 61 additions and 60 deletions

View file

@ -412,7 +412,7 @@ KonqAboutPage::KonqAboutPage( //KonqMainWindow *
else
setCharset("iso-8859-1", true);
// about:blah isn't a kioslave -> disable View source
KAction * act = actionCollection()->action("viewDocumentSource");
QAction * act = actionCollection()->action("viewDocumentSource");
if ( act )
act->setEnabled( false );
}

View file

@ -132,9 +132,9 @@ PopupMenuGUIClient::~PopupMenuGUIClient()
{
}
KAction *PopupMenuGUIClient::action( const QDomElement &element ) const
QAction *PopupMenuGUIClient::action( const QDomElement &element ) const
{
KAction *res = KXMLGUIClient::action( element );
QAction *res = KXMLGUIClient::action( element );
if ( !res )
res = m_mainWindow->action( element );
@ -220,7 +220,7 @@ ToggleViewGUIClient::~ToggleViewGUIClient()
{
}
QList<KAction*> ToggleViewGUIClient::actions() const
QList<QAction*> ToggleViewGUIClient::actions() const
{
return m_actions.values();
}
@ -313,7 +313,7 @@ void ToggleViewGUIClient::slotViewAdded( KonqView *view )
{
QString name = view->service()->desktopEntryName();
KAction *action = m_actions.value( name );
QAction *action = m_actions.value( name );
if ( action )
{
@ -347,7 +347,7 @@ void ToggleViewGUIClient::slotViewRemoved( KonqView *view )
{
QString name = view->service()->desktopEntryName();
KAction *action = m_actions.value( name );
QAction *action = m_actions.value( name );
if ( action )
{

View file

@ -25,7 +25,7 @@
#include <QHash>
#include <kservice.h>
class KAction;
class QAction;
class KActionCollection;
class KonqMainWindow;
class KonqView;
@ -59,7 +59,7 @@ public:
bool isIntoTrash, bool doTabHandling );
virtual ~PopupMenuGUIClient();
virtual KAction *action( const QDomElement &element ) const;
virtual QAction *action( const QDomElement &element ) const;
private:
void addEmbeddingService( QDomElement &menu, int idx, const QString &name, const KService::Ptr &service );
@ -78,8 +78,8 @@ public:
bool empty() const { return m_empty; }
QList<KAction*> actions() const;
KAction *action( const QString &name ) { return m_actions[ name ]; }
QList<QAction*> actions() const;
QAction *action( const QString &name ) { return m_actions[ name ]; }
void saveConfig( bool add, const QString &serviceName );
@ -89,7 +89,7 @@ private Q_SLOTS:
void slotViewRemoved( KonqView *view );
private:
KonqMainWindow *m_mainWindow;
QHash<QString,KAction*> m_actions;
QHash<QString,QAction*> m_actions;
bool m_empty;
QMap<QString,bool> m_mapOrientation;
};

View file

@ -1874,7 +1874,7 @@ void KonqMainWindow::slotGoAutostart()
void KonqMainWindow::slotGoHistory()
{
KAction *a = m_toggleViewGUIClient->action("konq_sidebartng");
QAction *a = m_toggleViewGUIClient->action("konq_sidebartng");
if (!a) {
KMessageBox::sorry(0, i18n("Your sidebar is not functional or unavailable."), i18n("Show History Sidebar"));
return;
@ -2072,7 +2072,7 @@ void KonqMainWindow::applyKonqMainWindowSettings()
{
// Find the action by name
// KAction * act = m_toggleViewGUIClient->actionCollection()->action( (*togIt).toLatin1() );
KAction *act = m_toggleViewGUIClient->action( *togIt );
QAction *act = m_toggleViewGUIClient->action( *togIt );
if ( act )
act->trigger();
else
@ -2164,7 +2164,7 @@ void KonqMainWindow::slotPartActivated( KParts::Part *part )
for ( ; it != itEnd ; ++it )
{
KAction * act = actionCollection()->action( it.key().data() );
QAction * act = actionCollection()->action( it.key().data() );
Q_ASSERT(act);
if (act)
act->setEnabled( false );
@ -3348,8 +3348,8 @@ bool KonqMainWindow::eventFilter(QObject*obj,QEvent *ev)
// but the duplicate_window action also has Ctrl-D as accel and
// prevents the lineedit from getting this event. IMHO the accel
// should be disabled in favor of the focus-widget.
KAction *duplicate = actionCollection()->action("duplicate_window");
if ( duplicate->shortcut().contains( QKeySequence(Qt::CTRL+Qt::Key_D) ))
QAction *duplicate = actionCollection()->action("duplicate_window");
if ( duplicate->shortcuts().contains( QKeySequence(Qt::CTRL+Qt::Key_D) ))
duplicate->setEnabled( false );
if (slotMetaObject && slotMetaObject->indexOfSlot("cut()") != -1)
@ -3389,8 +3389,8 @@ bool KonqMainWindow::eventFilter(QObject*obj,QEvent *ev)
// see above in FocusIn for explanation
// we use new_window as reference, as it's always in the same state
// as duplicate_window
KAction *duplicate = actionCollection()->action("duplicate_window");
if ( duplicate->shortcut().contains( QKeySequence(Qt::CTRL+Qt::Key_D) ) )
QAction *duplicate = actionCollection()->action("duplicate_window");
if ( duplicate->shortcuts().contains( QKeySequence(Qt::CTRL+Qt::Key_D) ) )
duplicate->setEnabled( actionCollection()->action("new_window")->isEnabled() );
if (slotMetaObject && slotMetaObject->indexOfSlot("cut()") != -1)
@ -3492,7 +3492,7 @@ void KonqMainWindow::slotUpdateFullScreen( bool set )
{
//Are we plugged here, in a visible toolbar?
if (bar->isVisible() &&
action( "fullscreen" )->isPlugged(bar))
action( "fullscreen" )->associatedWidgets().contains(bar))
{
haveFullScreenButton = true;
break;
@ -3501,7 +3501,7 @@ void KonqMainWindow::slotUpdateFullScreen( bool set )
if (!haveFullScreenButton)
{
QList<KAction*> lst;
QList<QAction*> lst;
lst.append( m_ptaFullScreen );
plugActionList( "fullscreen", lst );
}
@ -3572,7 +3572,7 @@ void KonqMainWindow::setPageSecurity( PageSecurity pageSecurity )
void KonqMainWindow::showPageSecurity()
{
if ( m_currentView && m_currentView->part() ) {
KAction *act = m_currentView->part()->action( "security" );
QAction *act = m_currentView->part()->action( "security" );
if ( act )
act->trigger();
}
@ -3920,7 +3920,7 @@ void KonqMainWindow::initActions()
m_pBookmarkMenu = new KonqBookmarkMenu( KonqBookmarkManager::self(), m_pBookmarksOwner, m_pamBookmarks, m_bookmarksActionCollection );
KAction *addBookmark = actionCollection()->action("add_bookmark");
QAction *addBookmark = actionCollection()->action("add_bookmark");
if (addBookmark)
addBookmark->setText(i18n("Bookmark This Location"));
@ -4181,7 +4181,7 @@ void KonqMainWindow::updateViewActions()
connect(m_paNewDir, SIGNAL(triggered(bool) ), SLOT( slotNewDir() ));
m_paNewDir->setShortcut(Qt::Key_F10);
QList<KAction*> lst;
QList<QAction*> lst;
lst.append( m_paCopyFiles );
lst.append( m_paMoveFiles );
m_paCopyFiles->setEnabled( false );
@ -4234,7 +4234,7 @@ void KonqMainWindow::connectExtension( KParts::BrowserExtension *ext )
for ( ; it != itEnd ; ++it )
{
KAction * act = actionCollection()->action( it.key().data() );
QAction * act = actionCollection()->action( it.key().data() );
//kDebug(1202) << it.key() << endl;
if ( act )
{
@ -4266,7 +4266,7 @@ void KonqMainWindow::disconnectExtension( KParts::BrowserExtension *ext )
for ( ; it != itEnd ; ++it )
{
KAction * act = actionCollection()->action( it.key().data() );
QAction * act = actionCollection()->action( it.key().data() );
//kDebug(1202) << it.key() << endl;
if ( act && ext->metaObject()->indexOfSlot( it.key()+"()" ) != -1 )
{
@ -4289,7 +4289,7 @@ void KonqMainWindow::slotTrashActivated( Qt::MouseButtons, Qt::KeyboardModifiers
void KonqMainWindow::enableAction( const char * name, bool enabled )
{
KAction * act = actionCollection()->action( name );
QAction * act = actionCollection()->action( name );
if (!act)
kWarning(1202) << "Unknown action " << name << " - can't enable" << endl;
else
@ -4315,7 +4315,7 @@ void KonqMainWindow::enableAction( const char * name, bool enabled )
void KonqMainWindow::setActionText( const char * name, const QString& text )
{
KAction * act = actionCollection()->action( name );
QAction * act = actionCollection()->action( name );
if (!act)
kWarning(1202) << "Unknown action " << name << " - can't enable" << endl;
else
@ -4338,12 +4338,12 @@ void KonqMainWindow::enableAllActions( bool enable )
kDebug(1202) << "KonqMainWindow::enableAllActions " << enable << endl;
KParts::BrowserExtension::ActionSlotMap * actionSlotMap = KParts::BrowserExtension::actionSlotMapPtr();
QList<KAction *> actions = actionCollection()->actions();
QList<KAction *>::Iterator it = actions.begin();
QList<KAction *>::Iterator end = actions.end();
QList<QAction *> actions = actionCollection()->actions();
QList<QAction *>::Iterator it = actions.begin();
QList<QAction *>::Iterator end = actions.end();
for (; it != end; ++it )
{
KAction *act = *it;
QAction *act = *it;
if ( !act->objectName().startsWith("options_configure") /* do not touch the configureblah actions */
&& ( !enable || !actionSlotMap->contains( act->objectName().toLatin1() ) ) ) /* don't enable BE actions */
act->setEnabled( enable );
@ -4369,7 +4369,7 @@ void KonqMainWindow::enableAllActions( bool enable )
if (m_toggleViewGUIClient)
{
QList<KAction*> actions = m_toggleViewGUIClient->actions();
QList<QAction*> actions = m_toggleViewGUIClient->actions();
for (int i = 0; i < actions.size(); ++i) {
actions.at(i)->setEnabled( true );
}
@ -4397,7 +4397,7 @@ void KonqMainWindow::disableActionsNoView()
m_paLinkView->setEnabled( false );
if (m_toggleViewGUIClient)
{
QList<KAction*> actions = m_toggleViewGUIClient->actions();
QList<QAction*> actions = m_toggleViewGUIClient->actions();
for (int i = 0; i < actions.size(); ++i) {
actions.at(i)->setEnabled( false );
}
@ -4413,7 +4413,7 @@ void KonqMainWindow::disableActionsNoView()
"go_url", "go_media", "go_history", "options_configure_extensions", 0 };
for ( int i = 0 ; s_enActions[i] ; ++i )
{
KAction * act = action(s_enActions[i]);
QAction * act = action(s_enActions[i]);
if (act)
act->setEnabled( true );
}
@ -5138,7 +5138,7 @@ void KonqMainWindow::saveToolBarServicesMap()
void KonqMainWindow::plugViewModeActions()
{
QList<KAction*> lst;
QList<QAction*> lst;
lst.append( m_viewModeMenu );
plugActionList( "viewmode", lst );
// display the toolbar viewmode icons only for inode/directory, as here we have dedicated icons
@ -5316,8 +5316,8 @@ void KonqMainWindow::slotOpenURL( const KUrl& url )
bool KonqMainWindow::sidebarVisible() const
{
KAction *a = m_toggleViewGUIClient->action("konq_sidebartng");
return (a && static_cast<KToggleAction*>(a)->isChecked());
QAction *a = m_toggleViewGUIClient->action("konq_sidebartng");
return (a && static_cast<KToggleAction*>(a)->isChecked());
}
void KonqMainWindow::slotAddWebSideBar(const KUrl& url, const QString& name)
@ -5327,7 +5327,7 @@ void KonqMainWindow::slotAddWebSideBar(const KUrl& url, const QString& name)
kDebug(1202) << "Requested to add URL " << url << " [" << name << "] to the sidebar!" << endl;
KAction *a = m_toggleViewGUIClient->action("konq_sidebartng");
QAction *a = m_toggleViewGUIClient->action("konq_sidebartng");
if (!a) {
KMessageBox::sorry(0, i18n("Your sidebar is not functional or unavailable. A new entry cannot be added."), i18n("Web Sidebar"));
return;

View file

@ -53,6 +53,7 @@
#include <ktogglefullscreenaction.h>
class QFile;
class QAction;
class KAction;
class KActionCollection;
class KActionMenu;
@ -622,7 +623,7 @@ private: // members
KAction *m_paSaveViewProfile;
KToggleAction *m_paSaveViewPropertiesLocally;
KAction *m_paRemoveLocalProperties;
QAction *m_paRemoveLocalProperties;
KAction *m_paSplitViewHor;
KAction *m_paSplitViewVer;
@ -734,10 +735,10 @@ private: // members
QString m_initialFrameName;
QList<KAction *> m_openWithActions;
QList<QAction *> m_openWithActions;
KActionMenu *m_viewModeMenu;
QActionGroup* m_viewModesGroup;
QList<KAction*> m_toolBarViewModeActions; // basically holds three KonqViewActions, one of
QList<QAction*> m_toolBarViewModeActions; // basically holds three KonqViewActions, one of
// iconview, one for listview, and one for externals
QActionGroup* m_toolBarViewModesGroup;
QList<KToggleAction *> m_viewModeActions;

View file

@ -84,18 +84,18 @@ KonqFrameTabs::KonqFrameTabs(QWidget* parent, KonqFrameContainerBase* parentCont
i18n("&New Tab"),
m_pViewManager->mainWindow(),
SLOT( slotAddTab() ),
m_pViewManager->mainWindow()->action("newtab")->shortcut().primary() );
m_pViewManager->mainWindow()->action("newtab")->shortcut() );
m_pPopupMenu->insertItem( SmallIconSet( "tab_duplicate" ),
i18n("&Duplicate Tab"),
m_pViewManager->mainWindow(),
SLOT( slotDuplicateTabPopup() ),
m_pViewManager->mainWindow()->action("duplicatecurrenttab")->shortcut().primary(),
m_pViewManager->mainWindow()->action("duplicatecurrenttab")->shortcut(),
DUPLICATE_ID );
m_pPopupMenu->insertItem( SmallIconSet( "reload" ),
i18n( "&Reload Tab" ),
m_pViewManager->mainWindow(),
SLOT( slotReloadPopup() ),
m_pViewManager->mainWindow()->action("reload")->shortcut().primary(), RELOAD_ID );
m_pViewManager->mainWindow()->action("reload")->shortcut(), RELOAD_ID );
m_pPopupMenu->addSeparator();
m_pSubPopupMenuTab = new QMenu( this );
m_pPopupMenu->insertItem( i18n("Other Tabs" ), m_pSubPopupMenuTab, OTHERTABS_ID );
@ -106,14 +106,14 @@ KonqFrameTabs::KonqFrameTabs(QWidget* parent, KonqFrameContainerBase* parentCont
i18n("D&etach Tab"),
m_pViewManager->mainWindow(),
SLOT( slotBreakOffTabPopup() ),
m_pViewManager->mainWindow()->action("breakoffcurrenttab")->shortcut().primary(),
m_pViewManager->mainWindow()->action("breakoffcurrenttab")->shortcut(),
BREAKOFF_ID );
m_pPopupMenu->addSeparator();
m_pPopupMenu->insertItem( SmallIconSet( "tab_remove" ),
i18n("&Close Tab"),
m_pViewManager->mainWindow(),
SLOT( slotRemoveTabPopup() ),
m_pViewManager->mainWindow()->action("removecurrenttab")->shortcut().primary(),
m_pViewManager->mainWindow()->action("removecurrenttab")->shortcut(),
CLOSETAB_ID );
connect( this, SIGNAL( contextMenu( QWidget *, const QPoint & ) ),
SLOT(slotContextMenu( QWidget *, const QPoint & ) ) );
@ -408,7 +408,7 @@ void KonqFrameTabs::refreshSubPopupMenuTab()
i18n( "&Reload All Tabs" ),
m_pViewManager->mainWindow(),
SLOT( slotReloadAllTabs() ),
m_pViewManager->mainWindow()->action("reload_all_tabs")->shortcut().primary() );
m_pViewManager->mainWindow()->action("reload_all_tabs")->shortcut() );
m_pSubPopupMenuTab->addSeparator();
foreach (KonqFrameBase* frameBase, *m_pChildFrameList)
{
@ -430,7 +430,7 @@ void KonqFrameTabs::refreshSubPopupMenuTab()
i18n( "Close &Other Tabs" ),
m_pViewManager->mainWindow(),
SLOT( slotRemoveOtherTabsPopup() ),
m_pViewManager->mainWindow()->action("removeothertabs")->shortcut().primary() );
m_pViewManager->mainWindow()->action("removeothertabs")->shortcut() );
}
void KonqFrameTabs::slotCloseRequest( QWidget *w )

View file

@ -96,7 +96,7 @@ KWrite::KWrite (KTextEditor::Document *doc)
}
doc = editor->createDocument(0);
// enable the modified on disk warning dialogs if any
if (qobject_cast<KTextEditor::ModificationInterface *>(doc))
qobject_cast<KTextEditor::ModificationInterface *>(doc)->setModifiedOnDiskWarning (true);
@ -374,9 +374,9 @@ void KWrite::slotDropEvent( QDropEvent *event )
void KWrite::slotEnableActions( bool enable )
{
QList<KAction *> actions = actionCollection()->actions();
QList<KAction *>::ConstIterator it = actions.begin();
QList<KAction *>::ConstIterator end = actions.end();
QList<QAction *> actions = actionCollection()->actions();
QList<QAction *>::ConstIterator it = actions.begin();
QList<QAction *>::ConstIterator end = actions.end();
for (; it != end; ++it )
(*it)->setEnabled( enable );
@ -644,7 +644,7 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
QByteArray kWriteVersion = QString ("%1.%2.%3").arg(KDE::versionMajor() + 1).arg(KDE::versionMinor()).arg(KDE::versionRelease()).toLatin1();
KAboutData aboutData ( "kwrite",
I18N_NOOP("KWrite"),
I18N_NOOP("KWrite"),
kWriteVersion,
I18N_NOOP( "KWrite - Text Editor" ), KAboutData::License_LGPL_V2,
I18N_NOOP( "(c) 2000-2005 The Kate Authors" ), 0, "http://www.kate-editor.org" );
@ -806,11 +806,11 @@ KWriteEditorChooser::KWriteEditorChooser(QWidget *):
connect( this, SIGNAL( okClicked() ), SLOT( slotOk() ) );
}
KWriteEditorChooser::~KWriteEditorChooser()
KWriteEditorChooser::~KWriteEditorChooser()
{
}
void KWriteEditorChooser::slotOk()
void KWriteEditorChooser::slotOk()
{
m_chooser->writeAppSetting();
}

View file

@ -263,8 +263,8 @@ void KNewMenu::fillMenu()
bool bSkip = false;
QList<KAction*> actions = d->m_actionCollection->actions();
QList<KAction*>::Iterator it = actions.begin();
QList<QAction*> actions = d->m_actionCollection->actions();
QList<QAction*>::Iterator it = actions.begin();
for( ; it != actions.end() && !bSkip; ++it )
{
if ( (*it)->text() == (*templ).text )

View file

@ -1081,11 +1081,11 @@ KPropertiesDialog* KonqPopupMenu::showPropertiesDialog()
return new KPropertiesDialog( m_lstItems, d->m_parentWidget );
}
KAction *KonqPopupMenu::action( const QDomElement &element ) const
QAction *KonqPopupMenu::action( const QDomElement &element ) const
{
QByteArray name = element.attribute( attrName ).toLatin1();
KAction *res = m_ownActions.action( name.data() );
QAction *res = m_ownActions.action( name.data() );
if ( !res )
res = m_actions.action( name.data() );

View file

@ -124,7 +124,7 @@ public:
/**
* Reimplemented for internal purpose
*/
virtual KAction *action( const QDomElement &element ) const;
virtual QAction *action( const QDomElement &element ) const;
virtual KActionCollection *actionCollection() const;