1 #include "mainwindow.h"
3 #include <qfiledialog.h>
4 #include <qtextstream.h>
11 * Constructs a MainWindow which is a child of 'parent', with the
12 * name 'name' and widget flags set to 'f'
14 MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl )
15 : CMainWindowBase( parent, name, fl )
17 //connect(LoadButton, SIGNAL(clicked()), SLOT(slotLoad()));
21 * Destroys the object and frees any allocated resources
23 MainWindow::~MainWindow()
25 // no need to delete child widgets, Qt does it all for us
31 void MainWindow::slotSave()
33 qWarning( "MainWindow::slotSave() not yet implemented!" );
38 void MainWindow::slotAdd()
40 qWarning( "MainWindow::slotAdd() not yet implemented!" );
45 void MainWindow::slotDel()
47 qWarning( "MainWindow::slotDel() not yet implemented!" );
52 void MainWindow::slotLoad()
54 QString filename(QFileDialog::getOpenFileName(0, "Adressfiler (*.adr)", this));
57 if ( !f.open( IO_ReadOnly ) )
64 QString fname = t.readLine();
65 QString lname = t.readLine();
66 QString adr = t.readLine();
67 QString pn = t.readLine();
68 if (fname == "" && lname == "" && lname == "" && pn == "")
70 (void) new CContact(fname, lname, adr, pn);
77 void MainWindow::slotSearch()
79 qWarning( "MainWindow::slotSearch() not yet implemented!" );
84 * This funtion puts all contacts in the listview
86 void MainWindow::updateView()
91 CContact* contact = CContact::getFirst();
96 while (contact != '\0')
99 (void) new QListViewItem(ContactView, s, contact->lastname(), contact->firstname(), contact->adress(), contact->phoneNumber());
100 contact = contact->getNext();