TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

memberinfo.cpp 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. This file is part of KitchenSync.
  3. Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  15. USA.
  16. */
  17. #include "memberinfo.h"
  18. #include <tdeglobal.h>
  19. #include <kiconloader.h>
  20. #include <tdelocale.h>
  21. MemberInfo::MemberInfo( const QSync::Member &member )
  22. : mMember( member )
  23. {
  24. }
  25. TQPixmap MemberInfo::smallIcon() const
  26. {
  27. return TDEGlobal::iconLoader()->loadIcon( iconName(), TDEIcon::Small );
  28. }
  29. TQPixmap MemberInfo::desktopIcon() const
  30. {
  31. return TDEGlobal::iconLoader()->loadIcon( iconName(), TDEIcon::Desktop );
  32. }
  33. TQString MemberInfo::iconName() const
  34. {
  35. return pluginIconName( mMember.pluginName() );
  36. }
  37. TQString MemberInfo::name() const
  38. {
  39. static TQMap<TQString, TQString> nameMap;
  40. if ( nameMap.isEmpty() ) {
  41. nameMap.insert( "file-sync", i18n( "File" ) );
  42. nameMap.insert( "palm-sync", i18n( "Palm" ) );
  43. nameMap.insert( "tdepim-sync", i18n( "TDE PIM" ) );
  44. nameMap.insert( "tdeio-sync", i18n( "Remote File" ) );
  45. nameMap.insert( "irmc-sync", i18n( "Mobile Phone" ) );
  46. nameMap.insert( "evo2-sync", i18n( "Evolution" ) );
  47. nameMap.insert( "opie-sync", i18n( "Handheld" ) );
  48. nameMap.insert( "ldap-sync", i18n( "LDAP" ) );
  49. nameMap.insert( "syncml-obex-client", i18n( "Mobile Phone" ) );
  50. nameMap.insert( "syncml-http-server", i18n( "Mobile Phone" ) );
  51. nameMap.insert( "moto-sync", i18n( "Mobile Phone" ) );
  52. nameMap.insert( "gnokii-sync", i18n( "Mobile Phone" ) );
  53. nameMap.insert( "google-calendar", i18n( "Google Calendar" ) );
  54. nameMap.insert( "gpe-sync", i18n( "Handheld" ) );
  55. nameMap.insert( "sunbird-sync", i18n( "Sunbird Calendar" ) );
  56. nameMap.insert( "jescs-sync", i18n( "Java Enterprise System Calendar" ) );
  57. nameMap.insert( "synce-plugin", i18n( "WinCE Devices" ) );
  58. }
  59. if ( mMember.name().isEmpty() )
  60. return nameMap[ mMember.pluginName() ] + " (" + TQString::number( mMember.id() ) + ") ";
  61. else
  62. return mMember.name();
  63. }
  64. TQString MemberInfo::pluginIconName( const TQString &pluginName )
  65. {
  66. if ( pluginName == "file-sync" ) return "folder";
  67. if ( pluginName == "palm-sync" ) return "pda_black";
  68. if ( pluginName == "tdepim-sync" ) return "kontact";
  69. if ( pluginName == "tdeio-sync" ) return "network";
  70. if ( pluginName == "irmc-sync" ) return "mobile_phone";
  71. if ( pluginName == "evo2-sync" ) return "evolution";
  72. if ( pluginName == "opie-sync" ) return "pda_blue";
  73. if ( pluginName == "synce-plugin" ) return "pda_blue";
  74. if ( pluginName == "ldap-sync" ) return "contents2";
  75. if ( pluginName == "syncml-obex-client" ) return "mobile_phone";
  76. if ( pluginName == "syncml-http-server" ) return "pda_blue";
  77. if ( pluginName == "moto-sync" ) return "mobile_phone";
  78. if ( pluginName == "gnokii-sync" ) return "mobile_phone";
  79. if ( pluginName == "google-calendar" ) return "www";
  80. if ( pluginName == "gpe-sync" ) return "pda_blue";
  81. if ( pluginName == "sunbird-sync" ) return "www";
  82. if ( pluginName == "jescs-sync" ) return "www";
  83. return TQString();
  84. }