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

Show "configure kaddressbook" in kontact

parent 9ccb2680
......@@ -28,6 +28,8 @@
#include <KLocale>
#include <KPluginFactory>
#include <KParts/StatusBarExtension>
#include <KAction>
#include <KActionCollection>
#include <QtGui/QVBoxLayout>
......@@ -41,7 +43,6 @@ KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent,
setComponentData( KAddressBookFactory::componentData() );
KIconLoader::global()->addAppDir( "kaddressbook" );
setXMLFile( "kaddressbookui.rc" );
// create a canvas to insert our widget
QWidget *canvas = new QWidget( parentWidget );
canvas->setFocusPolicy( Qt::ClickFocus );
......@@ -49,9 +50,19 @@ KAddressBookPart::KAddressBookPart( QWidget *parentWidget, QObject *parent,
QVBoxLayout *topLayout = new QVBoxLayout( canvas );
mMainWidget = new MainWidget( this, canvas );
initAction();
topLayout->addWidget( mMainWidget );
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()
......
......@@ -41,7 +41,7 @@ class KAddressBookPart: public KParts::ReadOnlyPart
protected:
virtual bool openFile();
virtual void guiActivateEvent( KParts::GUIActivateEvent * );
void initAction();
private:
MainWidget *mMainWidget;
};
......
<!DOCTYPE kpartgui>
<kpartgui name="kaddressbook" version="8">
<kpartgui name="kaddressbook" version="9">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
......@@ -47,6 +47,11 @@
<Menu name="settings"><text>&amp;Settings</text>
<Action name="options_show_simplegui"/>
<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>
</MenuBar>
......
......@@ -68,6 +68,7 @@
#include <KToggleAction>
#include <KToolBar>
#include <KXmlGuiWindow>
#include <KCMultiDialog>
#include <QtGui/QAction>
#include <QtGui/QHBoxLayout>
......@@ -256,6 +257,15 @@ MainWidget::MainWidget( KXMLGUIClient *guiClient, QWidget *parent )
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()
{
// restore previous state
......
......@@ -61,6 +61,7 @@ class KADDRESSBOOK_EXPORT MainWidget : public QWidget
void newContact();
void newGroup();
void print();
void configure();
private Q_SLOTS:
void delayedInit();
......
......@@ -23,11 +23,11 @@
#include <KAction>
#include <KActionCollection>
#include <KCMultiDialog>
#include <KEditToolBar>
#include <KShortcutsDialog>
#include <KStandardAction>
#include <KToolBar>
#include <KLocale>
MainWindow::MainWindow()
: KXmlGuiWindow( 0 )
......@@ -68,11 +68,7 @@ void MainWindow::initActions()
void MainWindow::configure()
{
KCMultiDialog dlg( this );
dlg.addModule( "akonadicontact_actions.desktop" );
dlg.addModule( "kcmldap.desktop" );
dlg.exec();
mMainWidget->configure();
}
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