Don't keep compiling/run if something failed.
[kdevelopdvcssupport.git] / plugins / teamwork / kdevteamwork_helpers.cpp
blob5cb3fd08a8828b0642526905c674bcff0b9097d4
1 /***************************************************************************
2 Copyright 2006 David Nolden <david.nolden.kdevelop@art-master.de>
3 ***************************************************************************/
5 /***************************************************************************
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 ***************************************************************************/
13 #include "kdevteamwork_helpers.h"
14 #include <QIcon>
15 #include <kiconloader.h>
16 #include "lib/network/messagetypeset.h"
18 IconCache* IconCache::m_instance = 0;
21 IconCache::IconCache() {
22 ///Here, the appropriate icon-names can be chosen by mapping
23 m_instance = this;
24 maps_[ "unknown" ] = "unknown";
25 maps_[ "text_message_in" ] = "mail-receive";
26 maps_[ "text_message_out" ] = "mail-send";
28 maps_[ "document_message_in" ] = "folder_inbox";
29 maps_[ "document_message_out" ] = "folder_outbox";
31 maps_[ "generalrequest_in" ] = "bookmarks";
32 maps_[ "generalrequest_out" ] = "tools-wizard";
33 maps_[ "generalrequest_in_denied" ] = "fileclose";
34 maps_[ "generalrequest_in_accepted" ] = "dialog-ok";
35 maps_[ "generalrequest_out_denied" ] = "fileclose";
36 maps_[ "generalrequest_out_accepted" ] = "dialog-ok";
37 maps_[ "generalrequest_out_failed" ] = "remove";
38 maps_[ "generalrequest_in_failed" ] = "remove";
40 maps_[ "collaborationrequest_in" ] = "bookmarks";
41 maps_[ "collaborationrequest_out" ] = "tools-wizard";
42 maps_[ "collaborationrequest_accepted" ] = "dialog-ok";
43 maps_[ "collaborationrequest_denied" ] = "fileclose";
44 maps_[ "collaborationrequest_in_denied" ] = "fileclose";
45 maps_[ "collaborationrequest_in_accepted" ] = "dialog-ok";
46 maps_[ "collaborationrequest_out_denied" ] = "fileclose";
47 maps_[ "collaborationrequest_out_accepted" ] = "dialog-ok";
48 maps_[ "collaborationrequest_out_failed" ] = "remove";
49 maps_[ "collaborationrequest_in_failed" ] = "remove";
51 maps_[ "collaboration_file" ] = "completion";
52 maps_[ "collaboration_file_disabled" ] = "remove";
53 maps_[ "collaboration_file_dead" ] = "fileclose";
54 maps_[ "collaboration_session" ] = "system-switch-user";
55 maps_[ "collaboration_session_finished" ] = "remove";
56 maps_[ "collaboration_session_connectionlost" ] = "fileclose";
58 maps_[ "filecollaborationrequest_in" ] = "bookmarks";
59 maps_[ "filecollaborationrequest_out" ] = "tools-wizard";
60 maps_[ "filecollaborationrequest_accepted" ] = "dialog-ok";
61 maps_[ "filecollaborationrequest_denied" ] = "fileclose";
62 maps_[ "filecollaborationrequest_in_denied" ] = "fileclose";
63 maps_[ "filecollaborationrequest_in_accepted" ] = "dialog-ok";
64 maps_[ "filecollaborationrequest_out_denied" ] = "fileclose";
65 maps_[ "filecollaborationrequest_out_accepted" ] = "dialog-ok";
66 maps_[ "filecollaborationrequest_out_failed" ] = "remove";
67 maps_[ "filecollaborationrequest_in_failed" ] = "remove";
68 maps_[ "filecollaborationrequest_in_failed" ] = "remove";
69 maps_[ "fileusercollaboration_inactive" ] = "presence_unknown";
71 maps_[ "patch" ] = "text-x-generic";
72 maps_[ "failed" ] = "fileclose";
74 maps_[ "error" ] = "stop";
77 void SafeTeamworkEmitter::updateMessageInfo( const MessagePointer& msg ) {
78 emit signalUpdateMessageInfo( msg );
81 QIcon IconCache::operator () ( const QString& name, KIconLoader::Group grp ) {
82 return getIcon( name, grp );
85 QIcon IconCache::getIconStatic( QString name, KIconLoader::Group grp ) {
86 return IconCache::instance() ->getIcon( name, grp );
89 QIcon IconCache::getIcon( QString name, KIconLoader::Group grp ) {
91 QMap<QString, QString>::iterator it = maps_.find( name );
93 if ( it != maps_.end() )
94 name = *it;
97 QPair<QString, KIconLoader::Group> pos( name, grp );
98 IconMap::iterator it = m_icons.find( pos );
99 if ( it != m_icons.end() ) {
100 return * it;
101 } else {
102 m_icons[ pos ] = QIcon( KIconLoader::global() ->loadIcon( name, grp ) );
103 return m_icons[ pos ];
107 IconCache* IconCache::instance() {
108 return m_instance;
112 #include "kdevteamwork_helpers.moc"