diff options
Diffstat (limited to 'kopete/libkopete/knotification.cpp')
-rw-r--r-- | kopete/libkopete/knotification.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/kopete/libkopete/knotification.cpp b/kopete/libkopete/knotification.cpp index 737fe102..4b41b48b 100644 --- a/kopete/libkopete/knotification.cpp +++ b/kopete/libkopete/knotification.cpp @@ -33,20 +33,20 @@ #include <kwin.h> -#include <qvbox.h> +#include <tqvbox.h> #include <dcopclient.h> -#include <qcstring.h> -#include <qguardedptr.h> -#include <qstylesheet.h> -#include <qlabel.h> -#include <qtimer.h> -#include <qtabwidget.h> +#include <tqcstring.h> +#include <tqguardedptr.h> +#include <tqstylesheet.h> +#include <tqlabel.h> +#include <tqtimer.h> +#include <tqtabwidget.h> //TODO, make the KNotification aware of the systemtray. #include "kopeteuiglobal.h" -static WId checkWinId( const QString &/*appName*/, WId senderWinId ) +static WId checkWinId( const TQString &/*appName*/, WId senderWinId ) { if(senderWinId==0) senderWinId=Kopete::UI::Global::sysTrayWId(); @@ -57,14 +57,14 @@ static WId checkWinId( const QString &/*appName*/, WId senderWinId ) struct KNotification::Private { - QWidget *widget; - QString text; - QStringList actions; + TQWidget *widget; + TQString text; + TQStringList actions; int level; }; -KNotification::KNotification(QObject *parent) : - QObject(parent) , d(new Private) +KNotification::KNotification(TQObject *parent) : + TQObject(parent) , d(new Private) { m_linkClicked = false; } @@ -75,20 +75,20 @@ KNotification::~KNotification() } -void KNotification::notifyByExecute(const QString &command, const QString& event, - const QString& fromApp, const QString& text, +void KNotification::notifyByExecute(const TQString &command, const TQString& event, + const TQString& fromApp, const TQString& text, int winId, int eventId) { if (!command.isEmpty()) { // kdDebug() << "executing command '" << command << "'" << endl; - QMap<QChar,QString> subst; + TQMap<TQChar,TQString> subst; subst.insert( 'e', event ); subst.insert( 'a', fromApp ); subst.insert( 's', text ); - subst.insert( 'w', QString::number( winId )); - subst.insert( 'i', QString::number( eventId )); - QString execLine = KMacroExpander::expandMacrosShellQuote( command, subst ); + subst.insert( 'w', TQString::number( winId )); + subst.insert( 'i', TQString::number( eventId )); + TQString execLine = KMacroExpander::expandMacrosShellQuote( command, subst ); if ( execLine.isEmpty() ) execLine = command; // fallback @@ -108,7 +108,7 @@ void KNotification::notifyByMessagebox() if ( d->text.isEmpty() ) return; - QString action=d->actions[0]; + TQString action=d->actions[0]; WId winId=d->widget ? d->widget->topLevelWidget()->winId() : 0; if( action.isEmpty()) @@ -134,21 +134,21 @@ void KNotification::notifyByMessagebox() else { //we may show the specific action button int result=0; - QGuardedPtr<KNotification> _this=this; //this can be deleted + TQGuardedPtr<KNotification> _this=this; //this can be deleted switch( d->level ) { default: case KNotifyClient::Notification: - result = KMessageBox::questionYesNo(d->widget, d->text, i18n( "Notification" ), action, KStdGuiItem::cancel(), QString::null, false ); + result = KMessageBox::questionYesNo(d->widget, d->text, i18n( "Notification" ), action, KStdGuiItem::cancel(), TQString::null, false ); break; case KNotifyClient::Warning: - result = KMessageBox::warningYesNo( d->widget, d->text, i18n( "Warning" ), action, KStdGuiItem::cancel(), QString::null, false ); + result = KMessageBox::warningYesNo( d->widget, d->text, i18n( "Warning" ), action, KStdGuiItem::cancel(), TQString::null, false ); break; case KNotifyClient::Error: - result = KMessageBox::warningYesNo( d->widget, d->text, i18n( "Error" ), action, KStdGuiItem::cancel(), QString::null, false ); + result = KMessageBox::warningYesNo( d->widget, d->text, i18n( "Error" ), action, KStdGuiItem::cancel(), TQString::null, false ); break; case KNotifyClient::Catastrophe: - result = KMessageBox::warningYesNo( d->widget, d->text, i18n( "Fatal" ), action, KStdGuiItem::cancel(), QString::null, false ); + result = KMessageBox::warningYesNo( d->widget, d->text, i18n( "Fatal" ), action, KStdGuiItem::cancel(), TQString::null, false ); break; } if(result==KMessageBox::Yes && _this) @@ -160,30 +160,30 @@ void KNotification::notifyByMessagebox() -void KNotification::notifyByPassivePopup(const QPixmap &pix ) +void KNotification::notifyByPassivePopup(const TQPixmap &pix ) { - QString appName = QString::fromAscii( KNotifyClient::instance()->instanceName() ); + TQString appName = TQString::fromAscii( KNotifyClient::instance()->instanceName() ); KIconLoader iconLoader( appName ); - KConfig eventsFile( QString::fromAscii( KNotifyClient::instance()->instanceName()+"/eventsrc" ), true, false, "data"); + KConfig eventsFile( TQString::fromAscii( KNotifyClient::instance()->instanceName()+"/eventsrc" ), true, false, "data"); KConfigGroup config( &eventsFile, "!Global!" ); - QString iconName = config.readEntry( "IconName", appName ); - QPixmap icon = iconLoader.loadIcon( iconName, KIcon::Small ); - QString title = config.readEntry( "Comment", appName ); + TQString iconName = config.readEntry( "IconName", appName ); + TQPixmap icon = iconLoader.loadIcon( iconName, KIcon::Small ); + TQString title = config.readEntry( "Comment", appName ); //KPassivePopup::message(title, text, icon, senderWinId); WId winId=d->widget ? d->widget->topLevelWidget()->winId() : 0; KPassivePopup *pop = new KPassivePopup( checkWinId(appName, winId) ); - QObject::connect(this, SIGNAL(closed()), pop, SLOT(deleteLater())); + TQObject::connect(this, TQT_SIGNAL(closed()), pop, TQT_SLOT(deleteLater())); - QVBox *vb = pop->standardView( title, pix.isNull() ? d->text: QString::null , icon ); - QVBox *vb2=vb; + TQVBox *vb = pop->standardView( title, pix.isNull() ? d->text: TQString::null , icon ); + TQVBox *vb2=vb; if(!pix.isNull()) { - QHBox *hb = new QHBox(vb); + TQHBox *hb = new TQHBox(vb); hb->setSpacing(KDialog::spacingHint()); - QLabel *pil=new QLabel(hb); + TQLabel *pil=new TQLabel(hb); pil->setPixmap(pix); pil->setScaledContents(true); if(pix.height() > 80 && pix.height() > pix.width() ) @@ -196,27 +196,27 @@ void KNotification::notifyByPassivePopup(const QPixmap &pix ) pil->setMaximumWidth(80); pil->setMaximumHeight(80*pix.height()/pix.width()); } - vb=new QVBox(hb); - QLabel *msg = new QLabel( d->text, vb, "msg_label" ); + vb=new TQVBox(hb); + TQLabel *msg = new TQLabel( d->text, vb, "msg_label" ); msg->setAlignment( AlignLeft ); } if ( !d->actions.isEmpty() ) { - QString linkCode=QString::fromLatin1("<p align=\"right\">"); + TQString linkCode=TQString::fromLatin1("<p align=\"right\">"); int i=0; - for ( QStringList::ConstIterator it = d->actions.begin() ; it != d->actions.end(); ++it ) + for ( TQStringList::ConstIterator it = d->actions.begin() ; it != d->actions.end(); ++it ) { i++; - linkCode+=QString::fromLatin1(" <a href=\"%1\">%2</a> ").arg( QString::number(i) , QStyleSheet::escape(*it) ); + linkCode+=TQString::fromLatin1(" <a href=\"%1\">%2</a> ").arg( TQString::number(i) , TQStyleSheet::escape(*it) ); } - linkCode+=QString::fromLatin1("</p>"); + linkCode+=TQString::fromLatin1("</p>"); KActiveLabel *link = new KActiveLabel(linkCode , vb ); //link->setAlignment( AlignRight ); - QObject::disconnect(link, SIGNAL(linkClicked(const QString &)), link, SLOT(openLink(const QString &))); - QObject::connect(link, SIGNAL(linkClicked(const QString &)), this, SLOT(slotPopupLinkClicked(const QString &))); - QObject::connect(link, SIGNAL(linkClicked(const QString &)), pop, SLOT(hide())); + TQObject::disconnect(link, TQT_SIGNAL(linkClicked(const TQString &)), link, TQT_SLOT(openLink(const TQString &))); + TQObject::connect(link, TQT_SIGNAL(linkClicked(const TQString &)), this, TQT_SLOT(slotPopupLinkClicked(const TQString &))); + TQObject::connect(link, TQT_SIGNAL(linkClicked(const TQString &)), pop, TQT_SLOT(hide())); } pop->setAutoDelete( true ); @@ -227,7 +227,7 @@ void KNotification::notifyByPassivePopup(const QPixmap &pix ) } -void KNotification::slotPopupLinkClicked(const QString &adr) +void KNotification::slotPopupLinkClicked(const TQString &adr) { m_linkClicked = true; unsigned int action=adr.toUInt(); @@ -236,7 +236,7 @@ void KNotification::slotPopupLinkClicked(const QString &adr) activate(action); - // since we've hidden the message (KNotification::notifyByPassivePopup(const QPixmap &pix )) + // since we've hidden the message (KNotification::notifyByPassivePopup(const TQPixmap &pix )) // we must now schedule overselves for deletion close(); } @@ -274,7 +274,7 @@ void KNotification::raiseWidget() } -void KNotification::raiseWidget(QWidget *w) +void KNotification::raiseWidget(TQWidget *w) { //TODO this funciton is far from finished. if(w->isTopLevel()) @@ -284,10 +284,10 @@ void KNotification::raiseWidget(QWidget *w) } else { - QWidget *pw=w->parentWidget(); + TQWidget *pw=w->parentWidget(); raiseWidget(pw); - if( QTabWidget *tab_widget=dynamic_cast<QTabWidget*>(pw)) + if( TQTabWidget *tab_widget=dynamic_cast<TQTabWidget*>(pw)) { tab_widget->showPage(w); } @@ -298,9 +298,9 @@ void KNotification::raiseWidget(QWidget *w) -KNotification *KNotification::event( const QString& message , const QString& text, - const QPixmap& pixmap, QWidget *widget, - const QStringList &actions, unsigned int flags) +KNotification *KNotification::event( const TQString& message , const TQString& text, + const TQPixmap& pixmap, TQWidget *widget, + const TQStringList &actions, unsigned int flags) { /* NOTE: this function still use the KNotifyClient, * in the future (KDE4) all the function of the knotifyclient will be moved there. @@ -308,15 +308,15 @@ KNotification *KNotification::event( const QString& message , const QString& tex */ int level=KNotifyClient::Default; - QString sound; - QString file; - QString commandline; + TQString sound; + TQString file; + TQString commandline; // get config file - KConfig eventsFile( QString::fromAscii( KNotifyClient::instance()->instanceName()+"/eventsrc" ), true, false, "data"); + KConfig eventsFile( TQString::fromAscii( KNotifyClient::instance()->instanceName()+"/eventsrc" ), true, false, "data"); eventsFile.setGroup(message); - KConfig configFile( QString::fromAscii( KNotifyClient::instance()->instanceName()+".eventsrc" ), true, false); + KConfig configFile( TQString::fromAscii( KNotifyClient::instance()->instanceName()+".eventsrc" ), true, false); configFile.setGroup(message); int present=KNotifyClient::getPresentation(message); @@ -327,7 +327,7 @@ KNotification *KNotification::event( const QString& message , const QString& tex // get sound file name if( present & KNotifyClient::Sound ) { - QString theSound = configFile.readPathEntry( "soundfile" ); + TQString theSound = configFile.readPathEntry( "soundfile" ); if ( theSound.isEmpty() ) theSound = eventsFile.readPathEntry( "default_sound" ); if ( !theSound.isEmpty() ) @@ -336,7 +336,7 @@ KNotification *KNotification::event( const QString& message , const QString& tex // get log file name if( present & KNotifyClient::Logfile ) { - QString theFile = configFile.readPathEntry( "logfile" ); + TQString theFile = configFile.readPathEntry( "logfile" ); if ( theFile.isEmpty() ) theFile = eventsFile.readPathEntry( "default_logfile" ); if ( !theFile.isEmpty() ) @@ -357,9 +357,9 @@ KNotification *KNotification::event( const QString& message , const QString& tex return userEvent( text, pixmap, widget, actions, present , level, sound, file, commandline, flags ); } -KNotification *KNotification::userEvent( const QString& text, const QPixmap& pixmap, QWidget *widget, - QStringList actions,int present, int level, const QString &sound, const QString &file, - const QString &commandline, unsigned int flags) +KNotification *KNotification::userEvent( const TQString& text, const TQPixmap& pixmap, TQWidget *widget, + TQStringList actions,int present, int level, const TQString &sound, const TQString &file, + const TQString &commandline, unsigned int flags) { /* NOTE: this function still use the KNotifyClient, @@ -391,17 +391,17 @@ KNotification *KNotification::userEvent( const QString& text, const QPixmap& pix } if ( present & KNotifyClient::Messagebox ) { - QTimer::singleShot(0,notify,SLOT(notifyByMessagebox())); + TQTimer::singleShot(0,notify,TQT_SLOT(notifyByMessagebox())); } else //not a message box (because closing the event when a message box is there is suicide) if(flags & CloseOnTimeout) { - QTimer::singleShot(6*1000, notify, SLOT(close())); + TQTimer::singleShot(6*1000, notify, TQT_SLOT(close())); } if ( present & KNotifyClient::Execute ) { - QString appname = QString::fromAscii( KNotifyClient::instance()->instanceName() ); - notify->notifyByExecute(commandline, QString::null,appname,text, winId, 0 ); + TQString appname = TQString::fromAscii( KNotifyClient::instance()->instanceName() ); + notify->notifyByExecute(commandline, TQString::null,appname,text, winId, 0 ); } return notify; @@ -422,10 +422,10 @@ KNotification *KNotification::userEvent( const QString& text, const QPixmap& pix #include "kopetenotifyevent.h" #include "kopetemetacontact.h" #include "kopeteuiglobal.h" -#include <qimage.h> +#include <tqimage.h> -static KNotification *performCustomNotifications( QWidget *widget, Kopete::MetaContact * mc, const QString &message, bool& suppress) +static KNotification *performCustomNotifications( TQWidget *widget, Kopete::MetaContact * mc, const TQString &message, bool& suppress) { KNotification *n=0L; //kdDebug( 14010 ) << k_funcinfo << endl; @@ -445,8 +445,8 @@ static KNotification *performCustomNotifications( QWidget *widget, Kopete::MetaC bool checkingMetaContact = true; Kopete::NotifyDataObject * dataObj = mc; do { - QString sound; - QString text; + TQString sound; + TQString text; if ( dataObj ) { @@ -479,7 +479,7 @@ static KNotification *performCustomNotifications( QWidget *widget, Kopete::MetaC evt->firePresentation( Kopete::EventPresentation::Chat ); } // fire the event - n=KNotification::userEvent( text, mc->photo(), widget, QStringList() , present, 0, sound, QString::null, QString::null , KNotification::CloseOnTimeout); + n=KNotification::userEvent( text, mc->photo(), widget, TQStringList() , present, 0, sound, TQString::null, TQString::null , KNotification::CloseOnTimeout); } } @@ -502,9 +502,9 @@ static KNotification *performCustomNotifications( QWidget *widget, Kopete::MetaC -KNotification *KNotification::event( Kopete::MetaContact *mc, const QString& message , - const QString& text, const QPixmap& pixmap, QWidget *widget, - const QStringList &actions, unsigned int flags) +KNotification *KNotification::event( Kopete::MetaContact *mc, const TQString& message , + const TQString& text, const TQPixmap& pixmap, TQWidget *widget, + const TQStringList &actions, unsigned int flags) { if (message.isEmpty()) return 0; |