Bug 123505

Summary: 'Highlighting' in settings is always 'none'
Product: [Applications] kate Reporter: Hugh Warrington <hughwarrington>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Hugh Warrington 2006-03-12 18:01:57 UTC
Version:           2.5.0 (using KDE 3.5.0, compiled sources)
Compiler:          gcc version 3.4.3
OS:                Linux (i686) release 2.6.15.4-0

Load a file such that Kate turns on a particular syntax highlighting based on the filename extension. Then look at Settings->Configure Kate...->Highlighting. The box at the top says Highlight: None, rather than the highlighting that has been applied. If you choose a particular highlighting and click OK, when you go back to the dialogue it is on 'None' again.
Comment 1 Philip Rodrigues 2006-03-13 20:14:40 UTC
Sounds like a wishlist rather than a bug: The highlight drop-down on the configure page lets you select whatever highlight mode you want to change (not necessarily the currently active one). OTOH, I guess that the steps you describe would be a common use case for changing the settings of a particular highlight style, so setting the highlight mode in that drop-down could be useful.
Comment 2 Anders Lund 2006-03-13 20:23:39 UTC
This is a regression that happened when the settings was reorganized. The 
color settings correctly picks up the correct highlight, and this one should 
as well. I'll look into it.
Comment 3 Andreas Kling 2006-07-03 17:59:41 UTC
SVN commit 557593 by kling:

Make the current document's highlighting mode selected when the highlighting config page opens.

BUG: 123505


 M  +5 -4      katedialogs.cpp  
 M  +3 -1      katedialogs.h  
 M  +1 -1      katedocument.cpp  


--- branches/KDE/3.5/kdelibs/kate/part/katedialogs.cpp #557592:557593
@@ -1244,9 +1244,10 @@
 //END KatePartPluginConfigPage
 
 //BEGIN KateHlConfigPage
-KateHlConfigPage::KateHlConfigPage (QWidget *parent)
+KateHlConfigPage::KateHlConfigPage (QWidget *parent, KateDocument *doc)
  : KateConfigPage (parent, "")
  , hlData (0)
+ , m_doc (doc)
 {
   QVBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint() );
 
@@ -1267,7 +1268,6 @@
     else
       hlCombo->insertItem(KateHlManager::self()->hlNameTranslated(i));
   }
-  hlCombo->setCurrentItem(0);
 
   QGroupBox *gbInfo = new QGroupBox( 1, Qt::Horizontal, i18n("Information"), this );
   layout->add (gbInfo);
@@ -1316,8 +1316,9 @@
   QPushButton *btnDl = new QPushButton(i18n("Do&wnload..."), hbBtns);
   connect( btnDl, SIGNAL(clicked()), this, SLOT(hlDownload()) );
 
-  hlCombo->setCurrentItem( 0 );
-  hlChanged(0);
+  int currentHl = m_doc ? m_doc->hlMode() : 0;
+  hlCombo->setCurrentItem( currentHl );
+  hlChanged( currentHl );
 
   QWhatsThis::add( hlCombo, i18n(
         "Choose a <em>Syntax Highlight mode</em> from this list to view its "
--- branches/KDE/3.5/kdelibs/kate/part/katedialogs.h #557592:557593
@@ -310,7 +310,7 @@
   Q_OBJECT
 
   public:
-    KateHlConfigPage (QWidget *parent);
+    KateHlConfigPage (QWidget *parent, KateDocument *doc);
     ~KateHlConfigPage ();
 
   public slots:
@@ -335,6 +335,8 @@
 
     QIntDict<KateHlData> hlDataDict;
     KateHlData *hlData;
+
+	KateDocument *m_doc;
 };
 
 class KateHlDownloadDialog: public KDialogBase
--- branches/KDE/3.5/kdelibs/kate/part/katedocument.cpp #557592:557593
@@ -402,7 +402,7 @@
       return new KateSaveConfigTab (parent);
 
     case 6:
-      return new KateHlConfigPage (parent);
+      return new KateHlConfigPage (parent, this);
 
     case 7:
       return new KateFileTypeConfigTab (parent);
Comment 4 Andreas Kling 2006-07-03 21:53:12 UTC
SVN commit 557677 by kling:

Forward-port of SVN commit 557593 by kling: 
 
Make the current document's highlighting mode selected when the highlighting config page opens. 
   
CCBUG: 123505



 M  +5 -4      katedialogs.cpp  
 M  +3 -1      katedialogs.h  
 M  +1 -1      kateglobal.cpp  


--- trunk/KDE/kdelibs/kate/part/katedialogs.cpp #557676:557677
@@ -950,9 +950,10 @@
 //END KateScriptConfigPage
 
 //BEGIN KateHlConfigPage
-KateHlConfigPage::KateHlConfigPage (QWidget *parent)
+KateHlConfigPage::KateHlConfigPage (QWidget *parent, KateDocument *doc)
  : KateConfigPage (parent, "")
  , m_currentHlData (-1)
+ , m_doc (doc)
 {
   ui = new Ui::HlConfigWidget();
   ui->setupUi( this );
@@ -964,15 +965,15 @@
     else
       ui->cmbHl->addItem(KateHlManager::self()->hlNameTranslated(i));
   }
-  ui->cmbHl->setCurrentIndex(0);
 
   ui->btnMimeTypes->setIcon(QIcon(SmallIcon("wizard")));
   connect( ui->btnMimeTypes, SIGNAL(clicked()), this, SLOT(showMTDlg()) );
   connect( ui->btnDownload, SIGNAL(clicked()), this, SLOT(hlDownload()) );
   connect( ui->cmbHl, SIGNAL(activated(int)), this, SLOT(hlChanged(int)) );
 
-  ui->cmbHl->setCurrentIndex( 0 );
-  hlChanged(0);
+  int currentHl = m_doc ? m_doc->hlMode() : 0;
+  ui->cmbHl->setCurrentIndex( currentHl );
+  hlChanged( currentHl );
 
   // What's This? help is in the ui-file
 
--- trunk/KDE/kdelibs/kate/part/katedialogs.h #557676:557677
@@ -314,7 +314,7 @@
   Q_OBJECT
 
   public:
-    KateHlConfigPage (QWidget *parent);
+    KateHlConfigPage (QWidget *parent, KateDocument *doc);
     ~KateHlConfigPage ();
 
   public Q_SLOTS:
@@ -335,6 +335,8 @@
 
     QHash<int,KateHlData> hlDataDict;
     int m_currentHlData;
+
+    KateDocument *m_doc;
 };
 
 class KateHlDownloadDialog: public KDialog
--- trunk/KDE/kdelibs/kate/part/kateglobal.cpp #557676:557677
@@ -329,7 +329,7 @@
       return new KateSaveConfigTab (parent);
 
     case 6:
-      return new KateHlConfigPage (parent);
+      return new KateHlConfigPage (parent, 0);
 
     case 7:
       return new KateFileTypeConfigTab (parent);