Logo Search packages:      
Sourcecode: kmess version File versions


                          networkwindow.cpp  -  description
    begin                : Wed Jan 28 2005
    copyright            : (C) 2005 by Diederik van der Boor
    email                : "vdboor" --at-- "codingdomain.com"

 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *


#include "../kmessdebug.h"

#include <kdialogbase.h>
#include <ktextbrowser.h>

#include <qptrdict.h>  // a hashmap with key and value pointers.

class QTabWidget;

 * Network log window, to filter MSN protocol information in a readable way.
 * Based on the original work of Michael Jarrett, but totally revised.
 * @author Diederik van der Boor
00038 class NetworkWindow : public KDialogBase
    // Constructor
                           NetworkWindow(QWidget *parent = 0, const char *name = 0);

    // List of connection types
    enum ConnectionType
      TYPE_UNKNOWN = 0,
      TYPE_NS      = 1,
      TYPE_SB      = 2,
      TYPE_FTP     = 3,
      TYPE_FTP_RAW = 4,
      TYPE_DC      = 5,
      TYPE_HTTP    = 6

    // Add a log message to the last log entry
    void                   addLogMessage(QObject *connection, const QString &message);
    // Add an incoming message to the log.
    void                   addIncomingMessage(QObject *connection, const QByteArray &message);
    // Add an outgoing message to the log.
    void                   addOutgoingMessage(QObject *connection, const QByteArray &message);
    // Inform the connection was closed
    void                   connectionClosed(QObject *connection);
    // Return the primary instance of the network window.
    static NetworkWindow*  instance();
    // Set the title of the connection in the display
    void                   setConnectionTitle(QObject *connection, const QString &title);

    struct ConnectionEntry;
    // Return a log description for a standard command.
    QString                describeCommand(const QString &command);
    // Return a log description for the direct connection preamble
    QString                describeDirectConnectionPreamble(const QByteArray &message);
    // Return a log description for the mime message
    QString                describeMimeMessage(const QString &mimeMessage);
    // Return a log description for the p2p message
    QString                describeP2PMessage(const QByteArray &message, const int headerStart);
    // Format the description to be displayed
    QString                formatDescription(const QString &description);
    // Format the message to be displayed
    QString                formatMessage(ConnectionEntry *entry, bool incoming, const QByteArray &message);
    // Format a msnp2p message to be displayed.
    QString                formatP2PMessage(bool incoming, const QByteArray &message, const int headerStart);
    // Format a utf-8 string to be displayed
    QString                formatRawData(bool incoming, const QByteArray &message,
                                         const int start, const int length, const int bytesPerRow = 32);
    // Format a utf-8 string to be displayed
    QString                formatString(const QString &message);
    // Return the current time.
    QString                getTime() const;
    // Find the tab for the connection, or create a new one.
    ConnectionEntry *      getConnectionEntry(QObject *connection);

    // The connection types
    struct ConnectionEntry
      KTextBrowser  *logView;
      ConnectionType type;

    // The html view for each connection
    QPtrDict<ConnectionEntry> connectionViews_;  // void* keys, KTextBrowser* values
    // The tab bar with all connections
    QTabWidget            *connectionTabs_;
    // Whether the network window is enabled or not.
    bool                   enabled_;
    // The instance of the network window
    static NetworkWindow  *instance_;



Generated by  Doxygen 1.6.0   Back to index