diff options
Diffstat (limited to 'kpilot/conduits/sysinfoconduit')
-rw-r--r-- | kpilot/conduits/sysinfoconduit/CMakeLists.txt | 50 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/Makefile.am | 24 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/Template.html | 184 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/Template.txt | 76 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfo-conduit.cc | 611 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfo-conduit.h | 79 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfo-factory.cc | 43 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfo-factory.h | 36 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfo-setup.cc | 198 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfo-setup.h | 47 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui | 214 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfoSettings.kcfgc | 7 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfo_conduit.desktop | 111 | ||||
-rw-r--r-- | kpilot/conduits/sysinfoconduit/sysinfoconduit.kcfg | 64 |
14 files changed, 1744 insertions, 0 deletions
diff --git a/kpilot/conduits/sysinfoconduit/CMakeLists.txt b/kpilot/conduits/sysinfoconduit/CMakeLists.txt new file mode 100644 index 000000000..cae6d89f1 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/CMakeLists.txt @@ -0,0 +1,50 @@ +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} +) + +set(conduit_sysinfo_SRCS + sysinfo-setup.cc + sysinfo-factory.cc + sysinfo-conduit.cc +) + +set(conduit_sysinfo_UIS + sysinfo-setup_dialog.ui +) + +set(conduit_sysinfo_KCFGS + sysinfoSettings.kcfgc +) + +kde3_add_kcfg_files(conduit_sysinfo_SRCS ${conduit_sysinfo_KCFGS}) +kde3_add_ui_files(conduit_sysinfo_SRCS ${conduit_sysinfo_UIS}) +kde3_automoc(${conduit_sysinfo_SRCS}) +add_library(conduit_sysinfo SHARED ${conduit_sysinfo_SRCS}) + +set_target_properties( + conduit_sysinfo PROPERTIES LOCATION ${KDE3_PLUGIN_INSTALL_DIR} + INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib + PREFIX "" +) + +kde3_install_libtool_file(conduit_sysinfo) + +install( + TARGETS conduit_sysinfo + LIBRARY DESTINATION ${KDE3_PLUGIN_INSTALL_DIR} +) + +install( + FILES sysinfo_conduit.desktop DESTINATION ${KDE3_SERVICES_DIR} +) + +install( + FILES sysinfoSettings.kcfgc sysinfoconduit.kcfg + DESTINATION ${KDE3_KCFG_DIR} +) + +install( + FILES Template.html Template.txt + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/apps/kpilot/sysinfoconduit +) + diff --git a/kpilot/conduits/sysinfoconduit/Makefile.am b/kpilot/conduits/sysinfoconduit/Makefile.am new file mode 100644 index 000000000..eb7f7aa92 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/Makefile.am @@ -0,0 +1,24 @@ +### Makefile for the sysinfo conduit +### +### The sysinfo conduit is Copyright (C) 2003 by Reinhold Kainhofer + +INCLUDES= $(PISOCK_INCLUDE) -I$(top_srcdir)/kpilot/lib $(all_includes) +METASOURCES = AUTO + +servicedir = $(kde_servicesdir) +service_DATA = sysinfo_conduit.desktop + +kde_module_LTLIBRARIES = conduit_sysinfo.la + +conduit_sysinfo_la_SOURCES = sysinfoSettings.kcfgc \ + sysinfo-factory.cc \ + sysinfo-setup.cc \ + sysinfo-conduit.cc \ + sysinfo-setup_dialog.ui +conduit_sysinfo_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +conduit_sysinfo_la_LIBADD = ../../lib/libkpilot.la $(LIB_KDEUI) $(LIB_KIO) + +kpilot_sysinfo_data_DATA = Template.html Template.txt +kpilot_sysinfo_datadir = $(kde_datadir)/kpilot/sysinfoconduit +EXTRA_DIST = $(kpilot_sysinfo_data_DATA) +kde_kcfg_DATA = sysinfoconduit.kcfg diff --git a/kpilot/conduits/sysinfoconduit/Template.html b/kpilot/conduits/sysinfoconduit/Template.html new file mode 100644 index 000000000..e5a33e0fd --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/Template.html @@ -0,0 +1,184 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<head> + <title>KPilot System Information Page</title> + <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15"> + <meta name="GENERATOR" content="KPilot SysInfo conduit"> + <style type="text/css"> + h1 { + font-family: sans-serif; + font-size: xx-large; + font-style: italic; + font-variant: small-caps; + font-weight: bolder; + color: darkBlue; + border-bottom: thick solid darkBlue; + margin: 30; + } + h2 { + font-family: sans-serif; + font-size: large; + color: darkRed; + margin-top: 40; + border-top: thin solid darkRed; + display: list-item; + list-style-type: circle; + margin: 40; + } + th { + font-style: italic; + font-weight: bold; + background-color: #DFC370; + text-align: center; + } + </style> +</head> +<body bgcolor="#FFE080"> + <h1>KPilot System Information</h1> + <center> +<p><!--#ifhardware#<a href="#Hardware">Hardware info</a> - #endifhardware#--> +<!--#ifuser#<a href="#User">User info</a> - #endifuser#--> +<!--#ifmemory#<a href="#Memory">Memory info</a> - #endifmemory#--> +<!--#ifstorage#<a href="#Storage">Storage info</a> - #endifstorage#--> +<!--#ifdblist#<a href="#DBList">Database list</a> - #endifdblist#--> +<!--#ifrecords#<a href="#Records">Addresses, to-dos, events, and memos</a> - #endifrecords#--> +<!--#ifsync#<a href="#Sync">Sync info</a> - #endifsync#--> +<!--#ifpcversion#<a href="#Version">PC Version info</a> - #endifpcversion#--> +<!--#ifpalmversion#<a href="#PalmVersion">Palm Version info</a> - #endifpalmversion#--> +<!--#ifdebug#<a href="#Debug">Debug info</a>#endifdebug#--></p> + </center> + + +<!--#ifhardware#<h2><a name="Hardware">Hardware Information</a></h2> + <center> + <table border=1> + <tbody> + <tr><td><b>DeviceID:</b></td><td>#deviceid#</td></tr> + <tr><td><b>Device name:</b></td><td>#devicename#</td></tr> + <tr><td><b>Device model:</b></td><td>#devicemodel#</td></tr> + <tr><td><b>Manufacturer:</b></td><td>#manufacturer#</td></tr> + <tr><td><b>Connected via:</b></td><td>#devicetype#</td></tr> + </tbody> + </table> + </center>#endifhardware#--> + + +<!--#ifuser#<h2><a name="User">User Information</a></h2> + <center> + <table border=1> + <tbody> + <tr><td><b>Handheld User Name:</b></td><td>#username#</td></tr> + <tr><td><b>Handheld Password:</b></td><td>#pw#</td></tr> + <tr><td><b>Handheld User ID:</b></td><td>#uid#</td></tr> + <tr><td><b>Viewer ID:</b></td><td>#viewerid#</td></tr> + </tbody> + </table> + </center>#endifuser#--> + + +<!--#ifmemory#<h2><a name="Memory">Memory Information</a></h2> + <center> + <table border=1> + <tbody> + <tr><td><b>ROM:</b></td><td>#rom# kB total</td></tr> + <tr><td><b>Total RAM:</b></td><td>#totalmem# kB total</td></tr> + <tr><td><b>Free RAM:</b></td><td>#freemem# kB free</td></tr> + </tbody> + </table> + </center>#endifmemory#--> + + +<!--#ifstorage#<h2><a name="Storage">Storage Information</a></h2> + <center> + <table border=1> + <tbody> + <tr><td><b>Cards:</b></td><td>#cards#</td></tr> + </tbody> + </table> + </center>#endifstorage#--> + + +<!--#ifdblist#<h2><a name="DBList">List of Databases on Handheld</a></h2> + <center> + <table border=1> + <tr><th>DB name</th><th>type, creator</th><th>index</th><th>flags</th> + <th>created</th><th>modified</th><th>version</th></tr> + #dblist[<tr><td>%0</td><td>%1,%2</td><td>%3</td><td>%4/%5</td> + <td>%7</td><td>%8</td><td>%6</td></tr> + ]# + </table> + </center>#endifdblist#--> + + + +<!--#ifrecords#<h2><a name="Records">Number of addresses, to-dos, events, and memos</a></h2> + <center> + <table border=1> + <thead> + <tr><th scope=col>Record type</th><th scope=col># of recs</th></tr> + </thead> + <tbody> + <tr><td><b>Addresses:</b></td><td>#addresses# entries in Addressbook</td></tr> + <tr><td><b>Events:</b></td><td>#events# entries in Calendar</td></tr> + <tr><td><b>To-dos:</b></td><td>#todos# entries in To-do list</td></tr> + <tr><td><b>Memos:</b></td><td>#memos# memos</td></tr> + </tbody> + </table> + </center>#endifrecords#--> + + +<!--#ifsync#<h2><a name="Sync">Synchronization Information</a></h2> + <center> + <table border=1> + <tbody> + <tr><td><b>Last sync attempt:</b></td><td>#lastsync#</td></tr> + <tr><td><b>Last successful sync:</b></td><td>#lastsuccsync#</td></tr> + <tr><td><b>Last sync with PC (ID):</b></td><td>#lastsyncpc#</td></tr> + </tbody> + </table> + </center>#endifsync#--> + + +<!--#ifpcversion#<h2><a name="Version">Version Information (Desktop)</a></h2> + <center> + <table border=1> + <thead> + <tr><th scope=col>Application</th><th scope=col>Version</th></tr> + </thead> + <tbody> + <tr><td><b>Operating System:</b></td><td>#os#</td></tr> + <tr><td><b>Hostname:</b></td><td>#hostname#</td></tr> + <tr><td><b>Qt Version:</b></td><td>#qt#</td></tr> + <tr><td><b>KDE Libraries Version:</b></td><td>#kde#</td></tr> + <tr><td><b>KPilot Version:</b></td><td>#kpilot#</td></tr> + <tr><td><b>Pilot-Link Version:</b></td><td>#pilotlink#</td></tr> + </tbody> + </table> + </center>#endifpcversion#--> + + +<!--#ifpalmversion#<h2><a name="PalmVersion">Version Information (Handheld)</a></h2> + <center> + <table border=1> + <thead> + <tr><th scope=col>Application</th><th scope=col>Version</th></tr> + </thead> + <tbody> + <tr><td><b>PalmOS:</b></td><td>#palmos#</td></tr> + </tbody> + </table> + </center>#endifpalmversion#--> + + +<!--#ifdebug#<h2><a name="Debug">Debug Information</a></h2> + <center> + <table border=1> + <tr><td><pre>#debug#</pre></td></tr> + </table> + </center>#endifdebug#--> + + + <p> </p> + <hr> + <font size="-1">Page created #date# by the SysInfo conduit of <a href="http://www.kpilot.org/">KPilot</a>.</font> +</body> +</html> diff --git a/kpilot/conduits/sysinfoconduit/Template.txt b/kpilot/conduits/sysinfoconduit/Template.txt new file mode 100644 index 000000000..8796e44a1 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/Template.txt @@ -0,0 +1,76 @@ +KPilot System Information Page +============================== + +<!--#ifhardware# +-) Hardware Information + DeviceID: #deviceid# + Device name: #devicename# + Device model: #devicemodel# + Manufacturer: #manufacturer# + Connected via: #devicetype# +#endifhardware#--> + +<!--#ifuser# +-) User Information + Handheld User Name: #username# + Handheld Password: #pw# + Handheld User ID: #uid# + Viewer ID: #viewerid# +#endifuser#--> + +<!--#ifmemory# +-) Memory Information + ROM: #rom# kB total + Total RAM: #totalmem# kB total + Free RAM: #freemem# kB fre +#endifmemory#--> + +<!--#ifstorage# +-) Storage Information + Cards: #cards# +#endifstorage#--> + +<!--#ifdblist# +-) List of Databases on Handheld + Available Databases: #dblist[ + %0 (%1, %2)]# +#endifdblist#--> + +<!--#ifrecords# +-) Number of addresses, todos, events, and memos + Addresses: #addresses# entries in Addressbook + Events: #events# entries in Calendar + Todos: #todos# entries in ToDo list + Memos: #memos# memos +#endifrecords#--> + +<!--#ifsync# +-) Synchronization Information + Last sync attempt: #lastsync# + Last successful sync: #lastsuccsync# + Last sync with PC (ID): #lastsyncpc# +#endifsync#--> + +<!--#ifpcversion# +-) Version Information (Desktop) + Operating System: #os# + Hostname: #hostname# + Qt Version: #qt# + KDE Version: #kde# + KPilot Version: #kpilot# + Pilot-Link Version: #pilotlink# +#endifpcversion#--> + +<!--#ifpalmversion# +-) Version Information (Handheld) + PalmOS: #palmos# +#endifpalmversion#--> + +<!--#ifdebug# +-) Debug Information + #debug# +#endifdebug#--> + + +------------------------------------------------------------ +Page created #date# by the SysInfo conduit of KPilot. diff --git a/kpilot/conduits/sysinfoconduit/sysinfo-conduit.cc b/kpilot/conduits/sysinfoconduit/sysinfo-conduit.cc new file mode 100644 index 000000000..b3e69b65c --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfo-conduit.cc @@ -0,0 +1,611 @@ +/* KPilot +** +** Copyright (C) 2003 by Reinhold Kainhofer +** +*/ + +/* +** 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 in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to [email protected]. +*/ + +#include "options.h" + +#include <pi-version.h> + +#include <qtimer.h> +#include <qdir.h> +#include <qfileinfo.h> +#include <qregexp.h> +#include <kconfig.h> +#include <kdebug.h> + +#include <pilotSysInfo.h> +#include <pilotUser.h> +#include <pilotCard.h> +#include <kpilotlink.h> +#include <kstandarddirs.h> +#include <pilotSerialDatabase.h> + +#include <sys/utsname.h> + +#include "sysinfo-factory.h" +#include "sysinfo-conduit.moc" +#include "sysinfoSettings.h" + +const QString SysInfoConduit::defaultpage = CSL1("KPilot System Information Page\n" +"==============================\n" +"(Kpilot was unable to find the correct template file, \n" +"so this simple template was used.)\n\n" +"<!--#ifhardware#\n" +"-) Hardware Information\n" +" DeviceID: #deviceid#\n" +" Device name: #devicename#\n" +" Device model: #devicemodel#\n" +" Manufacturer: #manufacturer#\n" +" Connected via: #devicetype#\n" +"#endifhardware#-->\n" +"\n" +"<!--#ifuser#\n" +"-) User Information\n" +" Handheld User Name: #username#\n" +" Handheld Password: #pw#\n" +" Handheld User ID: #uid#\n" +" Viewer ID: #viewerid#\n" +"#endifuser#-->\n" +"\n" +"<!--#ifmemory#\n" +"-) Memory Information\n" +" ROM: #rom# kB total\n" +" Total RAM: #totalmem# kB total\n" +" Free RAM: #freemem# kB free\n" +"#endifmemory#-->\n" +"\n" +"<!--#ifstorage#\n" +"-) Storage Information\n" +" Number of cards: #cards#\n" +" Memory on cards: #storagemem#\n" +"#endifstorage#-->\n" +"\n" +"<!--#ifdblist#\n" +"-) List of Databases on Handheld\n" +" Available Databases: #dblist(%1,)#\n" +"#endifdblist#-->\n" +"\n" +"<!--#ifrecords#\n" +"-) Number of addresses, to-dos, events, and memos\n" +" Addresses: #addresses# entries in Addressbook\n" +" Events: #events# entries in Calendar\n" +" To-dos: #todos# entries in To-do list\n" +" Memos: #memos# memos\n" +"#endifrecords#-->\n" +"\n" +"<!--#ifsync#\n" +"-) Synchronization Information\n" +" Last sync attempt: #lastsync#\n" +" Last successful sync: #lastsuccsync#\n" +" Last sync with PC (ID): #lastsyncpc#\n" +"#endifsync#-->\n" +"\n" +"<!--#ifpcversion#\n" +"-) Version Information (Desktop)\n" +" Operating System: #os#\n" +" Hostname: #hostname#\n" +" Qt Version: #qt#\n" +" KDE Version: #kde#\n" +" KPilot Version: #kpilot#\n" +" Pilot-Link Version: #pilotlink#\n" +"#endifpcversion#-->\n" +"\n" +"<!--#ifpalmversion#\n" +"-) Version Information (Handheld)\n" +" PalmOS: #palmos#\n" +"#endifpalmversion#-->\n" +"\n" +"<!--#ifdebug#\n" +"-) Debug Information\n" +" #debug#\n" +"#endifdebug#-->\n" +"\n" +"------------------------------------------------------------\n" +"Page created <!--#date#--> by the KPilot System Information conduit.\n" +""); + + + /** possible fields in the templates are: + * - hardware + * - user + * - memory + * - storage + * - dblist + * - recnumber + * - syncinfo + * - pcversion + * - palmversion + * - debug + */ + + +// Something to allow us to check what revision +// the modules are that make up a binary distribution. + +extern "C" +{ + +unsigned long version_conduit_sysinfo = Pilot::PLUGIN_API; + +} + + + +SysInfoConduit::SysInfoConduit(KPilotLink * o, + const char *n, + const QStringList & a) : + ConduitAction(o, n, a) +{ + FUNCTIONSETUP; + fConduitName=i18n("System Information"); +} + + + +SysInfoConduit::~SysInfoConduit() +{ + FUNCTIONSETUP; +} + + + +void SysInfoConduit::readConfig() +{ + fOutputFile = SysinfoSettings::outputFile(); + fOutputType = (eOutputTypeEnum) SysinfoSettings::outputFormat(); + fTemplateFile = SysinfoSettings::templateFile(); + fHardwareInfo = SysinfoSettings::hardwareInfo(); + fUserInfo = SysinfoSettings::userInfo(); + fMemoryInfo = SysinfoSettings::memoryInfo(); + fStorageInfo = SysinfoSettings::storageInfo(); + fDBList = SysinfoSettings::databaseList(); + fRecordNumber = SysinfoSettings::recordNumbers(); + fSyncInfo = SysinfoSettings::syncInfo(); + fKDEVersion = SysinfoSettings::kDEVersion(); + fPalmOSVersion = SysinfoSettings::palmOSVersion(); + fDebugInfo = SysinfoSettings::debugInformation(); +} + + +/* virtual */ bool SysInfoConduit::exec() +{ + FUNCTIONSETUP; + + readConfig(); + + QTimer::singleShot(0, this, SLOT(hardwareInfo())); + return true; +} + +void SysInfoConduit::hardwareInfo() +{ + FUNCTIONSETUP; + if (fHardwareInfo) { + QString unknown = i18n("unknown"); + + /* Retrieve values for + * - #deviceid# + * - #devicename# + * - #devicemodel# + * - #manufactorer# + * - #devicetype# + */ + KPilotSysInfo sysinfo = fHandle->getSysInfo(); + fValues[CSL1("deviceid")] = QString::fromLatin1(sysinfo.getProductID()); + + const KPilotCard *device = fHandle->getCardInfo(); + if (device) + { + fValues[CSL1("devicename")] = QString::fromLatin1(device->getCardName()); + fValues[CSL1("devicemodel")] = unknown; // TODO + fValues[CSL1("manufacturer")] = QString::fromLatin1(device->getCardManufacturer()); + } + else + { + fValues[CSL1("devicename")] = unknown; + fValues[CSL1("devicemodel")] = unknown; + fValues[CSL1("manufacturer")] = unknown; + } + + fValues[CSL1("devicetype")] = unknown; + + KPILOT_DELETE(device); + keepParts.append(CSL1("hardware")); + } else removeParts.append(CSL1("hardware")); + QTimer::singleShot(0, this, SLOT(userInfo())); +} + +void SysInfoConduit::userInfo() +{ + FUNCTIONSETUP; + if (fUserInfo) + { + /* Retrieve values for + * - #username# + * - #uid# + */ + KPilotUser user=fHandle->getPilotUser(); + fValues[CSL1("username")] = user.name(); + if (user.passwordLength()>0) + { + fValues[CSL1("pw")] = i18n("Password set"); + } + else + { + fValues[CSL1("pw")] = i18n("No password set"); + } + fValues[CSL1("uid")] = QString::number(user.data()->userID); + fValues[CSL1("viewerid")] = QString::number(user.data()->viewerID); + keepParts.append(CSL1("user")); + } + else + { + removeParts.append(CSL1("user")); + } + QTimer::singleShot(0, this, SLOT(memoryInfo())); +} + +void SysInfoConduit::memoryInfo() +{ + FUNCTIONSETUP; + if (fMemoryInfo) { + /* Retrieve values for + * - #rom# + * - #totalmem# + * - #freemem# + */ + const KPilotCard *device = fHandle->getCardInfo(); + if (device) + { + fValues[CSL1("rom")] = QString::number(device->getRomSize()/1024); + fValues[CSL1("totalmem")] = QString::number(device->getRamSize()/1024); + fValues[CSL1("freemem")] = QString::number(device->getRamFree()/1024); + } + keepParts.append(CSL1("memory")); + } else removeParts.append(CSL1("memory")); + QTimer::singleShot(0, this, SLOT(storageInfo())); +} + +void SysInfoConduit::storageInfo() +{ + FUNCTIONSETUP; + if (fStorageInfo) { + /* Retrieve values for + * - $cards$ + */ + const KPilotCard *device = fHandle->getCardInfo(1); + if (device) { + fValues[CSL1("cards")] = CSL1("%1 (%2, %3 kB of %3 kB free)") + .arg(QString::fromLatin1(device->getCardName())) + .arg(QString::fromLatin1(device->getCardManufacturer())) + .arg(device->getRamFree()/1024) + .arg(device->getRamSize()/1024); + KPILOT_DELETE(device); + } else { + fValues[CSL1("cards")] = i18n("No Cards available via pilot-link"); + } + keepParts.append(CSL1("storage")); + } else removeParts.append(CSL1("storage")); + QTimer::singleShot(0, this, SLOT(dbListInfo())); +} + +void SysInfoConduit::dbListInfo() +{ + FUNCTIONSETUP; + if (fDBList) { + /* Retrieve values for + * - #dblist(structure)# + */ + dblist=deviceLink()->getDBList(); + keepParts.append(CSL1("dblist")); + } else removeParts.append(CSL1("dblist")); + QTimer::singleShot(0, this, SLOT(recNumberInfo())); +} + +void SysInfoConduit::recNumberInfo() +{ + FUNCTIONSETUP; + if (fRecordNumber) { + /* Retrieve values for + * - #addresses# + * - #events# + * - #todos# + * - #memos# + */ + PilotDatabase *fDatabase = 0L; + QString ERROR = CSL1("ERROR"); + fValues[CSL1("addresses")] = ERROR; + fValues[CSL1("events")] = ERROR; + fValues[CSL1("todos")] = ERROR; + fValues[CSL1("memos")] = ERROR; + fDatabase = deviceLink()->database(CSL1("AddressDB")); + if (fDatabase) { + fValues[CSL1("addresses")] = QString::number(fDatabase->recordCount()); + KPILOT_DELETE(fDatabase); + } + fDatabase = deviceLink()->database(CSL1("DatebookDB")); + if (fDatabase) { + fValues[CSL1("events")] = QString::number(fDatabase->recordCount()); + KPILOT_DELETE(fDatabase); + } + fDatabase = deviceLink()->database(CSL1("ToDoDB")); + if (fDatabase) { + fValues[CSL1("todos")] = QString::number(fDatabase->recordCount()); + KPILOT_DELETE(fDatabase); + } + fDatabase = deviceLink()->database(CSL1("MemoDB")); + if (fDatabase) { + fValues[CSL1("memos")] = QString::number(fDatabase->recordCount()); + KPILOT_DELETE(fDatabase); + } + keepParts.append(CSL1("records")); + } else removeParts.append(CSL1("records")); + QTimer::singleShot(0, this, SLOT(syncInfo())); +} + +void SysInfoConduit::syncInfo() +{ + FUNCTIONSETUP; + if (fSyncInfo) { + /* Retrieve values for + * - #lastsync# + * - #lastsuccsync# + * - #lastsyncpc# + */ + KPilotUser user = deviceLink()->getPilotUser(); + time_t lastsync = user.getLastSyncDate(); + QDateTime qlastsync; + qlastsync.setTime_t(lastsync); + fValues[CSL1("lastsync")] = qlastsync.toString(Qt::LocalDate); + lastsync = user.getLastSuccessfulSyncDate(); + qlastsync.setTime_t(lastsync); + fValues[CSL1("lastsuccsync")] = qlastsync.toString(Qt::LocalDate); + fValues[CSL1("lastsyncpc")] = QString::number(user.getLastSyncPC()); + keepParts.append(CSL1("sync")); + } else removeParts.append(CSL1("sync")); + QTimer::singleShot(0, this, SLOT(pcVersionInfo())); +} + +void SysInfoConduit::pcVersionInfo() +{ + FUNCTIONSETUP; + if (fKDEVersion) { + /* Retrieve values for + * - #os# + * - #qt# + * - #kde# + * - #kpilot# + * - #pilotlink# + */ + fValues[CSL1("kpilot")] = QString::fromLatin1(KPILOT_VERSION); + fValues[CSL1("kde")] = i18n("unknown"); + fValues[CSL1("qt")] = i18n("unknown"); + fValues[CSL1("os")] = i18n("unknown"); + fValues[CSL1("hostname")] = i18n("unknown"); + struct utsname name; + if (uname (&name) >= 0) { + fValues[CSL1("os")] = CSL1("%1 %3, %5") + .arg(QString::fromLatin1(name.sysname)) + .arg(QString::fromLatin1(name.release)) + .arg(QString::fromLatin1(name.machine)); + fValues[CSL1("hostname")] = CSL1("%2").arg(QString::fromLatin1(name.nodename)); + } +#ifdef KDE_VERSION_STRING + fValues[CSL1("kde")] = QString::fromLatin1(KDE_VERSION_STRING); +#endif +#ifdef QT_VERSION_STR + fValues[CSL1("qt")] = QString::fromLatin1(QT_VERSION_STR); +#endif + fValues[CSL1("pilotlink")] = CSL1("%1.%2.%3%4") + .arg(PILOT_LINK_VERSION) + .arg(PILOT_LINK_MAJOR) + .arg(PILOT_LINK_MINOR) +#ifdef PILOT_LINK_PATCH + .arg(QString::fromLatin1(PILOT_LINK_PATCH)); +#else + .arg(QString()); +#endif + keepParts.append(CSL1("pcversion")); + } else removeParts.append(CSL1("pcversion")); + QTimer::singleShot(0, this, SLOT(palmVersionInfo())); +} + +void SysInfoConduit::palmVersionInfo() +{ + FUNCTIONSETUP; + if (fPalmOSVersion) { + /* Retrieve values for + * - #palmos# + */ +/* fValues["palmos"] = QString("PalmOS %1.%2 (compat %3.%4)") + .arg(fHandle->getSysInfo()->getMajorVersion()) + .arg(fHandle->getSysInfo()->getMinorVersion()) + .arg(fHandle->getSysInfo()->getCompatMajorVersion()) + .arg(fHandle->getSysInfo()->getCompatMinorVersion());*/ + KPilotSysInfo i = deviceLink()->getSysInfo(); + fValues[CSL1("palmos")] = CSL1("PalmOS %1.%2").arg(i.getMajorVersion()).arg(i.getMinorVersion()); + + keepParts.append(CSL1("palmversion")); + } else removeParts.append(CSL1("palmversion")); + QTimer::singleShot(0, this, SLOT(debugInfo())); +} + +void SysInfoConduit::debugInfo() +{ + FUNCTIONSETUP; + if (fDebugInfo) { + /* Retrieve values for + * - #debug# + */ + fValues[CSL1("debug")] = i18n("No debug data"); + keepParts.append(CSL1("debug")); + } else removeParts.append(CSL1("debug")); + QTimer::singleShot(0, this, SLOT(writeFile())); +} + +void SysInfoConduit::writeFile() +{ + FUNCTIONSETUP; + + fValues[CSL1("date")] = QDateTime::currentDateTime().toString(Qt::LocalDate); + + QString output; + // Open the template file + QString templatefile; + switch(fOutputType) + { + case eOutputText: + templatefile=locate("data", CSL1("kpilot/sysinfoconduit/Template.txt")); + break; + case eOutputTemplate: + templatefile=fTemplateFile; + break; + case eOutputHTML: + default: + templatefile=locate("data", CSL1("kpilot/sysinfoconduit/Template.html")); + break; + } + + // Read in the template, close the file + bool loaded=false; + if (!templatefile.isEmpty()){ +#ifdef DEBUG + DEBUGKPILOT<<"Loading template file "<<templatefile<<endl; +#endif + QFile infile(templatefile); + if (infile.open(IO_ReadOnly)) { + QTextStream instream(&infile); + output = instream.read(); + infile.close(); + loaded=true; + } + } + + if (!loaded) + { + WARNINGKPILOT << "Loading template file " << templatefile + <<" failed. Using default template instead." << endl; + output=defaultpage; + } + + // Remove all parts not extracted + for ( QStringList::Iterator it = removeParts.begin(); it != removeParts.end(); ++it ) { + QRegExp re(CSL1("<!--#if%1#.*#endif%1#-->").arg(*it).arg(*it)); + re.setMinimal(true); + output.remove(re); + } + for ( QStringList::Iterator it = keepParts.begin(); it != keepParts.end(); ++it ) { + QRegExp re(CSL1("<!--#if%1#(.*)#endif%1#-->").arg(*it).arg(*it)); + re.setMinimal(true); + output.replace(re, CSL1("\\1")); + } + + // Do a loop through all keys in fValues + QMap<QString,QString>::Iterator it; + for ( it = fValues.begin(); it != fValues.end(); ++it ) { + output.replace(CSL1("#%1#").arg(it.key()), it.data()); + } + + // Insert the list of databases + QRegExp re(CSL1("#dblist\\[(.*)\\]#")); + re.setMinimal(true); + while (re.search(output)>=0){ + QString dbstring; + QString subpatt=re.cap(1); + for (KPilotLink::DBInfoList::ConstIterator i = dblist.begin(); i != dblist.end(); ++i ) { + DBInfo dbi = *i; + QString newpatt(subpatt); + char tmpchr[5]; + ::memset(&tmpchr[0], 0, 5); + /* Patterns for the dblist argument: + * %0 .. Database name + * %1 .. type + * %2 .. creator + * %3 .. index + * %4 .. flags + * %5 .. miscFlags + * %6 .. version + * %7 .. createDate + * %8 .. modifyDate + * %9 .. backupDate + */ + newpatt.replace(CSL1("%0"), QString::fromLatin1(dbi.name)); + set_long(&tmpchr[0],dbi.type); + newpatt.replace(CSL1("%1"), QString::fromLatin1(tmpchr)); + set_long(&tmpchr[0],dbi.creator); + newpatt.replace(CSL1("%2"), QString::fromLatin1(tmpchr)); + newpatt.replace(CSL1("%3"), QString::number(dbi.index)); + newpatt.replace(CSL1("%4"), QString::number(dbi.flags)); + newpatt.replace(CSL1("%5"), QString::number(dbi.miscFlags)); + newpatt.replace(CSL1("%6"), QString::number(dbi.version)); + QDateTime tm; + tm.setTime_t(dbi.createDate); + newpatt.replace(CSL1("%7"), tm.toString(Qt::LocalDate)); + tm.setTime_t(dbi.modifyDate); + newpatt.replace(CSL1("%8"), tm.toString(Qt::LocalDate)); + tm.setTime_t(dbi.backupDate); + newpatt.replace(CSL1("%9"), tm.toString(Qt::LocalDate)); + + dbstring.append(newpatt); + } + // Now, just replace the whole found pattern by the string we just constructed. + output.replace(re.cap(0), dbstring); + } + + // Write out the result + QFile outfile(fOutputFile); +#ifdef DEBUG + DEBUGKPILOT << fname << ": Writing file <" << fOutputFile << ">" << endl; +#endif + if (fOutputFile.isEmpty() || (!outfile.open(IO_WriteOnly)) ) { + QFileInfo fi(QDir::home(), CSL1("KPilotSysInfo.")+QFileInfo(templatefile).extension() ); + fOutputFile=fi.absFilePath(); + WARNINGKPILOT << "Unable to open output file, using " << fOutputFile << " instead." << endl; + emit logMessage(i18n("Unable to open output file, using %1 instead.").arg(fOutputFile)); + outfile.setName(fOutputFile); + if (!outfile.open(IO_WriteOnly)) { + WARNINGKPILOT<< "Unable to open " << fOutputFile << endl; + emit logError(i18n("Unable to open %1").arg(fOutputFile)); + QTimer::singleShot(0, this, SLOT(cleanup())); + return; + } + } + + // Finally, write the actual text out to the file. + QTextStream outstream(&outfile); + outstream<<output; + outfile.close(); + + emit logMessage(i18n("Handheld system information written to the file %1").arg(fOutputFile)); + QTimer::singleShot(0, this, SLOT(cleanup())); +} + +void SysInfoConduit::cleanup() +{ + FUNCTIONSETUP; + // Nothing to clean up so far (Do I have memory leaks somewhere?) + emit syncDone(this); +} diff --git a/kpilot/conduits/sysinfoconduit/sysinfo-conduit.h b/kpilot/conduits/sysinfoconduit/sysinfo-conduit.h new file mode 100644 index 000000000..05bc395d3 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfo-conduit.h @@ -0,0 +1,79 @@ +#ifndef _SysInfo_CONDUIT_H +#define _SysInfo_CONDUIT_H +/* sysinfo-conduit.h KPilot +** +** Copyright (C) 2003 by Reinhold Kainhofer +** +*/ + +/* +** 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 in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to [email protected] +*/ + + +#include <plugin.h> + +class SysInfoConduit : public ConduitAction +{ + Q_OBJECT +public: + SysInfoConduit( + KPilotLink *o, + const char *n = 0L, + const QStringList &a = QStringList() ); + virtual ~SysInfoConduit(); + virtual bool exec(); + +public slots: + void hardwareInfo(); + void userInfo(); + void memoryInfo(); + void storageInfo(); + void dbListInfo(); + void recNumberInfo(); + void syncInfo(); + void pcVersionInfo(); + void palmVersionInfo(); + void debugInfo(); + void writeFile(); + void cleanup(); + +protected: + void readConfig(); +private: + QMap<QString,QString> fValues; + + bool fHardwareInfo, fUserInfo, fMemoryInfo, fStorageInfo, + fDBList, fRecordNumber, fSyncInfo, + fKDEVersion, fPalmOSVersion, fDebugInfo; + QString fOutputFile, fTemplateFile; + enum eOutputTypeEnum { + eOutputHTML=0, + eOutputText, + eOutputTemplate + } fOutputType; + + KPilotLink::DBInfoList dblist; + QStringList removeParts; + QStringList keepParts; + static const QString defaultpage; +} ; + +#endif diff --git a/kpilot/conduits/sysinfoconduit/sysinfo-factory.cc b/kpilot/conduits/sysinfoconduit/sysinfo-factory.cc new file mode 100644 index 000000000..d03dc0b04 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfo-factory.cc @@ -0,0 +1,43 @@ +/* SysInfo-factory.cc KPilot +** +** Copyright (C) 2003 by Reinhold Kainhofer +** +** This file defines the factory for the SysInfo-conduit plugin. +*/ + +/* +** 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 in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to [email protected] +*/ + +#include "options.h" +#include "pluginfactory.h" + +#include "sysinfo-conduit.h" +#include "sysinfo-setup.h" + +extern "C" +{ + +void *init_conduit_sysinfo() +{ + return new ConduitFactory<SysInfoWidgetConfig,SysInfoConduit>; +} + +} diff --git a/kpilot/conduits/sysinfoconduit/sysinfo-factory.h b/kpilot/conduits/sysinfoconduit/sysinfo-factory.h new file mode 100644 index 000000000..66ae5ae38 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfo-factory.h @@ -0,0 +1,36 @@ +#ifndef _SYSINFO_FACTORY_H +#define _SYSINFO_FACTORY_H +/* SysInfo-factory.h KPilot +** +** Copyright (C) 2003 by Reinhold Kainhofer +** +** This file defines the factory for the SysInfo-conduit plugin. +*/ + +/* +** 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 in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to [email protected] +*/ + +extern "C" +{ + void *init_libsysinfoconduit(); +} + +#endif diff --git a/kpilot/conduits/sysinfoconduit/sysinfo-setup.cc b/kpilot/conduits/sysinfoconduit/sysinfo-setup.cc new file mode 100644 index 000000000..ed7419ab3 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfo-setup.cc @@ -0,0 +1,198 @@ +/* SysInfo-setup.cc KPilot +** +** Copyright (C) 2003 by Reinhold Kainhofer +** +** This file defines the setup dialog for the SysInfo-conduit plugin. +*/ + +/* +** 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 in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to [email protected] +*/ + +#include "options.h" + +#include <qtabwidget.h> +#include <qradiobutton.h> +#include <qcheckbox.h> +#include <qbuttongroup.h> +#include <qlistview.h> + +#include <kaboutdata.h> +#include <kapplication.h> +#include <kurlrequester.h> + +#include "sysinfo-setup_dialog.h" + +#include "sysinfo-factory.h" +#include "sysinfo-setup.h" +#include "sysinfoSettings.h" + + +typedef struct { const char *name; bool (*accessor)(); void (*mutator)(bool); } sysinfoEntry_t; + +const sysinfoEntry_t sysinfoEntries[] = +{ + { I18N_NOOP("HardwareInfo"), SysinfoSettings::hardwareInfo, SysinfoSettings::setHardwareInfo }, + { I18N_NOOP("UserInfo"), SysinfoSettings::userInfo, SysinfoSettings::setUserInfo }, + { I18N_NOOP("MemoryInfo"), SysinfoSettings::memoryInfo, SysinfoSettings::setMemoryInfo }, + { I18N_NOOP("StorageInfo"), SysinfoSettings::storageInfo, SysinfoSettings::setStorageInfo }, + { I18N_NOOP("DatabaseList"), SysinfoSettings::databaseList, SysinfoSettings::setDatabaseList }, + { I18N_NOOP("RecordNumbers"), SysinfoSettings::recordNumbers, SysinfoSettings::setRecordNumbers}, + { I18N_NOOP("SyncInfo"), SysinfoSettings::syncInfo, SysinfoSettings::setSyncInfo }, + { I18N_NOOP("KDEVersion"), SysinfoSettings::kDEVersion, SysinfoSettings::setKDEVersion }, + { I18N_NOOP("PalmOSVersion"), SysinfoSettings::palmOSVersion, SysinfoSettings::setPalmOSVersion }, + { I18N_NOOP("DebugInformation"), SysinfoSettings::debugInformation, SysinfoSettings::setDebugInformation }, + { 0L, 0L, 0L } +} ; + + +/* +** The QCheckListItems used in the list of parts to print have +** several text fields with special meanings. +** 0: The text displayed in the list. +** 1: The index of the item in the sysinfoEntries array. +** 2: This string is empty if the part was originally not checked, +** and non-empty (probably "1") if the part was originally checked. +** This is used to detect changes in the configuration. +** We introduce some defines for these numbers. +*/ + +#define PART_NAME (0) +#define PART_KEY (1) +#define PART_SETTING (2) + +/* +** This is a convenience define to update an item's "original setting". +*/ +#define updateSetting(i) { QCheckListItem *ubbu=(i); \ + ubbu->setText(PART_SETTING,(ubbu->isOn() ? CSL1("1") : QString::null)); } + + +SysInfoWidgetConfig::SysInfoWidgetConfig(QWidget *w, const char *n) : + ConduitConfigBase(w,n), + fConfigWidget(new SysInfoWidget(w)) +{ + FUNCTIONSETUP; + + KAboutData *fAbout = new KAboutData("SysInfoConduit", + I18N_NOOP("KPilot System Information conduit"), + KPILOT_VERSION, + I18N_NOOP("Retrieves System, Hardware, and User Info from the Handheld and stores them to a file."), + KAboutData::License_GPL, + "(C) 2003, Reinhold Kainhofer"); + fAbout->addAuthor("Reinhold Kainhofer", + I18N_NOOP("Primary Author"), "[email protected]", "http://reinhold.kainhofer.com/"); + + ConduitConfigBase::addAboutPage(fConfigWidget->tabWidget,fAbout); + fWidget=fConfigWidget; + + QObject::connect(fConfigWidget->fOutputFile,SIGNAL(textChanged(const QString&)), + this,SLOT(modified())); + QObject::connect(fConfigWidget->fTemplateFile,SIGNAL(textChanged(const QString&)), + this,SLOT(modified())); + QObject::connect(fConfigWidget->fOutputType,SIGNAL(clicked(int)), + this,SLOT(modified())); + fConduitName=i18n("System Information"); +} + +void SysInfoWidgetConfig::commit() +{ + FUNCTIONSETUP; + + SysinfoSettings::setOutputFile( + fConfigWidget->fOutputFile->url() ); + SysinfoSettings::setTemplateFile( + fConfigWidget->fTemplateFile->url() ); + SysinfoSettings::setOutputFormat( + fConfigWidget->fOutputType->id(fConfigWidget->fOutputType->selected())); + + QListViewItem *i = fConfigWidget->fPartsList->firstChild(); + QCheckListItem *ci = dynamic_cast<QCheckListItem *>(i); + while(ci) + { +#ifdef DEBUG + DEBUGKPILOT << fname << ": Saving " << ci->text(PART_NAME) + << (ci->isOn() ? " on" : " off") << endl; +#endif + int index=ci->text(PART_KEY).toInt(); + if (0<=index && index<=10) + { + const sysinfoEntry_t *p = sysinfoEntries+index; + p->mutator(ci->isOn()); + } + updateSetting(ci); + i=i->nextSibling(); + ci = dynamic_cast<QCheckListItem *>(i); + } + SysinfoSettings::self()->writeConfig(); + unmodified(); +} + +void SysInfoWidgetConfig::load() +{ + FUNCTIONSETUP; + SysinfoSettings::self()->readConfig(); + + const sysinfoEntry_t *p = sysinfoEntries; + QCheckListItem *i = 0L; + while (p && p->name) + { + i = new QCheckListItem(fConfigWidget->fPartsList,i18n(p->name),QCheckListItem::CheckBox); + // by default let the sysinfo conduit write out all available information + i->setOn( p->accessor() ); + i->setText(PART_KEY, QString::number(p-sysinfoEntries)); // store index there + updateSetting(i); +#ifdef DEBUG + DEBUGKPILOT << fname << ": Loaded " << p->name + << (i->isOn() ? " on" : " off") << endl; +#endif + + p++; + } + fConfigWidget->fOutputFile->setURL( SysinfoSettings::outputFile() ); + fConfigWidget->fTemplateFile->setURL( SysinfoSettings::templateFile() ); + fConfigWidget->fOutputType->setButton( SysinfoSettings::outputFormat() ); + unmodified(); +} + +/* virtual */ bool SysInfoWidgetConfig::isModified() const +{ + FUNCTIONSETUP; + if (fModified) return true; + + QListViewItem *i = fConfigWidget->fPartsList->firstChild(); + QCheckListItem *ci = dynamic_cast<QCheckListItem *>(i); + + while(ci) + { + bool current = ci->isOn(); + bool original = !ci->text(PART_SETTING).isEmpty(); +#ifdef DEBUG + DEBUGKPILOT << fname << ": Checking " << ci->text(PART_KEY) + << " was " << (original ? " on" : " off") + << " now " << (current ? " on" : " off") << endl; +#endif + + if (current!=original) return true; + i=i->nextSibling(); + ci = dynamic_cast<QCheckListItem *>(i); + } + return false; +} diff --git a/kpilot/conduits/sysinfoconduit/sysinfo-setup.h b/kpilot/conduits/sysinfoconduit/sysinfo-setup.h new file mode 100644 index 000000000..41e55eb86 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfo-setup.h @@ -0,0 +1,47 @@ +#ifndef _SysInfo_SysInfo_SETUP_H +#define _SysInfo_SysInfo_SETUP_H +/* sysinfo-setup.h KPilot +** +** Copyright (C) 2003 by Reinhold Kainhofer +** +** This file defines the widget and behavior for the config dialog +** of the KNotes conduit. +*/ + +/* +** 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 in a file called COPYING; if not, write to +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +** MA 02110-1301, USA. +*/ + +/* +** Bug reports and questions can be sent to [email protected] +*/ + +#include "plugin.h" + +class SysInfoWidget; + +class SysInfoWidgetConfig : public ConduitConfigBase +{ +public: + SysInfoWidgetConfig(QWidget *parent, const char *); + virtual void commit(); + virtual void load(); + virtual bool isModified() const; +protected: + SysInfoWidget *fConfigWidget; +} ; + +#endif diff --git a/kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui b/kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui new file mode 100644 index 000000000..e4502bb1e --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfo-setup_dialog.ui @@ -0,0 +1,214 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>SysInfoWidget</class> +<author>Reinhold Kainhofer</author> +<widget class="QWidget"> + <property name="name"> + <cstring>Form2</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>330</width> + <height>232</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>General</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="3" column="1"> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>51</height> + </size> + </property> + </spacer> + <widget class="KURLRequester" row="0" column="1"> + <property name="name"> + <cstring>fOutputFile</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Enter here, or select by clicking the file picker button, the location and file name of the output file used to store the handheld's system information.</qt></string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>Output &file:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>fOutputFile</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Enter here, or select by clicking the file picker button, the location and file name of the output file used to store the handheld's system information.</qt></string> + </property> + </widget> + <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>fOutputType</cstring> + </property> + <property name="title"> + <string>Type of Output</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>radioButton3</cstring> + </property> + <property name="text"> + <string>&HTML</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Select this option to output the system information data as a HTML document.</qt></string> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>radioButton4</cstring> + </property> + <property name="text"> + <string>Te&xt file</string> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Select this option to output the system information data as a text document.</qt></string> + </property> + </widget> + <widget class="KURLRequester" row="2" column="1"> + <property name="name"> + <cstring>fTemplateFile</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Enter here, or select by clicking on the file picker button, the location of the template to be used if you select the Custom template option.</qt></string> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>radioButton5</cstring> + </property> + <property name="text"> + <string>&Custom template:</string> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Select this option to output the system information data as defined by a custom template. Enter the location of the template in the edit box, or select it clicking on the file picker button.</qt></string> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Parts Included</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QListView" row="0" column="0"> + <column> + <property name="text"> + <string>Output Type</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>fPartsList</cstring> + </property> + <property name="resizeMode"> + <enum>LastColumn</enum> + </property> + <property name="whatsThis" stdset="0"> + <string><qt>Check on this list the types of information about your system and handheld you want to display in the output file.</qt></string> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>radioButton5</sender> + <signal>toggled(bool)</signal> + <receiver>fTemplateFile</receiver> + <slot>setEnabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>tabWidget</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includes> + <include location="global" impldecl="in implementation">kurlrequester.h</include> + <include location="global" impldecl="in implementation">klineedit.h</include> + <include location="global" impldecl="in implementation">kpushbutton.h</include> +</includes> +</UI> diff --git a/kpilot/conduits/sysinfoconduit/sysinfoSettings.kcfgc b/kpilot/conduits/sysinfoconduit/sysinfoSettings.kcfgc new file mode 100644 index 000000000..09337f301 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfoSettings.kcfgc @@ -0,0 +1,7 @@ +File=sysinfoconduit.kcfg +ClassName=SysinfoSettings +Singleton=true +ItemAccessors=true +Mutators=true +GlobalEnums=true +SetUserTexts=true diff --git a/kpilot/conduits/sysinfoconduit/sysinfo_conduit.desktop b/kpilot/conduits/sysinfoconduit/sysinfo_conduit.desktop new file mode 100644 index 000000000..7e7b04380 --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfo_conduit.desktop @@ -0,0 +1,111 @@ +[Desktop Entry] +Type=Service +Comment=This conduit writes information about your handheld and the sync to a file. +Comment[af]=Hierdie pad skryf informasie aangaande die draagbare toestel en sinkronisasie na 'n lêer. +Comment[bg]=Запис на информацията относно мобилното устройство във файл +Comment[bs]=Ovaj conduit ispisuje informacije o ručnom računaru i sinhronizuje ih sa datotekom. +Comment[ca]=Aquest conducte escriu informació a un fitxer a sobre de la vostra agenda electrònica i la sincronització. +Comment[cs]=Toto propojení zapisuje informace o vašem handheldu a synchronizaci do souboru. +Comment[cy]=Mae'r cwndid yma yn ysgrifennu gwybodaeth ynglyn â'ch llawiadur a'r cydamseriad i ffeil. +Comment[da]=Denne kanal skriver information om din håndholdte og synkroniseringen til en fil. +Comment[de]=Schreibt Daten zum Taschencomputer und den Abgleich in eine Datei +Comment[el]=Αυτός ο σύνδεσμος γράφει πληροφορίες σχετικά με τον υπολογιστή παλάμης σας και το συγχρονισμό προς ένα αρχείο. +Comment[es]=Este conducto escribe la información subre su agenda electrónica y la sincronización a un archivo. +Comment[et]=See kanal salvestab info pihuarvuti kohta failina. +Comment[eu]=Kanal honek zure agenda elektronikoari buruzko informazioa eta sinkronizazio fitxategi batean gordetzen ditu. +Comment[fa]=این لوله، اطلاعات دربارۀ دستی شما و ترکیبدهی به پرونده را مینویسد. +Comment[fi]=Tämä yhdyskäytävä kirjoittaa tietoja taskutietokoneelta ja synkronoi ne tiedostoon. +Comment[fr]=Ce canal écrit des informations sur votre périphérique et la synchronisation dans un fichier. +Comment[fy]=Dit conduit bewarret ynformaasje oer jo handheld en syngronosaasje yn in triem. +Comment[gl]=Este conducto escribe a información sobre o seu aparello portátil e a sincronización a un ficheiro. +Comment[hi]=यह कन्ड्यूइट आपके हैंण्डहेल्ड के बारे में जानकारी लिखता है तथा एक फ़ाइल में सिंक करता है. +Comment[hu]=Ezzel a csatolóval fájlba lehet kiíratni a kéziszámítógép és a szinkronizálás jellemzőit +Comment[is]=Þessi rás skrifar upplýsingar um lófatölvuna þína og samstillinguna í skrá. +Comment[it]=Questo conduit scrive in un file informazioni sul tuo palmare. +Comment[ja]=このコンジットはあなたのハンドヘルドの情報を書き出し、ファイルに同期します。 +Comment[ka]=ეს არხი ინფორმაციას წერს თქვენი პორტატიული მოწყობილობის შესახებ და ახდენს მის სინქრონიზაციას ფაილთან. +Comment[kk]=Қалта құрылғыңыз туралы мәліметті файла жазу арнасы. +Comment[km]=បំពង់នេះសរសេរព័ត៌មានអំពីឧបករណ៍យួរដៃរបស់អ្នក និងការធ្វើសមកាលកម្ម ទៅឯកសារមួយ ។ +Comment[lt]=Šis kanalas įrašo informaciją apie delninuką ir sinchronizavimą į bylą. +Comment[ms]=Saluran ini menulis maklumat tentang komputer telapak dan segerakan ke fail. +Comment[nb]=Denne kanalen skriver informasjon om PDA-en og synkroniseringen til en fil. +Comment[nds]=De Kanaal schrifft Informatschonen över den Handreekner un de Synkroniseren na en Datei. +Comment[ne]=यो कन्ड्युटले ह्यान्डहेल्ड बारेमा सूचना लेख्दछ र फाइलमा सिन्क गर्दछ । +Comment[nl]=Dit conduit slaat informatie over uw handheld en de synchronisatie op in een bestand. +Comment[nn]=Denne koplinga skriv informasjon om den handheldte eininga di og synkroniseringa til ei fil. +Comment[pl]=Ten łącznik zapisuje informacje o twoim palmtopie i przebiegu synchronizacji do pliku. +Comment[pt]=Esta conduta escreve informações sobre o seu dispositivo e a sincronização para um ficheiro. +Comment[pt_BR]=Este conduíte escreve informação sobre o seu handheld e a sincronização em um arquivo. +Comment[ru]=Канал передачи системной информации с КПК и записи в файл. +Comment[sk]=Táto spojka zobrazuje informácie o vašom prenosnom zariadení a ukladá ich do súboru. +Comment[sl]=Ta veznik zapiše podatke o vašem ročnem računalniku in usklajevanju v datoteko. +Comment[sr]=Овај провод записује информације о вашем ручном рачунару и синхронизује са фајлом. +Comment[sr@Latn]=Ovaj provod zapisuje informacije o vašem ručnom računaru i sinhronizuje sa fajlom. +Comment[sv]=Den här kanalen skriver information om handdatorn och synkroniseringen till en fil. +Comment[ta]=இந்த காப்புக் குழாய் உங்கள் கையேட்டைப் பற்றிய தகவல்களையும் ஒத்திசைவையும் கோப்புக்கு எழுதுகிறது +Comment[tg]=Канали таҳвили иттилооти системавӣ аз Pilot ва қайдкунӣ ба файл +Comment[tr]=Bu bileşen, el bilgisayarınızın bilgilerini bir dosyaya yazar. +Comment[uk]=Цей акведук записує інформацію про кишеньковий пристрій і синхронізацію у файл. +Comment[zh_CN]=此管道写入您手持设备的信息,并同步至一文件。 +Comment[zh_TW]=此軟體將您的 handheld 資訊寫入檔案。 +Name=System Information +Name[af]=Stelsel informasie +Name[ar]=معلومات عن النظام +Name[be]=Сыстэмная інфармацыя +Name[bg]=Системна информация +Name[br]=Titouroù diwar-benn ar reizhiad +Name[bs]=Sistemske informacije +Name[ca]=Sistema d'informació +Name[cs]=Informace o systému +Name[cy]=Gwybodaeth Gysawd +Name[da]=Systeminformation +Name[de]=System-Information +Name[el]=Πληροφορίες συστήματος +Name[eo]=Sisteminformoj +Name[es]=Información del sistema +Name[et]=Süsteemi info +Name[eu]=Sistemaren informazioa +Name[fa]=اطلاعات سیستم +Name[fi]=Järjestelmätiedot +Name[fr]=Informations sur le système +Name[fy]=Systeemynformaasje +Name[ga]=Faisnéis Córais +Name[gl]=Información do Sistema +Name[hi]=तंत्र जानकारी +Name[hu]=Rendszerinformáció +Name[is]=Kerfisupplýsingar +Name[it]=Informazioni di sistema +Name[ja]=システム情報 +Name[ka]=სისტემის ინფორმაცია +Name[kk]=Жүйелік мәлімет +Name[km]=ព័ត៌មានអំពីប្រព័ន្ធ +Name[lt]=Sistemos informacija +Name[mk]=Информации за системот +Name[ms]=Maklumat Sistem +Name[nb]=Systeminformasjon +Name[nds]=Systeem-Informatschoon +Name[ne]=प्रणाली सूचना +Name[nl]=Systeeminformatie +Name[nn]=Systeminformasjon +Name[pl]=Informacja systemowa +Name[pt]=Informação do Sistema +Name[pt_BR]=Informação do Sistema +Name[ro]=Informaţii de sistem +Name[ru]=Информация о системе +Name[se]=Vuogádatdieđut +Name[sk]=Informácie o systéme +Name[sl]=Sistemske informacije +Name[sr]=Информације о систему +Name[sr@Latn]=Informacije o sistemu +Name[sv]=Systeminformation +Name[ta]=அமைப்பு தகவல் +Name[tg]=Иттилоот дар бораи система +Name[tr]=Sistem Bilgisi +Name[uk]=Системна інформація +Name[uz]=Tizim haqida maʼlumot +Name[uz@cyrillic]=Тизим ҳақида маълумот +Name[zh_CN]=系统信息 +Name[zh_TW]=系統資訊 +Implemented=file +ServiceTypes=KPilotConduit +X-KDE-Library=conduit_sysinfo diff --git a/kpilot/conduits/sysinfoconduit/sysinfoconduit.kcfg b/kpilot/conduits/sysinfoconduit/sysinfoconduit.kcfg new file mode 100644 index 000000000..20d8cc24d --- /dev/null +++ b/kpilot/conduits/sysinfoconduit/sysinfoconduit.kcfg @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 + http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > + <kcfgfile name="kpilot_sysinfoconduitrc"/> + <group name="General"> + <entry name="OutputFile" key="Output file" type="Path"> + <default>$HOME/kpilot-syslog.html</default> + </entry> + <entry name="OutputFormat" key="Output format" type="Enum"> + <choices> + <choice name="eSysInfoHTML"/> + <choice name="eSysInfoText"/> + <choice name="eSysInfoTemplate"/> + </choices> + <default>eSysInfoHTML</default> + </entry> + <entry name="TemplateFile" key="Template file" type="Path"> + <default></default> + </entry> + <entry name="DebugInformation" key="Debug Information" type="Bool"> + <label>Debug information (for KPilot developers)</label> + <default>true</default> + </entry> + <entry name="HardwareInfo" key="Hardware Info" type="Bool"> + <label>Hardware information</label> + <default>true</default> + </entry> + <entry name="DatabaseList" key="Database List" type="Bool"> + <label>List of databases on handheld (takes long!)</label> + <default>true</default> + </entry> + <entry name="MemoryInfo" key="Memory Info" type="Bool"> + <label>Memory information</label> + <default>true</default> + </entry> + <entry name="RecordNumbers" key="Record Numbers" type="Bool"> + <label>Number of addresses, todos, events and memos</label> + <default>true</default> + </entry> + <entry name="PalmOSVersion" key="PalmOS Version" type="Bool"> + <label>PalmOS version</label> + <default>true</default> + </entry> + <entry name="StorageInfo" key="Storage Info" type="Bool"> + <label>Storage info (SD card, memory stick, ...)</label> + <default>true</default> + </entry> + <entry name="SyncInfo" key="Sync Info" type="Bool"> + <label>Synchronization information</label> + <default>true</default> + </entry> + <entry name="UserInfo" key="User Info" type="Bool"> + <label>User information</label> + <default>true</default> + </entry> + <entry name="KDEVersion" key="KDE Version" type="Bool"> + <label>Version of KPilot, pilot-link and KDE</label> + <default>true</default> + </entry> + </group> + +</kcfg> |