[Kstars-devel] branches/KDE/3.5/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Thu Sep 29 05:08:42 CEST 2005
SVN commit 465078 by harris:
Fixing bug #112838 (objects with sq. brackets in name can't display log
text), using patch from Carl Knight. Thanks Carl!
Also, deleting all text from the user log will now cause the object's
entry to be removed from userlog.txt, so that the log edit box will
display the default message instead of nothing at all.
BUG: 112838
CCMAIL: kstars-devel at kde.org
M +3 -2 kstarsdata.cpp
M +6 -8 skyobject.cpp
--- branches/KDE/3.5/kdeedu/kstars/kstars/kstarsdata.cpp #465077:465078
@@ -1049,9 +1049,10 @@
endIndex = sub.find("[KSLogEnd]");
// Read name after KSLABEL identifer
- name = sub.mid(startIndex + 9, sub.find("]") - (startIndex + 9));
+ uint uiFirstNewline = sub.find("\n", startIndex + 9);
+ name = sub.mid(startIndex + 9, sub.findRev( "]", uiFirstNewline ) - (startIndex + 9) );
// Read data and skip new line
- data = sub.mid(sub.find("]") + 2, endIndex - (sub.find("]") + 2));
+ data = sub.mid( uiFirstNewline + 1, endIndex - (uiFirstNewline + 1));
buffer = buffer.mid(endIndex + 11);
//Find the sky object named 'name'.
--- branches/KDE/3.5/kdeedu/kstars/kstars/skyobject.cpp #465077:465078
@@ -381,9 +381,8 @@
QFile file;
QString logs; //existing logs
- //Do nothing if:
- //+ new log is the "default" message
- //+ new log is empty
+ //Do nothing if new log is the "default" message
+ //(keep going if new log is empty; we'll want to delete its current entry)
if ( newLog == (i18n("Record here observation logs and/or data on %1.").arg(name())) || newLog.isEmpty() )
return;
@@ -416,12 +415,11 @@
logs.remove(startIndex, endIndex + 11);
}
- //append the new log entry to the end of the logs text
- logs.append( KSLabel + "\n" + newLog + "\n[KSLogEnd]\n" );
+ //append the new log entry to the end of the logs text,
+ //but only if the log is not empty
+ if ( ! newLog.stripWhiteSpace().isEmpty() )
+ logs.append( KSLabel + "\n" + newLog + "\n[KSLogEnd]\n" );
- //DEBUG
- kdDebug() << "filename: " << file.name() << endl;
-
//Open file for writing
//FIXME: change error message to "cannot write to user log file"
if ( !file.open( IO_WriteOnly ) ) {
More information about the Kstars-devel
mailing list