Commit a0242fe1 authored by Till Adam's avatar Till Adam
Browse files

Add a proper config dialog for the maildir resource.

svn path=/trunk/KDE/kdepim/akonadi/; revision=788391
parent 50be8152
......@@ -14,10 +14,12 @@ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" )
set( maildirresource_SRCS
maildirresource.cpp
main.cpp
configdialog.cpp
)
install( FILES maildirresource.desktop DESTINATION "${CMAKE_INSTALL_PREFIX}/share/akonadi/agents" )
kde4_add_ui_files(maildirresource_SRCS settings.ui)
kde4_add_kcfg_files(maildirresource_SRCS settings.kcfgc)
kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/maildirresource.kcfg org.kde.Akonadi.Maildir.Settings)
qt4_add_dbus_adaptor(maildirresource_SRCS
......
/*
Copyright (c) 2008 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "configdialog.h"
#include "settings.h"
#include <kconfigdialogmanager.h>
#include <kurlrequester.h>
ConfigDialog::ConfigDialog(QWidget * parent) :
KDialog( parent )
{
ui.setupUi( mainWidget() );
mManager = new KConfigDialogManager( this, Settings::self() );
mManager->updateWidgets();
ui.kcfg_Path->setMode( KFile::Directory | KFile::ExistingOnly );
ui.kcfg_Path->setUrl( KUrl( Settings::self()->path() ) );
connect( this, SIGNAL(okClicked()), SLOT(save()) );
}
void ConfigDialog::save()
{
mManager->updateSettings();
Settings::self()->setPath( ui.kcfg_Path->url().url() );
}
#include "configdialog.moc"
/*
Copyright (c) 2008 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H
#include <kdialog.h>
#include "ui_settings.h"
class KConfigDialogManager;
class ConfigDialog : public KDialog
{
Q_OBJECT
public:
ConfigDialog( QWidget *parent = 0 );
private slots:
void save();
private:
Ui::ConfigDialog ui;
KConfigDialogManager* mManager;
};
#endif
......@@ -20,6 +20,7 @@
#include "maildirresource.h"
#include "settings.h"
#include "settingsadaptor.h"
#include "configdialog.h"
#include <QtCore/QDir>
#include <QtDBus/QDBusConnection>
......@@ -29,6 +30,8 @@
#include <kfiledialog.h>
#include <klocale.h>
#include <KWindowSystem>
#include <maildir/maildir.h>
#include <kmime/kmime_message.h>
......@@ -103,6 +106,11 @@ void MaildirResource::aboutToQuit()
void MaildirResource::configure( WId windowId )
{
ConfigDialog dlg;
if ( windowId )
KWindowSystem::setMainWindow( &dlg, windowId );
dlg.exec();
/*
QString oldDir = Settings::self()->path();
KUrl url;
if ( !oldDir.isEmpty() )
......@@ -115,6 +123,7 @@ void MaildirResource::configure( WId windowId )
if ( oldDir == newDir )
return;
Settings::self()->setPath( newDir );
*/
}
void MaildirResource::itemAdded( const Akonadi::Item & item, const Akonadi::Collection& collection )
......
<ui version="4.0" >
<author>Till Adam &lt;adam@kde.org&gt;</author>
<class>ConfigDialog</class>
<widget class="QWidget" name="ConfigDialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>250</height>
</rect>
</property>
<property name="windowTitle" >
<string>Mail Directory Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>Select the folder containing the maildir information</string>
</property>
</widget>
</item>
<item>
<widget class="KUrlRequester" name="kcfg_Path" >
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_ReadOnly" >
<property name="text" >
<string>Open in read-only mode</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KUrlRequester</class>
<extends>QFrame</extends>
<header>kurlrequester.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
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