--Boundary-00=_dfOZ+DqQT99PnHo Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline =2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2003. March 04., Tuesday 19:38, Andras Mantia wrote: > It's source incompatible... New patch will come soon. Here it is. It's not so nice, but without ambiguously overloaded ctors. Andras =2D --=20 Quanta Plus developer - http://quanta.sourceforge.net K Desktop Environment - http://www.kde.org =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+ZOfdTQdfac6L/08RArncAKDDKr4tqwt97ps/mXi+n7EJOf5CVQCgi8WI 1NQOrn1zWZpPvax8WzlKlSs=3D =3DQmuC =2D----END PGP SIGNATURE----- --Boundary-00=_dfOZ+DqQT99PnHo Content-Type: text/x-diff; charset="iso-8859-1"; name="kedittoolbar.cpp.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kedittoolbar.cpp.diff" --- kedittoolbar.cpp.orig Sun Jan 5 17:57:57 2003 +++ kedittoolbar.cpp Tue Mar 4 19:50:16 2003 @@ -198,6 +198,15 @@ init(); } +KEditToolbar::KEditToolbar(const QString& defaultToolbar, KActionCollection *collection, + const QString& file, bool global, + QWidget* parent, const char* name) + : KDialogBase(Swallow, i18n("Configure Toolbars"), Ok|Apply|Cancel, Ok, parent, name), + m_widget(new KEditToolbarWidget(defaultToolbar, collection, file, global, this)) +{ + init(); +} + KEditToolbar::KEditToolbar(KXMLGUIFactory* factory, QWidget* parent, const char* name) : KDialogBase(Swallow, i18n("Configure Toolbars"), Ok|Apply|Cancel, Ok, parent, name), m_widget(new KEditToolbarWidget(factory, this)) @@ -205,6 +214,14 @@ init(); } +KEditToolbar::KEditToolbar(const QString& defaultToolbar,KXMLGUIFactory* factory, + QWidget* parent, const char* name) + : KDialogBase(Swallow, i18n("Configure Toolbars"), Ok|Apply|Cancel, Ok, parent, name), + m_widget(new KEditToolbarWidget(defaultToolbar, factory, this)) +{ + init(); +} + void KEditToolbar::init() { d = new KEditToolbarPrivate(); @@ -261,6 +278,60 @@ : QWidget(parent), d(new KEditToolbarWidgetPrivate(instance(), collection)) { + initNonKPart(collection, file, global); + // now load in our toolbar combo box + loadToolbarCombo(); + adjustSize(); + setMinimumSize(sizeHint()); +} + +KEditToolbarWidget::KEditToolbarWidget(const QString& defaultToolbar, + KActionCollection *collection, + const QString& file, bool global, + QWidget *parent) + : QWidget(parent), + d(new KEditToolbarWidgetPrivate(instance(), collection)) +{ + initNonKPart(collection, file, global); + // now load in our toolbar combo box + loadToolbarCombo(defaultToolbar); + adjustSize(); + setMinimumSize(sizeHint()); +} + +KEditToolbarWidget::KEditToolbarWidget( KXMLGUIFactory* factory, + QWidget *parent) + : QWidget(parent), + d(new KEditToolbarWidgetPrivate(instance(), KXMLGUIClient::actionCollection() /*create new one*/)) +{ + initKPart(factory); + // now load in our toolbar combo box + loadToolbarCombo(); + adjustSize(); + setMinimumSize(sizeHint()); +} + +KEditToolbarWidget::KEditToolbarWidget( const QString& defaultToolbar, + KXMLGUIFactory* factory, + QWidget *parent) + : QWidget(parent), + d(new KEditToolbarWidgetPrivate(instance(), KXMLGUIClient::actionCollection() /*create new one*/)) +{ + initKPart(factory); + // now load in our toolbar combo box + loadToolbarCombo(defaultToolbar); + adjustSize(); + setMinimumSize(sizeHint()); +} + +KEditToolbarWidget::~KEditToolbarWidget() +{ + delete d; +} + +void KEditToolbarWidget::initNonKPart(KActionCollection *collection, + const QString& file, bool global) +{ // let's not forget the stuff that's not xml specific //d->m_collection = *collection; d->m_actionList = collection->actions(); @@ -295,19 +366,9 @@ // okay, that done, we concern ourselves with the GUI aspects setupLayout(); - - // now load in our toolbar combo box - loadToolbarCombo(); - adjustSize(); - - //kdDebug() << "kedittoolbarwidget " << sizeHint() << endl; - setMinimumSize(sizeHint()); } -KEditToolbarWidget::KEditToolbarWidget( KXMLGUIFactory* factory, - QWidget *parent) - : QWidget(parent), - d(new KEditToolbarWidgetPrivate(instance(), KXMLGUIClient::actionCollection() /*create new one*/)) +void KEditToolbarWidget::initKPart(KXMLGUIFactory* factory) { // reusable vars QDomElement elem; @@ -342,15 +403,6 @@ // okay, that done, we concern ourselves with the GUI aspects setupLayout(); - setMinimumSize(sizeHint()); - - // now load in our toolbar combo box - loadToolbarCombo(); -} - -KEditToolbarWidget::~KEditToolbarWidget() -{ - delete d; } bool KEditToolbarWidget::save() @@ -534,7 +586,7 @@ top_layout->addWidget(new KSeparator(this)); } -void KEditToolbarWidget::loadToolbarCombo() +void KEditToolbarWidget::loadToolbarCombo(const QString& defaultToolbar) { static const QString &attrName = KGlobal::staticQString( "name" ); static const QString &tagText = KGlobal::staticQString( "text" ); @@ -543,6 +595,8 @@ // just in case, we clear our combo m_toolbarCombo->clear(); + int defaultToolbarId = 0; + int count = 0; // load in all of the toolbar names into this combo box XmlDataList::Iterator xit = d->m_xmlFiles.begin(); for ( ; xit != d->m_xmlFiles.end(); ++xit) @@ -575,11 +629,15 @@ m_toolbarCombo->setEnabled( true ); m_toolbarCombo->insertItem( name ); + if (name == defaultToolbar) + defaultToolbarId = count; + count++; } } - // we want to the first item selected and its actions loaded - slotToolbarSelected( m_toolbarCombo->currentText() ); + // we want to the specified item selected and its actions loaded + m_toolbarCombo->setCurrentItem(defaultToolbarId); + slotToolbarSelected(m_toolbarCombo->currentText()); } void KEditToolbarWidget::loadActionList(QDomElement& elem) --Boundary-00=_dfOZ+DqQT99PnHo Content-Type: text/x-diff; charset="iso-8859-1"; name="kedittoolbar.h.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="kedittoolbar.h.diff" --- kedittoolbar.h.orig Sat Feb 8 13:06:12 2003 +++ kedittoolbar.h Tue Mar 4 19:49:10 2003 @@ -140,6 +140,21 @@ const QString& xmlfile = QString::null, bool global = true, QWidget* parent = 0, const char* name = 0); + //KDE 4.0: merge the two constructors + /* Constructor for apps that do not use components, which has an extra argument + * specifying the toolbar to be shown. + * @param collection The collection of actions to work on. + * @param xmlfile The application's local resource file. + * @param global If @p true, then the global resource file will also + * be parsed. + * @param defaultToolbar The toolbar with this name will appear for editing. + * @param parent The parent of the dialog. + * @param name An internal name. + * @since 3.2 + */ + KEditToolbar(const QString& defaultToolbar, KActionCollection *collection, + const QString& xmlfile = QString::null, bool global = true, + QWidget* parent = 0, const char* name = 0); /** * Constructor for KParts based apps. * @@ -165,6 +180,19 @@ */ KEditToolbar(KXMLGUIFactory* factory, QWidget* parent = 0, const char* name = 0); + //KDE 4.0: merge the two constructors + /* Constructor for KParts based apps, which has an extra argument + * specifying the toolbar to be shown. + * + * @param factory Your application's factory object + * @param defaultToolbar The toolbar with this name will appear for editing. + * @param parent The usual parent for the dialog. + * @param name An internal name. + * @since 3.2 + */ + KEditToolbar(const QString& defaultToolbar, KXMLGUIFactory* factory, + QWidget* parent = 0, const char* name = 0); + /// destructor ~KEditToolbar(); @@ -257,6 +285,23 @@ const QString& file = QString::null, bool global = true, QWidget *parent = 0L); + //KDE 4.0: merge the two constructors + /* Same as above, with an extra agrument specifying the toolbar to be shown. + * + * @param collection The collection of actions to work on + * @param xmlfile The application's local resource file + * @param global If true, then the global resource file will also + * be parsed + * @param defaultToolbar The toolbar with this name will appear for editing. + * @param parent This widget's parent + * @since 3.2 + */ + KEditToolbarWidget(const QString& defaultToolbar, + KActionCollection *collection, + const QString& file = QString::null, + bool global = true, + QWidget *parent = 0L); + /** * Constructor for KParts based apps. * @@ -279,6 +324,19 @@ */ KEditToolbarWidget(KXMLGUIFactory* factory, QWidget *parent = 0L); + //KDE 4.0: merge the two constructors + /* Same as above, with an extra agrument specifying the toolbar to be shown. + * + * + * @param factory Your application's factory object + * @param defaultToolbar The toolbar with this name will appear for editing. + * @param parent This widget's parent + * @since 3.2 + */ + KEditToolbarWidget(const QString& defaultToolbar, + KXMLGUIFactory* factory, + QWidget *parent = 0L); + /** * Destructor. Note that any changes done in this widget will * @p NOT be saved in the destructor. You @p must call @ref save() @@ -321,7 +379,9 @@ protected: void setupLayout(); - void loadToolbarCombo(); + void initNonKPart(KActionCollection *collection, const QString& file, bool global); + void initKPart(KXMLGUIFactory* factory); + void loadToolbarCombo(const QString& defaultToolbar = QString::null); void loadActionList(QDomElement& elem); void updateLocal(QDomElement& elem); --Boundary-00=_dfOZ+DqQT99PnHo--