[rkward-cvs] rkward/rkward/windows rkcommandeditorwindow.cpp,1.25,1.26 rkcommandeditorwindow.h,1.18,1.19

Thomas Friedrichsmeier tfry at users.sourceforge.net
Wed Nov 9 22:53:28 UTC 2005


Update of /cvsroot/rkward/rkward/rkward/windows
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4324/rkward/windows

Modified Files:
	rkcommandeditorwindow.cpp rkcommandeditorwindow.h 
Log Message:
keep tab caption for command editor windows up to date

Index: rkcommandeditorwindow.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** rkcommandeditorwindow.cpp	21 Oct 2005 15:23:36 -0000	1.25
--- rkcommandeditorwindow.cpp	9 Nov 2005 22:53:26 -0000	1.26
***************
*** 44,47 ****
--- 44,48 ----
  #include <kaccel.h>
  #include <klibloader.h>
+ #include <kiconloader.h>
  
  #include "../rkeditormanager.h"
***************
*** 73,77 ****
  	pLayout->addWidget(m_view);
  
! 	m_view->setName("Kate Part View");
  	if (use_r_highlighting) setRHighlighting ();
  }
--- 74,81 ----
  	pLayout->addWidget(m_view);
  
! 	setIcon (SmallIcon ("source"));
! 
! 	connect (m_doc, SIGNAL (fileNameChanged ()), this, SLOT (updateCaption ()));
! 	connect (m_doc, SIGNAL (modifiedChanged ()), this, SLOT (updateCaption ()));		// of course most of the time this causes a redundant call to updateCaption. Not if a modification is undone, however.
  	if (use_r_highlighting) setRHighlighting ();
  }
***************
*** 113,117 ****
  }
  
- 
  QString RKCommandEditorWindow::getSelection () {
  	RK_TRACE (COMMANDEDITOR);
--- 117,120 ----
***************
*** 125,138 ****
  
  QString RKCommandEditorWindow::getText () {
  	return editInterface (m_doc)->text ();
  }
  
- 
  bool RKCommandEditorWindow::openURL (const KURL &url, bool use_r_highlighting, bool read_only){
  	if (m_doc->openURL (url)){
  		if (use_r_highlighting) setRHighlighting ();
  		m_doc->setReadWrite (!read_only);
  
! 		updateTabCaption (url);
  
  		return true;
--- 128,142 ----
  
  QString RKCommandEditorWindow::getText () {
+ 	RK_TRACE (COMMANDEDITOR);
  	return editInterface (m_doc)->text ();
  }
  
  bool RKCommandEditorWindow::openURL (const KURL &url, bool use_r_highlighting, bool read_only){
+ 	RK_TRACE (COMMANDEDITOR);
  	if (m_doc->openURL (url)){
  		if (use_r_highlighting) setRHighlighting ();
  		m_doc->setReadWrite (!read_only);
  
! 		updateCaption ();
  
  		return true;
***************
*** 142,164 ****
  
  bool RKCommandEditorWindow::isModified() {
      return m_doc->isModified();
  }
  
- 
  void RKCommandEditorWindow::insertText (const QString &text) {
  	m_doc->insertText (m_view->cursorLine  (), m_view->cursorColumn (), text);
  	setFocus();
  }
  
! void RKCommandEditorWindow::updateTabCaption (const KURL &url) {
! 	QString fname = url.fileName ();
! 	if (!fname.isEmpty ()) {
! 		setTabCaption(fname);
! 	} else {
! 		setTabCaption(url.prettyURL());
! 	}
  }
  
  void RKCommandEditorWindow::showHelp () {
  	uint para=0; uint p=0;
  	m_view->cursorPosition (&para, &p);
--- 146,171 ----
  
  bool RKCommandEditorWindow::isModified() {
+ 	RK_TRACE (COMMANDEDITOR);
      return m_doc->isModified();
  }
  
  void RKCommandEditorWindow::insertText (const QString &text) {
+ 	RK_TRACE (COMMANDEDITOR);
  	m_doc->insertText (m_view->cursorLine  (), m_view->cursorColumn (), text);
  	setFocus();
  }
  
! void RKCommandEditorWindow::updateCaption () {
! 	RK_TRACE (COMMANDEDITOR);
! 	QString name = m_doc->url ().fileName ();
! 	if (name.isEmpty ()) name = m_doc->url ().prettyURL ();
! 	if (name.isEmpty ()) name = i18n ("Unnamed");
! 	if (isModified ()) name.append (i18n (" [modified]"));
! 
! 	setMDICaption (name);
  }
  
  void RKCommandEditorWindow::showHelp () {
+ 	RK_TRACE (COMMANDEDITOR);
  	uint para=0; uint p=0;
  	m_view->cursorPosition (&para, &p);

Index: rkcommandeditorwindow.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/windows/rkcommandeditorwindow.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** rkcommandeditorwindow.h	21 Oct 2005 15:23:36 -0000	1.18
--- rkcommandeditorwindow.h	9 Nov 2005 22:53:26 -0000	1.19
***************
*** 64,67 ****
--- 64,70 ----
  /** Show help about the current word. */
  	void showHelp ();
+ public slots:
+ /** update Tab caption according to the current url. Display the filename-component of the URL, or - if not available - a more elaborate description of the url. Also appends a "[modified]" if approriate */
+ 	void updateCaption ();
  protected:
  /** reimplemented from KMdiChildView: give the editor window a chance to object to being closed (if unsaved) */
***************
*** 73,79 ****
  /** set syntax highlighting-mode to R syntax */
  	void setRHighlighting ();
- 
- /** update Tab caption according to the given url. Display the filename-component of the URL, or - if not available - a more elaborate description of the url */
- 	void updateTabCaption(const KURL &url);
  };
  
--- 76,79 ----





More information about the rkward-tracker mailing list