kitchensync

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