1
/***************************************************************************
2
rkcommandlog - description
5
copyright : (C) 2002, 2004, 2005, 2006, 2007 by Thomas Friedrichsmeier
6
email : tfry@users.sourceforge.net
7
***************************************************************************/
9
/***************************************************************************
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
16
***************************************************************************/
18
#ifndef RKCOMMANDLOG_H
19
#define RKCOMMANDLOG_H
22
#include <qtextedit.h>
23
#include <kmdichildview.h>
25
#include "rkmdiwindow.h"
26
#include "../rbackend/rcommandreceiver.h"
32
class RKCommandEditor;
34
class RKCommandLogView;
35
class RKCommandLogPart;
38
\brief This widget shows all executed commands and their result
39
@author Thomas Friedrichsmeier
42
class RKCommandLog : public RKMDIWindow, public RCommandReceiver {
45
/** Adds input to the log_view-window (i.e. commands issued) */
46
void addInput (RCommand *command);
47
/** Adds output to the log_view-window (i.e. replies received) */
48
void newOutput (RCommand *command, ROutput *output_fragment);
50
static RKCommandLog *getLog () { return rkcommand_log; };
52
RKCommandLogView *getView () { return log_view; };
54
/** Command has finished. If the command has failed, it may be necessary to print some more information */
55
void rCommandDone (RCommand *command);
56
RKCommandLog (QWidget *parent, bool tool_window, const char *name=0);
59
/** configures the log_view-window */
61
/** clears the log_view-window */
65
void addInputNoCheck (RCommand *command);
66
void addOutputNoCheck (RCommand *command, ROutput *output);
67
void checkRaiseWindow (RCommand *command);
68
/** internal helper function, called whenever a line/lines have been added. Check whether log is longer than maximum setting. Scroll to the bottom */
70
/** Id of last command the input (i.e. the command itself) was shown for. Used to keep track of whether a command's input should be shown or not */
71
int command_input_shown;
72
/** On a given command, the log_view should not be raised more than once */
73
int last_raised_command;
75
RKCommandLogView *log_view;
76
friend class RKWardMainWindow;
77
static RKCommandLog *rkcommand_log;
80
/** Simply subclass of QTextEdit to override context menu handling */
81
class RKCommandLogView : public QTextEdit {
84
RKCommandLogView (RKCommandLog *parent);
89
void popupMenuRequest (const QPoint &pos);
91
bool eventFilter (QObject *o, QEvent *e);
94
#include <kparts/part.h>
98
/** Provides a part interface for the RKCommandLog */
99
class RKCommandLogPart : public KParts::Part {
102
explicit RKCommandLogPart (RKCommandLog *for_log);
103
~RKCommandLogPart ();
105
void doPopupMenu (const QPoint &pos);
109
KAction *run_selection;