diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /korganizer/plugins/exchange | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korganizer/plugins/exchange')
-rw-r--r-- | korganizer/plugins/exchange/Makefile.am | 27 | ||||
-rw-r--r-- | korganizer/plugins/exchange/exchange.cpp | 238 | ||||
-rw-r--r-- | korganizer/plugins/exchange/exchange.desktop | 101 | ||||
-rw-r--r-- | korganizer/plugins/exchange/exchange.h | 68 | ||||
-rw-r--r-- | korganizer/plugins/exchange/exchangeconfig.cpp | 135 | ||||
-rw-r--r-- | korganizer/plugins/exchange/exchangeconfig.h | 60 | ||||
-rw-r--r-- | korganizer/plugins/exchange/exchangedialog.cpp | 58 | ||||
-rw-r--r-- | korganizer/plugins/exchange/exchangedialog.h | 43 | ||||
-rw-r--r-- | korganizer/plugins/exchange/exchangeui.rc | 13 |
9 files changed, 743 insertions, 0 deletions
diff --git a/korganizer/plugins/exchange/Makefile.am b/korganizer/plugins/exchange/Makefile.am new file mode 100644 index 000000000..39290aadd --- /dev/null +++ b/korganizer/plugins/exchange/Makefile.am @@ -0,0 +1,27 @@ +# $Id$ + +SUBDIRS= + +METASOURCES = AUTO + +INCLUDES = -I$(top_srcdir)/korganizer/interfaces \ + -I$(top_srcdir)/libkpimexchange/core -I$(top_builddir)/libkpimexchange/core \ + -I$(top_srcdir) \ + $(all_includes) + +kde_module_LTLIBRARIES = libkorg_exchange.la + +libkorg_exchange_la_SOURCES = exchange.cpp exchangedialog.cpp exchangeconfig.cpp +libkorg_exchange_la_LDFLAGS = -module $(KDE_PLUGIN) $(KDE_RPATH) $(all_libraries) +libkorg_exchange_la_LIBADD = $(top_builddir)/korganizer/libkorganizer.la \ + $(top_builddir)/libkpimexchange/libkpimexchange.la \ + $(LIB_KDEUI) $(LIB_KPARTS) + +noinst_HEADERS = exchange.h exchangedialog.h exchangeconfig.h + +servicedir = $(kde_servicesdir)/korganizer +service_DATA = exchange.desktop + +rcdir = $(kde_datadir)/korganizer/plugins +rc_DATA = exchangeui.rc + diff --git a/korganizer/plugins/exchange/exchange.cpp b/korganizer/plugins/exchange/exchange.cpp new file mode 100644 index 000000000..86377f046 --- /dev/null +++ b/korganizer/plugins/exchange/exchange.cpp @@ -0,0 +1,238 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include <qfile.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <kstandarddirs.h> + +#include <kurl.h> +#include <kdebug.h> + +#include <kmessagebox.h> +#include <klocale.h> +#include <kaction.h> +#include <kglobal.h> + +#include "korganizer/korganizer.h" +#include "korganizer/calendarview.h" + +#include <exchangeclient.h> +#include <exchangeaccount.h> + +#include "exchange.h" +#include "exchangedialog.h" +#include "exchangeconfig.h" + + +using namespace KCal; // Needed for connecting slots + +class ExchangeFactory : public KOrg::PartFactory { + public: + KOrg::Part *create(KOrg::MainWindow *parent, const char *name) + { + kdDebug(5850) << "Registering Exchange Plugin...\n"; + KGlobal::locale()->insertCatalogue("libkpimexchange"); + return new Exchange(parent,name); + } +}; + +K_EXPORT_COMPONENT_FACTORY( libkorg_exchange, ExchangeFactory ) + +Exchange::Exchange(KOrg::MainWindow *parent, const char *name) : + KOrg::Part(parent,name) +{ + setInstance( new KInstance( "korganizer" ) ); + + kdDebug(5850) << "Creating Exchange Plugin...\n"; + + mAccount = new KPIM::ExchangeAccount( "Calendar/Exchange Plugin" ); + mClient = new KPIM::ExchangeClient( mAccount ); + mClient->setWindow( parent->topLevelWidget() ); + + setXMLFile("plugins/exchangeui.rc"); + + new KAction(i18n("&Download..."), 0, this, SLOT(download()), + actionCollection(), "exchange_download"); + + KAction *action = new KAction(i18n("&Upload Event..."), 0, this, SLOT(upload()), + actionCollection(), "exchange_upload"); + QObject::connect(mainWindow()->view(),SIGNAL(incidenceSelected(Incidence *)), + this, SLOT(slotIncidenceSelected(Incidence *))); + action->setEnabled( false ); + QObject::connect(this,SIGNAL(enableIncidenceActions(bool)), + action,SLOT(setEnabled(bool))); + + action = new KAction(i18n("De&lete Event"), 0, this, SLOT(remove()), + actionCollection(), "exchange_delete"); + QObject::connect(this,SIGNAL(enableIncidenceActions(bool)), + action,SLOT(setEnabled(bool))); + action->setEnabled( false ); + + new KAction(i18n("&Configure..."), 0, this, SLOT(configure()), + actionCollection(), "exchange_configure"); + + connect( this, SIGNAL( calendarChanged() ), mainWindow()->view(), SLOT( updateView() ) ); + connect( this, SIGNAL( calendarChanged(const QDate &, const QDate &)), + mainWindow()->view(), SLOT(updateView(const QDate &, const QDate &)) ); +} + +Exchange::~Exchange() +{ + kdDebug(5850) << "Exchange Plugin destructor" << endl; +} + +QString Exchange::info() +{ + return i18n("This plugin imports and export calendar events from/to a Microsoft Exchange 2000 Server."); +} + +QString Exchange::shortInfo() +{ + return i18n("Exchange Plugin"); +} + +void Exchange::slotIncidenceSelected( Incidence *incidence ) +{ + emit enableIncidenceActions( incidence != 0 ); +} + +void Exchange::download() +{ + ExchangeDialog dialog( mainWindow()->view()->startDate(), mainWindow()->view()->endDate() ); + + if (dialog.exec() != QDialog::Accepted ) + return; + + QDate start = dialog.m_start->date(); + QDate end = dialog.m_end->date(); + + KCal::Calendar* calendar = mainWindow()->view()->calendar(); + + int result = mClient->downloadSynchronous(calendar, start, end, true ); + + if ( result == KPIM::ExchangeClient::ResultOK ) + emit calendarChanged(); + else + showError( result, mClient->detailedErrorString() ); + +} + +void Exchange::upload() +{ + kdDebug(5850) << "Called Exchange::upload()" << endl; + + Event* event = dynamic_cast<Event *> ( mainWindow()->view()->currentSelection() ); + if ( ! event ) + { + KMessageBox::information( 0L, i18n("Please select an appointment."), i18n("Exchange Plugin") ); + return; + } + if ( KMessageBox::warningContinueCancel( 0L, i18n("Exchange Upload is EXPERIMENTAL, you may lose data on this appointment!"), i18n("Exchange Plugin"), i18n("&Upload") ) + == KMessageBox::Continue ) { + kdDebug(5850) << "Trying to add appointment " << event->summary() << endl; + int result = mClient->uploadSynchronous( event ); + if ( result != KPIM::ExchangeClient::ResultOK ) + showError( result, mClient->detailedErrorString() ); + } +} + +void Exchange::remove() +{ + kdDebug(5850) << "Called Exchange::remove()" << endl; + + Event* event = dynamic_cast<Event *> ( mainWindow()->view()->currentSelection() ); + if ( ! event ) + { + KMessageBox::information( 0L, i18n("Please select an appointment."), i18n("Exchange Plugin") ); + return; + } + + if ( KMessageBox::warningContinueCancel( 0L, i18n("Exchange Delete is EXPERIMENTAL, if this is a recurring event it will delete all instances!"), i18n("Exchange Plugin"), KGuiItem(i18n("&Delete"),"editdelete") ) + == KMessageBox::Continue ) { + kdDebug(5850) << "Trying to delete appointment " << event->summary() << endl; + int result = mClient->removeSynchronous( event ); + + if ( result == KPIM::ExchangeClient::ResultOK ) { + mainWindow()->view()->calendar()->deleteEvent( event ); + emit calendarChanged(); + } else + showError( result, mClient->detailedErrorString() ); + } +} + +void Exchange::configure() +{ + kdDebug(5850) << "Exchange::configure" << endl; + ExchangeConfig dialog( mAccount ); + + if (dialog.exec() == QDialog::Accepted ) + mAccount->save( "Calendar/Exchange Plugin" ); +} + +void Exchange::showError( int error, const QString& moreInfo /* = QString::null */ ) +{ + QString errorText; + switch( error ) { + case KPIM::ExchangeClient::ResultOK: + errorText = i18n( "No Error" ); + break; + case KPIM::ExchangeClient::CommunicationError: + errorText = i18n( "The Exchange server could not be reached or returned an error." ); + break; + case KPIM::ExchangeClient::ServerResponseError: + errorText = i18n( "Server response could not be interpreted." ); + break; + case KPIM::ExchangeClient::IllegalAppointmentError: + errorText = i18n( "Appointment data could not be interpreted." ); + break; + case KPIM::ExchangeClient::NonEventError: + errorText = i18n( "This should not happen: trying to upload wrong type of event." ); + break; + case KPIM::ExchangeClient::EventWriteError: + errorText = i18n( "An error occurred trying to write an appointment to the server." ); + break; + case KPIM::ExchangeClient::DeleteUnknownEventError: + errorText = i18n( "Trying to delete an event that is not present on the server." ); + break; + case KPIM::ExchangeClient::UnknownError: + default: + errorText = i18n( "Unknown Error" ); + } + + if ( error != KPIM::ExchangeClient::ResultOK ) { + if ( moreInfo.isNull() ) + KMessageBox::error( mainWindow()->topLevelWidget(), errorText, i18n( "Exchange Plugin" ) ); + else + KMessageBox::detailedError( mainWindow()->topLevelWidget(), errorText, moreInfo, i18n( "Exchange Plugin" ) ); + } +} + +void Exchange::test() +{ + kdDebug(5850) << "Entering test()" << endl; + mClient->test(); +} + +void Exchange::test2() +{ + kdDebug(5850) << "Entering test2()" << endl; +} +#include "exchange.moc" diff --git a/korganizer/plugins/exchange/exchange.desktop b/korganizer/plugins/exchange/exchange.desktop new file mode 100644 index 000000000..121bf9863 --- /dev/null +++ b/korganizer/plugins/exchange/exchange.desktop @@ -0,0 +1,101 @@ +[Desktop Entry] +X-KDE-Library=libkorg_exchange +Name=Microsoft Exchange 2000 Plugin for KOrganizer +Name[af]=Microsoft Exchange 2000 inprop module vir KOrganizer +Name[be]=Дапаўненне K Арганізатара "Microsoft Exchange 2000" +Name[bg]=Приставка на организатора за връзка с Microsoft Exchange 2000 +Name[bs]=Microsoft Exchange 2000 dodatak za KOrganizer +Name[ca]=Endollable Microsoft Exchange 2000 per a KOrganizer +Name[cs]=Modul Microsoft Exchange 2000 pro KOrganizer +Name[da]=Microsoft Exchange 2000-plugin for KOrganizer +Name[de]=Microsoft Exchange 2000-Modul für KOrganizer +Name[el]=Πρόσθετο Microsoft Exchange 2000 του KOrganizer +Name[eo]=Microsoft Exchange 2000-kromaĵo por Organizilo +Name[es]=Accesorio de Microsoft Exchange 2000 para KOrganizer +Name[et]=Microsoft Exchange 2000 plugin KOrganizeri jaoks +Name[eu]=KOrganizer-en Microsoft Exchange 2000 plugin-a +Name[fa]=وصلۀ Microsoft Exchange ۲۰۰۰ برای KOrganizer +Name[fi]=KOrganizerin Microsoft Exchange 2000 -liitännäinen +Name[fr]=Module Microsoft Exchange 2000 pour KOrganizer +Name[fy]=Microsoft Exchange 2000 plugin foar KOrganizer +Name[ga]=Breiseán Microsoft Exchange 2000 le haghaidh KOrganizer +Name[gl]=Extensión de Microsoft Exchange 2000 para KOrganizer +Name[hu]=Microsoft Exchange 2000-bővítőmodul a KOrganizerhez +Name[is]=Microsoft Exchange 2000 íforrit fyrir KOrganizer +Name[it]=Plugin Microsoft Exchange 2000 per KOrganizer +Name[ja]=KOrganizer の Microsoft Exchange 2000 プラグイン +Name[ka]=Microsoft Exchange 2000-ის მოდული KOrganizer-სთვის +Name[kk]=KOrganizer-дің Microsoft Exchange 2000 модулі +Name[km]=កម្មវិធីជំនួយម៉ៃក្រូសូហ្វ Exchange ២០០០ សម្រាប់ KOrganizer +Name[lt]=Microsoft Exchange 2000 priedas, skirtas KOrganizer +Name[mk]=Приклучок за КОрганизатор за Microsoft Exchange 2000 +Name[ms]=PLugin Microsoft Exchange 2000 untuk KOrganizer +Name[nb]=Microsoft Exchange 2000 programtillegg for KOrganizer +Name[nds]=MSExchange2000-Moduul för KOrganizer +Name[ne]=केडीई आयोजकका लागि माइक्रोसफ्ट एक्सचेन्ज 2000 +Name[nl]=Microsoft Exchange 2000 plugin voor KOrganizer +Name[nn]=Microsoft Exchange 2000 programtillegg for KOrganizer +Name[pl]=Wtyczka Microsoft Exchange 2000 dla Organizatora +Name[pt]='Plugin' do Microsoft Exchange 2000 para o KOrganizer +Name[pt_BR]=Plug-in do Microsoft Exchange 2000 para o KOrganizer +Name[ru]=Доступ к Microsoft Exchange 2000 +Name[sk]=KOrganizer modul pre Microsoft Exchange 2000 +Name[sl]=Vstavek za Microsoft Exchange 2000 za KOrganizer +Name[sr]=Прикључак KOrganizer-а за Microsoft Exchange 2000 +Name[sr@Latn]=Priključak KOrganizer-a za Microsoft Exchange 2000 +Name[sv]=Microsoft Exchange 2000-insticksprogram för Korganizer +Name[ta]=கேஅமைப்பாளருக்கான மைக்ரோசாஃப்ட் எக்ஸ்சேன்ஜ் 2000 சொருகுப்பொருள் +Name[tg]=Дастрасӣ ба Microsoft Exchange 2000 +Name[tr]=KOrganizer için Microsoft Exchange 2000 Eklentisi +Name[uk]=Втулок Microsoft Exchange 2000 для KOrganizer +Name[zh_CN]=KOrganizer 的 Microsoft Exchange 2000 插件 +Name[zh_TW]=KOrganizer 的 Microsoft Exchange 2000 外掛程式 +Comment=This plugin allows korganizer users to work with Microsoft Exchange 2000 groupware servers. +Comment[af]=Hierdie inprop module maak dit vir korganizer gebruikers moontlik om met Microsoft Exchange 2000 bedieners te praat. +Comment[bg]=Приставката служи за връзка на Korganizer със сървъра Microsoft Exchange 2000 groupware. +Comment[ca]=Aquest endollable permet als usuaris de korganizer treballar amb servidors groupware Microsoft Exchange 2000. +Comment[cs]=tento modul umožňuje pracovat uživatelům korganizeru s Microsoft Exchange 2000 groupware servery. +Comment[da]=Dette plugin tillader brugere af korganizer at arbejde med Microsoft Exchange 2000 groupware servere. +Comment[de]=Mit diesem Modul kann KOrganizer mit Microsoft Exchange 2000 Groupware-Servern zusammenarbeiten. +Comment[el]=Αυτό το πρόσθετο επιτρέπει στους χρήστες του korganizer να δουλεύουν με εξυπηρετητές groupware του Microsoft Exchange 2000. +Comment[es]=Esta extensión permite que los usuarios de korganizer trabajen con servidores de groupware de Microsoft Exchange 2000. +Comment[et]=See plugin võimaldab KOrganizeri kasutajatel pruukida Microsoft Exchange 2000 grupitööservereid. +Comment[eu]=Plugin honek korganizer-en erabiltzaileei Microsoft Exchange 2000 groupware zerbitzariekin lan egiteko aukera ematen die. +Comment[fa]=این وصله به کاربران korganizer اجازه میدهد که با کارسازهای Microsoft Exchange 2000 groupware کار کند. +Comment[fi]=Tämä liitännäinen mahdollistaa KOrganizer-käyttäjien työskentelemisen Microsoft Exchange 2000 -ryhmätyöpalvelimien kanssa. +Comment[fr]=Ce module permet à KOrganizer de fonctionner avec Microsoft Exchange 2000 +Comment[fy]=Dizze plugin makket it mooglik om Microsoft Exchange 2000 te brûken yn KOrganizer. +Comment[gl]=Este engadido permite que os usuarios de korganizer traballen con servidores de traballo en grupo Microsoft Exchange 2000 +Comment[hu]=Ez a modul lehetővé teszi KOrganizer-felhasználóknak Microsoft Exchange 2000-kiszolgálón tárolt csoportmunka-adatok elérését. +Comment[is]=Þetta íforrit gerir KOrganizer kleyft að vinna með Microsoft Exchange 2000 hópvinnuþjónum. +Comment[it]=Questo plugin permette agli utenti di korganizer di lavorare con i server groupware Microsoft Exchange 2000. +Comment[ja]=このプラグインにより、korganizer のユーザが Microsoft Exchange 2000 グループウェアサーバと同期できるようになります。 +Comment[ka]=ეს მოდული korganizer-ის მომხმარებლებს საშუალებას აძლევს იმუშაონ Microsoft Exchange 2000 ჯგუფურ სერვერებთან. +Comment[kk]=Бұл модуль korganizer-мен MS Exchange 2000 біріккен жұмыс сервермен істеуге мүмкіндік береді. +Comment[km]=កម្មវិធីជំនួយនេះអនុញ្ញាតឲ្យអ្នកប្រើរបស់ korganizer ធ្វើការជាមួយម៉ាស៊ីនបម្រើកម្មវិធីពហុអ្នកប្រើរបស់ម៉ៃក្រូសូហ្វ Exchange ២០០០ ។ +Comment[lt]=Šis priedas leidžia korganizer dirbti su Microsoft Exchange 2000 groupware serveriais. +Comment[mk]=Овој приклучок им овозможува на корисниците на КОрганизатор да работат со groupware-серверите на Microsoft Exchange 2000. +Comment[ms]=Plugin ini membenarkan pengguna korganizer bekerja bersama pelayan groupware Microsoft Exchange 2000. +Comment[nb]=Med dette programtillegget kan korganizer-brukere arbeide med gruppevare-tjenere fra Microsoft Exchange 2000.i +Comment[nds]=Över dit Moduul köönt KOrganizer-Brukers mit Groupware-Servers för MSExchange-2000 arbeiden. +Comment[ne]=यो प्लगइनले माइक्रोसफ्ट एक्सचेन्ज 2000 ग्रुपवेयर सर्भरमा केडीई आयोजकलाई कार्य गर्न अनुमति दिन्छ । +Comment[nl]=Deze plugin maakt het mogelijk om Microsoft Exchange 2000 te gebruiken in KOrganizer. +Comment[nn]=Dette programtillegget lèt KOrganizer-brukarar arbeida saman med Microsoft Exchange 2000-gruppevaretenarar. +Comment[pl]=Ta wtyczka pozwala KOrganizerowi współpracować z serwerami pracy grupowej Microsoft Exchange. +Comment[pt]=Este 'plugin' permite aos utilizadores do KOrganizer lidarem com servidores de 'groupware' do Microsoft Exchange 2000. +Comment[pt_BR]=Esse plug-in permite que o KOrganizer conecte-se à servidores groupware Microsoft Exchance 2000 +Comment[ru]=Этот модуль позволяет пользователям органайзера работать с серверами совместной работы Microsoft Exchange 2000. +Comment[sk]=Tento modul umožní, aby korganizer užívatelia pracovali s Microsoft Exchange 2000 groupware servermi. +Comment[sl]=Ta vstavke omogoča uporabnikom KOrganizerja delo s strežniki Microsoft Exchange 2000. +Comment[sr]=Овај прикључак омогућава корисницима KOrganizer-а да раде са Microsoft-овим Exchange 2000 groupware серверима. +Comment[sr@Latn]=Ovaj priključak omogućava korisnicima KOrganizer-a da rade sa Microsoft-ovim Exchange 2000 groupware serverima. +Comment[sv]=Insticksprogrammet gör det möjligt för användare av Korganizer att arbeta med Microsoft Exchange 2000 grupprogramservrar. +Comment[ta]=இந்த சொருகுப்பொருள் korganizer பயனர்களை மைக்ரோசாப்ட் எக்ஸ்சேஞ்ச் 2000 குழுவாரி சேவகன்களில் பணி செய்ய அனுமதிக்கிறது. +Comment[tr]=Bu eklenti KOrganizer kullanıcılarının Microsoft Exchange 2000 sunucuları ile çalışabilmelerini sağlar. +Comment[uk]=Цей втулок дозволяє користувачам korganizer працювати з серверами групової роботи Microsoft Exchange 2000. +Comment[zh_CN]=此插件允许 KOrganizer 用户与 Microsoft Exchange 2000 群件服务器协同工作。 +Comment[zh_TW]=這個外掛程式允許 KOrganizer 使用者與 Microsoft Exchange 2000 群組伺服器一起工作。 +Type=Service +ServiceTypes=KOrganizer/Part +X-KDE-KOrganizer-HasSettings=false +X-KDE-PluginInterfaceVersion=2 diff --git a/korganizer/plugins/exchange/exchange.h b/korganizer/plugins/exchange/exchange.h new file mode 100644 index 000000000..a145bd12f --- /dev/null +++ b/korganizer/plugins/exchange/exchange.h @@ -0,0 +1,68 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef KORG_EXCHANGE_H +#define KORG_EXCHANGE_H + +#include <qstring.h> +#include <qdatetime.h> + +#include <korganizer/part.h> + +#include <libkcal/incidence.h> +#include <libkcal/event.h> + +#include <exchangeaccount.h> +#include <exchangeclient.h> + +// using namespace KOrg; +using namespace KCal; + +class Exchange : public KOrg::Part { + Q_OBJECT + public: + Exchange( KOrg::MainWindow *, const char *name ); + ~Exchange(); + + QString info(); + // This method is used for the category of the key bindings + QString shortInfo(); + + signals: + void enableIncidenceActions( bool ); + void calendarChanged(); + void calendarChanged(const QDate&start,const QDate&end); + + private slots: + void download(); + void upload(); + void remove(); + void configure(); + void test(); + void slotIncidenceSelected( Incidence * ); + + private: + void test2(); + void showError( int error, const QString& moreInfo = QString::null ); + + KPIM::ExchangeClient *mClient; + KPIM::ExchangeAccount* mAccount; +}; + +#endif + diff --git a/korganizer/plugins/exchange/exchangeconfig.cpp b/korganizer/plugins/exchange/exchangeconfig.cpp new file mode 100644 index 000000000..e75265caa --- /dev/null +++ b/korganizer/plugins/exchange/exchangeconfig.cpp @@ -0,0 +1,135 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include <qlayout.h> +#include <qlabel.h> +#include <qcombobox.h> + +#include <kapplication.h> +#include <kconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kmessagebox.h> + +#include <exchangeaccount.h> + +#include "exchangeconfig.h" + +ExchangeConfig::ExchangeConfig( KPIM::ExchangeAccount* account, QWidget* parent ) + : KDialogBase(Plain,i18n("Exchange Plugin"),Ok|Cancel,Ok,parent) +{ + mAccount = account; + + kdDebug(5850) << "Creating ExchangeConfig with account: " << + account->host() << ":" << account->account() << endl; + + QFrame *topFrame = plainPage(); + QGridLayout *topLayout = new QGridLayout( topFrame, 5, 3, 3 ); + + m_host = new KLineEdit( mAccount->host(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "Exchange server:" ), topFrame ), 0, 0 ); + topLayout->addWidget( m_host, 0, 1 ); + + m_port = new KLineEdit( mAccount->port(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "Port:" ), topFrame ), 1, 0 ); + topLayout->addWidget( m_port, 1, 1 ); + + m_user = new KLineEdit( mAccount->account(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "User:" ), topFrame ), 2, 0 ); + topLayout->addWidget( m_user, 2, 1 ); + connect( m_user, SIGNAL(textChanged(const QString&)), this, SLOT(slotUserChanged(const QString&)) ); + + m_password = new KLineEdit( mAccount->password(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "Password:" ), topFrame ), 3, 0 ); + topLayout->addWidget( m_password, 3, 1 ); + m_password->setEchoMode( QLineEdit::Password ); + + m_autoMailbox = new QCheckBox( i18n( "Determine mailbox automatically" ), topFrame ); + topLayout->addMultiCellWidget( m_autoMailbox, 4, 4, 0, 1 ); + connect( m_autoMailbox, SIGNAL(toggled(bool)), this, SLOT(slotToggleAuto(bool)) ); + + m_mailbox= new KLineEdit( mAccount->mailbox(), topFrame ); + topLayout->addWidget( new QLabel( i18n( "Mailbox URL:" ), topFrame ), 5, 0 ); + topLayout->addWidget( m_mailbox, 5, 1 ); + + m_tryFindMailbox = new QPushButton( "&Find", topFrame ); + topLayout->addWidget( m_tryFindMailbox, 5, 2 ); + connect( m_tryFindMailbox, SIGNAL(clicked()), this, SLOT(slotFindClicked()) ); + + kapp->config()->setGroup( "Calendar/Exchange Plugin" ); + bool autoChecked = kapp->config()->readBoolEntry( "auto-mailbox", true ); + m_autoMailbox->setChecked( autoChecked ); +} + +ExchangeConfig::~ExchangeConfig() +{ +} + +void ExchangeConfig::slotToggleAuto( bool on ) +{ + m_mailbox->setEnabled( ! on ); +// m_tryFindMailbox->setEnabled( ! on ); +// if ( on ) { +// m_mailbox->setText( "webdav://" + m_host->text() + "/exchange/" + m_user->text() ); +// } +} + +void ExchangeConfig::slotUserChanged( const QString& /*text*/ ) +{ +// if ( m_mailboxEqualsUser->isChecked() ) { +// m_mailbox->setText( "webdav://" + m_host->text() + "/exchange/" + text ); +// } +} + +void ExchangeConfig::slotOk() +{ + if ( m_autoMailbox->isChecked() ) { + QString mailbox = mAccount->tryFindMailbox( m_host->text(), m_port->text(), m_user->text(), m_password->text() ); + if ( mailbox.isNull() ) { + kdWarning() << "Could not find Exchange mailbox URL, incomplete settings!"<< endl; + KMessageBox::sorry( this, "Could not determine mailbox URL" ); + return; // Do not accept + } else { + mAccount->setMailbox( mailbox ); + } + } else { + mAccount->setMailbox( m_mailbox->text() ); + } + mAccount->setHost( m_host->text() ); + mAccount->setPort( m_port->text() ); + mAccount->setAccount( m_user->text() ); + mAccount->setPassword( m_password->text() ); + + kapp->config()->setGroup( "Calendar/Exchange Plugin" ); + kapp->config()->writeEntry( "auto-mailbox", m_autoMailbox->isChecked() ); + + accept(); +} + +void ExchangeConfig::slotFindClicked() +{ + QString mailbox = mAccount->tryFindMailbox( m_host->text(), m_port->text(), m_user->text(), m_password->text() ); + if ( mailbox.isNull() ) { + KMessageBox::sorry( this, "Could not determine mailbox URL" ); + } else { + m_mailbox->setText( mailbox ); + } +} + +#include "exchangeconfig.moc" diff --git a/korganizer/plugins/exchange/exchangeconfig.h b/korganizer/plugins/exchange/exchangeconfig.h new file mode 100644 index 000000000..ba974ba26 --- /dev/null +++ b/korganizer/plugins/exchange/exchangeconfig.h @@ -0,0 +1,60 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef EXCHANGECONFIG_H +#define EXCHANGECONFIG_H + +#include <qcheckbox.h> +#include <qpushbutton.h> +#include <kdialogbase.h> +#include <klineedit.h> +//#include <kpassdlg.h> + +#include <exchangeaccount.h> + +class ExchangeConfig : public KDialogBase +{ + Q_OBJECT + public: + ExchangeConfig(KPIM::ExchangeAccount* account, QWidget *parent=0); + virtual ~ExchangeConfig(); + +// protected: +// void load(); +// void save(); + + protected slots: + void slotToggleAuto( bool on ); + void slotUserChanged( const QString& text ); + void slotFindClicked(); + void slotOk(); + + private: + public: + KPIM::ExchangeAccount* mAccount; + KLineEdit *m_host; + KLineEdit *m_port; + KLineEdit *m_user; + QCheckBox *m_autoMailbox; + KLineEdit *m_mailbox; + QPushButton* m_tryFindMailbox; + KLineEdit *m_password; +}; + +#endif + diff --git a/korganizer/plugins/exchange/exchangedialog.cpp b/korganizer/plugins/exchange/exchangedialog.cpp new file mode 100644 index 000000000..249b07a91 --- /dev/null +++ b/korganizer/plugins/exchange/exchangedialog.cpp @@ -0,0 +1,58 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#include <qlayout.h> +#include <qlabel.h> +#include <qcombobox.h> + +#include <klocale.h> +#include <kmessagebox.h> +#include <kapplication.h> +#include <kglobal.h> +#include <kstandarddirs.h> +#include <ksimpleconfig.h> + +#include "exchangedialog.h" + +ExchangeDialog::ExchangeDialog( const QDate &_start, const QDate &_end, QWidget *parent) + : KDialogBase(Plain,i18n("Exchange Plugin"),Ok|Cancel,Ok,parent) +{ + QFrame *topFrame = plainPage(); + QGridLayout *topLayout = new QGridLayout( topFrame, 2, 2, 3 ); + + QLabel *label = new QLabel(i18n("Start date:"),topFrame); + topLayout->addWidget(label, 0, 0); + + m_start = new KDateWidget( _start, topFrame ); + topLayout->addWidget( m_start, 0, 1 ); + + m_end = new KDateWidget( _end, topFrame ); + topLayout->addWidget( new QLabel( i18n( "End date:" ), topFrame ), 1, 0 ); + topLayout->addWidget( m_end, 1, 1 ); +} + +ExchangeDialog::~ExchangeDialog() +{ +} + +void ExchangeDialog::slotOk() +{ + accept(); +} +#include "exchangedialog.moc" diff --git a/korganizer/plugins/exchange/exchangedialog.h b/korganizer/plugins/exchange/exchangedialog.h new file mode 100644 index 000000000..440d48fd9 --- /dev/null +++ b/korganizer/plugins/exchange/exchangedialog.h @@ -0,0 +1,43 @@ +/* + This file is part of KOrganizer. + Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef EXCHANGEDIALOG_H +#define EXCHANGEDIALOG_H + +#include <kdialogbase.h> +#include <kdatewidget.h> + +class QComboBox; + +class ExchangeDialog : public KDialogBase +{ + Q_OBJECT + public: + ExchangeDialog( const QDate &start, const QDate &end, QWidget *parent=0); + virtual ~ExchangeDialog(); + + protected slots: + void slotOk(); + + private: + public: + KDateWidget *m_start; + KDateWidget *m_end; +}; + +#endif diff --git a/korganizer/plugins/exchange/exchangeui.rc b/korganizer/plugins/exchange/exchangeui.rc new file mode 100644 index 000000000..b1caad16b --- /dev/null +++ b/korganizer/plugins/exchange/exchangeui.rc @@ -0,0 +1,13 @@ +<!DOCTYPE kpartgui> +<kpartgui name="exchange" version="1"> + + <MenuBar> + <Menu name="exchange"><text>Exchange</text> + <Action name="exchange_download" /> + <Action name="exchange_upload" /> + <Action name="exchange_delete" /> + <Action name="exchange_configure" /> + </Menu> + </MenuBar> + +</kpartgui> |