<commit_before>#include "cancellablenotification.h"

#include <QTimer>
#include <QDebug>
#include <DuiLocale>

CancellableNotification::CancellableNotification(  
        const QString &notifTextPattern,
        const int &appearTime,
        const QString &appearTimeVariable,
        const QHash<QString,QString> &staticVariables)
{    
    //define the textual content of the messagebox
    this->notifTextPattern = notifTextPattern;
    this->appearTime = appearTime;
    this->appearTimeVariable = appearTimeVariable;

    QHash<QString,QString>::const_iterator i;
    for (i = staticVariables.begin(); i != staticVariables.end(); ++i)
        this->notifTextPattern.replace(i.key(),i.value());

    //start the timer
    t = new QTimer();
    connect(t, SIGNAL(timeout()), this, SLOT(updateText()));
    t->setSingleShot(false);

    mb = NULL;

}

CancellableNotification::~CancellableNotification()
{
    delete mb;
    mb = NULL;
    delete t;
    t = NULL;
}

void CancellableNotification::show()
{    
    t->start(1000);
}

void CancellableNotification::updateText()
{
    if(mb != NULL) {
        mb->disappear();
        delete mb;
        mb = NULL;
    }

    if(appearTime > 0) {
        QString number;
        number.setNum(appearTime);
        appearTime--;
        QString notifText = notifTextPattern;
        notifText.replace(appearTimeVariable, number);
        mb = new DuiMessageBox(notifText, DuiMessageBoxModel::Cancel);
        connect(mb, SIGNAL(rejected()), this, SIGNAL(cancelled()));
        mb->appear();
    }
    else
        emit timeout();
}<commit_msg>DuiMessageBox changed. Caused a compilation error.<commit_after>#include "cancellablenotification.h"

#include <QTimer>
#include <QDebug>
#include <DuiLocale>

CancellableNotification::CancellableNotification(  
        const QString &notifTextPattern,
        const int &appearTime,
        const QString &appearTimeVariable,
        const QHash<QString,QString> &staticVariables)
{    
    //define the textual content of the messagebox
    this->notifTextPattern = notifTextPattern;
    this->appearTime = appearTime;
    this->appearTimeVariable = appearTimeVariable;

    QHash<QString,QString>::const_iterator i;
    for (i = staticVariables.begin(); i != staticVariables.end(); ++i)
        this->notifTextPattern.replace(i.key(),i.value());

    //start the timer
    t = new QTimer();
    connect(t, SIGNAL(timeout()), this, SLOT(updateText()));
    t->setSingleShot(false);

    mb = NULL;

}

CancellableNotification::~CancellableNotification()
{
    delete mb;
    mb = NULL;
    delete t;
    t = NULL;
}

void CancellableNotification::show()
{    
    t->start(1000);
}

void CancellableNotification::updateText()
{
    if(mb != NULL) {
        mb->disappear();
        delete mb;
        mb = NULL;
    }

    if(appearTime > 0) {
        QString number;
        number.setNum(appearTime);
        appearTime--;
        QString notifText = notifTextPattern;
        notifText.replace(appearTimeVariable, number);
        mb = new DuiMessageBox(notifText, DuiMessageBox::Cancel);
        connect(mb, SIGNAL(rejected()), this, SIGNAL(cancelled()));
        mb->appear();
    }
    else
        emit timeout();
}
{'fraction_non_alphanumeric': 0.125, 'fraction_numerical': 0.003109452736318408, 'mean_word_length': 3.1138107416879794, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7225853', 'n_tokens_mistral': 1013, 'n_tokens_neox': 994, 'n_words': 205}