Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

listviewconfdir.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  ***************************************************************************/
00009   // (c) 2002 Patrick S. Vogtp <tille@handhelds.org>
00010 
00011 #include "listviewconfdir.h"
00012 #include "listviewitemconffile.h"
00013 
00014 /* OPIE */
00015 #include <opie2/odebug.h>
00016 using namespace Opie::Core;
00017 
00018 /* QT */
00019 #include <qmessagebox.h>
00020 
00021 ListViewConfDir::ListViewConfDir(QString settingsPath, QWidget *parent, const char *name )
00022   : QListView(parent,name), confDir(settingsPath)
00023 {
00024 
00025         setRootIsDecorated( true );
00026         addColumn(tr("Files"));
00027 
00028         if (!confDir.isReadable())
00029                 QMessageBox::critical(this,tr("Could not open"),tr("The directory ")+settingsPath+tr(" could not be opened."),1,0);
00030         readConfFiles();
00031 
00032         connect( this, SIGNAL(expanded(QListViewItem*)), SLOT(expand(QListViewItem*)));
00033 }
00034 
00035 
00036 ListViewConfDir::~ListViewConfDir()
00037 {
00038 }
00039 
00040 void ListViewConfDir::readConfFiles()
00041 {
00042 
00043   confDir.setFilter( QDir::Files | QDir::NoSymLinks );
00044   confDir.setSorting( QDir::Name );
00045   confDir.setNameFilter("*.conf");
00046   const QFileInfoList *list = confDir.entryInfoList();
00047   QFileInfoListIterator it( *list );
00048   QFileInfo *fi;
00049 
00050   ListViewItemConfFile *fileEntry;
00051 
00052         while ( (fi=it.current()) )
00053         {
00054     odebug << "opening: >" << fi->fileName().data() << "<" << oendl;
00055         fileEntry = new ListViewItemConfFile( fi, this );
00056         (void)new QListViewItem(fileEntry, "dummy");
00057         ++it;
00058   }
00059 }
00060 
00061 void ListViewConfDir::expand(QListViewItem *item)
00062 {
00063         ((ListViewItemConf*)item)->expand();
00064 }
00065 

Generated on Sat Nov 5 16:16:48 2005 for OPIE by  doxygen 1.4.2