[rkward-cvs] rkward/rkward/windows rkhtmlwindowpart.cpp,NONE,1.1 rkhtmlwindowpart.h,NONE,1.1 rkhtmlwindowpart.rc,NONE,1.1 Makefile.am,1.4,1.5 rkcommandeditorwindow.cpp,1.20,1.21 rkcommandeditorwindowpart.cpp,1.1,1.2 rkcommandeditorwindowpart.h,1.1,1.2 rkcommandeditorwindowpart.rc,1.1,1.2 rkhelpwindow.cpp,1.11,1.12 rkhelpwindow.h,1.9,1.10
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Thu Sep 15 21:03:30 UTC 2005
- Previous message: [rkward-cvs] rkward/rkward rkward.cpp,1.93,1.94 rkward.h,1.42,1.43 rkwardui.rc,1.22,1.23
- Next message: [rkward-cvs] rkward/rkward rkeditormanager.cpp,1.7,1.8 rkeditormanager.h,1.6,1.7 rkoutputwindow.cpp,1.6,1.7 rkoutputwindow.h,1.5,1.6 rkward.cpp,1.94,1.95 rkward.h,1.43,1.44 rkwardui.rc,1.23,1.24
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/rkward/rkward/rkward/windows
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14471/windows
Modified Files:
Makefile.am rkcommandeditorwindow.cpp
rkcommandeditorwindowpart.cpp rkcommandeditorwindowpart.h
rkcommandeditorwindowpart.rc rkhelpwindow.cpp rkhelpwindow.h
Added Files:
rkhtmlwindowpart.cpp rkhtmlwindowpart.h rkhtmlwindowpart.rc
Log Message:
Added a KPart wrapper for RKHelpWindow. Next we can add some generic functionality such as Window->Close(All), Window->Detach, etc.
--- NEW FILE: rkhtmlwindowpart.rc ---
<!DOCTYPE kpartgui>
<kpartgui name="rkward" version="0.3.3">
<MenuBar>
<Menu name="output"><text>&Output</text>
<Separator/>
<Action name="output_refresh"/>
<Separator/>
<Action name="output_flush"/>
</Menu>
</kpartgui>
Index: rkhelpwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkhelpwindow.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rkhelpwindow.h 14 Sep 2005 12:06:02 -0000 1.9
--- rkhelpwindow.h 15 Sep 2005 21:03:27 -0000 1.10
***************
*** 30,52 ****
This class wraps a khtml part.
@author Pierre Ecochard
*/
! class RKHelpWindow : public KMdiChildView
! {
Q_OBJECT
public:
! RKHelpWindow (QWidget *parent = 0, const char *name = 0, bool output=false);
! ~RKHelpWindow();
! bool openURL(const KURL &url);
! void refresh();
! void scrollToBottom();
public slots:
! void slotOpenURLRequest(const KURL &url, const KParts::URLArgs & );
private:
KHTMLPart * khtmlpart;
- /** Are we showing the output? (Rather than some other, non-special HTML-file */
- bool window_is_output;
KURL currentURL;
private slots:
--- 30,53 ----
This class wraps a khtml part.
+ TODO: rename this to RKHTMLWindow, as it really is more generic
+
@author Pierre Ecochard
*/
! class RKHelpWindow : public KMdiChildView {
Q_OBJECT
public:
! RKHelpWindow (QWidget *parent = 0);
! ~RKHelpWindow ();
! bool openURL (const KURL &url, bool update_caption=true);
! void refresh ();
! void scrollToBottom ();
! void showOutputEmptyMessage ();
public slots:
! void slotOpenURLRequest (const KURL &url, const KParts::URLArgs &);
! friend class RKHTMLWindowPart;
private:
KHTMLPart * khtmlpart;
KURL currentURL;
private slots:
Index: rkcommandeditorwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** rkcommandeditorwindow.cpp 15 Sep 2005 11:50:03 -0000 1.20
--- rkcommandeditorwindow.cpp 15 Sep 2005 21:03:27 -0000 1.21
***************
*** 249,253 ****
url.setPath(command->getStringVector ()[0]);
if (QFile::exists( url.path() )) {
! RKGlobals::rkApp()->openHTML(url);
return;
}
--- 249,253 ----
url.setPath(command->getStringVector ()[0]);
if (QFile::exists( url.path() )) {
! RKGlobals::rkApp ()->openHTML (url);
return;
}
Index: rkcommandeditorwindowpart.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindowpart.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkcommandeditorwindowpart.h 15 Sep 2005 11:50:03 -0000 1.1
--- rkcommandeditorwindowpart.h 15 Sep 2005 21:03:27 -0000 1.2
***************
*** 37,43 ****
public slots:
! void slotRunSelection();
! void slotRunLine();
! void slotRunAll();
private:
RKCommandEditorWindow *command_editor;
--- 37,44 ----
public slots:
! void slotRunSelection ();
! void slotRunLine ();
! void slotRunAll ();
! void slotFunctionReference ();
private:
RKCommandEditorWindow *command_editor;
***************
*** 48,51 ****
--- 49,54 ----
KAction* runSelection;
KAction* runLine;
+
+ KAction* helpFunction;
protected:
bool openFile () { return false; };
Index: Makefile.am
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile.am 15 Sep 2005 11:50:03 -0000 1.4
--- Makefile.am 15 Sep 2005 21:03:27 -0000 1.5
***************
*** 3,9 ****
noinst_LIBRARIES = libwindows.a
noinst_HEADERS = rkcommandeditorwindow.h rkhelpwindow.h \
! rkcommandeditorwindowpart.h
libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkhelpwindow.cpp \
! rkcommandeditorwindowpart.cpp
rcdir = $(kde_datadir)/rkward
! rc_DATA = rkcommandeditorwindowpart.rc
\ No newline at end of file
--- 3,9 ----
noinst_LIBRARIES = libwindows.a
noinst_HEADERS = rkcommandeditorwindow.h rkhelpwindow.h \
! rkcommandeditorwindowpart.h rkhtmlwindowpart.h
libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkhelpwindow.cpp \
! rkcommandeditorwindowpart.cpp rkhtmlwindowpart.cpp
rcdir = $(kde_datadir)/rkward
! rc_DATA = rkcommandeditorwindowpart.rc rkhtmlwindowpart.rc
--- NEW FILE: rkhtmlwindowpart.cpp ---
/***************************************************************************
rkhtmlwindowpart - description
-------------------
begin : Thu Sep 15 2005
copyright : (C) 2005 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* 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 "rkhtmlwindowpart.h"
#include <kmdichildview.h>
#include <kmessagebox.h>
#include <kiconloader.h>
#include <klocale.h>
#include <khtml_part.h>
#include <qfile.h>
#include "rkhelpwindow.h"
#include "../settings/rksettingsmodulelogfiles.h"
#include "../rkward.h"
#include "../rkglobals.h"
#include "../debug.h"
//static
RKHTMLWindowPart* RKHTMLWindowPart::current_output = 0;
RKHTMLWindowPart::RKHTMLWindowPart (bool is_output) : KParts::Part (RKGlobals::rkApp ()) {
RK_TRACE (APP);
KInstance* instance = new KInstance ("rkward");
setInstance (instance);
setXMLFile ("rkhtmlwindowpart.rc");
widget = new RKHelpWindow (RKGlobals::rkApp ());
// TODO: this is ugly as the night. Eventually, we'll have to split this class into an RKHelpWindowPart, and an RKOutputWindowPart
if (is_output) {
widget->khtmlpart->insertChildClient (this);
}
if (is_output) {
getWidget ()->setIcon (SmallIcon ("text_block"));
getWidget ()->setMDICaption (i18n ("Output"));
RKGlobals::rkApp ()->addWindow (getWidget ());
} else {
getWidget ()->setIcon (SmallIcon ("help"));
RKGlobals::rkApp ()->addWindow (getWidget ());
}
outputFlush = new KAction (i18n ("&Flush"), 0, 0, this, SLOT (flushOutput ()), actionCollection (), "output_flush");
outputRefresh = new KAction (i18n ("&Refresh"), 0, 0, this, SLOT (refreshOutput ()), actionCollection (), "output_refresh");
RKGlobals::rkApp ()->m_manager->addPart (widget->khtmlpart);
}
RKHTMLWindowPart::~RKHTMLWindowPart () {
RK_TRACE (APP);
if (this == current_output) {
current_output = 0;
}
}
// this could really be inlined. By putting it here, however, we save the #include "rkhelpwindow.h" in the header.
KMdiChildView* RKHTMLWindowPart::getWidget () {
RK_TRACE (APP);
return widget;
}
//static
void RKHTMLWindowPart::openHTML (const KURL &url, bool is_output) {
RK_TRACE (APP);
RKHTMLWindowPart* part;
if (!is_output) {
part = new RKHTMLWindowPart (is_output);
part->widget->openURL (url);
} else {
part = getCurrentOutput ();
if (!part->widget->openURL (url, false)) {
part->widget->showOutputEmptyMessage ();
}
}
}
//static
void RKHTMLWindowPart::refreshOutput (bool show, bool raise) {
RK_TRACE (APP);
if (current_output) {
if (raise) {
current_output->widget->raise ();
current_output->widget->refresh ();
}
} else {
if (show) {
// getCurrentOutput creates an output window
getCurrentOutput ();
}
}
}
//static
RKHTMLWindowPart* RKHTMLWindowPart::getCurrentOutput () {
RK_TRACE (APP);
if (!current_output) {
current_output = new RKHTMLWindowPart (true);
KURL url (RKSettingsModuleLogfiles::filesPath () + "/rk_out.html");
current_output->openHTML (url, true);
}
return current_output;
}
void RKHTMLWindowPart::flushOutput () {
RK_TRACE (APP);
int res = KMessageBox::questionYesNo (getCurrentOutput ()->getWidget (), i18n ("Do you really want to flush the ouput? It won't be possible to restore it."), i18n ("Flush output?"));
if (res==KMessageBox::Yes) {
QFile out_file (RKSettingsModuleLogfiles::filesPath () + "/rk_out.html");
out_file.remove ();
refreshOutput (false, false);
}
}
void RKHTMLWindowPart::refreshOutput () {
RK_TRACE (APP);
refreshOutput (true, true);
}
#include "rkhtmlwindowpart.moc"
Index: rkhelpwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkhelpwindow.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rkhelpwindow.cpp 14 Sep 2005 12:06:02 -0000 1.11
--- rkhelpwindow.cpp 15 Sep 2005 21:03:27 -0000 1.12
***************
*** 34,93 ****
! RKHelpWindow::RKHelpWindow(QWidget *parent, const char *name, bool output)
! : KMdiChildView(parent, name)
! {
scroll_position=0;
! khtmlpart = new KHTMLPart(this,0,0,0,KHTMLPart::BrowserViewGUI);
! khtmlpart->setSelectable(true);
! window_is_output=output;
!
! (RKGlobals::rkApp()->m_manager)->addPart(khtmlpart,false);
! khtmlpart->widget()->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
! QHBoxLayout *pLayout = new QHBoxLayout( this, 0, -1, "layout");
! pLayout->addWidget(khtmlpart->widget());
// We have to connect this in order to allow browsing.
! connect( khtmlpart->browserExtension(), SIGNAL( openURLRequest( const KURL &, const KParts::URLArgs & ) ), this, SLOT( slotOpenURLRequest(const KURL &, const KParts::URLArgs & ) ) );
! connect(khtmlpart,SIGNAL(completed()),this,SLOT(loadDone()));
}
-
RKHelpWindow::~RKHelpWindow()
{
}
! bool RKHelpWindow::openURL(const KURL &url)
! {
! if (QFile::exists( url.path() )) {
khtmlpart->openURL(url);
! if (window_is_output) {
! setTabCaption(i18n("Output"));
! setCaption(i18n("Output"));
! }
! else {
setTabCaption(url.fileName());
setCaption(url.fileName());
-
}
currentURL=url;
scroll_position=0;
! return(true);
}
! else{
khtmlpart->begin();
! khtmlpart->write(i18n("<HTML><BODY><H1>RKWard output</H1>"
! "<P>The output is empty.</P>"
! "</BODY></HTML>"));
khtmlpart->end();
- return (false);
- }
}
-
/*!
\fn RKHelpWindow::slotOpenURLRequest(const KURL &, const KParts::URLArgs & )
--- 34,79 ----
! RKHelpWindow::RKHelpWindow (QWidget *parent) : KMdiChildView (parent) {
scroll_position=0;
! khtmlpart = new KHTMLPart (this,0,0,0,KHTMLPart::BrowserViewGUI);
! khtmlpart->setSelectable (true);
! khtmlpart->widget ()->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
! QHBoxLayout *pLayout = new QHBoxLayout (this, 0, -1, "layout");
! pLayout->addWidget (khtmlpart->widget());
// We have to connect this in order to allow browsing.
! connect (khtmlpart->browserExtension (), SIGNAL(openURLRequest (const KURL &, const KParts::URLArgs &)), this, SLOT (slotOpenURLRequest (const KURL &, const KParts::URLArgs &)));
! connect (khtmlpart, SIGNAL (completed ()), this, SLOT (loadDone ()));
}
RKHelpWindow::~RKHelpWindow()
{
}
! bool RKHelpWindow::openURL(const KURL &url, bool update_caption) {
! if (QFile::exists (url.path ())) {
khtmlpart->openURL(url);
! if (update_caption) {
setTabCaption(url.fileName());
setCaption(url.fileName());
}
currentURL=url;
scroll_position=0;
! return (true);
! } else{
! return (false);
}
! }
+ void RKHelpWindow::showOutputEmptyMessage () {
khtmlpart->begin();
! khtmlpart->write (i18n ("<HTML><BODY><H1>RKWard output</H1>\n<P>The output is empty.</P>\n</BODY></HTML>"));
khtmlpart->end();
}
/*!
\fn RKHelpWindow::slotOpenURLRequest(const KURL &, const KParts::URLArgs & )
***************
*** 117,123 ****
This slot is called when the new page has finished loading.
*/
! void RKHelpWindow::loadDone()
! {
! khtmlpart->view()->setContentsPos ( 0, scroll_position );
}
--- 103,108 ----
This slot is called when the new page has finished loading.
*/
! void RKHelpWindow::loadDone () {
! khtmlpart->view()->setContentsPos (0, scroll_position);
}
***************
*** 127,133 ****
Scrolls to the bottom of the page.
*/
! void RKHelpWindow::scrollToBottom()
! {
! khtmlpart->view()->setContentsPos ( 0, khtmlpart->view()->contentsHeight() );
}
--- 112,117 ----
Scrolls to the bottom of the page.
*/
! void RKHelpWindow::scrollToBottom () {
! khtmlpart->view()->setContentsPos (0, khtmlpart->view ()->contentsHeight ());
}
Index: rkcommandeditorwindowpart.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindowpart.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkcommandeditorwindowpart.cpp 15 Sep 2005 11:50:03 -0000 1.1
--- rkcommandeditorwindowpart.cpp 15 Sep 2005 21:03:27 -0000 1.2
***************
*** 55,58 ****
--- 55,60 ----
runLine = new KAction (i18n ("Run current line"), KShortcut ("Ctrl+L"), this, SLOT (slotRunLine ()), actionCollection (), "run_line");
runLine->setIcon("player_play");
+
+ helpFunction = new KAction (i18n ("&Function reference"), KShortcut ("F2"), this, SLOT (slotFunctionReference ()), actionCollection (), "function_reference");
}
***************
*** 85,88 ****
--- 87,96 ----
}
+ void RKCommandEditorWindowPart::slotFunctionReference () {
+ RK_TRACE (COMMANDEDITOR);
+
+ command_editor->showHelp ();
+ }
+
#include "rkcommandeditorwindowpart.moc"
--- NEW FILE: rkhtmlwindowpart.h ---
/***************************************************************************
rkhtmlwindowpart - description
-------------------
begin : Thu Sep 15 2005
copyright : (C) 2005 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef RKHTMLWINDOWPART_H
#define RKHTMLWINDOWPART_H
#include <kparts/part.h>
class KMdiChildView;
class RKHelpWindow;
class KAction;
/**
@author Thomas Friedrichsmeier
*/
class RKHTMLWindowPart: public KParts::Part {
Q_OBJECT
public:
RKHTMLWindowPart (bool is_output=false);
~RKHTMLWindowPart ();
KMdiChildView* getWidget ();
static void openHTML (const KURL &url, bool is_output=false);
static void refreshOutput (bool show, bool raise);
static RKHTMLWindowPart* getCurrentOutput ();
public slots:
void flushOutput ();
void refreshOutput ();
private:
KAction* outputFlush;
KAction* outputRefresh;
RKHelpWindow* widget;
static RKHTMLWindowPart* current_output;
};
#endif
Index: rkcommandeditorwindowpart.rc
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindowpart.rc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rkcommandeditorwindowpart.rc 15 Sep 2005 19:04:40 -0000 1.1
--- rkcommandeditorwindowpart.rc 15 Sep 2005 21:03:27 -0000 1.2
***************
*** 9,12 ****
--- 9,15 ----
</Menu>
</MenuBar>
+ <Menu name="help"><text>&Help</text>
+ <Action name="function_reference"></Action>
+ </Menu>
<ToolBar fullWidth="true" name="runToolBar">
<Action name="run_line"/>
- Previous message: [rkward-cvs] rkward/rkward rkward.cpp,1.93,1.94 rkward.h,1.42,1.43 rkwardui.rc,1.22,1.23
- Next message: [rkward-cvs] rkward/rkward rkeditormanager.cpp,1.7,1.8 rkeditormanager.h,1.6,1.7 rkoutputwindow.cpp,1.6,1.7 rkoutputwindow.h,1.5,1.6 rkward.cpp,1.94,1.95 rkward.h,1.43,1.44 rkwardui.rc,1.23,1.24
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the rkward-tracker
mailing list