From 7d9ac6d07bdb73b8ebce6b56cafd6e473b7086b1 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 2 Dec 2000 14:19:11 +0000 Subject: [PATCH] *** empty log message *** --- functions.h | 16 ---------------- mainwindow.cpp | 31 +++++++++++++++++-------------- mainwindow.h | 6 ++++++ 3 files changed, 23 insertions(+), 30 deletions(-) delete mode 100644 functions.h diff --git a/functions.h b/functions.h deleted file mode 100644 index afb6972..0000000 --- a/functions.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __functions_h__ -#define __functions_h__ -#include "contact.h" - -void display(); -void add(); -void remove(); -void printContactInfo(int num, CContact* contact); -void search(); - -void save(); -void load(); - -void modify(); - -#endif diff --git a/mainwindow.cpp b/mainwindow.cpp index 68afb43..4552b94 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,10 +1,4 @@ #include "mainwindow.h" -#include -#include -#include -#include -#include -#include "contact.h" #include /* BRÖÖL @@ -30,13 +24,19 @@ MainWindow::~MainWindow() */ void MainWindow::slotSave() { - if (filename == "") - return; + if (filename.isNull()) + { + filename = QFileDialog::getSaveFileName( 0, "Adresslista (*.adr)"); + if (filename.isNull()) + { + return; + } + } QFile f(filename); if ( !f.open( IO_WriteOnly ) ) - return false; + return; QTextStream t(&f); QString s; @@ -71,14 +71,17 @@ void MainWindow::slotDel() */ void MainWindow::slotLoad() { - slotSave(); + filename = QFileDialog::getOpenFileName(0, "Adressfiler (*.adr)", this); + QFile f(filename); - do + if ( !f.open( IO_ReadOnly ) ) + return; + + while (CContact::getNum() != 0) { - filename(QFileDialog::getOpenFileName(0, "Adressfiler (*.adr)", this)); + delete CContact::getFirst(); } - while ( !f.open( IO_ReadOnly ) ); - + QTextStream t(&f); while (!t.eof()) diff --git a/mainwindow.h b/mainwindow.h index 8eca343..2a65fe3 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,6 +1,12 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include "ui/mainwindowbase.h" +#include +#include +#include +#include +#include +#include "contact.h" class MainWindow : public CMainWindowBase { -- 2.39.2