Fix unreported bug related to 3246 by Richard Heck:

"View" button in TeX information dialog not enabled when file is selected with the keyboard. Problem was that SIGNAL itemSelectionChanged was not connected to anything. Also made some minor stylistic changes to the code.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17614 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-03-28 16:58:08 +00:00
parent ae4db7543f
commit 2b0e8a0d9b
3 changed files with 21 additions and 24 deletions

View File

@ -48,15 +48,15 @@ void QTexinfo::build_dialog()
void QTexinfo::updateStyles(ControlTexinfo::texFileSuffix whichStyle)
{
ContentsType & data = texdata_[whichStyle];
bool const withFullPath = dialog_->path->isChecked();
bool const withFullPath = dialog_->pathCB->isChecked();
getTexFileList(whichStyle, data, withFullPath);
dialog_->fileList->clear();
dialog_->fileListLW->clear();
ContentsType::const_iterator it = data.begin();
ContentsType::const_iterator end = data.end();
for (; it != end; ++it)
dialog_->fileList->addItem(toqstr(*it));
dialog_->fileListLW->addItem(toqstr(*it));
activeStyle = whichStyle;
}

View File

@ -34,12 +34,13 @@ QTexinfoDialog::QTexinfoDialog(QTexinfo * form)
form, SLOT(slotClose()));
connect( viewPB, SIGNAL( clicked() ), this, SLOT( viewClicked() ) );
connect( whatStyle, SIGNAL( activated(const QString&) ), this, SLOT( enableViewPB() ) );
connect( whatStyle, SIGNAL( activated(int) ), this, SLOT( update() ) );
connect( path, SIGNAL( stateChanged(int) ), this, SLOT( update() ) );
connect( whatStyleCO, SIGNAL( activated(const QString&) ), this, SLOT( enableViewPB() ) );
connect( whatStyleCO, SIGNAL( activated(int) ), this, SLOT( update() ) );
connect( pathCB, SIGNAL( stateChanged(int) ), this, SLOT( update() ) );
connect( rescanPB, SIGNAL( clicked() ), this, SLOT( enableViewPB() ) );
connect( rescanPB, SIGNAL( clicked() ), this, SLOT( rescanClicked() ) );
connect( fileList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( enableViewPB() ) );
connect( fileListLW, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( enableViewPB() ) );
connect( fileListLW, SIGNAL( itemSelectionChanged() ), this, SLOT( enableViewPB() ) );
}
@ -67,10 +68,10 @@ void QTexinfoDialog::rescanClicked()
void QTexinfoDialog::viewClicked()
{
vector<string>::size_type const fitem = fileList->currentRow();
vector<string>::size_type const fitem = fileListLW->currentRow();
vector<string> const & data = form_->texdata_[form_->activeStyle];
string file = data[fitem];
if (!path->isChecked())
if (!pathCB->isChecked())
file = getTexFileFromList(data[fitem],
form_->controller().getFileType(form_->activeStyle));
form_->controller().viewFile(file);
@ -79,7 +80,7 @@ void QTexinfoDialog::viewClicked()
void QTexinfoDialog::update()
{
switch (whatStyle->currentIndex()) {
switch (whatStyleCO->currentIndex()) {
case 0:
form_->updateStyles(ControlTexinfo::cls);
break;
@ -99,7 +100,7 @@ void QTexinfoDialog::update()
void QTexinfoDialog::enableViewPB()
{
viewPB->setEnabled(fileList->currentRow() > -1);
viewPB->setEnabled(fileListLW->currentRow() > -1);
}
} // namespace frontend

View File

@ -1,7 +1,4 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>QTexinfoUi</class>
<widget class="QDialog" name="QTexinfoUi" >
<property name="geometry" >
@ -26,7 +23,7 @@
<number>6</number>
</property>
<item row="1" column="0" >
<widget class="QListWidget" name="fileList" />
<widget class="QListWidget" name="fileListLW" />
</item>
<item row="3" column="0" >
<layout class="QHBoxLayout" >
@ -122,7 +119,7 @@
<number>6</number>
</property>
<item>
<widget class="QComboBox" name="whatStyle" >
<widget class="QComboBox" name="whatStyleCO" >
<property name="toolTip" >
<string>Selected classes or styles</string>
</property>
@ -160,7 +157,7 @@
</spacer>
</item>
<item>
<widget class="QCheckBox" name="path" >
<widget class="QCheckBox" name="pathCB" >
<property name="toolTip" >
<string>Toggles view of the file list</string>
</property>
@ -173,18 +170,17 @@
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<includes>
<include location="local" >qt_helpers.h</include>
</includes>
<tabstops>
<tabstop>whatStyle</tabstop>
<tabstop>path</tabstop>
<tabstop>fileList</tabstop>
<tabstop>whatStyleCO</tabstop>
<tabstop>pathCB</tabstop>
<tabstop>fileListLW</tabstop>
<tabstop>rescanPB</tabstop>
<tabstop>viewPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
<includes>
<include location="local" >qt_helpers.h</include>
</includes>
<resources/>
<connections/>
</ui>