00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 void ChannelImportDlg::enableImport()
00011 {
00012 _ok->setEnabled(true);
00013 }
00014
00015 void ChannelImportDlg::init()
00016 {
00017 KGlobal::dirs()->addResourceType("qtvision", "share/apps/qtvision");
00018 }
00019
00020 void ChannelImportDlg::populateWithDefaults()
00021 {
00022 QStringList qsl = KGlobal::dirs()->resourceDirs("qtvision");
00023
00024 _channelList->clear();
00025 for (QStringList::Iterator p = qsl.begin(); p != qsl.end(); ++p) {
00026 QString path = *p + "/channels-dist/";
00027 QDir dir(path);
00028
00029 if (dir.exists()) {
00030 kdDebug() << "Loading default channels from directory: " << path << endl;
00031 dir.setNameFilter("*");
00032 const QFileInfoList *list = dir.entryInfoList();
00033 QFileInfoListIterator it( *list );
00034 QFileInfo *fi;
00035
00036 while ( (fi = it.current()) != 0 ) {
00037 if (fi->isFile()) {
00038 kdDebug() << "\tFound channel file: " << fi->fileName() << endl;
00039 ChannelFileMetaInfo x = ChannelIO::getMetaInfo(_qtv, fi->absFilePath());
00040 new ChannelImportItem(_channelList, x, fi->absFilePath());
00041 }
00042 ++it;
00043 }
00044 }
00045 }
00046 }
00047
00048 QString ChannelImportDlg::selectedFile()
00049 {
00050 ChannelImportItem *x = static_cast<ChannelImportItem*>(_channelList->selectedItem());
00051
00052 if (!x)
00053 return QString();
00054
00055 return x->_f;
00056 }
00057
00058 QtVision* ChannelImportDlg::driver()
00059 {
00060 return _qtv;
00061 }
00062
00063 void ChannelImportDlg::setDriver(QtVision* driver)
00064 {
00065 _qtv = driver;
00066 }