Embedding dialog: use two buttons (will have more) for the actions

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19981 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2007-09-01 20:48:51 +00:00
parent 9b4bd90138
commit 044d958788
3 changed files with 33 additions and 62 deletions

View File

@ -55,14 +55,6 @@ GuiEmbeddedFilesDialog::GuiEmbeddedFilesDialog(GuiEmbeddedFiles * form)
} }
filesLW->setCurrentRow(0); filesLW->setCurrentRow(0);
// //
actionCB->addItem("No action");
actionCB->addItem("Add file");
actionCB->addItem("Extract file");
actionCB->addItem("Extract all");
actionCB->addItem("Embed all");
actionCB->addItem("Embed layout file");
actionCB->addItem("View file");
actionCB->addItem("Edit file");
update(); update();
} }
@ -115,33 +107,10 @@ void GuiEmbeddedFilesDialog::update()
statusGB->setEnabled(enabled); statusGB->setEnabled(enabled);
filesLW->setEnabled(enabled); filesLW->setEnabled(enabled);
fullpathLE->setEnabled(enabled); fullpathLE->setEnabled(enabled);
actionCB->setEnabled(enabled);
actionPB->setEnabled(enabled);
} }
void GuiEmbeddedFilesDialog::on_actionPB_clicked() void GuiEmbeddedFilesDialog::on_addPB_clicked()
{
// FIXME.
// ACTION
QString action = actionCB->currentText();
if (action == "Add file") {
addFile();
} else if (action == "Extract file") {
extractFile();
} else if (action == "Extract all") {
extractAll();
} else if (action == "Embed all") {
} else if (action == "Embed layout file") {
} else if (action == "View file") {
} else if (action == "Edit file") {
} else {
}
}
void GuiEmbeddedFilesDialog::addFile()
{ {
docstring const file = form_->browseFile(); docstring const file = form_->browseFile();
if (!file.empty()) { if (!file.empty()) {
@ -151,25 +120,13 @@ void GuiEmbeddedFilesDialog::addFile()
} }
bool GuiEmbeddedFilesDialog::extractFile() void GuiEmbeddedFilesDialog::on_extractPB_clicked()
{ {
EmbeddedFiles const & files = form_->embeddedFiles(); EmbeddedFiles const & files = form_->embeddedFiles();
QList<QListWidgetItem *> selection = filesLW->selectedItems(); QList<QListWidgetItem *> selection = filesLW->selectedItems();
form_->extract(files[filesLW->row(*selection.begin())]); for (QList<QListWidgetItem*>::iterator it = selection.begin();
} it != selection.end(); ++it)
form_->extract(files[filesLW->row(*it)]);
bool GuiEmbeddedFilesDialog::extractAll()
{
EmbeddedFiles const & files = form_->embeddedFiles();
files.extractAll();
}
void GuiEmbeddedFilesDialog::on_actionCB_stateChanged(int idx)
{
// valid action, enable action button
actionPB->setEnabled(idx != 0);
} }

View File

@ -34,19 +34,15 @@ public Q_SLOTS:
/// ///
void update(); void update();
/// ///
void on_actionPB_clicked();
///
void on_actionCB_stateChanged(int);
///
void on_enableCB_toggled(bool enable); void on_enableCB_toggled(bool enable);
/// ///
void on_autoRB_clicked(); void on_autoRB_clicked();
void on_embeddedRB_clicked(); void on_embeddedRB_clicked();
void on_externalRB_clicked(); void on_externalRB_clicked();
/// ///
void addFile(); void on_addPB_clicked();
bool extractFile(); //
bool extractAll(); void on_extractPB_clicked();
private: private:
void set_embedding_status(EmbeddedFile::STATUS); void set_embedding_status(EmbeddedFile::STATUS);
/// ///

View File

@ -109,22 +109,40 @@
<number>6</number> <number>6</number>
</property> </property>
<item> <item>
<widget class="QComboBox" name="actionCB" > <widget class="QToolButton" name="addPB" >
<property name="toolTip" > <property name="toolTip" >
<string>Actions to perform</string> <string>Add embedded file</string>
</property> </property>
<property name="currentIndex" > <property name="text" >
<number>-1</number> <string>...</string>
</property>
<property name="icon" >
<iconset>../../../../lib/images/file-open.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="actionPB" > <widget class="QToolButton" name="extractPB" >
<property name="toolTip" > <property name="toolTip" >
<string>Extract this file to disk</string> <string>Extract selected file.</string>
</property> </property>
<property name="text" > <property name="text" >
<string>Action!</string> <string>...</string>
</property>
<property name="icon" >
<iconset>../../../../lib/images/depth-increment.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>