bool tarch::logging::CommandLineLogger::writeInfo(const std::string& className) {
  #ifdef Parallel
  int rank = -1;
  if (tarch::parallel::Node::getInstance().isInitialised()) {
    rank = tarch::parallel::Node::getInstance().getRank();
  }
  #else
  int rank = -1;
  #endif
  return !filterOut("info",className,rank);
}
Ejemplo n.º 2
0
// interface of KParts::HistoryManager
// Usually, we only record the history for non-local URLs (i.e. filterOut()
// returns false). But when using the HistoryProvider interface, we record
// exactly those filtered-out urls.
// Moreover, we  don't get any pending/confirming entries, just one insert()
void KonqHistoryManager::insert(const QString &url)
{
    QUrl u(url);
    if (!filterOut(u) || u.scheme() == QLatin1String("about")) {     // remote URL
        return;
    }
    // Local URL -> add to history
    KonqHistoryEntry entry;
    entry.url = u;
    entry.firstVisited = QDateTime::currentDateTime();
    entry.lastVisited = entry.firstVisited;
    emitAddToHistory(entry);
}
Ejemplo n.º 3
0
FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_type_t type) :
    WiresharkDialog(parent, cf),
    ui(new Ui::FollowStreamDialog),
    follow_type_(type),
    truncated_(false),
    save_as_(false)
{
    ui->setupUi(this);

    setAttribute(Qt::WA_DeleteOnClose, true);
    memset(&follow_info_, 0, sizeof(follow_info_));
    follow_info_.show_type = SHOW_ASCII;
    follow_info_.show_stream = BOTH_HOSTS;

    ui->teStreamContent->installEventFilter(this);

    // XXX Use recent settings instead
    resize(parent.width() * 2 / 3, parent.height());

    QComboBox *cbcs = ui->cbCharset;
    cbcs->blockSignals(true);
    cbcs->addItem(tr("ASCII"), SHOW_ASCII);
    cbcs->addItem(tr("C Arrays"), SHOW_CARRAY);
    cbcs->addItem(tr("EBCDIC"), SHOW_EBCDIC);
    cbcs->addItem(tr("Hex Dump"), SHOW_HEXDUMP);
    cbcs->addItem(tr("UTF-8"), SHOW_UTF8);
    cbcs->addItem(tr("YAML"), SHOW_YAML);
    cbcs->addItem(tr("Raw"), SHOW_RAW);
    cbcs->blockSignals(false);

    b_filter_out_ = ui->buttonBox->addButton(tr("Hide this stream"), QDialogButtonBox::ActionRole);
    connect(b_filter_out_, SIGNAL(clicked()), this, SLOT(filterOut()));

    b_print_ = ui->buttonBox->addButton(tr("Print"), QDialogButtonBox::ActionRole);
    connect(b_print_, SIGNAL(clicked()), this, SLOT(printStream()));

    b_save_ = ui->buttonBox->addButton(tr("Save as" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ActionRole);
    connect(b_save_, SIGNAL(clicked()), this, SLOT(saveAs()));

    ProgressFrame::addToButtonBox(ui->buttonBox, &parent);

    connect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(helpButton()));
    connect(ui->teStreamContent, SIGNAL(mouseMovedToTextCursorPosition(int)),
            this, SLOT(fillHintLabel(int)));
    connect(ui->teStreamContent, SIGNAL(mouseClickedOnTextCursorPosition(int)),
            this, SLOT(goToPacketForTextPos(int)));
    connect(&cap_file_, SIGNAL(captureFileClosing()), this, SLOT(captureFileClosing()));

    fillHintLabel(-1);
}
FollowStreamDialog::FollowStreamDialog(QWidget *parent, follow_type_t type, capture_file *cf) :
    QDialog(parent),
    ui(new Ui::FollowStreamDialog),
    cap_file_(cf),
    follow_type_(type),
    save_as_(false)
{
    ui->setupUi(this);

    setAttribute(Qt::WA_DeleteOnClose, true);
    memset(&follow_info_, 0, sizeof(follow_info_));

    ui->teStreamContent->installEventFilter(this);

    // XXX Use recent settings instead
    if (parent) {
        resize(parent->width() * 2 / 3, parent->height());
    }

    QComboBox *cbcs = ui->cbCharset;
    cbcs->blockSignals(true);
    cbcs->addItem("ASCII", SHOW_ASCII);
    cbcs->addItem("C Arrays", SHOW_CARRAY);
    cbcs->addItem("EBCDIC", SHOW_EBCDIC);
    cbcs->addItem("Hex Dump", SHOW_HEXDUMP);
    cbcs->addItem("UTF-8", SHOW_RAW);
    cbcs->addItem("YAML", SHOW_YAML);
    cbcs->blockSignals(false);

    b_filter_out_ = ui->buttonBox->addButton(tr("Hide this stream"), QDialogButtonBox::ActionRole);
    connect(b_filter_out_, SIGNAL(clicked()), this, SLOT(filterOut()));

    b_print_ = ui->buttonBox->addButton(tr("Print"), QDialogButtonBox::ActionRole);
    connect(b_print_, SIGNAL(clicked()), this, SLOT(printStream()));

    b_save_ = ui->buttonBox->addButton(tr("Save as..."), QDialogButtonBox::ActionRole);
    connect(b_save_, SIGNAL(clicked()), this, SLOT(saveAs()));

    connect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(helpButton()));
    connect(ui->teStreamContent, SIGNAL(mouseMovedToTextCursorPosition(int)),
            this, SLOT(fillHintLabel(int)));
    connect(ui->teStreamContent, SIGNAL(mouseClickedOnTextCursorPosition(int)),
            this, SLOT(goToPacketForTextPos(int)));

    fillHintLabel(-1);
}
Ejemplo n.º 5
0
void KonqHistoryManager::addToHistory(bool pending, const QUrl &_url,
                                      const QString &typedUrl,
                                      const QString &title)
{
    //qDebug() << _url << "Typed URL:" << typedUrl << ", Title:" << title;

    if (filterOut(_url)) {   // we only want remote URLs
        return;
    }

    // http URLs without a path will get redirected immediately to url + '/'
    if (_url.path().isEmpty() && _url.scheme().startsWith(QLatin1String("http"))) {
        return;
    }

    QUrl url(_url);
    bool hasPass = !url.password().isEmpty();
    url.setPassword(QString()); // No password in the history, especially not in the completion!
    url.setHost(url.host().toLower());   // All host parts lower case
    KonqHistoryEntry entry;
    QString u = url.toDisplayString();
    entry.url = url;
    if ((u != typedUrl) && !hasPass) {
        entry.typedUrl = typedUrl;
    }

    // we only keep the title if we are confirming an entry. Otherwise,
    // we might get bogus titles from the previous url (actually it's just
    // konqueror's window caption).
    if (!pending && u != title) {
        entry.title = title;
    }
    entry.firstVisited = QDateTime::currentDateTime();
    entry.lastVisited = entry.firstVisited;

    // always remove from pending if available, otherwise the else branch leaks
    // if the map already contains an entry for this key.
    QMap<QString, KonqHistoryEntry *>::iterator it = m_pending.find(u);
    if (it != m_pending.end()) {
        delete it.value();
        m_pending.erase(it);
    }

    if (!pending) {
        if (it != m_pending.end()) {
            // we make a pending entry official, so we just have to update
            // and not increment the counter. No need to care about
            // firstVisited, as this is not taken into account on update.
            entry.numberOfTimesVisited = 0;
        }
    } else {
        // We add a copy of the current history entry of the url to the
        // pending list, so that we can restore it if the user canceled.
        // If there is no entry for the url yet, we just store the url.
        KonqHistoryList::const_iterator oldEntry = constFindEntry(url);
        m_pending.insert(u, (oldEntry != entries().constEnd()) ?
                         new KonqHistoryEntry(*oldEntry) : 0);
    }

    // notify all konqueror instances about the entry
    emitAddToHistory(entry);
}
FollowStreamDialog::FollowStreamDialog(QWidget &parent, CaptureFile &cf, follow_type_t type) :
    WiresharkDialog(parent, cf),
    ui(new Ui::FollowStreamDialog),
    b_find_(NULL),
    follow_type_(type),
    follower_(NULL),
    show_type_(SHOW_ASCII),
    truncated_(false),
    client_buffer_count_(0),
    server_buffer_count_(0),
    client_packet_count_(0),
    server_packet_count_(0),
    last_packet_(0),
    last_from_server_(0),
    turns_(0),
    save_as_(false),
    use_regex_find_(false),
    terminating_(false)
{
    ui->setupUi(this);
    loadGeometry(parent.width() * 2 / 3, parent.height());

    switch(type)
    {
    case FOLLOW_TCP:
        follower_ = get_follow_by_name("TCP");
        break;
    case FOLLOW_SSL:
        follower_ = get_follow_by_name("SSL");
        break;
    case FOLLOW_UDP:
        follower_ = get_follow_by_name("UDP");
        break;
    case FOLLOW_HTTP:
        follower_ = get_follow_by_name("HTTP");
        break;
    default :
        g_assert_not_reached();
    }

    memset(&follow_info_, 0, sizeof(follow_info_));
    follow_info_.show_stream = BOTH_HOSTS;

    ui->teStreamContent->installEventFilter(this);

    connect(ui->leFind, SIGNAL(useRegexFind(bool)), this, SLOT(useRegexFind(bool)));

    QComboBox *cbcs = ui->cbCharset;
    cbcs->blockSignals(true);
    cbcs->addItem(tr("ASCII"), SHOW_ASCII);
    cbcs->addItem(tr("C Arrays"), SHOW_CARRAY);
    cbcs->addItem(tr("EBCDIC"), SHOW_EBCDIC);
    cbcs->addItem(tr("Hex Dump"), SHOW_HEXDUMP);
    cbcs->addItem(tr("UTF-8"), SHOW_UTF8);
    cbcs->addItem(tr("UTF-16"), SHOW_UTF16);
    cbcs->addItem(tr("YAML"), SHOW_YAML);
    cbcs->addItem(tr("Raw"), SHOW_RAW);
    cbcs->blockSignals(false);

    b_filter_out_ = ui->buttonBox->addButton(tr("Filter Out This Stream"), QDialogButtonBox::ActionRole);
    connect(b_filter_out_, SIGNAL(clicked()), this, SLOT(filterOut()));

    b_print_ = ui->buttonBox->addButton(tr("Print"), QDialogButtonBox::ActionRole);
    connect(b_print_, SIGNAL(clicked()), this, SLOT(printStream()));

    b_save_ = ui->buttonBox->addButton(tr("Save as" UTF8_HORIZONTAL_ELLIPSIS), QDialogButtonBox::ActionRole);
    connect(b_save_, SIGNAL(clicked()), this, SLOT(saveAs()));

    b_back_ = ui->buttonBox->addButton(tr("Back"), QDialogButtonBox::ActionRole);
    connect(b_back_, SIGNAL(clicked()), this, SLOT(backButton()));

    ProgressFrame::addToButtonBox(ui->buttonBox, &parent);

    connect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(helpButton()));
    connect(ui->teStreamContent, SIGNAL(mouseMovedToTextCursorPosition(int)),
            this, SLOT(fillHintLabel(int)));
    connect(ui->teStreamContent, SIGNAL(mouseClickedOnTextCursorPosition(int)),
            this, SLOT(goToPacketForTextPos(int)));
    connect(&cap_file_, SIGNAL(captureEvent(CaptureEvent *)),
            this, SLOT(captureEvent(CaptureEvent *)));

    fillHintLabel(-1);
}