[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kanagram/src
From:       Jeremy Paul Whiting <jeremy () scitools ! com>
Date:       2009-08-17 16:50:33
Message-ID: 1250527833.689580.14011.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1012423 by whiting:

BUG:203783
refresh view of vocabularies when any editor dialog is closed, also write an \
identifier to saved documents so they are valid to be read

 M  +2 -0      vocabedit.cpp  
 M  +0 -1      vocabedit.h  
 M  +30 -27    vocabsettings.cpp  
 M  +29 -27    vocabsettings.h  


--- trunk/KDE/kdeedu/kanagram/src/vocabedit.cpp #1012422:1012423
@@ -88,6 +88,8 @@
 	KEduVocDocument *doc = new KEduVocDocument(this);
 	doc->setTitle(txtVocabName->text());
 	doc->setDocumentComment(txtDescription->text());
+    KEduVocIdentifier id;
+    doc->appendIdentifier(id);
 	for(int i = 0; i < m_vocabList.size(); i++)
 	{
 		doc->lesson()->appendEntry(&m_vocabList[i]);
--- trunk/KDE/kdeedu/kanagram/src/vocabedit.h #1012422:1012423
@@ -46,7 +46,6 @@
 		void slotWordTextChanged(const QString &changes);
 		void slotHintTextChanged(const QString &changes);
 		void slotTextChanged(const QString &changes);
-		
 	private:
 		QVector<KEduVocExpression> m_vocabList;
 		QString m_fileName;
--- trunk/KDE/kdeedu/kanagram/src/vocabsettings.cpp #1012422:1012423
@@ -41,12 +41,12 @@
 
 VocabSettings::VocabSettings(QWidget *parent) : QWidget(parent), m_parent(NULL)
 {
-	setupUi(this);
-	m_parent = (KConfigDialog*)parent;
+    setupUi(this);
+    m_parent = (KConfigDialog*)parent;
 
-	connect(lviewVocab, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem \
*)), this, SLOT(slotSelectionChanged(QTreeWidgetItem *))); +    connect(lviewVocab, \
SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, \
SLOT(slotSelectionChanged(QTreeWidgetItem *)));  
-	refreshView();
+    refreshView();
 }
 
 VocabSettings::~VocabSettings()
@@ -55,43 +55,46 @@
 
 void VocabSettings::refreshView()
 {
-	lviewVocab->clear();
+    lviewVocab->clear();
 
-	m_fileList = SharedKvtmlFiles::fileNames(KanagramSettings::dataLanguage());
-	m_titleList = SharedKvtmlFiles::titles(KanagramSettings::dataLanguage());
-	m_commentList = SharedKvtmlFiles::comments(KanagramSettings::dataLanguage());
+    SharedKvtmlFiles::sortDownloadedFiles();
+    m_fileList = SharedKvtmlFiles::fileNames(KanagramSettings::dataLanguage());
+    m_titleList = SharedKvtmlFiles::titles(KanagramSettings::dataLanguage());
+    m_commentList = SharedKvtmlFiles::comments(KanagramSettings::dataLanguage());
 
-	for(int i = 0; i < m_fileList.size(); i++)
-	{
-		QTreeWidgetItem *item = new QTreeWidgetItem(lviewVocab, 0);
-		item->setText( 0, m_titleList[i] );
-		item->setText( 1, m_commentList[i] );
-		m_itemMap[item] = i;
-	}
-	m_parent->enableButtonApply(true);
+    for(int i = 0; i < m_fileList.size(); i++)
+    {
+        QTreeWidgetItem *item = new QTreeWidgetItem(lviewVocab, 0);
+        item->setText( 0, m_titleList[i] );
+        item->setText( 1, m_commentList[i] );
+        m_itemMap[item] = i;
+    }
+    m_parent->enableButtonApply(true);
 }
 
 void VocabSettings::on_btnEdit_clicked()
 {
-	if(lviewVocab->currentItem())
-	{
-		int index = m_itemMap[lviewVocab->currentItem()];
-		VocabEdit *vocabEdit = new VocabEdit(this, m_fileList[index]);
-		vocabEdit->show();
-	}
+    if(lviewVocab->currentItem())
+    {
+        int index = m_itemMap[lviewVocab->currentItem()];
+        VocabEdit *vocabEdit = new VocabEdit(this, m_fileList[index]);
+        connect(vocabEdit, SIGNAL(finished(int)), this, SLOT(refreshView()));
+        vocabEdit->show();
+    }
 }
 
 void VocabSettings::on_btnCreateNew_clicked()
 {
-	VocabEdit *vocabEdit = new VocabEdit(this, "");
-	vocabEdit->show();
+    VocabEdit *vocabEdit = new VocabEdit(this, "");
+    connect(vocabEdit, SIGNAL(finished(int)), this, SLOT(refreshView()));
+    vocabEdit->show();
 }
 
 void VocabSettings::slotSelectionChanged(QTreeWidgetItem *item)
 {
-	int index = m_itemMap[item];
-	bool writeable = QFileInfo(m_fileList[index]).isWritable();
-	btnEdit->setEnabled(writeable);
+    int index = m_itemMap[item];
+    bool writeable = QFileInfo(m_fileList[index]).isWritable();
+    btnEdit->setEnabled(writeable);
 }
 
 #include "vocabsettings.moc"
--- trunk/KDE/kdeedu/kanagram/src/vocabsettings.h #1012422:1012423
@@ -34,40 +34,42 @@
 class VocabSettings : public QWidget, public Ui::VocabSettingsWidget
 {
 Q_OBJECT
-	public:
-		/** default constructor */
-		explicit VocabSettings(QWidget *parent);
+    public:
+        /** default constructor */
+        explicit VocabSettings(QWidget *parent);
 
-		/** default destructor */
-		virtual ~VocabSettings();
+        /** default destructor */
+        virtual ~VocabSettings();
 
-		/** reload the list of vocabularies from what's on disk */
-		void refreshView();
+    public slots:
 
-	private:
+        /** reload the list of vocabularies from what's on disk */
+        void refreshView();
 
-		/** list of vocabulary files */
-		QStringList m_fileList;
-		
-		/** list of document titles */
-		QStringList m_titleList;
-		
-		/** list of document comments */
-		QStringList m_commentList;
-		
-		QMap<const QTreeWidgetItem*, int> m_itemMap;
+    private:
 
-		/** cache pointer to config dialog so we can enable the apply button in \
                slotSetDirty */
-		KConfigDialog *m_parent;
+        /** list of vocabulary files */
+        QStringList m_fileList;
+        
+        /** list of document titles */
+        QStringList m_titleList;
+        
+        /** list of document comments */
+        QStringList m_commentList;
+        
+        QMap<const QTreeWidgetItem*, int> m_itemMap;
 
-	private slots:
+        /** cache pointer to config dialog so we can enable the apply button in \
slotSetDirty */ +        KConfigDialog *m_parent;
 
-		/** create a new vocabulary
-		  * called when the btnCreateNew is clicked
-		  */
-		void on_btnCreateNew_clicked();
-		void on_btnEdit_clicked();
-		void slotSelectionChanged(QTreeWidgetItem *item);
+    private slots:
+
+        /** create a new vocabulary
+          * called when the btnCreateNew is clicked
+          */
+        void on_btnCreateNew_clicked();
+        void on_btnEdit_clicked();
+        void slotSelectionChanged(QTreeWidgetItem *item);
 };
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic