diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-15 17:32:48 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-15 17:32:48 +0000 |
commit | e2f541c98dfa4081fa3ab3d28f08ea2309281884 (patch) | |
tree | cb721a55bc88753ddeb9754dc98ef45e2850ce30 /src/kdesvnd | |
download | tdesvn-e2f541c98dfa4081fa3ab3d28f08ea2309281884.tar.gz tdesvn-e2f541c98dfa4081fa3ab3d28f08ea2309281884.zip |
Added KDE3 version of kdesvn
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kdesvn@1103685 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kdesvnd')
-rw-r--r-- | src/kdesvnd/CMakeLists.txt | 55 | ||||
-rw-r--r-- | src/kdesvnd/kdesvn_subversion.desktop.in | 368 | ||||
-rw-r--r-- | src/kdesvnd/kdesvnd.desktop | 12 | ||||
-rw-r--r-- | src/kdesvnd/kdesvnd_dcop.cpp | 461 | ||||
-rw-r--r-- | src/kdesvnd/kdesvnd_dcop.h | 74 | ||||
-rw-r--r-- | src/kdesvnd/main.cpp | 67 |
6 files changed, 1037 insertions, 0 deletions
diff --git a/src/kdesvnd/CMakeLists.txt b/src/kdesvnd/CMakeLists.txt new file mode 100644 index 0000000..fee835f --- /dev/null +++ b/src/kdesvnd/CMakeLists.txt @@ -0,0 +1,55 @@ +INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/src/svnqt) +FILE(GLOB hdr RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h") +SET(kded_kdesvnd_src + kdesvnd_dcop.cpp + ${hdr} + ) + +KDE3_ADD_MOC_FILES(kded_kdesvnd_src kdesvnd_dcop.h) + +KDE3_ADD_DCOP_SKELS(kded_kdesvnd_src + kdesvnd_dcop.h) + +KDE3_ADD_KPART(kded_kdesvnd ${kded_kdesvnd_src}) + +TARGET_LINK_LIBRARIES(kded_kdesvnd + svnqt + ksvnwidgets + kdesvnhelpers + kdesvncfgreader + ${QT_AND_KDECORE_LIBS} ${KDE3_KIO_LIBRARY} ${KDE3_DCOP_LIBRARY} + ${KDE3_UI_LIBRARY} ${KDE3_WALLET_LIBRARY} + ${KDE3_KINIT_KDED_LIBRARY}) + +SET_TARGET_PROPERTIES(kded_kdesvnd + PROPERTIES + LINK_FLAGS "${LINK_NO_UNDEFINED} ${_BASE_LDADD} ${APR_EXTRA_LIBFLAGS} ${APU_EXTRA_LIBFLAGS} -avoid-version -module") + +INSTALL(TARGETS kded_kdesvnd + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR}) + +KDESVN_GENERATE_LIBTOOL_FILE(kded_kdesvnd) + +IF(KDE3_KDECONFIG_EXECUTABLE) + EXECUTE_PROCESS(COMMAND ${KDE3_KDECONFIG_EXECUTABLE} "--version" OUTPUT_VARIABLE output) + STRING(REGEX MATCH "KDE: [0-9]+\\.[0-9]+\\.[0-9]+" KDEVERSION "${output}") + STRING(REGEX REPLACE "^KDE: " "" KDEVERSION "${KDEVERSION}") +ENDIF(KDE3_KDECONFIG_EXECUTABLE) +SET(KDE_MIN_VERSION "3.5.0") +MACRO_ENSURE_VERSION(${KDE_MIN_VERSION} ${KDEVERSION} VERSION_OK) + +IF(VERSION_OK) + SET(ACTION_MENU "X-KDE-GetActionMenu=kded kdesvnd getActionMenu(KURL::List)") +ELSE(VERSION_OK) + SET(ACTION_MENU "Actions=Update;Commit;Add;Delete;Blame;Log;Diff;Checkout;Export;Info;Addnew;Switch;Revert;Rename;Tree") +ENDIF(VERSION_OK) + +CONFIGURE_FILE(kdesvn_subversion.desktop.in + ${CMAKE_CURRENT_BINARY_DIR}/kdesvn_subversion.desktop @ONLY) + +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/kdesvn_subversion.desktop + DESTINATION ${DATA_INSTALL_DIR}/konqueror/servicemenus) + +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/kdesvnd.desktop + DESTINATION ${SERVICES_INSTALL_DIR}/kded) diff --git a/src/kdesvnd/kdesvn_subversion.desktop.in b/src/kdesvnd/kdesvn_subversion.desktop.in new file mode 100644 index 0000000..4897342 --- /dev/null +++ b/src/kdesvnd/kdesvn_subversion.desktop.in @@ -0,0 +1,368 @@ +[Desktop Entry] +Encoding=UTF-8 +ServiceTypes=inode/directory,all/allfiles +X-KDE-Submenu=Subversion (kdesvn) + +@ACTION_MENU@ + +[Desktop Action Log] +Name=Subversion log (last 100) +Name[es]=Mostrar registros (últimos 100) +Icon=kdesvnlog +Exec=kdesvn exec -r HEAD:1 -l 100 log %U +Comment=Displays the subversion log +Comment[es]=Muestra los registros de Subversion + +[Desktop Action Info] +Name=Detailed subversion info +Name[es]=Información detallada +Icon=kdesvninfo +Exec=kdesvn exec info %U + +[Desktop Action Add] +Name=Add to Repository +Name[bg]=Добавяне в хранилището +Name[da]=Tilføj til lager +Name[et]=Hoidlasse lisamine +Name[sr]=Додај у складиште +Name[sr@Latn]=Dodaj u skladište +Name[sv]=Lägg till i arkiv +Name[tr]=Depoya Ekle +Name[es]=Añadir al Repositorio +Icon=kdesvnadd +Exec=kdesvn exec add %U + +[Desktop Action Addnew] +Name=Check for unversioned items +Name[es]=Mostrar elementos no versionados +Icon=kdesvnaddrecursive +Exec=kdesvn exec addnew %U + +[Desktop Action Delete] +Name=Delete From Repository +Name[bg]=Изтриване от хранилището +Name[da]=Slet fra lager +Name[et]=Hoidlast kustutamine +Name[sr]=Обриши из складишта +Name[sr@Latn]=Obriši iz skladišta +Name[sv]=Ta bort från arkiv +Name[tr]=Depodan Sil +Name[es]=Eliminar del Repositorio +Icon=kdesvndelete +Exec=kdesvn exec rm %U + +[Desktop Action Revert] +Name=Revert Local Changes +Name[bg]=Игнориране на локалните промени +Name[da]=Vend lokale ændringer om +Name[et]=Kohalike muudatuste tühistamine +Name[sr]=Одбаци локалне измене +Name[sr@Latn]=Odbaci lokalne izmene +Name[sv]=Återställ lokal ändring +Name[tr]=Yerel Değişiklikleri Ters Çevir +Name[es]=Deshacer cambios locales +Icon=undo +Exec=kdesvn exec revert %U +Comment=Remove any changes made locally. Warning - this cannot be undone. +Comment[bg]=Премахване на локалните промени, които са направени. Забележете, че данните ще се загубят безвъзвратно. +Comment[da]=Fjern alle ændringer der er lavet lokalt. Advarsel - dette kan ikke fortrydes. +Comment[et]=Eemaldab kõik kohalikud muudatused. Hoiatus: seda ei saa tagasi võtta. +Comment[sr]=Уклони све локално направљене измене. Упозорење: ово се не може опозвати. +Comment[sr@Latn]=Ukloni sve lokalno napravljene izmene. Upozorenje: ovo se ne može opozvati. +Comment[sv]=Tar bort alla ändringar som gjorts lokalt. Varning: detta kan inte ångras. +Comment[tr]=Yerel olarak yapılan değişiklikleri kaldır. Dikkat - bu işlem geri alınamaz. +Comment[es]=Deshace cualquier cambio realizado localmente. Aviso - no se puede invertir el proceso. + +[Desktop Action Rename] +Name=Rename... +Name[bg]=Преименуване... +Name[br]=Adenvel ... +Name[cy]=Ail-enwi... +Name[da]=Omdøb... +Name[et]=Ümbernimetamine... +Name[ga]=Athainmnigh... +Name[sr]=Преименуј... +Name[sr@Latn]=Preimenuj... +Name[sv]=Byt namn... +Name[tr]=Yeniden Adlandır... +Name[es]=Renombrar... +Icon=pencil +Exec=kdesvn exec mv %U +Comment=Rename a file locally and in the repository. Use this rather than adding and deleting to rename a file. +Comment[bg]=Преименуване на файл локално и в хранилището. За предпочитане е да използвате този метод, вместо изтриване и добавяне. +Comment[da]=Omdøb en fil lokalt og i lageret. Brug dette i stedet for at tilføje og slette fro at omdøbe en fil. +Comment[et]=Faili ümbernimetamine nii kohalikult kui hoidlas. See on eelistatud viis faili ümbernimetamisel lisamise ja kustutamise asemel. +Comment[sr]=Преименуј фајл локално и у складишту. Користите ово уместо трика са додавањем и брисањем фајла. +Comment[sr@Latn]=Preimenuj fajl lokalno i u skladištu. Koristite ovo umesto trika sa dodavanjem i brisanjem fajla. +Comment[sv]=Byt namn på en fil lokalt och i arkivet. Använd detta istället för att lägga till och ta bort för att byta namn på en fil. +Comment[es]=Renombra un fichero localmente y en el repositorio. Utilizar ésto en lugar de añadir y borrar el fichero. + +[Desktop Action Import] +Name=Import Repository +Name[bg]=Импорт на директория +Name[da]=Importér lager +Name[et]=Hoidla import +Name[sr]=Увези складиште +Name[sr@Latn]=Uvezi skladište +Name[sv]=Importera arkiv +Name[tr]=Depoyu İçe Aktar +Name[es]=Importar Repositorio +Icon=svn_import +Exec=kio_svn_helper -i %U +Comment=Put folder into an existing repository to put it under revision control. +Comment[bg]=Импорт на директория в съществуващо хранилище. +Comment[da]=Put mappe ind i et eksisterende lager for at få den ind under revisionskontrol. +Comment[et]=Kataloogi lisamine olemasolevasse versioonikontrolli süsteemi hoidlasse. +Comment[sr]=Стави фасциклу у постојеће складиште, ради стављања под контролу ревизија. +Comment[sr@Latn]=Stavi fasciklu u postojeće skladište, radi stavljanja pod kontrolu revizija. +Comment[sv]=Lägg till katalog i ett befintligt arkiv för att få den under versionskontroll +Comment[tr]=Dizini başka bie alt düzeltme controlünde var olan bir depo içine koy. +Comment[es]=Poner la carpeta en un repositorio existente para tenerla bajo control de versiones. + +[Desktop Action Checkout] +Name=Checkout From Repository... +Name[bg]=Изтегляне от хранилището... +Name[da]=Tjek ud fra lager... +Name[et]=Hoidla väljavõte... +Name[sr]=Довуци из складишта... +Name[sr@Latn]=Dovuci iz skladišta... +Name[sv]=Checka ut från ett arkiv... +Name[tr]=Depodan Kontrol Et... +Name[es]=Obtener del Repositorio... +Icon=kdesvncheckout +Exec=kdesvn exec checkout %U +Comment=Checkout out files from an existing repository into this folder. +Comment[bg]=Изтегляне на файлове от хранилището в текущата директория. +Comment[da]=Tjek filer ud fra et eksisterende lager til denne mappe. +Comment[et]=Olemasoleva hoidla failide väljavõte sellesse kataloogi. +Comment[sr]=Довуци фајлове из постојећег складишта у ову фасциклу. +Comment[sr@Latn]=Dovuci fajlove iz postojećeg skladišta u ovu fasciklu. +Comment[sv]=Checka ut filer från ett befintligt arkiv till katalogen. +Comment[tr]=Bu dizinde var olan bir depodan hatalı dosyaları kontrol et. +Comment[es]=Extrae ficheros de un repositorio existente hacia esta carpeta. + +[Desktop Action Switch] +Name=Switch... +Name[bg]=Превключване... +Name[et]=Lülitumine... +Name[sr]=Пребаци... +Name[sr@Latn]=Prebaci... +Name[sv]=Byt... +Name[tr]=Değiştir... +Name[es]=Relocalizar... +Icon=kdesvnswitch +Comment=Switch given working copy to another branch +Comment[bg]=Превключване на работното копие към друго разклонение. +Comment[da]=Skift given arbejdskopi til en anden gren. +Comment[et]=Antud töökoopia lülitamine teise harru +Comment[sr]=Пребаци дату радну копију на другу грану +Comment[sr@Latn]=Prebaci datu radnu kopiju na drugu granu +Comment[sv]=Byt angiven arbetskopia till en annan gren +Comment[tr]=Çalışan belirli bir kopyayı başka bölüme değiştir +Comment[es]=Relocaliza la copia de trabajo hacia otra rama +Exec=kdesvn exec switch %U + +[Desktop Action Merge] +Name=Merge... +Name[bg]=Смесване... +Name[da]=Indflet... +Name[et]=Ühendamine... +Name[sr]=Стопи... +Name[sr@Latn]=Stopi... +Name[sv]=Sammanfoga... +Name[tr]=Birleştir... +Name[es]=Fusionar... +Icon=svn_merge +Comment=Merge changes between this and another branch +Comment[bg]=Смесване на промените от това разклонение с друго разклонение. +Comment[da]=Indflet ændringer mellem denne og en anden gren +Comment[et]=Selle ja teise haru muudatuste ühendamine +Comment[sr]=Стопи измене између ове и друге гране +Comment[sr@Latn]=Stopi izmene između ove i druge grane +Comment[sv]=Sammanfoga ändringar mellan den här och en annan gren +Comment[tr]=Bu ve başka bölüm arasındaki değişiklikleri birleştir +Comment[es]=Fusionar cambios entre esta rama y otra +Exec=kio_svn_helper -m %U + +[Desktop Action Blame] +Name=Blame... +Name[bg]=Информация... +Name[et]=Autorsus... +Name[pa]=ਬਲਾਮੀ... +Name[sr]=Окриви... +Name[sr@Latn]=Okrivi... +Name[sv]=Klandra... +Name[es]=Ver anotado... +Icon=kdesvnblame +Comment=See who wrote each line of the file and in what revision +Comment[bg]=Информация за файла. +Comment[da]=Se hvem der skrev hver linje i filen og i hvilken revision +Comment[et]=Vaatamine, kes ja millises versioonis mingi faili rea kirjutas +Comment[sr]=Прикажи за сваку линију фајла ко ју је написао и у којој ревизији +Comment[sr@Latn]=Prikaži za svaku liniju fajla ko ju je napisao i u kojoj reviziji +Comment[sv]=Se vem som skrev varje rad i filen och för vilken version +Comment[es]=Ver quién escribió cada línea del fichero y en qué revisión +Exec=kdesvn exec blame %U + +[Desktop Action CreatePatch] +Name=Create Patch... +Name[bg]=Създаване на кръпка... +Name[da]=Lav rettelse... +Name[et]=Paiga loomine... +Name[pa]=ਪੈਂਚ ਬਣਾਓ... +Name[sr]=Направи закрпу... +Name[sr@Latn]=Napravi zakrpu... +Name[sv]=Skapa programfix... +Name[tr]=Yama Oluştur... +Name[es]=Crear Parche... +Exec=kio_svn_helper -p %U + +[Desktop Action Export] +Name=Export... +Name[bg]=Експорт... +Name[br]=Ezporzh ... +Name[cy]=Allforio... +Name[da]=Eksportér... +Name[et]=Eksport... +Name[ga]=Easpórtáil... +Name[sr]=Извези... +Name[sr@Latn]=Izvezi... +Name[sv]=Exportera... +Name[tr]=Dışa Aktar... +Name[es]=Exportar... +Icon=kdesvnexport +Exec=kdesvn exec export %U +Comment=Checkout out an unversioned copy of a tree from a repository +Comment[bg]=Изтегляне на копие на дървото от хранилището. +Comment[da]=Tjek en kopi uden version ud af et træ fra et lager +Comment[et]=Hoidla failipuu versioonita koopia väljavõte +Comment[sr]=Довуци неверзирану копију стабла из складишта +Comment[sr@Latn]=Dovuci neverziranu kopiju stabla iz skladišta +Comment[sv]=Checka ut en kopia utan versionskontroll från ett arkiv +Comment[tr]=Depodaki bir ağaçtan kusurlu bir versionsuz kopyayı kontrol et +Comment[es]=Obtener una copia no versionada de un árbol de un repositorio + +[Desktop Action Diff] +Name=Diff (local) +Name[bg]=Разлика (локално) +Name[da]=Diff (lokal) +Name[et]=Võrdlemine (kohalik) +Name[ga]=Diff (logánta) +Name[sr]=Разликуј (локално) +Name[sr@Latn]=Razlikuj (lokalno) +Name[sv]=Jämför (lokalt) +Name[tr]=Diff (yerel) +Name[es]=Ver diferencias (locales) +Icon=kdesvndiff +Exec=kdesvn exec diff %U +Comment=Show local changes since last update +Comment[bg]=Показване на локалните промени след последното обновяване. +Comment[da]=Vis lokale ændringer siden sidste opdatering +Comment[et]=Kohalike muudatuste näitamine pärast viimast uuendamist +Comment[sr]=Прикажи локалне измене од последњег ажурирања +Comment[sr@Latn]=Prikaži lokalne izmene od poslednjeg ažuriranja +Comment[sv]=Visa lokala ändringar sedan senaste uppdateringen +Comment[tr]=Son güncellemeden sonraki yerel değişiklikleri göster +Comment[es]=Mostrar cambios locales desde la última actualización + +[Desktop Action Update] +Name=KDESvn Update +Name[bg]=Обновяване SVN +Name[da]=SVN Opdatér +Name[et]=SVN uuendamine +Name[sr]=SVN ажурирање +Name[sr@Latn]=SVN ažuriranje +Name[sv]=SVN-uppdatera +Name[tr]=SVN Güncelleme +Name[es]=(SVN) Actualizar +Icon=kdesvnupdate +Exec=kdesvn exec update %U + +[Desktop Action Commit] +Name=KDESvn Commit +Name[bg]=Предаване SVN +Name[et]=SVN sissekanne +Name[sr]=SVN предаја +Name[sr@Latn]=SVN predaja +Name[sv]=SVN-arkivera +Name[tr]=SVN Teslim Etme +Name[es]=(SVN) Confirmar +Icon=kdesvncommit +Exec=kdesvn exec commit %U + +[Desktop Action Checkout] +Name=Checkout From Repository... +Name[bg]=Изтегляне от хранилището... +Name[da]=Tjek ud fra lager... +Name[et]=Hoidla väljavõte... +Name[sr]=Довуци из складишта... +Name[sr@Latn]=Dovuci iz skladišta... +Name[sv]=Checka ut från ett arkiv... +Name[tr]=Depodan Kontrol Et... +Name[es]=(SVN) Obtener del Repositorio... +Icon=kdesvncheckout +Exec=kdesvn exec checkout %U +Comment=Checkout out files from an existing repository into this folder. +Comment[bg]=Изтегляне на файлове от хранилището в текущата директория. +Comment[da]=Tjek filer ud fra et eksisterende lager til denne mappe. +Comment[et]=Olemasoleva hoidla failide väljavõte sellesse kataloogi. +Comment[sr]=Довуци фајлове из постојећег складишта у ову фасциклу. +Comment[sr@Latn]=Dovuci fajlove iz postojećeg skladišta u ovu fasciklu. +Comment[sv]=Checka ut filer från ett befintligt arkiv till katalogen. +Comment[tr]=Bu dizinde var olan bir depodan hatalı dosyaları kontrol et. +Comment[es]=Extraer ficheros de un repositorio existente hacia esta carpeta. + +[Desktop Action Export] +Name=Export ... +Name[bg]=Експорт... +Name[br]=Ezporzh ... +Name[cy]=Allforio... +Name[da]=Eksportér... +Name[et]=Eksport... +Name[ga]=Easpórtáil... +Name[sr]=Извези... +Name[sr@Latn]=Izvezi... +Name[sv]=Exportera... +Name[tr]=Dışa Aktar... +Name[es]=(SVN) Exportar... +Icon=kdesvnexport +Exec=kdesvn exec export %U +Comment=Checkout out an unversioned copy of a tree from a repository +Comment[bg]=Изтегляне на копие на дървото от хранилището. +Comment[da]=Tjek en kopi uden version ud af et træ fra et lager +Comment[et]=Hoidla failipuu versioonita koopia väljavõte +Comment[sr]=Довуци неверзирану копију стабла из складишта +Comment[sr@Latn]=Dovuci neverziranu kopiju stabla iz skladišta +Comment[sv]=Checka ut en kopia utan versionskontroll från ett arkiv +Comment[tr]=Depodaki bir ağaçtan kusurlu bir versionsuz kopyayı kontrol et +Comment[es]=Obtener una copia no versionada del árbol de un repositorio + +[Desktop Action Checkoutto] +Name=Checkout from a repository... +Name[de]=Checkout einer Repository +Name[es]=Obtener de Subversion... +Icon=kdesvncheckout +Exec=kdesvn exec checkoutto %U +Comment=Checkout out files from an existing repository into this folder. +Comment[de]=Erzeuge eine Arbeitskopie von einer Repository +Comment[es]=Extraer ficheros de un repositorio existente hacia esta carpeta. + +[Desktop Action Exportto] +Name=Export from a subversion repository... +Name[de]=Exportiere von einer Subversion Repository... +Name[es]=Exportar de Subversion... +Icon=kdesvnexport +Exec=kdesvn exec exportto %U +Comment=Checkout out an unversioned copy of a tree from a repository +Comment[de]=Hole eine unversionierte Kopie eines Baums von einer Repository +Comment[es]=Obtener una copia no versionada del árbol de un repositorio + +[Desktop Action Tree] +Name=Display revision tree +Name[de]=Zeige Revisionsbaum +Name[es]=Mostrar árbol de revisiones +Icon=kdesvnlog +Exec=kdesvn exec tree %U +Comment[de]=Zeige den kompletten Revisionsbaum +Comment=Show complete revision tree +Comment[es]=Muestra el árbol de revisiones completo diff --git a/src/kdesvnd/kdesvnd.desktop b/src/kdesvnd/kdesvnd.desktop new file mode 100644 index 0000000..eb9c91c --- /dev/null +++ b/src/kdesvnd/kdesvnd.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Name=kdesvnd subversion module +Name[es]=módulo para subversion kdesvnd +ServiceTypes=KDEDModule +X-KDE-ModuleType=Library +X-KDE-Library=kdesvnd +X-KDE-FactoryName=kdesvnd +X-KDE-Kded-autoload=true +X-KDE-Kded-load-on-demand=true + diff --git a/src/kdesvnd/kdesvnd_dcop.cpp b/src/kdesvnd/kdesvnd_dcop.cpp new file mode 100644 index 0000000..580fa92 --- /dev/null +++ b/src/kdesvnd/kdesvnd_dcop.cpp @@ -0,0 +1,461 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 by Rajko Albrecht * + * rajko.albrecht@tecways.com * + * * + * 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 "kdesvn-config.h" +#include "kdesvnd_dcop.h" +#include "src/ksvnwidgets/authdialogimpl.h" +#include "src/ksvnwidgets/ssltrustprompt_impl.h" +#include "src/ksvnwidgets/logmsg_impl.h" +#include "src/settings/kdesvnsettings.h" +#include "src/ksvnwidgets/pwstorage.h" +#include "src/svnqt/client.hpp" +#include "src/svnqt/revision.hpp" +#include "src/svnqt/status.hpp" +#include "src/svnqt/context_listener.hpp" +#include "src/svnqt/url.hpp" +#include "helpers/ktranslateurl.h" + +#include <kdebug.h> +#include <kapplication.h> +#include <kmessagebox.h> +#include <klocale.h> +#include <kglobal.h> +#include <kfiledialog.h> +#include <kpassdlg.h> + +#include <qdir.h> + +extern "C" { + KDESVN_EXPORT KDEDModule *create_kdesvnd(const QCString &name) + { + return new kdesvnd_dcop(name); + } +} + +class IListener:public svn::ContextListener +{ + friend class kdesvnd_dcop; + + kdesvnd_dcop*m_back; +public: + IListener(kdesvnd_dcop*p); + virtual ~IListener(); + /* context-listener methods */ + virtual bool contextGetLogin (const QString & realm, + QString & username, + QString & password, + bool & maySave); + virtual bool contextGetSavedLogin (const QString & realm,QString & username,QString & password); + virtual bool contextGetCachedLogin (const QString & realm,QString & username,QString & password); + + virtual void contextNotify (const char *path, + svn_wc_notify_action_t action, + svn_node_kind_t kind, + const char *mime_type, + svn_wc_notify_state_t content_state, + svn_wc_notify_state_t prop_state, + svn_revnum_t revision); + virtual void contextNotify (const svn_wc_notify_t *action); + + virtual bool contextCancel(); + virtual bool contextGetLogMessage (QString & msg,const svn::CommitItemList&); + virtual svn::ContextListener::SslServerTrustAnswer + contextSslServerTrustPrompt (const SslServerTrustData & data, + apr_uint32_t & acceptedFailures); + virtual bool contextSslClientCertPrompt (QString & certFile); + virtual bool contextLoadSslClientCertPw(QString&password,const QString&realm); + virtual bool contextSslClientCertPwPrompt (QString & password, + const QString & realm, bool & maySave); + virtual void contextProgress(long long int current, long long int max); + + /* context listener virtuals end */ + +protected: + svn::Client* m_Svnclient; + svn::ContextP m_CurrentContext; +}; + +IListener::IListener(kdesvnd_dcop*p) + :svn::ContextListener() +{ + m_Svnclient = svn::Client::getobject(0,0); + m_back=p; + m_CurrentContext = new svn::Context(); + m_CurrentContext->setListener(this); + m_Svnclient->setContext(m_CurrentContext); +} + +IListener::~IListener() +{ +} + +kdesvnd_dcop::kdesvnd_dcop(const QCString&name) : KDEDModule(name) +{ + KGlobal::locale()->insertCatalogue("kdesvn"); + m_Listener=new IListener(this); +} + +kdesvnd_dcop::~kdesvnd_dcop() +{ + delete m_Listener; +} + +QStringList kdesvnd_dcop::getActionMenu (const KURL::List list) +{ + QStringList result; + Kdesvnsettings::self()->readConfig(); + if (Kdesvnsettings::no_konqueror_contextmenu()||list.count()==0) { + return result; + } + QString base; + + + bool parentIsWc = false; + bool itemIsWc = isWorkingCopy(list[0],base); + bool itemIsRepository = false; + + QString _par = list[0].directory(true,true); + parentIsWc = isWorkingCopy(_par,base); + + if (!parentIsWc && !itemIsWc) { + itemIsRepository = isRepository(list[0]); + } + + if (!itemIsWc) { + if (itemIsRepository) { + result << "Export" + << "Checkout"; + } else { + result << "Exportto" + << "Checkoutto"; + } + } else { + result << "Update" + << "Commit"; + } + + if (!parentIsWc && !itemIsWc) { + if (itemIsRepository) { + result << "Log" + << "Info"; + if (isRepository(list[0].upURL())) { + result << "Blame" + << "Rename"; + } + result << "Tree"; + } + return result; + } + + if (!itemIsWc) { + result << "Add"; + return result; + } + + result << "Log" + << "Tree" + << "Info" + << "Diff" + << "Rename" + << "Revert"; + + KURL url = helpers::KTranslateUrl::translateSystemUrl(list[0]); + + QFileInfo f(url.path()); + if (f.isFile()) { + result << "Blame"; + } + + if (f.isDir()) { + result << "Addnew"; + result << "Switch"; + } + + return result; +} + +QStringList kdesvnd_dcop::getSingleActionMenu(QCString what) +{ + KURL::List l; l.append(KURL(what)); + return getActionMenu(l); +} + +QStringList kdesvnd_dcop::get_login(QString realm,QString user) +{ + AuthDialogImpl auth(realm,user); + QStringList res; + if (auth.exec()==QDialog::Accepted) { + res.append(auth.Username()); + res.append(auth.Password()); + if (auth.maySave()) { + res.append("true"); + } else { + res.append("false"); + } + } + return res; +} + +int kdesvnd_dcop::get_sslaccept(QString hostname,QString fingerprint,QString validFrom,QString validUntil,QString issuerDName,QString realm) +{ + bool ok,saveit; + if (!SslTrustPrompt_impl::sslTrust( + hostname, + fingerprint, + validFrom, + validUntil, + issuerDName, + realm, + QStringList(), + &ok,&saveit)) { + return -1; + } + if (!saveit) { + return 0; + } + return 1; +} + +QStringList kdesvnd_dcop::get_sslclientcertpw(QString realm) +{ + QStringList resList; + QCString npass; + int keep = 1; + int res = KPasswordDialog::getPassword(npass,i18n("Enter password for realm %1").arg(realm),&keep); + if (res!=KPasswordDialog::Accepted) { + return resList; + } + resList.append(QString(npass)); + if (keep) { + resList.append("true"); + } else { + resList.append("false"); + } + return resList; +} + +QString kdesvnd_dcop::get_sslclientcertfile() +{ + QString afile = KFileDialog::getOpenFileName(QString::null, + QString::null, + 0, + i18n("Open a file with a #PKCS12 certificate")); + return afile; +} + +QStringList kdesvnd_dcop::get_logmsg() +{ + QStringList res; + bool ok; + QString logMessage = Logmsg_impl::getLogmessage(&ok,0,0,0,"logmsg_impl"); + if (!ok) { + return res; + } + res.append(logMessage); + return res; +} + +QStringList kdesvnd_dcop::get_logmsg(QMap<QString,QString> list) +{ + QStringList res; + bool ok; + QString logMessage = Logmsg_impl::getLogmessage(list,&ok,0,0,0,"logmsg_impl"); + if (!ok) { + return res; + } + res.append(logMessage); + return res; +} + +QString kdesvnd_dcop::cleanUrl(const KURL&url) +{ + QString cleanpath = url.path(); + while (cleanpath.endsWith("/")) { + cleanpath.truncate(cleanpath.length()-1); + } + return cleanpath; +} + +/* just simple name check of course - no network acess! */ +bool kdesvnd_dcop::isRepository(const KURL&url) +{ + kdDebug()<<"kdesvnd_dcop::isRepository Url zum repo check: "<<url<<endl; + QString proto = svn::Url::transformProtokoll(url.protocol()); + kdDebug()<<"kdesvnd_dcop::isRepository Protokoll: " << proto << endl; + if (proto=="file") { + // local access - may a repository + svn::Revision where = svn::Revision::HEAD; + svn::StatusEntries dlist; + try { + m_Listener->m_Svnclient->status("file://"+cleanUrl(url),svn::DepthEmpty,false,false,false,where); + } catch (const svn::ClientException&e) { + kdDebug()<< e.msg()<<endl; + return false; + } + return true; + } else { + return svn::Url::isValid(proto); + } +} + +bool kdesvnd_dcop::isWorkingCopy(const KURL&_url,QString&base) +{ + base = ""; + KURL url = _url; + url = helpers::KTranslateUrl::translateSystemUrl(url); + + if (url.isEmpty()||!url.isLocalFile()||url.protocol()!="file") return false; + svn::Revision peg(svn_opt_revision_unspecified); + svn::Revision rev(svn_opt_revision_unspecified); + svn::InfoEntries e; + try { + e = m_Listener->m_Svnclient->info(cleanUrl(url),svn::DepthEmpty,rev,peg); + } catch (const svn::ClientException&e) { + kdDebug()<< e.msg()<<endl; + return false; + } + base=e[0].url(); + return true; +} + +bool IListener::contextGetSavedLogin (const QString & realm,QString & username,QString & password) +{ + PwStorage::self()->getLogin(realm,username,password); + return true; +} + +bool IListener::contextGetCachedLogin (const QString & realm,QString & username,QString & password) +{ + return true; +} + +bool IListener::contextGetLogin (const QString & realm, + QString & username, + QString & password, + bool & maySave) +{ + maySave=false; + QStringList res = m_back->get_login(realm,username); + if (res.count()!=3) { + return false; + } + username = res[0]; + password = res[1]; + maySave = (res[2]=="true"); + if (maySave && Kdesvnsettings::passwords_in_wallet() ) { + PwStorage::self()->setLogin(realm,username,password); + maySave=false; + } + return true; +} + +void IListener::contextNotify(const char * /*path*/, + svn_wc_notify_action_t /*action*/, + svn_node_kind_t /*kind*/, + const char */*mime_type*/, + svn_wc_notify_state_t /*content_state*/, + svn_wc_notify_state_t /*prop_state*/, + svn_revnum_t /*revision*/) +{ +} + +void IListener::contextNotify(const svn_wc_notify_t * /*action*/) +{ +} + +bool IListener::contextCancel() +{ + return false; +} + +bool IListener::contextGetLogMessage (QString & msg,const svn::CommitItemList&) +{ + QStringList res = m_back->get_logmsg(); + if (res.count()==0) { + return false; + } + msg = res[1]; + return true; +} + +svn::ContextListener::SslServerTrustAnswer IListener::contextSslServerTrustPrompt (const SslServerTrustData & data, + apr_uint32_t & /*acceptedFailures*/) +{ + int res = m_back->get_sslaccept(data.hostname, + data.fingerprint, + data.validFrom, + data.validUntil, + data.issuerDName, + data.realm); + switch (res) { + case -1: + return DONT_ACCEPT; + break; + case 1: + return ACCEPT_PERMANENTLY; + break; + default: + case 0: + return ACCEPT_TEMPORARILY; + break; + } + /* avoid compiler warnings */ + return ACCEPT_TEMPORARILY; +} + +bool IListener::contextSslClientCertPrompt (QString & certFile) +{ + certFile = m_back->get_sslclientcertfile(); + if (certFile.isEmpty()) { + return false; + } + return true; +} + +bool IListener::contextLoadSslClientCertPw(QString&password,const QString&realm) +{ + return PwStorage::self()->getCertPw(realm,password); +} + +bool IListener::contextSslClientCertPwPrompt (QString & password, + const QString & realm, bool & maySave) +{ + maySave=false; + if (PwStorage::self()->getCertPw(realm,password)) { + return true; + } + QStringList res = m_back->get_sslclientcertpw(realm); + if (res.size()!=2) { + return false; + } + password=res[0]; + maySave=res[1]==QString("true"); + + if (maySave && Kdesvnsettings::passwords_in_wallet() ) { + PwStorage::self()->setCertPw(realm,password); + maySave=false; + } + + return true; +} + +void IListener::contextProgress(long long int, long long int) +{ +} diff --git a/src/kdesvnd/kdesvnd_dcop.h b/src/kdesvnd/kdesvnd_dcop.h new file mode 100644 index 0000000..61b8f83 --- /dev/null +++ b/src/kdesvnd/kdesvnd_dcop.h @@ -0,0 +1,74 @@ +/*************************************************************************** + * Copyright (C) 2005-2007 by Rajko Albrecht * + * rajko.albrecht@tecways.com * + * * + * 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 _kdesvnd_dcop_H +#define _kdesvnd_dcop_H + +#include <qstringlist.h> +#include <qstring.h> +#include <kurl.h> +#include <dcopobject.h> +#include <kdedmodule.h> + +class IListener; + +class kdesvnd_dcop : public KDEDModule +{ + Q_OBJECT + K_DCOP + +private: + +public: + kdesvnd_dcop(const QCString&); + virtual ~kdesvnd_dcop(); + +protected: + bool isWorkingCopy(const KURL&url,QString&base); + bool isRepository(const KURL&url); + static QString cleanUrl(const KURL&url); + IListener*m_Listener; + +k_dcop: + //! get a subversion login + /*! + * \param realm the realm + * \param user default username + * \return a stringlist containing username-password-saveit as "true" or "false" or empty list if cancel hit. + */ + QStringList get_login(QString,QString); + + // return: -1 dont accept 0 accept temporary 1 accept always + // hostname, fingerprint, validFrom, validUntil, issuerDName, realm, + int get_sslaccept(QString, QString, QString, QString, QString, QString); + + // returns cert file or empty string + QString get_sslclientcertfile(); + // return a logmessage at pos 0, null-size list if cancel hit + QStringList get_logmsg(); + // return a logmessage at pos 0, null-size list if cancel hit, parameter is path -> action for display + QStringList get_logmsg(QMap<QString,QString>); + // return pw at pos 0, maysafe at pos 1, null-size if cancel hit. + QStringList get_sslclientcertpw(QString); + QStringList getActionMenu(KURL::List); + QStringList getSingleActionMenu(QCString); +}; +#endif diff --git a/src/kdesvnd/main.cpp b/src/kdesvnd/main.cpp new file mode 100644 index 0000000..671b50a --- /dev/null +++ b/src/kdesvnd/main.cpp @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2005 by Rajko Albrecht * + * rajko.albrecht@tecways.com * + * * + * 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 <kuniqueapplication.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <kdebug.h> +#include <kaboutdata.h> +#include <klocale.h> +#include <dcopclient.h> +#include "kdesvnd_dcop.h" + +static const char description[] = + I18N_NOOP("Kdesvn DCOP service"); + +static const char version[] = "0.1"; + +static KCmdLineOptions options[] = +{ + KCmdLineLastOption +}; + +int main (int argc, char *argv[]) +{ + KLocale::setMainCatalogue("kdesvn"); + KAboutData aboutdata("kdesvnd", I18N_NOOP("KDE"), + version, description, + KAboutData::License_GPL, "(C) %{YEAR}, Rajko Albrecht"); + aboutdata.addAuthor("Rajko Albrecht",I18N_NOOP("Developer"),"rajko.albrecht@tecways.com"); + + KCmdLineArgs::init( argc, argv, &aboutdata ); + KCmdLineArgs::addCmdLineOptions( options ); + KUniqueApplication::addCmdLineOptions(); + + if (!KUniqueApplication::start()) + { + kdDebug() << "kdesvnd is already running!" << endl; + return (0); + } + + KUniqueApplication app; + kdDebug() << "starting kdesvnd_dcop " << endl; + // This app is started automatically, no need for session management + app.disableSessionManagement(); + kdesvnd_dcop *service = new kdesvnd_dcop; + kdDebug() << "starting kdesvnd_dcop " << endl; + return app.exec(); + +} |