[Kstars-devel] branches/kstars/summer/kstars/kstars/comast
Prakash Mohan
prak902000 at gmail.com
Sun Jul 26 16:06:09 CEST 2009
SVN commit 1002594 by prakash:
Replacing all the Overwrite warning dialog calls using a pre-defined warning function from the namespace rather than having to declare the enitre KMessageBox::warning(..) all over everytime.
Thanks Alexey for suggesting this.
CCMAIL: kstars-devel at kde.org
M +7 -0 comast.h
M +6 -7 equipmentwriter.cpp
--- branches/kstars/summer/kstars/kstars/comast/comast.h #1002593:1002594
@@ -18,6 +18,10 @@
#ifndef COMAST_H_
#define COMAST_H_
+
+#include <QString>
+#include <KLocale>
+#include <kmessagebox.h>
namespace Comast {
class Log;
class Observer;
@@ -31,5 +35,8 @@
class Session;
class Target;
class Lens;
+ inline int warningOverwrite( QString message ) {
+ return KMessageBox::warningYesNo( 0, message, i18n("Overwrite"), KGuiItem(i18n("Overwrite")), KGuiItem(i18n("Cancel")) );
+ }
}
#endif
--- branches/kstars/summer/kstars/kstars/comast/equipmentwriter.cpp #1002593:1002594
@@ -21,9 +21,9 @@
#include <QFile>
-#include <kmessagebox.h>
#include <kstandarddirs.h>
+#include "comast/comast.h"
#include "comast/scope.h"
#include "comast/eyepiece.h"
#include "comast/lens.h"
@@ -53,7 +53,7 @@
}
Comast::Scope *s = ks->data()->logObject()->findScopeByName( ui.Id->text() );
if( s ) {
- if( KMessageBox::warningYesNo( 0, i18n("Another Scope already exists with the given Id, Overwrite?"), i18n( "Overwrite" ), KGuiItem( i18n("Overwrite") ), KGuiItem( i18n( "Cancel" ) ) ) == KMessageBox::Yes ) {
+ if( Comast::warningOverwrite( "Another Scope already exists with the given Id, Overwrite?" ) == KMessageBox::Yes ) {
s->setScope( ui.Id->text(), ui.Model->text(), ui.Vendor->text(), ui.Type->text(), ui.FocalLength->value() );
} else
return; //Do nothing
@@ -77,7 +77,7 @@
}
Comast::Eyepiece *e = ks->data()->logObject()->findEyepieceByName( ui.e_Id->text() );
if( e ){
- if( KMessageBox::warningYesNo( 0, i18n("Another Eyepiece already exists with the given Id, Overwrite?"), i18n( "Overwrite" ), KGuiItem( i18n("Overwrite") ), KGuiItem( i18n( "Cancel" ) ) ) == KMessageBox::Yes ) {
+ if( Comast::warningOverwrite( "Another Eyepiece already exists with the given Id, Overwrite?" ) == KMessageBox::Yes ) {
e->setEyepiece( ui.e_Id->text(), ui.e_Model->text(), ui.e_Vendor->text(), ui.Fov->value(), ui.FovUnit->text(), ui.e_focalLength->value() );
} else
return;
@@ -101,7 +101,7 @@
}
Comast::Lens *l = ks->data()->logObject()->findLensByName( ui.l_Id->text() );
if( l ){
- if( KMessageBox::warningYesNo( 0, i18n("Another Lens already exists with the given Id, Overwrite?"), i18n( "Overwrite" ), KGuiItem( i18n("Overwrite") ), KGuiItem( i18n( "Cancel" ) ) ) == KMessageBox::Yes ) {
+ if( Comast::warningOverwrite( "Another Lens already exists with the given Id, Overwrite?" ) == KMessageBox::Yes ) {
l->setLens( ui.l_Id->text(), ui.l_Model->text(), ui.l_Vendor->text(), ui.l_Factor->value() );
} else
return;
@@ -123,9 +123,8 @@
}
Comast::Filter *f = ks->data()->logObject()->findFilterByName( ui.f_Id->text() );
if( f ){
- if( KMessageBox::warningYesNo( 0, i18n("Another Filter already exists with the given Id, Overwrite?"), i18n( "Overwrite" ), KGuiItem( i18n("Overwrite") ), KGuiItem( i18n( "Cancel" ) ) ) == KMessageBox::Yes ) {
+ if( Comast::warningOverwrite( "Another Filter already exists with the given Id, Overwrite?" ) == KMessageBox::Yes ) {
f->setFilter( ui.f_Id->text(), ui.f_Model->text(), ui.f_Vendor->text(), ui.f_Type->text(), ui.f_Color->text() );
- slotSaveEquipment();
} else
return;
} else {
@@ -161,5 +160,5 @@
ks->data()->logObject()->readBegin( istream.readAll() );
f.close();
}
-
+
#include "equipmentwriter.moc"
More information about the Kstars-devel
mailing list