diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-12-16 22:37:00 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2023-12-16 23:54:59 +0900 |
commit | 64cf76fc9fbf478314dcadd9eb768b5e9394d242 (patch) | |
tree | 5a32fcb094a027b39f4ded71ff874ef741ae73eb | |
parent | 5aed5382196cb094854e53ee4f06c22e9f8ec14c (diff) | |
download | kstreamripper-64cf76fc9fbf478314dcadd9eb768b5e9394d242.tar.gz kstreamripper-64cf76fc9fbf478314dcadd9eb768b5e9394d242.zip |
Prevent loss of last station across multiple program runs if its description is empty
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit 69209da95457952bb70cce369972f15444f1393b)
-rw-r--r-- | src/kstreamripper.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/kstreamripper.cpp b/src/kstreamripper.cpp index 1487344..0eb9dae 100644 --- a/src/kstreamripper.cpp +++ b/src/kstreamripper.cpp @@ -76,18 +76,21 @@ KStreamRipper::KStreamRipper( TQWidget* parent, const char* name ) nameList = appConfig->readListEntry( "names" ); urlList = appConfig->readListEntry( "urls" ); descList = appConfig->readListEntry( "descs" ); - TQStringList::iterator iter1, iter2, iter3; - iter1 = nameList.begin(); - iter2 = urlList.begin(); - iter3 = descList.begin(); - - for( ; iter1 != nameList.end() && iter2 != urlList.end() && iter3 != descList.end(); ++iter1, ++iter2, ++iter3 ) + size_t numEntries = nameList.size(); + if (urlList.size() < numEntries) + { + numEntries = urlList.size(); + } + for(size_t idx = 0; idx < numEntries; ++idx) { - ProcessListViewItem * procItem = new ProcessListViewItem( m_streamsListView, *iter1, "", ""); + ProcessListViewItem * procItem = new ProcessListViewItem( m_streamsListView, nameList[idx], "", ""); procItem->setRenameEnabled(0, true); ProcessController *pc = procItem->getProcessController(); - pc->setUrl( *iter2 ); - pc->setDescription( *iter3 ); + pc->setUrl( urlList[idx] ); + if (idx < descList.size()) + { + pc->setDescription( descList[idx] ); + } connect(pc, TQT_SIGNAL(stopRipSignal(ProcessController*)), this, TQT_SLOT(ripStopped(ProcessController*))); } |