moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kverbos / kverbos / kverbos.cpp
blob2a5198cf2bac67e479059773409a42414476c452
1 /***************************************************************************
2 kverbos.cpp - description
3 -------------------
4 begin : Fre Dez 14 19:28:09 CET 2001
5 copyright : (C) 2001 by Arnold Kraschinski
6 email : arnold.k67@gmx.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
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. *
15 * *
16 ***************************************************************************/
18 // include files for QT
19 #include <qprinter.h>
20 #include <qcheckbox.h>
21 #include <qradiobutton.h>
23 // include files for KDE
24 #include <kfiledialog.h>
25 #include <kinputdialog.h>
26 #include "kstartuplogo.h"
27 #include <kstandarddirs.h>
28 #include <kstatusbar.h>
30 // application specific includes
31 #include "kverbos.h"
32 #include "kverbosview.h"
34 // my includes
35 #include "kerfassen.h"
36 #include "kverbedit.h"
37 #include "kverbosoptions.h"
38 #include "kresult.h"
39 #include "kfeedercontrol.h"
40 #include "prefs.h"
42 // ID Nummern für die Statuszeile
43 #define ID_STATUS_MSG 1
44 #define ID_TRAINED_MSG 2
45 #define ID_CORRECT_MSG 3
46 #define ID_VERBS_MSG 4
47 #define ID_USERNAME_MSG 5
49 int KVerbosApp::kverbosCounter = 0;
51 KVerbosApp::KVerbosApp(QWidget* , const char* name):KMainWindow (0, name)
53 // als erstes das Logo starten
54 KStartupLogo* start_logo = new KStartupLogo(0);
55 start_logo->show();
56 start_logo->raise();
58 // die Instanzen von kverbos zählen
59 kverbosCounter++;
61 config=kapp->config();
63 ///////////////////////////////////////////////////////////////////
64 // call inits to invoke all other construction parts
65 initStatusBar();
66 initActions();
67 initDocument();
68 initView();
70 readOptions();
72 ///////////////////////////////////////////////////////////////////
73 // disable actions at startup
74 // Mir ist nicht klar, warum die Autoren des Frameworks diese
75 // Menuoptionen deaktivieren.
76 // Ich werde hier jedenfalls gleich einmal einige auskommentieren.
77 // fileSave->setEnabled(false);
78 // fileSaveAs->setEnabled(false);
79 filePrint->setEnabled(false);
80 editCut->setEnabled(false);
81 editCopy->setEnabled(false);
82 editPaste->setEnabled(false);
83 userResults->setEnabled(false);
85 // El programa ha leído las opciones del programa. Entonces puedo iniciar el objeto
86 // por la control de KFeeder.
87 if (useKFeeder)
89 kfeederControl = new KFeederControl(kverbosCounter, showKFeederSplash, automaticKFeeder);
90 useKFeeder = kfeederControl->isActive();
91 if (!useKFeeder)
93 // the KFeeder didn't start so it isn't installed. Delete the control object
94 delete kfeederControl;
95 kfeederControl = 0;
98 else
99 kfeederControl = 0;
101 // das Logo wieder löschen
102 delete start_logo;
105 KVerbosApp::~KVerbosApp()
107 // den Instanzenzähler zurücksetzen
108 kverbosCounter--;
109 if (kfeederControl)
111 disconnect(view, SIGNAL(informKFeeder(int)), this, SLOT(slotFeedIt(int)));
112 delete kfeederControl;
113 kfeederControl = 0;
117 void KVerbosApp::initActions()
119 fileNewWindow = new KAction(i18n("New &Window"), "window_new.png", 0, this, SLOT(slotFileNewWindow()), actionCollection(),"file_new_window");
120 fileNew = KStdAction::openNew(this, SLOT(slotFileNew()), actionCollection());
121 fileOpen = KStdAction::open(this, SLOT(slotFileOpen()), actionCollection());
122 fileOpenRecent = KStdAction::openRecent(this, SLOT(slotFileOpenRecent(const KURL&)), actionCollection());
123 fileOpenStandard = new KAction(i18n("Open &Standard Verb File"), "fileopen.png", 0, this, SLOT(slotFileOpenStandard()), actionCollection(),"file_open_standard");
124 fileSave = KStdAction::save(this, SLOT(slotFileSave()), actionCollection());
125 fileSaveAs = KStdAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection());
126 fileClose = KStdAction::close(this, SLOT(slotFileClose()), actionCollection());
127 filePrint = KStdAction::print(this, SLOT(slotFilePrint()), actionCollection());
128 fileQuit = KStdAction::quit(this, SLOT(slotFileQuit()), actionCollection());
129 editCut = KStdAction::cut(this, SLOT(slotEditCut()), actionCollection());
130 editCopy = KStdAction::copy(this, SLOT(slotEditCopy()), actionCollection());
131 editPaste = KStdAction::paste(this, SLOT(slotEditPaste()), actionCollection());
132 editErfassen = new KAction(i18n("E&nter New Verb..."), 0, 0, this, SLOT(slotEditErfassen()), actionCollection(),"edit_erfassen");
133 editBearbeiten = new KAction(i18n("&Edit Verb List..."), 0, 0, this, SLOT(slotEditBearbeiten()), actionCollection(), "edit_bearbeiten");
135 settingOptions = new KAction(i18n("&Configure KVerbos..."), 0, 0, this, SLOT(slotSettingsOptions()), actionCollection(), "settings_options");
136 userUsername = new KAction(i18n("&Username..."), 0, 0, this, SLOT(slotSettingsUsername()), actionCollection(), "user_username");
137 userResults = new KAction(i18n("&Results"), 0, 0, this, SLOT(slotUserResults()), actionCollection(), "user_results");
139 fileNewWindow->setToolTip(i18n("Opens a new application window"));
140 fileOpenStandard->setToolTip(i18n("Opens the standard KVerbos verb file"));
141 fileNew->setToolTip(i18n("Creates a new document"));
142 fileOpen->setToolTip(i18n("Opens an existing document"));
143 fileOpenRecent->setToolTip(i18n("Opens a recently used file"));
144 fileSave->setToolTip(i18n("Saves the actual document"));
145 fileSaveAs->setToolTip(i18n("Saves the actual document as..."));
146 fileClose->setToolTip(i18n("Closes the actual document"));
147 filePrint ->setToolTip(i18n("Prints out the actual document"));
148 fileQuit->setToolTip(i18n("Quits the application"));
149 editCut->setToolTip(i18n("Cuts the selected section and puts it to the clipboard"));
150 editCopy->setToolTip(i18n("Copies the selected section to the clipboard"));
151 editPaste->setToolTip(i18n("Pastes the clipboard contents to actual position"));
152 editErfassen->setToolTip(i18n("Add new verbs."));
153 editBearbeiten->setToolTip(i18n("Edit the list of verbs."));
154 settingOptions->setToolTip(i18n("Change some options of the program"));
155 userUsername->setToolTip(i18n("Enter your name as the username"));
156 userResults->setToolTip(i18n("These are your latest results."));
158 // icons
159 editBearbeiten->setIcon("edit.png");
160 editErfassen->setIcon("editclear.png");
161 settingOptions->setIcon("configure.png");
162 userUsername->setIcon("kverbosuser.png");
163 userResults->setIcon("kverbosuser.png");
165 setupGUI();
169 void KVerbosApp::initStatusBar()
171 ///////////////////////////////////////////////////////////////////
172 // STATUSBAR
173 // TODO: add your own items you need for displaying current application status.
174 statusBar()->insertItem(i18n("Ready."), ID_STATUS_MSG);
175 statusBar()->insertItem(i18n("Trained: 0"), ID_TRAINED_MSG);
176 statusBar()->insertItem(i18n("Correct: 0"), ID_CORRECT_MSG);
177 statusBar()->insertItem(i18n("Number of verbs: 0"), ID_VERBS_MSG);
178 statusBar()->insertItem(i18n("User: nobody"), ID_USERNAME_MSG);
181 void KVerbosApp::initDocument()
183 doc = new KVerbosDoc(this);
184 doc->newDocument();
185 connect(doc, SIGNAL(anzahlVerbenGeaendert(int)), this, SLOT(slotStatusVerbMsg(int)));
186 connect(this, SIGNAL(testAnzahl(int)), this, SLOT(slotStatusVerbMsg(int)));
189 void KVerbosApp::initView()
191 ////////////////////////////////////////////////////////////////////
192 // create the main widget here that is managed by KTMainWindow's view-region and
193 // connect the widget to your document to display document contents.
195 view = new KVerbosView(this);
196 doc->addView(view);
197 setCentralWidget(view);
198 setCaption(doc->URL().fileName(),false);
200 connect(view, SIGNAL(numberTrainedChanged(int)), this, SLOT(slotStatusTrainedMsg(int)));
201 connect(view, SIGNAL(numberCorrectChanged(int)), this, SLOT(slotStatusCorrectMsg(int)));
202 connect(view, SIGNAL(informKFeeder(int)), this, SLOT(slotFeedIt(int)));
205 void KVerbosApp::openDocumentFile(const KURL& url)
207 slotStatusMsg(i18n("Opening file..."));
209 doc->openDocument( url);
210 fileOpenRecent->addURL( url );
211 slotStatusMsg(i18n("Ready."));
215 KVerbosDoc* KVerbosApp::getDocument() const
217 return doc;
220 void KVerbosApp::saveOptions()
222 fileOpenRecent->saveEntries(config,"Recent Files");
224 // Meine eigenen Optionen
225 // Die zum Lernen ausgewählten Zeiten
226 config->setGroup("tiempos");
227 QString key;
228 for (int i = presente; i<MAX_TIEMPOS; i++)
230 key.setNum(i);
231 QString options = timeOptions[i][0] ? "true " : "false ";
232 options = timeOptions[i][1] ? options + "true " : options + "false ";
233 options = timeOptions[i][2] ? options + "true" : options + "false";
234 config->writeEntry(key, options);
236 // den Korrekturmodus abspeichern
237 config->setGroup("correction mode");
238 config->writeEntry("strict", correctStrict);
239 // Abspeichern, ob der KFeeder benutzt werden soll
240 config->setGroup("use of KFeeder");
241 config->writeEntry("kfeeder", useKFeeder);
242 config->writeEntry("kfeederSplash", showKFeederSplash);
243 config->writeEntry("kfeederAutomatic", automaticKFeeder);
247 void KVerbosApp::readOptions()
249 // initialize the recent file list
250 fileOpenRecent->loadEntries(config,"Recent Files");
252 // Meine eigenen Optionen
253 // Die zum Lernen ausgewählten Zeiten
254 config->setGroup("tiempos");
255 QString key;
256 for (int i = presente; i<MAX_TIEMPOS; i++)
258 key.setNum(i);
259 QString options = config->readEntry ( key, "true false false");
260 int pos1 = 0;
261 int pos2 = options.find (' ', pos1, false);
262 timeOptions[i][0] = (options.left(pos2) == "true") ? true : false;
263 pos1 = pos2 + 1;
264 pos2 = options.find (' ', pos1, false);
265 timeOptions[i][1] = (options.mid(pos1,pos2-pos1) == "true") ? true : false;
266 timeOptions[i][2] = (options.right(options.length()-pos2-1) == "true") ? true : false;
268 // Solange einige Zeiten nicht fertig sind werden die hier auf false gesetzt.
269 /*TODO*/
270 for (int i = subPresente; i<MAX_TIEMPOS; i++)
272 timeOptions[i][0] = false;
273 timeOptions[i][1] = false;
274 timeOptions[i][2] = false;
276 // Korrekturmodus
277 config->setGroup("correction mode");
278 correctStrict = config->readBoolEntry("strict", false);
279 // Nutzung des KFeeders
280 config->setGroup("use of KFeeder");
281 useKFeeder = config->readBoolEntry("kfeeder", true);
282 showKFeederSplash = config->readBoolEntry("kfeederSplash", false);
283 automaticKFeeder = config->readBoolEntry("kfeederAutomatic", true);
286 void KVerbosApp::saveProperties(KConfig *_cfg)
288 if(doc->URL().fileName()!=i18n("Untitled") && !doc->isModified())
290 // saving to tempfile not necessary
293 else
295 KURL url=doc->URL();
296 _cfg->writePathEntry("filename", url.url());
297 _cfg->writeEntry("modified", doc->isModified());
298 QString tempname = kapp->tempSaveName(url.url());
299 QString tempurl= KURL::encode_string(tempname);
300 KURL _url(tempurl);
301 doc->saveDocument(_url);
306 void KVerbosApp::readProperties(KConfig* _cfg)
308 QString filename = _cfg->readPathEntry("filename");
309 KURL url(filename);
310 bool modified = _cfg->readBoolEntry("modified", false);
311 if(modified)
313 bool canRecover;
314 QString tempname = kapp->checkRecoverFile(filename, canRecover);
315 KURL _url(tempname);
316 if(canRecover)
318 doc->openDocument(_url);
319 doc->setModified();
320 setCaption(_url.fileName(),true);
321 QFile::remove(tempname);
324 else
326 if(!filename.isEmpty())
328 doc->openDocument(url);
329 setCaption(url.fileName(),false);
334 bool KVerbosApp::queryClose()
336 return doc->saveModified();
339 bool KVerbosApp::queryExit()
341 saveOptions();
342 return true;
345 /////////////////////////////////////////////////////////////////////
346 // SLOT IMPLEMENTATION
347 /////////////////////////////////////////////////////////////////////
349 void KVerbosApp::slotFileNewWindow()
351 slotStatusMsg(i18n("Opening a new application window..."));
353 KVerbosApp *new_window= new KVerbosApp();
354 new_window->show();
356 slotStatusMsg(i18n("Ready."));
359 void KVerbosApp::slotFileNew()
361 slotStatusMsg(i18n("Creating new document..."));
363 if(!doc->saveModified())
365 // here saving wasn't successful
368 else
370 doc->newDocument();
371 setCaption(doc->URL().fileName(), false);
374 slotStatusMsg(i18n("Ready."));
377 void KVerbosApp::slotFileOpen()
379 slotStatusMsg(i18n("Opening file..."));
381 if(!doc->saveModified())
383 // here saving wasn't successful
386 else
388 KURL url=KFileDialog::getOpenURL(QString::null,
389 i18n("*|All Files"), this, i18n("Open File"));
390 if(!url.isEmpty())
392 doc->openDocument(url);
393 // Die zu bearbeitende Datei in dem Dokument setzen
394 doc->setURL(url);
395 setCaption(url.fileName(), false);
396 fileOpenRecent->addURL( url );
399 slotStatusMsg(i18n("Ready."));
402 void KVerbosApp::slotFileOpenRecent(const KURL& url)
404 slotStatusMsg(i18n("Opening file..."));
406 if(!doc->saveModified())
408 // here saving wasn't successful
410 else
412 doc->openDocument(url);
413 doc->setURL(url);
414 setCaption(url.fileName(), false);
417 slotStatusMsg(i18n("Ready."));
420 void KVerbosApp::slotFileOpenStandard()
422 slotStatusMsg(i18n("Opening file..."));
423 QString userLanguage = Prefs::userLanguage();
424 if(!doc->saveModified())
426 // here saving wasn't successful
429 else
431 KURL url(locate("appdata", "data/"+userLanguage+"/verbos.verbos"));
432 if(!url.isEmpty())
434 doc->openDocument(url);
435 // Die zu bearbeitende Datei in dem Dokument setzen
436 doc->setURL(url);
437 setCaption(url.fileName(), false);
438 fileOpenRecent->addURL( url );
441 slotStatusMsg(i18n("Ready."));
444 void KVerbosApp::slotFileSave()
446 slotStatusMsg(i18n("Saving file..."));
447 if (doc->URL().fileName() == i18n("Untitled"))
449 // Hier liegt ein Fall vor, der zu "Save as ... " gehört.
450 slotFileSaveAs();
452 else
454 doc->saveDocument(doc->URL());
456 slotStatusMsg(i18n("Ready."));
459 void KVerbosApp::slotFileSaveAs()
461 slotStatusMsg(i18n("Saving file with a new filename..."));
463 KURL url=KFileDialog::getSaveURL(QDir::currentDirPath(),
464 i18n("*|All Files"), this, i18n("Save As"));
465 if(!url.isEmpty())
467 doc->saveDocument(url);
468 fileOpenRecent->addURL(url);
469 setCaption(url.fileName(),doc->isModified());
472 slotStatusMsg(i18n("Ready."));
475 void KVerbosApp::slotFileClose()
477 slotStatusMsg(i18n("Closing file..."));
479 close();
481 slotStatusMsg(i18n("Ready."));
484 void KVerbosApp::slotFilePrint()
486 slotStatusMsg(i18n("Printing..."));
488 QPrinter printer;
489 if (printer.setup(this))
491 view->print(&printer);
494 slotStatusMsg(i18n("Ready."));
497 void KVerbosApp::slotFileQuit()
499 slotStatusMsg(i18n("Exiting..."));
500 saveOptions();
501 // close the first window, the list makes the next one the first again.
502 // This ensures that queryClose() is called on each window to ask for closing
503 KMainWindow* w;
504 // In der Dokumentation konnte ich leider nicht finden, wozu diese memberliste gut ist.
505 if(memberList)
507 for(w=memberList->first(); w!=0; w=memberList->next())
509 // only close the window if the closeEvent is accepted. If the user presses Cancel on the saveModified() dialog,
510 // the window and the application stay open.
511 if(!w->close())
512 break;
515 slotStatusMsg(i18n("Ready."));
518 void KVerbosApp::slotEditCut()
520 slotStatusMsg(i18n("Cutting selection..."));
522 slotStatusMsg(i18n("Ready."));
525 void KVerbosApp::slotEditCopy()
527 slotStatusMsg(i18n("Copying selection to clipboard..."));
529 slotStatusMsg(i18n("Ready."));
532 void KVerbosApp::slotEditPaste()
534 slotStatusMsg(i18n("Inserting clipboard contents..."));
536 slotStatusMsg(i18n("Ready."));
539 void KVerbosApp::slotStatusMsg(const QString &text)
541 ///////////////////////////////////////////////////////////////////
542 // change status message permanently
543 statusBar()->clear();
544 statusBar()->changeItem(text, ID_STATUS_MSG);
547 // Gibt die Anzahl der Verben in der Statuszeile aus
548 void KVerbosApp::slotStatusVerbMsg(int n)
550 QString s;
551 s.setNum(n,10);
552 s = i18n("Number of verbs: ") + s;
553 statusBar()->changeItem(s, ID_VERBS_MSG);
556 // Gibt die Anzahl der geübten Verben in der Statuszeile aus.
557 void KVerbosApp::slotStatusTrainedMsg(int n)
559 QString s;
560 s.setNum(n,10);
561 s = i18n("Trained: ") + s;
562 statusBar()->changeItem(s, ID_TRAINED_MSG);
565 // Gibt die Anzahl der richtig geübten Verben aus.
566 void KVerbosApp::slotStatusCorrectMsg(int n)
568 QString s;
569 s.setNum(n,10);
570 s = i18n("Correct: ") + s;
571 statusBar()->changeItem(s, ID_CORRECT_MSG);
574 // öffnet einen Dialog mit dem neue Verben erfasst werden können.
575 void KVerbosApp::slotEditErfassen()
577 spanishVerbList* pList = getDocument()->getList();
578 KErfassen* pDlgErfassen = new KErfassen(*pList, -1, this, "erfassen", true);
579 pDlgErfassen->exec();
580 if (pDlgErfassen->wasChanged())
582 *pList = pDlgErfassen->getList();
583 doc->setModified();
585 delete pDlgErfassen;
586 pDlgErfassen = 0;
587 // Anzahl in der Statuszeile anpassen
588 emit testAnzahl(doc->getAnzahl());
591 // öffnet einen Dialog mit dem die Verbliste bearbeitet werden kann.
592 void KVerbosApp::slotEditBearbeiten()
594 KVerbEdit* pDlgEdit = new KVerbEdit(*(getDocument()->getList()), this, "edit the verbs", true);
595 pDlgEdit->exec();
596 if (pDlgEdit->wasChanged())
598 doc->setModified(true);
599 *(getDocument()->getList()) = pDlgEdit->getList();
601 delete pDlgEdit;
602 pDlgEdit = 0;
603 // Anzahl in der Statuszeile anpassen
604 emit testAnzahl(doc->getAnzahl());
607 void KVerbosApp::slotSettingsOptions()
609 KVerbosOptions* pDlgEdit = new KVerbosOptions(this, "bearbeiten", true);
610 pDlgEdit->CheckBox1_1->setChecked(timeOptions[presente][0]);
611 pDlgEdit->CheckBox2_1->setChecked(timeOptions[presente][1]);
612 pDlgEdit->CheckBox3_1->setChecked(timeOptions[presente][2]);
614 pDlgEdit->CheckBox1_2->setChecked(timeOptions[1][0]);
615 pDlgEdit->CheckBox2_2->setChecked(timeOptions[1][1]);
616 pDlgEdit->CheckBox3_2->setChecked(timeOptions[1][2]);
618 pDlgEdit->CheckBox1_3->setChecked(timeOptions[2][0]);
619 pDlgEdit->CheckBox2_3->setChecked(timeOptions[2][1]);
621 pDlgEdit->CheckBox1_4->setChecked(timeOptions[3][0]);
622 pDlgEdit->CheckBox2_4->setChecked(timeOptions[3][1]);
623 pDlgEdit->CheckBox3_4->setChecked(timeOptions[3][2]);
625 pDlgEdit->CheckBox1_5->setChecked(timeOptions[4][0]);
626 pDlgEdit->CheckBox2_5->setChecked(timeOptions[4][1]);
627 pDlgEdit->CheckBox3_5->setChecked(timeOptions[4][2]);
629 pDlgEdit->CheckBox1_6->setChecked(timeOptions[5][0]);
630 pDlgEdit->CheckBox2_6->setChecked(timeOptions[5][1]);
631 pDlgEdit->CheckBox3_6->setChecked(timeOptions[5][2]);
633 pDlgEdit->CheckBox1_7->setChecked(timeOptions[6][0]);
634 pDlgEdit->CheckBox2_7->setChecked(timeOptions[6][1]);
635 pDlgEdit->CheckBox3_7->setChecked(timeOptions[6][2]);
637 pDlgEdit->CheckBox1_8->setChecked(timeOptions[subFuturo][0]);
638 pDlgEdit->CheckBox2_8->setChecked(timeOptions[subFuturo][1]);
639 pDlgEdit->CheckBox3_8->setChecked(timeOptions[subFuturo][2]);
641 pDlgEdit->CheckBox1_9->setChecked(timeOptions[imperativo][0]);
643 pDlgEdit->RadioStrictCorr->setChecked(correctStrict);
644 pDlgEdit->RadioIgnoreAcc->setChecked(!correctStrict);
646 pDlgEdit->CheckBoxKFeeder->setChecked(useKFeeder);
647 if (!useKFeeder)
649 pDlgEdit->CheckBoxSplash->setDisabled(true);
650 pDlgEdit->CheckBoxMode->setDisabled(true);
652 pDlgEdit->CheckBoxSplash->setChecked(showKFeederSplash);
653 pDlgEdit->CheckBoxMode->setChecked(automaticKFeeder);
655 if (pDlgEdit->exec() == 1)
657 timeOptions[presente][0] = pDlgEdit->CheckBox1_1->isChecked();
658 timeOptions[presente][1] = pDlgEdit->CheckBox2_1->isChecked();
659 timeOptions[presente][2] = pDlgEdit->CheckBox3_1->isChecked();
661 timeOptions[1][0] = pDlgEdit->CheckBox1_2->isChecked();
662 timeOptions[1][1] = pDlgEdit->CheckBox2_2->isChecked();
663 timeOptions[1][2] = pDlgEdit->CheckBox3_2->isChecked();
665 timeOptions[2][0] = pDlgEdit->CheckBox1_3->isChecked();
666 timeOptions[2][1] = pDlgEdit->CheckBox2_3->isChecked();
668 timeOptions[3][0] = pDlgEdit->CheckBox1_4->isChecked();
669 timeOptions[3][1] = pDlgEdit->CheckBox2_4->isChecked();
670 timeOptions[3][2] = pDlgEdit->CheckBox3_4->isChecked();
672 timeOptions[4][0] = pDlgEdit->CheckBox1_5->isChecked();
673 timeOptions[4][1] = pDlgEdit->CheckBox2_5->isChecked();
674 timeOptions[4][2] = pDlgEdit->CheckBox3_5->isChecked();
676 timeOptions[5][0] = pDlgEdit->CheckBox1_6->isChecked();
677 timeOptions[5][1] = pDlgEdit->CheckBox2_6->isChecked();
678 timeOptions[5][2] = pDlgEdit->CheckBox3_6->isChecked();
680 timeOptions[6][0] = pDlgEdit->CheckBox1_7->isChecked();
681 timeOptions[6][1] = pDlgEdit->CheckBox2_7->isChecked();
682 timeOptions[6][2] = pDlgEdit->CheckBox3_7->isChecked();
684 timeOptions[subFuturo][0] = pDlgEdit->CheckBox1_8->isChecked();
685 timeOptions[subFuturo][1] = pDlgEdit->CheckBox2_8->isChecked();
686 timeOptions[subFuturo][2] = pDlgEdit->CheckBox3_8->isChecked();
688 timeOptions[imperativo][0] = pDlgEdit->CheckBox1_9->isChecked();
690 correctStrict = pDlgEdit->RadioStrictCorr->isChecked();
692 showKFeederSplash = pDlgEdit->CheckBoxSplash->isChecked();
693 // testen ob die Art der Futteranimationen geändert werden soll. Diese soll nur geändert
694 // werden, wenn der KFeeder läuft und auch weiterhin laufen soll.
696 if ((automaticKFeeder != pDlgEdit->CheckBoxMode->isChecked()) && useKFeeder &&
697 (pDlgEdit->CheckBoxKFeeder->isChecked() == true))
699 kfeederControl->setAutomatic(pDlgEdit->CheckBoxMode->isChecked());
701 automaticKFeeder = pDlgEdit->CheckBoxMode->isChecked();
702 // prüfen, ob der KFeeder angehalten oder gestartet werden soll.
703 if ((pDlgEdit->CheckBoxKFeeder->isChecked() == true) && (!useKFeeder))
705 // kfeeder starten
706 if (kfeederControl == 0)
707 kfeederControl = new KFeederControl(kverbosCounter, showKFeederSplash, automaticKFeeder);
709 else
710 if ((pDlgEdit->CheckBoxKFeeder->isChecked() == false) && (useKFeeder))
712 // kfeeder anhalten
713 disconnect(view, SIGNAL(informKFeeder(int)), this, SLOT(slotFeedIt(int)));
714 delete kfeederControl;
715 kfeederControl = 0;
717 useKFeeder = pDlgEdit->CheckBoxKFeeder->isChecked();
719 delete pDlgEdit;
720 pDlgEdit = 0;
723 void KVerbosApp::getTimeOptions(bool op[][3])
725 for (int i=0; i<MAX_TIEMPOS; i++)
726 for (int j=0; j<MAX_SUBTYPES; j++)
727 op[i][j] = timeOptions[i][j];
730 void KVerbosApp::slotSettingsUsername()
732 bool ok;
733 QString n = KInputDialog::getText(i18n("Enter User Name"), i18n("Please enter your name:"),
734 QString::null , &ok, this).simplifyWhiteSpace();
735 if (ok)
737 statusBar()->changeItem(i18n("user: ") + n, ID_USERNAME_MSG);
738 doc->setNewUser(n);
739 userResults->setEnabled(true);
740 if (kfeederControl != 0)
741 kfeederControl->reset();
745 void KVerbosApp::slotUserResults()
747 KResult* pDlgResult = new KResult(doc->getUser(), this, "username", true);
748 pDlgResult->exec();
751 void KVerbosApp::slotFeedIt(int n)
753 if (useKFeeder && (kfeederControl != 0))
754 kfeederControl->addN(n);
757 #include "kverbos.moc"