Commit 38a3dd36 authored by Hamish Rodda's avatar Hamish Rodda
Browse files

Port to new kdelibs snapshot. Most major changes are in konqueror due to

its reasonably heavy use of custom actions.

My kdelibs was a day old when i compiled, so if there is non-action
related porting still to do... it's probably still not done... will
check

svn path=/trunk/KDE/kdebase/libkonq/; revision=521386
parent 8d32d6ef
......@@ -599,31 +599,31 @@ static int directCommand(KCmdLineArgs *args)
if (args->count() >= 1) {
contextStr = QString::fromLocal8Bit(args->arg(0));
}
KIcon::Group group = KIcon::NoGroup;
K3Icon::Group group = K3Icon::NoGroup;
if ( groupStr == QLatin1String( "Desktop" ) )
group = KIcon::Desktop;
group = K3Icon::Desktop;
else if ( groupStr == QLatin1String( "Toolbar" ) )
group = KIcon::Toolbar;
group = K3Icon::Toolbar;
else if ( groupStr == QLatin1String( "MainToolbar" ) )
group = KIcon::MainToolbar;
group = K3Icon::MainToolbar;
else if ( groupStr == QLatin1String( "Small" ) )
group = KIcon::Small;
group = K3Icon::Small;
else if ( groupStr == QLatin1String( "Panel" ) )
group = KIcon::Panel;
group = K3Icon::Panel;
else if ( groupStr == QLatin1String( "User" ) )
group = KIcon::User;
KIcon::Context context = KIcon::Any;
group = K3Icon::User;
K3Icon::Context context = K3Icon::Any;
// From kicontheme.cpp
if ( contextStr == QLatin1String( "Devices" ) )
context = KIcon::Device;
context = K3Icon::Device;
else if ( contextStr == QLatin1String( "MimeTypes" ) )
context = KIcon::MimeType;
context = K3Icon::MimeType;
else if ( contextStr == QLatin1String( "FileSystems" ) )
context = KIcon::FileSystem;
context = K3Icon::FileSystem;
else if ( contextStr == QLatin1String( "Applications" ) )
context = KIcon::Application;
context = K3Icon::Application;
else if ( contextStr == QLatin1String( "Actions" ) )
context = KIcon::Action;
context = K3Icon::Action;
KIconDialog dlg((QWidget*)0L);
kapp->setTopWidget( &dlg );
......
......@@ -597,7 +597,7 @@ void ActionsImpl::slotChangeIcon() {
KEBApp::self()->bkInfo()->commitChanges();
KBookmark bk = KEBApp::self()->firstSelected();
KIconDialog dlg(KEBApp::self());
QString newIcon = dlg.selectIcon(KIcon::Small, KIcon::FileSystem);
QString newIcon = dlg.selectIcon(K3Icon::Small, K3Icon::FileSystem);
if (newIcon.isEmpty())
return;
EditCommand *cmd = new EditCommand(bk.address(), -1, newIcon);
......
......@@ -723,7 +723,6 @@ void KViewSearchLineWidget::createWidgets()
{
d->layout = new QHBoxLayout(this);
d->layout->setSpacing(5);
positionInToolBar();
if(!d->clearButton) {
d->clearButton = new QToolButton();
......@@ -752,34 +751,4 @@ KViewSearchLine *KViewSearchLineWidget::searchLine() const
return d->searchLine;
}
void KViewSearchLineWidget::positionInToolBar()
{
KToolBar *toolBar = dynamic_cast<KToolBar *>(parent());
if(toolBar) {
// Here we have The Big Ugly. Figure out how many widgets are in the
// and do a hack-ish iteration over them to find this widget so that we
// can insert the clear button before it.
int widgetCount = toolBar->count();
for(int index = 0; index < widgetCount; index++) {
int id = toolBar->idAt(index);
if(toolBar->getWidget(id) == this) {
toolBar->setItemAutoSized(id);
if(!d->clearButton) {
QString icon = QApplication::isRightToLeft() ? "clear_left" : "locationbar_erase";
d->clearButton = new KToolBarButton(icon, 2005, toolBar);
}
toolBar->insertWidget(2005, d->clearButton->width(), d->clearButton, index);
break;
}
}
}
if(d->searchLine)
d->searchLine->show();
}
#include "kebsearchline.moc"
......@@ -23,7 +23,6 @@
#include <kglobal.h>
#include <klocale.h>
#include <ktoolbar.h>
#include <ktoolbarbutton.h>
#include <kiconloader.h>
#include <kdebug.h>
......@@ -306,9 +305,6 @@ protected Q_SLOTS:
*/
virtual void createWidgets();
private Q_SLOTS:
void positionInToolBar();
private:
class KViewSearchLineWidgetPrivate;
KViewSearchLineWidgetPrivate *d;
......
......@@ -305,7 +305,7 @@ KfindTabWidget::KfindTabWidget(QWidget *parent, const char *name)
it != m_types.end(); ++it )
{
KMimeType::Ptr typ = *it;
typeBox->insertItem(typ->pixmap( KIcon::Small ), typ->comment());
typeBox->insertItem(typ->pixmap( K3Icon::Small ), typ->comment());
}
if ( editRegExp ) {
......
......@@ -47,28 +47,28 @@ KonqMainWindowIface::~KonqMainWindowIface()
void KonqMainWindowIface::openURL( QString url )
{
m_pMainWindow->openFilteredURL( url );
m_pMainWindow->openFilteredUrl( url );
}
void KonqMainWindowIface::newTab( QString url )
{
m_pMainWindow->openFilteredURL( url, true );
m_pMainWindow->openFilteredUrl( url, true );
}
void KonqMainWindowIface::openURL( QString url, bool tempFile )
{
m_pMainWindow->openFilteredURL( url, false, tempFile );
m_pMainWindow->openFilteredUrl( url, false, tempFile );
}
void KonqMainWindowIface::newTab( QString url, bool tempFile )
{
m_pMainWindow->openFilteredURL( url, true, tempFile );
m_pMainWindow->openFilteredUrl( url, true, tempFile );
}
void KonqMainWindowIface::newTabASN( QString url, const DCOPCString& startup_id, bool tempFile )
{
KStartupInfo::setNewStartupId( m_pMainWindow, startup_id );
m_pMainWindow->openFilteredURL( url, true, tempFile );
m_pMainWindow->openFilteredUrl( url, true, tempFile );
}
void KonqMainWindowIface::reload()
......
......@@ -96,15 +96,15 @@ QString KonqAboutPageFactory::launch()
return res;
KIconLoader *iconloader = KGlobal::iconLoader();
int iconSize = iconloader->currentSize(KIcon::Desktop);
QString home_icon_path = iconloader->iconPath("folder_home", KIcon::Desktop );
QString storage_icon_path = iconloader->iconPath("system", KIcon::Desktop );
QString remote_icon_path = iconloader->iconPath("network", KIcon::Desktop );
QString wastebin_icon_path = iconloader->iconPath("trashcan_full", KIcon::Desktop );
QString applications_icon_path = iconloader->iconPath("kmenu", KIcon::Desktop );
QString settings_icon_path = iconloader->iconPath("kcontrol", KIcon::Desktop );
int iconSize = iconloader->currentSize(K3Icon::Desktop);
QString home_icon_path = iconloader->iconPath("folder_home", K3Icon::Desktop );
QString storage_icon_path = iconloader->iconPath("system", K3Icon::Desktop );
QString remote_icon_path = iconloader->iconPath("network", K3Icon::Desktop );
QString wastebin_icon_path = iconloader->iconPath("trashcan_full", K3Icon::Desktop );
QString applications_icon_path = iconloader->iconPath("kmenu", K3Icon::Desktop );
QString settings_icon_path = iconloader->iconPath("kcontrol", K3Icon::Desktop );
QString home_folder = QDir::homePath();
QString continue_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("1leftarrow", KIcon::Small ):iconloader->iconPath("1rightarrow", KIcon::Small );
QString continue_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("1leftarrow", K3Icon::Small ):iconloader->iconPath("1rightarrow", K3Icon::Small );
res = res.arg( locate( "data", "kdeui/about/kde_infopage.css" ) );
if ( kapp->layoutDirection() == Qt::RightToLeft )
......@@ -147,7 +147,7 @@ QString KonqAboutPageFactory::launch()
.arg( i18n( "Settings" ) )
.arg( i18n( "Desktop configuration" ) )
.arg( continue_icon_path )
.arg( KIcon::SizeSmall ).arg( KIcon::SizeSmall )
.arg( K3Icon::SizeSmall ).arg( K3Icon::SizeSmall )
.arg( i18n( "Next: An Introduction to Konqueror" ) )
;
i18n("Search the Web");//i18n for possible future use
......@@ -167,9 +167,9 @@ QString KonqAboutPageFactory::intro()
return res;
KIconLoader *iconloader = KGlobal::iconLoader();
QString back_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("forward", KIcon::Small ):iconloader->iconPath("back", KIcon::Small );
QString gohome_icon_path = iconloader->iconPath("gohome", KIcon::Small );
QString continue_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("1leftarrow", KIcon::Small ):iconloader->iconPath("1rightarrow", KIcon::Small );
QString back_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("forward", K3Icon::Small ):iconloader->iconPath("back", K3Icon::Small );
QString gohome_icon_path = iconloader->iconPath("gohome", K3Icon::Small );
QString continue_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("1leftarrow", K3Icon::Small ):iconloader->iconPath("1rightarrow", K3Icon::Small );
res = res.arg( locate( "data", "kdeui/about/kde_infopage.css" ) );
if ( kapp->layoutDirection() == Qt::RightToLeft )
......@@ -222,7 +222,7 @@ QString KonqAboutPageFactory::specs()
KIconLoader *iconloader = KGlobal::iconLoader();
QString res = loadFile( locate( "data", "konqueror/about/specs.html" ));
QString continue_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("1leftarrow", KIcon::Small ):iconloader->iconPath("1rightarrow", KIcon::Small );
QString continue_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("1leftarrow", K3Icon::Small ):iconloader->iconPath("1rightarrow", K3Icon::Small );
if ( res.isEmpty() )
return res;
......@@ -308,20 +308,20 @@ QString KonqAboutPageFactory::tips()
KIconLoader *iconloader = KGlobal::iconLoader();
QString viewmag_icon_path =
iconloader->iconPath("viewmag", KIcon::Small );
iconloader->iconPath("viewmag", K3Icon::Small );
QString history_icon_path =
iconloader->iconPath("history", KIcon::Small );
iconloader->iconPath("history", K3Icon::Small );
QString openterm_icon_path =
iconloader->iconPath("openterm", KIcon::Small );
iconloader->iconPath("openterm", K3Icon::Small );
QString locationbar_erase_rtl_icon_path =
iconloader->iconPath("clear_left", KIcon::Small );
iconloader->iconPath("clear_left", K3Icon::Small );
QString locationbar_erase_icon_path =
iconloader->iconPath("locationbar_erase", KIcon::Small );
iconloader->iconPath("locationbar_erase", K3Icon::Small );
QString window_fullscreen_icon_path =
iconloader->iconPath("window_fullscreen", KIcon::Small );
iconloader->iconPath("window_fullscreen", K3Icon::Small );
QString view_left_right_icon_path =
iconloader->iconPath("view_left_right", KIcon::Small );
QString continue_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("1leftarrow", KIcon::Small ):iconloader->iconPath("1rightarrow", KIcon::Small );
iconloader->iconPath("view_left_right", K3Icon::Small );
QString continue_icon_path = QApplication::isRightToLeft()?iconloader->iconPath("1leftarrow", K3Icon::Small ):iconloader->iconPath("1rightarrow", K3Icon::Small );
res = res.arg( locate( "data", "kdeui/about/kde_infopage.css" ) );
if ( kapp->layoutDirection() == Qt::RightToLeft )
......
......@@ -113,7 +113,7 @@ QVariant KonqModel::data( const QModelIndex& index, int role ) const
if ( m_previews.contains( fileItem( index ) ) )
return m_previews[ fileItem( index ) ];
else
return QIcon( fileItem( index )->pixmap( KGlobal::iconLoader()->currentSize( KIcon::Desktop ) ) );
return QIcon( fileItem( index )->pixmap( KGlobal::iconLoader()->currentSize( K3Icon::Desktop ) ) );
else if ( role == Qt::FontRole )
return m_font;
else if ( role == Qt::TextColorRole )
......
......@@ -217,10 +217,10 @@ KonqKfmIconView::KonqKfmIconView( QWidget *parentWidget, QObject *parent, const
m_pamPreview = new KActionMenu( i18n( "&Preview" ), actionCollection(), "iconview_preview" );
m_paEnablePreviews = new KToggleAction( i18n("Enable Previews"), 0, actionCollection(), "iconview_preview_all" );
m_paEnablePreviews = new KToggleAction( i18n("Enable Previews"), actionCollection(), "iconview_preview_all" );
m_paEnablePreviews->setCheckedState( i18n("Disable Previews") );
connect( m_paEnablePreviews, SIGNAL( toggled( bool ) ), this, SLOT( slotPreview( bool ) ) );
m_paEnablePreviews->setIcon("thumbnail");
m_paEnablePreviews->setIconName("thumbnail");
m_pamPreview->insert( m_paEnablePreviews );
m_pamPreview->insert( new KActionSeparator(actionCollection()) );
......@@ -229,33 +229,36 @@ KonqKfmIconView::KonqKfmIconView( QWidget *parentWidget, QObject *parent, const
for ( KTrader::OfferList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it )
{
if ( KToggleAction*& preview = previewActions[ ( *it )->name() ] )
preview->setName( QByteArray( preview->name() ) + ',' + ( *it )->desktopEntryName().toLatin1() );
// Bypassing KAction restriction - this action will not be found via KActionCollection when doing a name search
preview->QAction::setName( QByteArray( preview->name() ) + ',' + ( *it )->desktopEntryName().toLatin1() );
else
{
preview = new KToggleAction( (*it)->name(), 0, actionCollection(), (*it)->desktopEntryName().toLatin1() );
preview = new KToggleAction( (*it)->name(), actionCollection(), (*it)->desktopEntryName().toLatin1() );
connect( preview, SIGNAL( toggled( bool ) ), this, SLOT( slotPreview( bool ) ) );
m_pamPreview->insert( preview );
m_paPreviewPlugins.append( preview );
}
}
KToggleAction *soundPreview = new KToggleAction( i18n("Sound Files"), 0, actionCollection(), "audio/" );
KToggleAction *soundPreview = new KToggleAction( i18n("Sound Files"), actionCollection(), "audio/" );
connect( soundPreview, SIGNAL( toggled( bool ) ), this, SLOT( slotPreview( bool ) ) );
m_pamPreview->insert( soundPreview );
m_paPreviewPlugins.append( soundPreview );
// m_pamSort = new KActionMenu( i18n( "Sort..." ), actionCollection(), "sort" );
KToggleAction *aSortByNameCS = new KRadioAction( i18n( "By Name (Case Sensitive)" ), 0, actionCollection(), "sort_nc" );
KToggleAction *aSortByNameCI = new KRadioAction( i18n( "By Name (Case Insensitive)" ), 0, actionCollection(), "sort_nci" );
KToggleAction *aSortBySize = new KRadioAction( i18n( "By Size" ), 0, actionCollection(), "sort_size" );
KToggleAction *aSortByType = new KRadioAction( i18n( "By Type" ), 0, actionCollection(), "sort_type" );
KToggleAction *aSortByDate = new KRadioAction( i18n( "By Date" ), 0, actionCollection(), "sort_date" );
KToggleAction *aSortByNameCS = new KToggleAction( i18n( "By Name (Case Sensitive)" ), actionCollection(), "sort_nc" );
KToggleAction *aSortByNameCI = new KToggleAction( i18n( "By Name (Case Insensitive)" ), actionCollection(), "sort_nci" );
KToggleAction *aSortBySize = new KToggleAction( i18n( "By Size" ), actionCollection(), "sort_size" );
KToggleAction *aSortByType = new KToggleAction( i18n( "By Type" ), actionCollection(), "sort_type" );
KToggleAction *aSortByDate = new KToggleAction( i18n( "By Date" ), actionCollection(), "sort_date" );
aSortByNameCS->setExclusiveGroup( "sorting" );
aSortByNameCI->setExclusiveGroup( "sorting" );
aSortBySize->setExclusiveGroup( "sorting" );
aSortByType->setExclusiveGroup( "sorting" );
aSortByDate->setExclusiveGroup( "sorting" );
QActionGroup* sorting = new QActionGroup(this);
sorting->setExclusive(true);
aSortByNameCS->setActionGroup( sorting );
aSortByNameCI->setActionGroup( sorting );
aSortBySize->setActionGroup( sorting );
aSortByType->setActionGroup( sorting );
aSortByDate->setActionGroup( sorting );
aSortByNameCS->setChecked( false );
aSortByNameCI->setChecked( false );
......@@ -271,11 +274,11 @@ KonqKfmIconView::KonqKfmIconView( QWidget *parentWidget, QObject *parent, const
//enable menu item representing the saved sorting criterion
QString sortcrit = KonqIconViewFactory::defaultViewProps()->sortCriterion();
KRadioAction *sort_action = dynamic_cast<KRadioAction *>(actionCollection()->action(sortcrit.toLatin1().constData()));
if(sort_action!=NULL) sort_action->activate();
KToggleAction *sort_action = dynamic_cast<KToggleAction *>(actionCollection()->action(sortcrit.toLatin1().constData()));
if(sort_action!=NULL) sort_action->trigger();
m_paSortDirsFirst = new KToggleAction( i18n( "Folders First" ), 0, actionCollection(), "sort_directoriesfirst" );
KToggleAction *aSortDescending = new KToggleAction( i18n( "Descending" ), 0, actionCollection(), "sort_descend" );
m_paSortDirsFirst = new KToggleAction( i18n( "Folders First" ), actionCollection(), "sort_directoriesfirst" );
KToggleAction *aSortDescending = new KToggleAction( i18n( "Descending" ), actionCollection(), "sort_descend" );
m_paSortDirsFirst->setChecked( KonqIconViewFactory::defaultViewProps()->isDirsFirst() );
......@@ -319,8 +322,8 @@ KonqKfmIconView::KonqKfmIconView( QWidget *parentWidget, QObject *parent, const
//m_paBottomText = new KToggleAction( i18n( "Text at &Bottom" ), 0, actionCollection(), "textbottom" );
//m_paRightText = new KToggleAction( i18n( "Text at &Right" ), 0, actionCollection(), "textright" );
//m_paBottomText->setExclusiveGroup( "TextPos" );
//m_paRightText->setExclusiveGroup( "TextPos" );
//m_paBottomText->setActionGroup( "TextPos" );
//m_paRightText->setActionGroup( "TextPos" );
//connect( m_paBottomText, SIGNAL( toggled( bool ) ), this, SLOT( slotTextBottom( bool ) ) );
//connect( m_paRightText, SIGNAL( toggled( bool ) ), this, SLOT( slotTextRight( bool ) ) );
......@@ -669,11 +672,11 @@ void KonqKfmIconView::newIconSize( int size )
//check for that when checking whether the size changed
int effSize = size;
if (effSize == 0)
effSize = IconSize(KIcon::Desktop);
effSize = IconSize(K3Icon::Desktop);
int oldEffSize = m_pIconView->iconSize();
if (oldEffSize == 0)
oldEffSize = IconSize(KIcon::Desktop);
oldEffSize = IconSize(K3Icon::Desktop);
// Make sure all actions are initialized.
KonqDirPart::newIconSize( size );
......
......@@ -21,7 +21,6 @@
#include <assert.h>
#include <ktoolbarbutton.h>
#include <ktoolbar.h>
#include <kanimwidget.h>
#include <kdebug.h>
......@@ -89,30 +88,36 @@ KonqBidiHistoryAction::KonqBidiHistoryAction ( const QString & text, KActionColl
{
setShortcutConfigurable(false);
m_firstIndex = 0;
m_goMenu = 0L;
setMenu(new KMenu);
connect( menu(), SIGNAL( aboutToShow() ), SIGNAL( menuAboutToShow() ) );
connect( menu(), SIGNAL( triggered( QAction* ) ), SLOT( slotTriggered( QAction* ) ) );
}
int KonqBidiHistoryAction::plug( QWidget *widget, int index )
KonqBidiHistoryAction::~ KonqBidiHistoryAction( )
{
if (!KAuthorized::authorizeKAction(name()))
return -1;
delete menu();
}
// Go menu
if ( qobject_cast<QMenu*>(widget) )
{
m_goMenu = (QMenu*)widget;
// Forward signal (to main view)
connect( m_goMenu, SIGNAL( aboutToShow() ),
this, SIGNAL( menuAboutToShow() ) );
connect( m_goMenu, SIGNAL( activated( int ) ),
this, SLOT( slotActivated( int ) ) );
//kDebug(1202) << "m_goMenu->count()=" << m_goMenu->count() << endl;
// Store how many items the menu already contains.
// This means, the KonqBidiHistoryAction has to be plugged LAST in a menu !
m_firstIndex = m_goMenu->count();
return m_goMenu->count(); // hmmm, what should this be ?
}
return KAction::plug( widget, index );
QWidget * KonqBidiHistoryAction::createToolBarWidget( QToolBar * parent )
{
QToolButton* button = new QToolButton(parent);
button->setAutoRaise(true);
button->setFocusPolicy(Qt::NoFocus);
button->setIconSize(parent->iconSize());
button->setToolButtonStyle(parent->toolButtonStyle());
QObject::connect(parent, SIGNAL(iconSizeChanged(const QSize&)),
button, SLOT(setIconSize(const QSize&)));
QObject::connect(parent, SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),
button, SLOT(setToolButtonStyle(Qt::ToolButtonStyle)));
button->setDefaultAction(this);
QObject::connect(button, SIGNAL(triggered(QAction*)), parent, SIGNAL(actionTriggered(QAction*)));
button->setPopupMode(QToolButton::MenuButtonPopup);
m_firstIndex = menu()->actions().count();
return button;
}
void KonqBidiHistoryAction::fillGoMenu( const QList<HistoryEntry*> & history, int historyIndex )
......@@ -122,11 +127,11 @@ void KonqBidiHistoryAction::fillGoMenu( const QList<HistoryEntry*> & history, in
//kDebug(1202) << "fillGoMenu position: " << history.at() << endl;
if ( m_firstIndex == 0 ) // should never happen since done in plug
m_firstIndex = m_goMenu->count();
m_firstIndex = menu()->actions().count();
else
{ // Clean up old history (from the end, to avoid shifts)
for ( int i = m_goMenu->count()-1 ; i >= m_firstIndex; i-- )
m_goMenu->removeItemAt( i );
for ( int i = menu()->actions().count()-1 ; i >= m_firstIndex; i-- )
menu()->removeAction( menu()->actions()[i] );
}
// TODO perhaps smarter algorithm (rename existing items, create new ones only if not enough) ?
......@@ -153,20 +158,20 @@ void KonqBidiHistoryAction::fillGoMenu( const QList<HistoryEntry*> & history, in
return;
}
m_currentPos = historyIndex; // for slotActivated
KonqBidiHistoryAction::fillHistoryPopup( history, historyIndex, m_goMenu, false, false, true, m_startPos );
KonqBidiHistoryAction::fillHistoryPopup( history, historyIndex, menu(), false, false, true, m_startPos );
}
void KonqBidiHistoryAction::slotActivated( int id )
void KonqBidiHistoryAction::slotTriggered( QAction* action )
{
// 1 for first item in the list, etc.
int index = m_goMenu->indexOf(id) - m_firstIndex + 1;
int index = menu()->actions().indexOf(action) - m_firstIndex + 1;
if ( index > 0 )
{
kDebug(1202) << "Item clicked has index " << index << endl;
// -1 for one step back, 0 for don't move, +1 for one step forward, etc.
int steps = ( m_startPos+1 ) - index - m_currentPos; // make a drawing to understand this :-)
kDebug(1202) << "Emit activated with steps = " << steps << endl;
emit activated( steps );
emit step( steps );
}
}
......@@ -175,22 +180,26 @@ void KonqBidiHistoryAction::slotActivated( int id )
KonqLogoAction::KonqLogoAction( const QString& text, const KShortcut& accel, KActionCollection* parent, const char* name )
: KAction( text, accel, 0L, "", parent, name )
{
setToolBarWidgetFactory(this);
}
KonqLogoAction::KonqLogoAction( const QString& text, const KShortcut& accel,
QObject* receiver, const char* slot, KActionCollection* parent, const char* name )
: KAction( text, accel, receiver, slot, parent, name )
{
setToolBarWidgetFactory(this);
}
KonqLogoAction::KonqLogoAction( const QString& text, const QIcon& pix, const KShortcut& accel, KActionCollection* parent, const char* name )
: KAction( text, pix, accel, 0L, "", parent, name )
{
setToolBarWidgetFactory(this);
}
KonqLogoAction::KonqLogoAction( const QString& text, const QIcon& pix, const KShortcut& accel, QObject* receiver, const char* slot, KActionCollection* parent, const char* name )
: KAction( text, pix, accel, receiver, slot, parent, name )
{
setToolBarWidgetFactory(this);
}
KonqLogoAction::KonqLogoAction( const QStringList& icons, QObject* receiver,
......@@ -199,88 +208,47 @@ KonqLogoAction::KonqLogoAction( const QStringList& icons, QObject* receiver,
: KAction( 0L, 0, receiver, slot, parent, name ) // text missing !
{
iconList = icons;
setToolBarWidgetFactory(this);
}
void KonqLogoAction::start()
{
int len = containerCount();
for ( int i = 0; i < len; i++ )
{
QWidget *w = container( i );
if ( w->inherits( "KToolBar" ) )
{
KAnimWidget *anim = ((KToolBar *)w)->animatedWidget( itemId( i ) );
anim->start();
}
}
emit startAnimation();
}
void KonqLogoAction::stop()
{
int len = containerCount();
for ( int i = 0; i < len; i++ )
{
QWidget *w = container( i );
if ( w->inherits( "KToolBar" ) )
{
KAnimWidget *anim = ((KToolBar *)w)->animatedWidget( itemId( i ) );
anim->stop();
}
}
}
void KonqLogoAction::updateIcon(int id)
{
QWidget *w = container( id );
if ( w->inherits( "KToolBar" ) )
{
KAnimWidget *anim = ((KToolBar *)w)->animatedWidget( itemId( id ) );
anim->setIcons(icon());
}
emit stopAnimation();
}
int KonqLogoAction::plug( QWidget *widget, int index )
QWidget * KonqLogoAction::createToolBarWidget( QToolBar * parent )
{
if (!KAuthorized::authorizeKAction(name()))
return -1;
/*
if ( widget->inherits( "KMainWindow" ) )
{
((KMainWindow*)widget)->setIndicatorWidget(m_logoLabel);
addContainer( widget, -1 );
return containerCount() - 1;
}
*/
if ( widget->inherits( "KToolBar" ) )
{
KToolBar *bar = (KToolBar *)widget;
int id_ = getToolButtonID();
QWidget* container = new QWidget(parent);
bar->insertAnimatedWidget( id_, this, SIGNAL(activated()), QString("kde"), index );
bar->alignItemRight( id_ );
QHBoxLayout* layout = new QHBoxLayout(container);
layout->setMargin(0);
layout->setSpacing(0);
layout->addStretch();
KAnimWidget *anim = bar->animatedWidget( id_ );
anim->setFrameStyle(QFrame::NoFrame);
KAnimatedButton *button = new KAnimatedButton(container);
button->setAutoRaise(true);
button->setFocusPolicy(Qt::