mirror of
				https://github.com/ElvishArtisan/rivendell.git
				synced 2025-10-31 14:13:52 +01:00 
			
		
		
		
	2015-01-09 Fred Gleason <fredg@paravelsystems.com>
* Fixed a bug in 'rdlogmanager/editschedrules.cpp' and 'rdlogmanager/editschedrules.h' that caused scheduling rule data to be corrupt if the rules list was resorted [GitHub issue #000054].
This commit is contained in:
		| @@ -14701,3 +14701,7 @@ | ||||
| 2015-01-07 Fred Gleason <fredg@paravelsystems.com> | ||||
| 	* Added an 'RDReport::MrMaster' value to the 'RDReport::ExportFilter | ||||
| 	enumeration in 'lib/rdreport.cpp' and 'lib/rdreport.h'. | ||||
| 2015-01-09 Fred Gleason <fredg@paravelsystems.com> | ||||
| 	* Fixed a bug in 'rdlogmanager/editschedrules.cpp' and | ||||
| 	'rdlogmanager/editschedrules.h' that caused scheduling rule data | ||||
| 	to be corrupt if the rules list was resorted [GitHub issue #000054]. | ||||
|   | ||||
| @@ -37,12 +37,7 @@ SchedRulesList::SchedRulesList(QString clockname) | ||||
|       NOT_AFTER varchar(10),\ | ||||
|       OR_AFTER varchar(10),\ | ||||
|       OR_AFTER_II varchar(10))",(const char*)clockname.replace(" ","_"));  | ||||
|  | ||||
|   q=new RDSqlQuery(sql); | ||||
|   if(!q->isActive()) { | ||||
|     printf("SQL: %s\n",(const char *)sql); | ||||
|     printf("SQL Error: %s\n",(const char *)q->lastError().databaseText()); | ||||
|   } | ||||
|   delete q; | ||||
|  | ||||
|   sql=QString().sprintf("select CODE,DESCRIPTION from SCHED_CODES order by `CODE` asc");  | ||||
|   | ||||
| @@ -402,7 +402,9 @@ void EditClock::schedRules() | ||||
|   QString clock_name = edit_clock->name(); | ||||
|   bool rules_modified = edit_clock->getRulesModified(); | ||||
|  | ||||
|   EditSchedRules *dialog=new EditSchedRules(clock_name,&edit_artistsep,sched_rules_list,&rules_modified,this,"dialog"); | ||||
|   EditSchedRules *dialog= | ||||
|     new EditSchedRules(clock_name,&edit_artistsep,sched_rules_list, | ||||
| 		       &rules_modified,this); | ||||
|   dialog->exec(); | ||||
|    | ||||
|   if (edit_clock->getArtistSep()!=edit_artistsep) | ||||
|   | ||||
| @@ -4,8 +4,6 @@ | ||||
| // | ||||
| //   Stefan Gabriel <stg@st-gabriel.de> | ||||
| // | ||||
| //    | ||||
| // | ||||
| //   This program is free software; you can redistribute it and/or modify | ||||
| //   it under the terms of the GNU General Public License version 2 as | ||||
| //   published by the Free Software Foundation. | ||||
| @@ -31,22 +29,22 @@ | ||||
|  | ||||
| #include <rd.h> | ||||
| #include <rddb.h> | ||||
| #include <rdlistviewitem.h> | ||||
|  | ||||
| #include <edit_schedrules.h> | ||||
| #include <edit_schedcoderules.h> | ||||
| #include <schedruleslist.h> | ||||
| #include <list_clocks.h> | ||||
|  | ||||
|  | ||||
| EditSchedRules::EditSchedRules(QString clock,unsigned *artistsep,SchedRulesList *schedruleslist,bool *rules_modified,QWidget *parent,const char *name) | ||||
|   : QDialog(parent,name,true) | ||||
| EditSchedRules::EditSchedRules(QString clock,unsigned *artistsep,SchedRulesList *schedruleslist,bool *rules_modified,QWidget *parent) | ||||
|   : QDialog(parent,"",true) | ||||
| { | ||||
|   edit_artistsep=artistsep; | ||||
|   edit_rules_modified=rules_modified; | ||||
|   sched_rules_list = schedruleslist; | ||||
|   clockname = clock; | ||||
|  | ||||
|    | ||||
|  | ||||
|   // | ||||
|   // Fix the Window Size | ||||
|   // | ||||
| @@ -113,7 +111,7 @@ EditSchedRules::EditSchedRules(QString clock,unsigned *artistsep,SchedRulesList | ||||
|  | ||||
|  | ||||
|   // List | ||||
|   list_schedCodes_view=new QListView(this,"list_schedCodes_view"); | ||||
|   list_schedCodes_view=new RDListView(this,"list_schedCodes_view"); | ||||
|   list_schedCodes_view->setGeometry(10,60,size().width()-20,size().height()-140); | ||||
|   list_schedCodes_view->setAllColumnsShowFocus(true); | ||||
|   list_schedCodes_view->addColumn(tr("CODE")); | ||||
| @@ -156,12 +154,12 @@ QSizePolicy EditSchedRules::sizePolicy() const | ||||
| void EditSchedRules::Load() | ||||
| { | ||||
|   QString str; | ||||
|   QListViewItem *item; | ||||
|   RDListViewItem *item; | ||||
|  | ||||
|   list_schedCodes_view->clear(); | ||||
|   for (int i=0; i<sched_rules_list->getNumberOfItems(); i++)   | ||||
|     { | ||||
|     item=new QListViewItem(list_schedCodes_view); | ||||
|   for (int i=0; i<sched_rules_list->getNumberOfItems(); i++) { | ||||
|     item=new RDListViewItem(list_schedCodes_view); | ||||
|     item->setId(i); | ||||
|     item->setText(0,sched_rules_list->getItemSchedCode(i)); | ||||
|     str=QString().sprintf("%d",sched_rules_list->getItemMaxRow(i)); | ||||
|     item->setText(1,str); | ||||
| @@ -171,31 +169,28 @@ void EditSchedRules::Load() | ||||
|     item->setText(4,sched_rules_list->getItemOrAfter(i)); | ||||
|     item->setText(5,sched_rules_list->getItemOrAfterII(i)); | ||||
|     item->setText(6,sched_rules_list->getItemDescription(i)); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| void EditSchedRules::Close() | ||||
| { | ||||
|   QListViewItem *item; | ||||
|   int number_of_items; | ||||
|  | ||||
|   number_of_items = list_schedCodes_view->childCount(); | ||||
|   RDListViewItem *item=(RDListViewItem *)list_schedCodes_view->firstChild(); | ||||
|  | ||||
|   *edit_rules_modified=true; | ||||
|  | ||||
|   for (int i=0; i< number_of_items; i++)   | ||||
|    { | ||||
|    item=list_schedCodes_view->firstChild(); | ||||
|    sched_rules_list->insertItem(i,item->text(1).toInt(),item->text(2).toInt(),item->text(3),item->text(4),item->text(5)); | ||||
|    list_schedCodes_view->takeItem(item); | ||||
|    } | ||||
|   while(item!=NULL) { | ||||
|     sched_rules_list-> | ||||
|       insertItem(item->id(),item->text(1).toInt(),item->text(2).toInt(), | ||||
| 		 item->text(3),item->text(4),item->text(5)); | ||||
|     item=(RDListViewItem *)item->nextSibling(); | ||||
|   } | ||||
| } | ||||
|  | ||||
|  | ||||
| void EditSchedRules::editData() | ||||
| { | ||||
|   QListViewItem *item=list_schedCodes_view->selectedItem(); | ||||
|   RDListViewItem *item=(RDListViewItem *)list_schedCodes_view->selectedItem(); | ||||
|   if(item==NULL) { | ||||
|     return; | ||||
|   } | ||||
| @@ -213,7 +208,7 @@ void EditSchedRules::importData() | ||||
| { | ||||
|   QString clockname = ""; | ||||
|   QString str; | ||||
|   QListViewItem *item; | ||||
|   RDListViewItem *item; | ||||
|   QString sql; | ||||
|   RDSqlQuery *q; | ||||
|  | ||||
| @@ -229,7 +224,8 @@ void EditSchedRules::importData() | ||||
|   list_schedCodes_view->clear(); | ||||
|   for (int i=0; i<import_list->getNumberOfItems(); i++)   | ||||
|     { | ||||
|     item=new QListViewItem(list_schedCodes_view); | ||||
|     item=new RDListViewItem(list_schedCodes_view); | ||||
|     item->setId(i); | ||||
|     item->setText(0,import_list->getItemSchedCode(i)); | ||||
|     str=QString().sprintf("%d",import_list->getItemMaxRow(i)); | ||||
|     item->setText(1,str); | ||||
|   | ||||
| @@ -30,6 +30,8 @@ | ||||
| #include <qlistview.h> | ||||
| #include <qvariant.h> | ||||
|  | ||||
| #include <rdlistview.h> | ||||
|  | ||||
| #include <schedruleslist.h> | ||||
|  | ||||
| class QSpinBox; | ||||
| @@ -38,7 +40,9 @@ class EditSchedRules : public QDialog | ||||
| { | ||||
|   Q_OBJECT | ||||
|  public: | ||||
|   EditSchedRules(QString clock,unsigned *artistsep,SchedRulesList *schedruleslist,bool *rules_modified,QWidget *parent=0,const char *name=0); | ||||
|   EditSchedRules(QString clock,unsigned *artistsep, | ||||
| 		 SchedRulesList *schedruleslist,bool *rules_modified, | ||||
| 		 QWidget *parent=0); | ||||
|   ~EditSchedRules(); | ||||
|   QSize sizeHint() const; | ||||
|   QSizePolicy sizePolicy() const; | ||||
| @@ -58,7 +62,7 @@ class EditSchedRules : public QDialog | ||||
|   void Close(); | ||||
|   QLabel* artistSepLabel; | ||||
|   QSpinBox* artistSepSpinBox; | ||||
|   QListView *list_schedCodes_view; | ||||
|   RDListView *list_schedCodes_view; | ||||
|   QString clockname; | ||||
|   unsigned* edit_artistsep; | ||||
|   bool* edit_rules_modified; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user