Commit e9e239e1 authored by Laurent Montel's avatar Laurent Montel 😁

Show "configure kaddressbook" in kontact

parent 9ccb2680
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include <KLocale> #include <KLocale>
#include <KPluginFactory> #include <KPluginFactory>
#include <KParts/StatusBarExtension> #include <KParts/StatusBarExtension>
#include <KAction>
#include <KActionCollection>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
...@@ -41,7 +43,6 @@ KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent, ...@@ -41,7 +43,6 @@ KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent,
setComponentData( KAddressBookFactory::componentData() ); setComponentData( KAddressBookFactory::componentData() );
KIconLoader::global()->addAppDir( "kaddressbook" ); KIconLoader::global()->addAppDir( "kaddressbook" );
setXMLFile( "kaddressbookui.rc" );
// create a canvas to insert our widget // create a canvas to insert our widget
QWidget *canvas = new QWidget( parentWidget ); QWidget *canvas = new QWidget( parentWidget );
canvas->setFocusPolicy( Qt::ClickFocus ); canvas->setFocusPolicy( Qt::ClickFocus );
...@@ -49,9 +50,19 @@ KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent, ...@@ -49,9 +50,19 @@ KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent,
QVBoxLayout *topLayout = new QVBoxLayout( canvas ); QVBoxLayout *topLayout = new QVBoxLayout( canvas );
mMainWidget = new MainWidget( this, canvas ); mMainWidget = new MainWidget( this, canvas );
initAction();
topLayout->addWidget( mMainWidget ); topLayout->addWidget( mMainWidget );
topLayout->setMargin(0); topLayout->setMargin(0);
setXMLFile( "kaddressbookui.rc" );
}
void KAddressBookPart::initAction()
{
KAction *action = new KAction( KIcon( "configure" ), i18n( "&Configure KAddressBook..." ), this );
actionCollection()->addAction( "kaddressbook_configure", action );
connect( action, SIGNAL(triggered(bool)), mMainWidget,
SLOT(configure()) );
} }
void KAddressBookPart::newContact() void KAddressBookPart::newContact()
......
...@@ -41,7 +41,7 @@ class KAddressBookPart: public KParts::ReadOnlyPart ...@@ -41,7 +41,7 @@ class KAddressBookPart: public KParts::ReadOnlyPart
protected: protected:
virtual bool openFile(); virtual bool openFile();
virtual void guiActivateEvent( KParts::GUIActivateEvent * ); virtual void guiActivateEvent( KParts::GUIActivateEvent * );
void initAction();
private: private:
MainWidget *mMainWidget; MainWidget *mMainWidget;
}; };
......
<!DOCTYPE kpartgui> <!DOCTYPE kpartgui>
<kpartgui name="kaddressbook" version="8"> <kpartgui name="kaddressbook" version="9">
<MenuBar> <MenuBar>
<Menu name="file"><text>&amp;File</text> <Menu name="file"><text>&amp;File</text>
...@@ -47,6 +47,11 @@ ...@@ -47,6 +47,11 @@
<Menu name="settings"><text>&amp;Settings</text> <Menu name="settings"><text>&amp;Settings</text>
<Action name="options_show_simplegui"/> <Action name="options_show_simplegui"/>
<Action name="options_show_qrcodes"/> <Action name="options_show_qrcodes"/>
<Separator/>
<Action name="options_configure_keybinding" group="settings_configure"/>
<Action name="options_configure_toolbars" group="settings_configure" />
<Action name="kaddressbook_configure" group="settings_configure" />
</Menu> </Menu>
</MenuBar> </MenuBar>
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
#include <KToggleAction> #include <KToggleAction>
#include <KToolBar> #include <KToolBar>
#include <KXmlGuiWindow> #include <KXmlGuiWindow>
#include <KCMultiDialog>
#include <QtGui/QAction> #include <QtGui/QAction>
#include <QtGui/QHBoxLayout> #include <QtGui/QHBoxLayout>
...@@ -256,6 +257,15 @@ MainWidget::MainWidget( KXMLGUIClient *guiClient, QWidget *parent ) ...@@ -256,6 +257,15 @@ MainWidget::MainWidget( KXMLGUIClient *guiClient, QWidget *parent )
QMetaObject::invokeMethod( this, "delayedInit", Qt::QueuedConnection ); QMetaObject::invokeMethod( this, "delayedInit", Qt::QueuedConnection );
} }
void MainWidget::configure()
{
KCMultiDialog dlg( this );
dlg.addModule( "akonadicontact_actions.desktop" );
dlg.addModule( "kcmldap.desktop" );
dlg.exec();
}
void MainWidget::delayedInit() void MainWidget::delayedInit()
{ {
// restore previous state // restore previous state
......
...@@ -61,6 +61,7 @@ class KADDRESSBOOK_EXPORT MainWidget : public QWidget ...@@ -61,6 +61,7 @@ class KADDRESSBOOK_EXPORT MainWidget : public QWidget
void newContact(); void newContact();
void newGroup(); void newGroup();
void print(); void print();
void configure();
private Q_SLOTS: private Q_SLOTS:
void delayedInit(); void delayedInit();
......
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
#include <KAction> #include <KAction>
#include <KActionCollection> #include <KActionCollection>
#include <KCMultiDialog>
#include <KEditToolBar> #include <KEditToolBar>
#include <KShortcutsDialog> #include <KShortcutsDialog>
#include <KStandardAction> #include <KStandardAction>
#include <KToolBar> #include <KToolBar>
#include <KLocale>
MainWindow::MainWindow() MainWindow::MainWindow()
: KXmlGuiWindow( 0 ) : KXmlGuiWindow( 0 )
...@@ -68,11 +68,7 @@ void MainWindow::initActions() ...@@ -68,11 +68,7 @@ void MainWindow::initActions()
void MainWindow::configure() void MainWindow::configure()
{ {
KCMultiDialog dlg( this ); mMainWidget->configure();
dlg.addModule( "akonadicontact_actions.desktop" );
dlg.addModule( "kcmldap.desktop" );
dlg.exec();
} }
void MainWindow::configureKeyBindings() void MainWindow::configureKeyBindings()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment