Skip to content

Commit

Permalink
Add plugin for haze/sipe protocol support
Browse files Browse the repository at this point in the history
REVIEWED-BY: David Edmundson
BUG: 328037
BUG: 326163
  • Loading branch information
max-posedon authored and davidedmundson committed Nov 25, 2013
1 parent c19091c commit 470db02
Show file tree
Hide file tree
Showing 11 changed files with 555 additions and 1 deletion.
8 changes: 8 additions & 0 deletions data/profiles/sipe-haze.profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<service xmlns="http://telepathy.freedesktop.org/wiki/service-profile-v1"
id="sipe-haze"
type="IM"
manager="haze"
protocol="sipe"
icon="im-sipe">
<name>Office Communicator (via libpurple)</name>
</service>
5 changes: 5 additions & 0 deletions plugins/haze/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ set (ktpaccountskcm_plugin_haze_SRCS
groupwise-advanced-settings-widget.cpp
haze-steam-account.cpp
steam-main-options-widget.cpp
haze-sipe-account.cpp
sipe-main-options-widget.cpp
sipe-advanced-settings-widget.cpp
)

kde4_add_ui_files (ktpaccountskcm_plugin_haze_SRCS
Expand All @@ -45,6 +48,8 @@ kde4_add_ui_files (ktpaccountskcm_plugin_haze_SRCS
groupwise-advanced-settings-widget.ui
groupwise-main-options-widget.ui
steam-main-options-widget.ui
sipe-main-options-widget.ui
sipe-advanced-settings-widget.ui
)

kde4_add_plugin (ktpaccountskcm_plugin_haze
Expand Down
6 changes: 5 additions & 1 deletion plugins/haze/haze-account-ui-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "haze-msn-account.h"
#include "haze-groupwise-account.h"
#include "haze-steam-account.h"
#include "haze-sipe-account.h"

#include <KPluginFactory>

Expand All @@ -45,6 +46,7 @@ HazeAccountUiPlugin::HazeAccountUiPlugin(QObject *parent, const QVariantList &)
registerProvidedProtocol(QLatin1String("haze"), QLatin1String("msn"));
registerProvidedProtocol(QLatin1String("haze"), QLatin1String("groupwise"));
registerProvidedProtocol(QLatin1String("haze"), QLatin1String("steam-mobile"));
registerProvidedProtocol(QLatin1String("haze"), QLatin1String("sipe"));
}

HazeAccountUiPlugin::~HazeAccountUiPlugin()
Expand Down Expand Up @@ -72,7 +74,9 @@ AbstractAccountUi* HazeAccountUiPlugin::accountUi(const QString &connectionManag
return new HazeGroupWiseAccountUi;
} else if (protocol == QLatin1String("steam-mobile")) {
return new HazeSteamAccountUi;
}
} else if (protocol == QLatin1String("sipe")) {
return new HazeSipeAccountUi;
}
}

return 0;
Expand Down
71 changes: 71 additions & 0 deletions plugins/haze/haze-sipe-account.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* This file is part of telepathy-accounts-kcm
*
* Copyright (C) 2013 Maksim Melnikau <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "haze-sipe-account.h"

#include "sipe-main-options-widget.h"
#include "sipe-advanced-settings-widget.h"

HazeSipeAccountUi::HazeSipeAccountUi(QObject *parent)
: AbstractAccountUi(parent)
{
// Main Options
registerSupportedParameter(QLatin1String("account"), QVariant::String);
registerSupportedParameter(QLatin1String("password"), QVariant::String);

// Advanced Options
registerSupportedParameter(QLatin1String("login"), QVariant::String);
registerSupportedParameter(QLatin1String("server"), QVariant::String);
registerSupportedParameter(QLatin1String("transport"), QVariant::String);
registerSupportedParameter(QLatin1String("useragent"), QVariant::String);
registerSupportedParameter(QLatin1String("authentication"), QVariant::String);
registerSupportedParameter(QLatin1String("dont-publish"), QVariant::Bool);
registerSupportedParameter(QLatin1String("email-url"), QVariant::String);
registerSupportedParameter(QLatin1String("email"), QVariant::String);
registerSupportedParameter(QLatin1String("email-login"), QVariant::String);
registerSupportedParameter(QLatin1String("email-password"), QVariant::String);
registerSupportedParameter(QLatin1String("groupchat-user"), QVariant::String);
}

HazeSipeAccountUi::~HazeSipeAccountUi()
{
}

AbstractAccountParametersWidget *HazeSipeAccountUi::mainOptionsWidget(
ParameterEditModel *model,
QWidget *parent) const
{
return new SipeMainOptionsWidget(model, parent);
}

bool HazeSipeAccountUi::hasAdvancedOptionsWidget() const
{
return true;
}

