make webinterface translatable. there are around 20 short strings, all with context...
[kdenetwork.git] / kopete / libkopete / kopeteutils.cpp
blob739a8a62e1ba097234ecbf978216e585863042d7
1 /*
2 Kopete Utils.
3 Copyright (c) 2005 Duncan Mac-Vicar Prett <duncan@kde.org>
5 isHostReachable function code derived from KDE's HTTP kioslave
6 Copyright (c) 2005 Waldo Bastian <bastian@kde.org>
8 Kopete (c) 2002-2003 by the Kopete developers <kopete-devel@kde.org>
10 *************************************************************************
11 * *
12 * This library is free software; you can redistribute it and/or *
13 * modify it under the terms of the GNU Lesser General Public *
14 * License as published by the Free Software Foundation; either *
15 * version 2 of the License, or (at your option) any later version. *
16 * *
17 *************************************************************************
20 #include <qmap.h>
21 //Added by qt3to4:
22 #include <QPixmap>
23 #include <QByteArray>
25 #include <kmessagebox.h>
27 #include <klocale.h>
28 #include <kdebug.h>
29 #include <kiconloader.h>
31 #include "kopeteaccount.h"
32 #include "knotification.h"
33 #include "kopeteutils_private.h"
34 #include "kopeteutils.h"
35 #include "kopeteuiglobal.h"
37 static const QString notifyConnectionLost_DefaultMessage = i18n("You have been disconnected.");
38 static const QString notifyConnectionLost_DefaultCaption = i18n("Connection Lost.");
39 static const QString notifyConnectionLost_DefaultExplanation = i18n("Kopete lost the channel used to talk to the instant messaging system.\nThis can be because either your internet access went down, the service is experiencing problems, or the service disconnected you because you tried to connect with the same account from another location. Try connecting again later.");
41 static const QString notifyCannotConnect_DefaultMessage = i18n("Cannot connect with the instant messaging server or peers.");
42 static const QString notifyCannotConnect_DefaultCaption = i18n("Cannot connect.");
43 static const QString notifyCannotConnect_DefaultExplanation = i18n("This means Kopete cannot reach the instant messaging server or peers.\nThis can be because either your internet access is down or the server is experiencing problems. Try connecting again later.");
45 namespace Kopete
47 namespace Utils
50 void notify( QPixmap pic, const QString &eventid, const QString &caption, const QString &message, const QString explanation, const QString debugInfo)
52 Q_UNUSED(caption);
54 QStringList actions;
55 if ( !explanation.isEmpty() )
56 actions << i18n( "More Information..." );
57 kDebug( 14010 ) ;
58 KNotification *n = new KNotification( eventid , 0l );
59 n->setActions( actions );
60 n->setText( message );
61 n->setPixmap( pic );
62 ErrorNotificationInfo info;
63 info.explanation = explanation;
64 info.debugInfo = debugInfo;
66 NotifyHelper::self()->registerNotification(n, info);
67 QObject::connect( n, SIGNAL(activated(unsigned int )) , NotifyHelper::self() , SLOT( slotEventActivated(unsigned int) ) );
68 QObject::connect( n, SIGNAL(closed()) , NotifyHelper::self() , SLOT( slotEventClosed() ) );
70 n->sendEvent();
73 void notifyConnectionLost( const Account *account, const QString caption, const QString message, const QString explanation, const QString debugInfo)
75 if (!account)
76 return;
78 notify( account->accountIcon(32), QString::fromLatin1("connection_lost"), caption.isEmpty() ? notifyConnectionLost_DefaultCaption : caption, message.isEmpty() ? notifyConnectionLost_DefaultMessage : message, explanation.isEmpty() ? notifyConnectionLost_DefaultExplanation : explanation, debugInfo);
81 void notifyCannotConnect( const Account *account, const QString explanation, const QString debugInfo)
83 Q_UNUSED(explanation);
85 if (!account)
86 return;
88 notify( account->accountIcon(), QString::fromLatin1("cannot_connect"), notifyCannotConnect_DefaultCaption, notifyCannotConnect_DefaultMessage, notifyCannotConnect_DefaultExplanation, debugInfo);
91 } // end ns ErrorNotifier
92 } // end ns Kopete