summaryrefslogtreecommitdiffstats
path: root/kitchensync/src/memberinfo.cpp
blob: fb52c7a7870963a4e090edb9f061397c8938ba94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
    This file is part of KitchenSync.

    Copyright (c) 2005 Cornelius Schumacher <schumacher@kde.org>

    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 "memberinfo.h"

#include <tdeglobal.h>
#include <kiconloader.h>
#include <tdelocale.h>

MemberInfo::MemberInfo( const QSync::Member &member )
  : mMember( member )
{
}

TQPixmap MemberInfo::smallIcon() const
{
  return TDEGlobal::iconLoader()->loadIcon( iconName(), TDEIcon::Small );
}

TQPixmap MemberInfo::desktopIcon() const
{
  return TDEGlobal::iconLoader()->loadIcon( iconName(), TDEIcon::Desktop );
}

TQString MemberInfo::iconName() const
{
  return pluginIconName( mMember.pluginName() );
}

TQString MemberInfo::name() const
{
  static TQMap<TQString, TQString> nameMap;
  if ( nameMap.isEmpty() ) {
    nameMap.insert( "file-sync", i18n( "File" ) );
    nameMap.insert( "palm-sync", i18n( "Palm" ) );
    nameMap.insert( "tdepim-sync", i18n( "TDE PIM" ) );
    nameMap.insert( "tdeio-sync", i18n( "Remote File" ) );
    nameMap.insert( "irmc-sync", i18n( "Mobile Phone" ) );
    nameMap.insert( "evo2-sync", i18n( "Evolution" ) );
    nameMap.insert( "opie-sync", i18n( "Handheld" ) );
    nameMap.insert( "ldap-sync", i18n( "LDAP" ) );
    nameMap.insert( "syncml-obex-client", i18n( "Mobile Phone" ) );
    nameMap.insert( "syncml-http-server", i18n( "Mobile Phone" ) );
    nameMap.insert( "moto-sync", i18n( "Mobile Phone" ) );
    nameMap.insert( "gnokii-sync", i18n( "Mobile Phone" ) );
    nameMap.insert( "google-calendar", i18n( "Google Calendar" ) );
    nameMap.insert( "gpe-sync", i18n( "Handheld" ) );
    nameMap.insert( "sunbird-sync", i18n( "Sunbird Calendar" ) );
    nameMap.insert( "jescs-sync", i18n( "Java Enterprise System Calendar" ) );
    nameMap.insert( "synce-plugin", i18n( "WinCE Devices" ) );
  }

  if ( mMember.name().isEmpty() )
    return nameMap[ mMember.pluginName() ] + " (" + TQString::number( mMember.id() ) + ") ";
  else
    return mMember.name();
}

TQString MemberInfo::pluginIconName( const TQString &pluginName )
{
  if ( pluginName == "file-sync" ) return "folder";
  if ( pluginName == "palm-sync" ) return "pda_black";
  if ( pluginName == "tdepim-sync" ) return "kontact";
  if ( pluginName == "tdeio-sync" ) return "network";
  if ( pluginName == "irmc-sync" ) return "mobile_phone";
  if ( pluginName == "evo2-sync" ) return "evolution";
  if ( pluginName == "opie-sync" ) return "pda_blue";
  if ( pluginName == "synce-plugin" ) return "pda_blue";
  if ( pluginName == "ldap-sync" ) return "contents2";
  if ( pluginName == "syncml-obex-client" ) return "mobile_phone";
  if ( pluginName == "syncml-http-server" ) return "pda_blue";
  if ( pluginName == "moto-sync" ) return "mobile_phone";
  if ( pluginName == "gnokii-sync" ) return "mobile_phone";
  if ( pluginName == "google-calendar" ) return "www";
  if ( pluginName == "gpe-sync" ) return "pda_blue";
  if ( pluginName == "sunbird-sync" ) return "www";
  if ( pluginName == "jescs-sync" ) return "www";


  return TQString();
}