AbstractAccountParametersWidget *HazeSipeAccountUi::advancedOptionsWidget(
ParameterEditModel *model,
QWidget *parent) const
{
AbstractAccountParametersWidget *sipeAdvancedSettingsWidget = new SipeAdvancedSettingsWidget(model, parent);
return sipeAdvancedSettingsWidget;
}

#include "haze-sipe-account.moc"
46 changes: 46 additions & 0 deletions plugins/haze/haze-sipe-account.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* This file is part of telepathy-accounts-kcm
*
* Copyright (C) 2013 Maksim Melnikau <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_HAZE_SIPE_ACCOUNT_H
#define KCMTELEPATHYACCOUNTS_PLUGIN_HAZE_SIPE_ACCOUNT_H

#include <KCMTelepathyAccounts/AbstractAccountUi>

class HazeSipeAccountUi : public AbstractAccountUi
{
Q_OBJECT

public:
explicit HazeSipeAccountUi(QObject *parent = 0);
virtual ~HazeSipeAccountUi();

virtual AbstractAccountParametersWidget
*mainOptionsWidget(ParameterEditModel *model,
QWidget *parent = 0) const;
virtual bool hasAdvancedOptionsWidget() const;
virtual AbstractAccountParametersWidget
*advancedOptionsWidget(ParameterEditModel *model,
QWidget *parent = 0) const;

private:
Q_DISABLE_COPY(HazeSipeAccountUi);
};

#endif // header guard
50 changes: 50 additions & 0 deletions plugins/haze/sipe-advanced-settings-widget.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* This file is part of telepathy-accounts-kcm
*
* Copyright (C) 2013 Maksim Melnikau <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "sipe-advanced-settings-widget.h"

SipeAdvancedSettingsWidget::SipeAdvancedSettingsWidget(ParameterEditModel *model,
QWidget *parent)
: AbstractAccountParametersWidget(model, parent)
{
// Set up the UI.
m_ui = new Ui::SipeAdvancedSettingsWidget;
m_ui->setupUi(this);

//server
handleParameter(QLatin1String("login"), QVariant::String, m_ui->loginLineEdit, m_ui->loginLabel);
handleParameter(QLatin1String("server"), QVariant::String, m_ui->serverLineEdit, m_ui->serverLabel);
handleParameter(QLatin1String("transport"), QVariant::String, m_ui->transportLineEdit, m_ui->transportLabel);
handleParameter(QLatin1String("useragent"), QVariant::String, m_ui->useragentLineEdit, m_ui->useragentLabel);
handleParameter(QLatin1String("authentication"), QVariant::String, m_ui->authenticationLineEdit, m_ui->authenticationLabel);
handleParameter(QLatin1String("dont-publish"), QVariant::Bool, m_ui->dontpublishCheckBox, 0);
handleParameter(QLatin1String("email-url"), QVariant::String, m_ui->emailurlLineEdit, m_ui->emailurlLabel);
handleParameter(QLatin1String("email"), QVariant::String, m_ui->emailLineEdit, m_ui->emailLabel);
handleParameter(QLatin1String("email-login"), QVariant::String, m_ui->emailloginLineEdit, m_ui->emailloginLabel);
handleParameter(QLatin1String("email-password"), QVariant::String, m_ui->emailpasswordLineEdit, m_ui->emailpasswordLabel);
handleParameter(QLatin1String("groupchat-user"), QVariant::String, m_ui->groupchatuserLineEdit, m_ui->groupchatuserLabel);
}

SipeAdvancedSettingsWidget::~SipeAdvancedSettingsWidget()
{
delete m_ui;
}

#include "sipe-advanced-settings-widget.moc"
42 changes: 42 additions & 0 deletions plugins/haze/sipe-advanced-settings-widget.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* This file is part of telepathy-accounts-kcm
*
* Copyright (C) 2013 Maksim Melnikau <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef KCMTELEPATHYACCOUNTS_PLUGIN_HAZE_SIPE_SERVER_SETTINGS_WIDGET_H
#define KCMTELEPATHYACCOUNTS_PLUGIN_HAZE_SIPE_SERVER_SETTINGS_WIDGET_H

#include "ui_sipe-advanced-settings-widget.h"

#include <KCMTelepathyAccounts/AbstractAccountParametersWidget>

class SipeAdvancedSettingsWidget : public AbstractAccountParametersWidget
{
Q_OBJECT

public:
explicit SipeAdvancedSettingsWidget(ParameterEditModel *model, QWidget *parent = 0);
virtual ~SipeAdvancedSettingsWidget();

private:
Q_DISABLE_COPY(SipeAdvancedSettingsWidget);
Ui::SipeAdvancedSettingsWidget *m_ui;
};


#endif // header guard
Loading

0 comments on commit 470db02

Please sign in to comment.