memberinfo.cpp
00001 /* 00002 This file is part of KitchenSync. 00003 00004 Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00019 USA. 00020 */ 00021 00022 #include "memberinfo.h" 00023 00024 #include <tdeglobal.h> 00025 #include <kiconloader.h> 00026 #include <tdelocale.h> 00027 00028 MemberInfo::MemberInfo( const QSync::Member &member ) 00029 : mMember( member ) 00030 { 00031 } 00032 00033 TQPixmap MemberInfo::smallIcon() const 00034 { 00035 return TDEGlobal::iconLoader()->loadIcon( iconName(), TDEIcon::Small ); 00036 } 00037 00038 TQPixmap MemberInfo::desktopIcon() const 00039 { 00040 return TDEGlobal::iconLoader()->loadIcon( iconName(), TDEIcon::Desktop ); 00041 } 00042 00043 TQString MemberInfo::iconName() const 00044 { 00045 return pluginIconName( mMember.pluginName() ); 00046 } 00047 00048 TQString MemberInfo::name() const 00049 { 00050 static TQMap<TQString, TQString> nameMap; 00051 if ( nameMap.isEmpty() ) { 00052 nameMap.insert( "file-sync", i18n( "File" ) ); 00053 nameMap.insert( "palm-sync", i18n( "Palm" ) ); 00054 nameMap.insert( "tdepim-sync", i18n( "TDE PIM" ) ); 00055 nameMap.insert( "tdeio-sync", i18n( "Remote File" ) ); 00056 nameMap.insert( "irmc-sync", i18n( "Mobile Phone" ) ); 00057 nameMap.insert( "evo2-sync", i18n( "Evolution" ) ); 00058 nameMap.insert( "opie-sync", i18n( "Handheld" ) ); 00059 nameMap.insert( "ldap-sync", i18n( "LDAP" ) ); 00060 nameMap.insert( "syncml-obex-client", i18n( "Mobile Phone" ) ); 00061 nameMap.insert( "syncml-http-server", i18n( "Mobile Phone" ) ); 00062 nameMap.insert( "moto-sync", i18n( "Mobile Phone" ) ); 00063 nameMap.insert( "gnokii-sync", i18n( "Mobile Phone" ) ); 00064 nameMap.insert( "google-calendar", i18n( "Google Calendar" ) ); 00065 nameMap.insert( "gpe-sync", i18n( "Handheld" ) ); 00066 nameMap.insert( "sunbird-sync", i18n( "Sunbird Calendar" ) ); 00067 nameMap.insert( "jescs-sync", i18n( "Java Enterprise System Calendar" ) ); 00068 nameMap.insert( "synce-plugin", i18n( "WinCE Devices" ) ); 00069 } 00070 00071 if ( mMember.name().isEmpty() ) 00072 return nameMap[ mMember.pluginName() ] + " (" + TQString::number( mMember.id() ) + ") "; 00073 else 00074 return mMember.name(); 00075 } 00076 00077 TQString MemberInfo::pluginIconName( const TQString &pluginName ) 00078 { 00079 if ( pluginName == "file-sync" ) return "folder"; 00080 if ( pluginName == "palm-sync" ) return "pda_black"; 00081 if ( pluginName == "tdepim-sync" ) return "kontact"; 00082 if ( pluginName == "tdeio-sync" ) return "network"; 00083 if ( pluginName == "irmc-sync" ) return "mobile_phone"; 00084 if ( pluginName == "evo2-sync" ) return "evolution"; 00085 if ( pluginName == "opie-sync" ) return "pda_blue"; 00086 if ( pluginName == "synce-plugin" ) return "pda_blue"; 00087 if ( pluginName == "ldap-sync" ) return "contents2"; 00088 if ( pluginName == "syncml-obex-client" ) return "mobile_phone"; 00089 if ( pluginName == "syncml-http-server" ) return "pda_blue"; 00090 if ( pluginName == "moto-sync" ) return "mobile_phone"; 00091 if ( pluginName == "gnokii-sync" ) return "mobile_phone"; 00092 if ( pluginName == "google-calendar" ) return "www"; 00093 if ( pluginName == "gpe-sync" ) return "pda_blue"; 00094 if ( pluginName == "sunbird-sync" ) return "www"; 00095 if ( pluginName == "jescs-sync" ) return "www"; 00096 00097 00098 return TQString(); 00099 }