Commit 70ec9c3b authored by Volker Krause's avatar Volker Krause
Browse files

Name the runtime part of kdepim actually "runtime", and move stuff out

of it that belongs in the apps part.

svn path=/branches/work/akonadi-ports/kdepim/runtime/; revision=1061292
parent 6f8bc458
......@@ -97,19 +97,15 @@ endmacro( akonadi_add_resourcetest )
add_subdirectory(libkdepim-copy)
add_subdirectory(xml)
add_subdirectory(resourcetester)
add_subdirectory(clients)
add_subdirectory(resources)
add_subdirectory(agents)
add_subdirectory(kioslave)
add_subdirectory(plugins)
add_subdirectory(kcal)
add_subdirectory(kcm)
add_subdirectory(tray)
add_subdirectory(migration)
add_subdirectory(defaultsetup)
add_subdirectory(akonadi_next)
add_subdirectory(kresources)
add_subdirectory(akonadiconsole)
add_subdirectory(accountwizard)
#if(OPENSYNC_FOUND)
......
set(accountwizard_srcs
main.cpp
dialog.cpp
typepage.cpp
loadpage.cpp
global.cpp
page.cpp
dynamicpage.cpp
setupmanager.cpp
setuppage.cpp
resource.cpp
setupobject.cpp
transport.cpp
)
kde4_add_ui_files(accountwizard_srcs
typepage.ui
loadpage.ui
setuppage.ui
)
kde4_add_executable(accountwizard ${accountwizard_srcs})
target_link_libraries(accountwizard
${KDEPIMLIBS_AKONADI_LIBS}
${KDEPIMLIBS_MAILTRANSPORT_LIBS}
${KDE4_KROSSCORE_LIBS}
${KDE4_KROSSUI_LIBS}
${KDE4_KDECORE_LIBS}
${QT_QTGUI_LIBRARY}
${QT_QTUITOOLS_LIBRARY}
)
install(TARGETS accountwizard ${INSTALL_TARGETS_DEFAULT_ARGS})
#!/bin/sh
$XGETTEXT *.cpp *.h -o $podir/accountwizard.pot
- figure out i18n for the actual wizards (DONE)
- GHNS support for downloading new wizards
- add support for creating LDAP accounts
- add support for creating identities
- remember which set up resources/transports/ldap accounts/identities belong together so we can offer to remove them in one go again
- add more wizards (In progress)
- implement type filtering, for integration into applications (DONE)
/*
Copyright (c) 2009 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 "dialog.h"
#include "typepage.h"
#include "loadpage.h"
#include "global.h"
#include "dynamicpage.h"
#include "setupmanager.h"
#include <klocalizedstring.h>
#include <kross/core/action.h>
#include <kdebug.h>
#include "setuppage.h"
Dialog::Dialog(QWidget* parent) :
KAssistantDialog( parent )
{
SetupManager *setupManager = new SetupManager( this );
Kross::Action* action = new Kross::Action( this, "AccountWizard" );
action->addQObject( this, QLatin1String( "Dialog" ) );
action->addQObject( setupManager, QLatin1String( "SetupManager" ) );
if ( Global::assistant().isEmpty() ) {
TypePage *page = new TypePage( this );
connect( page->treeview(), SIGNAL(doubleClicked(QModelIndex)), SLOT(slotNextPage()) );
addPage( page, i18n( "Select Account Type" ) );
}
LoadPage *loadPage = new LoadPage( this );
loadPage->setAction( action );
addPage( loadPage, i18n( "Loading Assistant" ) );
SetupPage *setupPage = new SetupPage( this );
mLastPage = addPage( setupPage, i18n( "Setting up Account" ) );
setupManager->setSetupPage( setupPage );
Page *page = qobject_cast<Page*>( currentPage()->widget() );
page->enterPageNext();
emit page->pageEnteredNext();
}
KPageWidgetItem* Dialog::addPage(Page* page, const QString &title)
{
KPageWidgetItem *item = KAssistantDialog::addPage( page, title );
page->setPageWidgetItem( item );
return item;
}
void Dialog::slotNextPage()
{
next();
}
void Dialog::next()
{
Page *page = qobject_cast<Page*>( currentPage()->widget() );
page->leavePageNext();
emit page->pageLeftNext();
KAssistantDialog::next();
page = qobject_cast<Page*>( currentPage()->widget() );
page->enterPageNext();
emit page->pageEnteredNext();
}
void Dialog::back()
{
Page *page = qobject_cast<Page*>( currentPage()->widget() );
page->leavePageBack();
emit page->pageLeftBack();
KAssistantDialog::back();
page = qobject_cast<Page*>( currentPage()->widget() );
page->enterPageBack();
emit page->pageEnteredBack();
}
QObject* Dialog::addPage(const QString& uiFile, const QString &title )
{
kDebug() << uiFile;
DynamicPage *page = new DynamicPage( Global::assistantBasePath() + uiFile, this );
KPageWidgetItem* item = insertPage( mLastPage, page, title );
page->setPageWidgetItem( item );
return page;
}
#include "dialog.moc"
/*
Copyright (c) 2009 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 DIALOG_H
#define DIALOG_H
#include <kassistantdialog.h>
class Page;
class Dialog : public KAssistantDialog
{
Q_OBJECT
public:
explicit Dialog( QWidget *parent = 0 );
/* reimpl */ void next();
/* reimpl */ void back();
public slots:
Q_SCRIPTABLE QObject* addPage( const QString &uiFile, const QString &title );
private slots:
void slotNextPage();
private:
KPageWidgetItem* addPage( Page* page, const QString &title );
private:
KPageWidgetItem* mLastPage;
};
#endif
/*
Copyright (c) 2009 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 "dynamicpage.h"
#include <KDebug>
#include <QUiLoader>
#include <QFile>
#include <qboxlayout.h>
DynamicPage::DynamicPage(const QString& uiFile, KAssistantDialog* parent) : Page( parent )
{
QUiLoader loader;
QFile file( uiFile );
file.open( QFile::ReadOnly );
kDebug() << uiFile;
QWidget *dynamicWidget = loader.load( &file, this );
file.close();
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget( dynamicWidget );
setLayout( layout );
setValid( true );
}
......@@ -17,25 +17,16 @@
02110-1301, USA.
*/
#ifndef DBCONSOLE_H
#define DBCONSOLE_H
#ifndef DYNAMICPAGE_H
#define DYNAMICPAGE_H
#include "ui_dbconsole.h"
#include "page.h"
class QSqlQueryModel;
class DbConsole : public QWidget
class DynamicPage : public Page
{
Q_OBJECT
public:
DbConsole( QWidget *parent = 0 );
private slots:
void execClicked();
private:
Ui::DbConsole ui;
QSqlQueryModel *mQueryModel;
explicit DynamicPage( const QString &uiFile, KAssistantDialog* parent = 0 );
};
#endif
......@@ -17,47 +17,68 @@
02110-1301, USA.
*/
#include "dbaccess.h"
#include "global.h"
#include <akonadi/private/xdgbasedirs_p.h>
#include <kdebug.h>
#include <KGlobal>
#include <KStandardDirs>
#include <QtCore/qfileinfo.h>
#include <QtCore/QDir>
#include <QSettings>
#include <QSqlDatabase>
#include <QSqlError>
class GlobalPrivate
{
public:
QStringList filter;
QString assistant;
};
#include <KGlobal>
#include <KLocale>
#include <KMessageBox>
K_GLOBAL_STATIC( GlobalPrivate, sInstance )
using namespace Akonadi;
class DbAccessPrivate
QString Global::assistant()
{
public:
DbAccessPrivate()
{
const QString serverConfigFile = XdgBaseDirs::akonadiServerConfigFile( XdgBaseDirs::ReadWrite );
QSettings settings( serverConfigFile, QSettings::IniFormat );
const QString driver = settings.value( "General/Driver", "QMYSQL" ).toString();
database = QSqlDatabase::addDatabase( driver );
settings.beginGroup( driver );
database.setHostName( settings.value( "Host", QString() ).toString() );
database.setDatabaseName( settings.value( "Name", "akonadi" ).toString() );
database.setUserName( settings.value( "User", QString() ).toString() );
database.setPassword( settings.value( "Password", QString() ).toString() );
database.setConnectOptions( settings.value( "Options", QString() ).toString() );
if ( !database.open() ) {
KMessageBox::error( 0, i18n( "Failed to connect to database: %1", database.lastError().text() ) );
}
return sInstance->assistant;
}
void Global::setAssistant(const QString& assistant)
{
const QFileInfo info( assistant );
if ( info.isAbsolute() ) {
sInstance->assistant = assistant;
return;
}
const QStringList list = KGlobal::dirs()->findAllResources(
"data", QLatin1String( "akonadi/accountwizard/*.desktop" ),
KStandardDirs::Recursive | KStandardDirs::NoDuplicates );
foreach ( const QString &entry, list ) {
const QFileInfo info( entry );
const QDir dir( info.absolutePath() );
kDebug() << dir.dirName();
if ( dir.dirName() == assistant ) {
sInstance->assistant = entry;
return;
}
}
QSqlDatabase database;
};
sInstance->assistant.clear();
}
K_GLOBAL_STATIC( DbAccessPrivate, sInstance )
QSqlDatabase DbAccess::database()
QStringList Global::typeFilter()
{
return sInstance->filter;
}
void Global::setTypeFilter(const QStringList& filter)
{
sInstance->filter = filter;
}
QString Global::assistantBasePath()
{
return sInstance->database;
const QFileInfo info( assistant() );
if ( info.isAbsolute() )
return info.absolutePath() + QDir::separator();
return QString();
}
......@@ -17,25 +17,20 @@
02110-1301, USA.
*/
#ifndef DBBROWSER_H
#define DBBROWSER_H
#ifndef GLOBAL_H
#define GLOBAL_H
#include "ui_dbbrowser.h"
#include <QStringList>
class QSqlTableModel;
class DbBrowser : public QWidget
namespace Global
{
Q_OBJECT
public:
DbBrowser( QWidget *parent = 0 );
QStringList typeFilter();
void setTypeFilter( const QStringList &filter );
private slots:
void refreshClicked();
QString assistant();
void setAssistant( const QString &assistant );
private:
Ui::DbBrowser ui;
QSqlTableModel *mTableModel;
};
QString assistantBasePath();
}
#endif
/*
Copyright (c) 2009 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 "loadpage.h"
#include "global.h"
#include <kassistantdialog.h>
#include <kconfig.h>
#include <kconfiggroup.h>
#include <kross/core/action.h>
#include <QtCore/qfile.h>
LoadPage::LoadPage(KAssistantDialog* parent) : Page( parent )
{
ui.setupUi( this );
setValid( false );
}
void LoadPage::enterPageNext()
{
setValid( false );
const KConfig f( Global::assistant() );
KConfigGroup grp( &f, "Wizard" );
const QString scriptFile = grp.readEntry( "Script", QString() );
if ( scriptFile.isEmpty() ) {
ui.statusLabel->setText( i18n( "No script specified in '%1'.", Global::assistant() ) );
return;
}
if ( !QFile::exists( Global::assistantBasePath() + scriptFile ) ) {
ui.statusLabel->setText( i18n( "Unable to load assistant: File '%1' does not exist.", Global::assistantBasePath() + scriptFile ) );
return;
}
ui.statusLabel->setText( i18n( "Loading script '%1'...", Global::assistantBasePath() + scriptFile ) );
if ( !m_action->setFile( Global::assistantBasePath() + scriptFile ) ) {
ui.statusLabel->setText( i18n( "Failed to load script: '%1'.", m_action->errorMessage() ) );
return;
}
KConfigGroup grpTranslate( &f, "Translate");
const QString poFileName = grp.readEntry( "Filename" );
if( !poFileName.isEmpty())
KGlobal::locale()->insertCatalog(poFileName);
m_action->trigger();
m_parent->next();
}
void LoadPage::enterPageBack()
{
// TODO: if we are the first page, call enterPageNext(), hm, can we get here then at all?
m_parent->back();
}
void LoadPage::setAction(Kross::Action* action)
{
m_action = action;
}
#include "loadpage.moc"
/*
Copyright (c) 2009 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 LOADPAGE_H
#define LOADPAGE_H
#include "page.h"
#include "ui_loadpage.h"
namespace Kross {
class Action;
}
class LoadPage : public Page
{
Q_OBJECT
public:
LoadPage( KAssistantDialog *parent );
virtual void enterPageNext();
virtual void enterPageBack();
void setAction( Kross::Action *action );
private:
Ui::LoadPage ui;
Kross::Action* m_action;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LoadPage</class>
<widget class="QWidget" name="LoadPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>129</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="statusLabel">
<property name="text">
<string>Loading assistant...</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>129</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>