#include "office.h"
#include "listview.h"
#include "sslexception.h"
+#include "misc.h"
#include <QByteArray>
#include <QCheckBox>
fdlg.setDefaultSuffix("mshk");
fdlg.setAcceptMode(QFileDialog::AcceptSave);
fdlg.setFileMode(QFileDialog::AnyFile);
+ fdlg.setDirectory(currentDir());
if(!fdlg.exec())return;
fn=fdlg.selectedFiles();
if(fn.size()!=1)return;
+ setCurrentDir(fn[0]);
QFile fd(fn[0]);
if(!fd.open(QIODevice::WriteOnly|QIODevice::Truncate)){
QMessageBox::warning(this,tr("Warning"),tr("Unable to open file %1 for writing: %2").arg(fn[0]).arg(fd.errorString()));
fdlg.setDefaultSuffix("mshk");
fdlg.setAcceptMode(QFileDialog::AcceptOpen);
fdlg.setFileMode(QFileDialog::ExistingFile);
+ fdlg.setDirectory(currentDir());
if(!fdlg.exec())return;
fn=fdlg.selectedFiles();
if(fn.size()!=1)return;
+ setCurrentDir(fn[0]);
QFile fd(fn[0]);
if(!fd.open(QIODevice::ReadOnly)){
QMessageBox::warning(this,tr("Warning"),tr("Unable to open file %1 for reading: %2").arg(fn[0]).arg(fd.errorString()));
void MAppStyleDialog::selectCSS()
{
- QString s=QFileDialog::getOpenFileName(this,tr("Select Stylesheet"));
- if(s!="")css->setText(s);
+ QString s=QFileDialog::getOpenFileName(this,tr("Select Stylesheet"),currentDir());
+ if(s!=""){
+ css->setText(s);
+ setCurrentDir(s);
+ }
}
void MAppStyleDialog::save()
fd.setConfirmOverwrite(true);
fd.setFilter(tr("Open Document File (*.%1)").arg(tf.targetExtension()));
fd.setDefaultSuffix(tf.targetExtension());
+ fd.setDirectory(currentDir());
QString fname;
if(fd.exec()){
QStringList fn=fd.selectedFiles();
if(fn.size()<1)return;
fname=fn[0];
+ setCurrentDir(fname);
}
MOdtSignalRenderer rend(tf);
connect(&rend,SIGNAL(getVariable(QString,QVariant&)), this,SLOT(getVariable(QString,QVariant&)));
fd.setConfirmOverwrite(true);
fd.setFilter(tr("Open Document File (*.%1)").arg(tf.targetExtension()));
fd.setDefaultSuffix(tf.targetExtension());
+ fd.setDirectory(currentDir());
QString fname;
if(fd.exec()){
QStringList fn=fd.selectedFiles();
if(fn.size()<1)return;
fname=fn[0];
+ setCurrentDir(fname);
}
//mark order as shipped?
if(m_order.status()==MOOrder::Placed)
if(fn.isEmpty())return;
QFileInfo fi(fn);
//it is already a directory
- if(fi.isDir())QSettings().setValue("lastUsedDirectory",fn);
+ if(fi.isDir())QSettings().setValue("lastUsedDirectory",fi.absoluteFilePath());
//it is probably a file
else {
//get parent directory name
#include <QPushButton>
#include <QStandardItemModel>
#include <QTableView>
+#include <misc.h>
MUserTab::MUserTab(QString pk)
{
fdlg.setDefaultSuffix("mshk");
fdlg.setAcceptMode(QFileDialog::AcceptSave);
fdlg.setFileMode(QFileDialog::AnyFile);
+ fdlg.setDirectory(currentDir());
if(!fdlg.exec())return;
fn=fdlg.selectedFiles();
if(fn.size()!=1)return;
+ setCurrentDir(fn[0]);
QFile fd(fn[0]);
if(!fd.open(QIODevice::WriteOnly|QIODevice::Truncate)){
QMessageBox::warning(this,tr("Warning"),tr("Unable to open file %1 for writing: %2").arg(fn[0]).arg(fd.errorString()));
fdlg.setDefaultSuffix("mshk");
fdlg.setAcceptMode(QFileDialog::AcceptOpen);
fdlg.setFileMode(QFileDialog::ExistingFile);
+ fdlg.setDirectory(currentDir());
if(!fdlg.exec())return;
fn=fdlg.selectedFiles();
if(fn.size()!=1)return;
+ setCurrentDir(fn[0]);
QFile fd(fn[0]);
if(!fd.open(QIODevice::ReadOnly)){
QMessageBox::warning(this,tr("Warning"),tr("Unable to open file %1 for reading: %2").arg(fn[0]).arg(fd.errorString()));
fdlg.setDefaultSuffix("mshh");
fdlg.setAcceptMode(QFileDialog::AcceptSave);
fdlg.setFileMode(QFileDialog::AnyFile);
+ fdlg.setDirectory(currentDir());
if(!fdlg.exec())return;
fn=fdlg.selectedFiles();
if(fn.size()!=1)return;
+ setCurrentDir(fn[0]);
QFile fd(fn[0]);
if(!fd.open(QIODevice::WriteOnly|QIODevice::Truncate)){
QMessageBox::warning(this,tr("Warning"),tr("Unable to open file %1 for writing: %2").arg(fn[0]).arg(fd.errorString()));
#include <QComboBox>
#include <QDebug>
#include <QFile>
-#include <QFileDialog>
#include <QGroupBox>
#include <QInputDialog>
#include <QLabel>
#include <QComboBox>
#include <QDebug>
#include <QFile>
-#include <QFileDialog>
#include <QGroupBox>
#include <QInputDialog>
#include <QLabel>
if(fn!=""){
d->mFileName=fn;
saveFile(fn);
+ setCurrentDir(fn);
}
}
//
#include "office.h"
+#include "misc.h"
#include <QBoxLayout>
#include <QCheckBox>
proc.waitForFinished();
//copy file
if(QSettings().value("officePrinterSave",false).toBool()){
- QString fn=QFileDialog::getSaveFileName(0,QCoreApplication::translate("office","Save current document as..."));
+ QString fn=QFileDialog::getSaveFileName(0,QCoreApplication::translate("office","Save current document as..."),currentDir());
if(fn=="")return;
QFile(fn).remove();
QFile(fname).copy(fn);
+ setCurrentDir(fn);
}
}
void MOfficeConfig::selectpath()
{
QString np=QFileDialog::getOpenFileName(this,tr("Select OpenOffice.org executable"),QFileInfo(oopath->text()).dir().absolutePath());
- if(np!="")oopath->setText(np);
+ if(np!=""){
+ oopath->setText(np);
+ setCurrentDir(np);
+ }
}
#include "ticketedit.h"
#include "odfedit.h"
#include "flagedit.h"
+#include "misc.h"
#include <QBoxLayout>
#include <QComboBox>
QString base=model->data(bidx,BASEROLE).toString();
if(base=="")return;
//query file name
- QString fn=QFileDialog::getOpenFileName(this,tr("Select Template File"));
+ QString fn=QFileDialog::getOpenFileName(this,tr("Select Template File"),currentDir());
if(fn=="")return;
+ setCurrentDir(fn);
//check extension
QString ext=QFileInfo(fn).completeSuffix();
if(!MTemplate::legalSuffixes(base).contains(ext)){
QFileDialog fd(this,tr("Save template as..."));
fd.setAcceptMode(QFileDialog::AcceptSave);
fd.setDefaultSuffix(tmp.extension());
+ fd.setDirectory(currentDir());
fd.selectFile(tmp.baseName());
if(fd.exec()!=QDialog::Accepted)
return;
nfn=fd.selectedFiles().at(0);
if(nfn=="")return;
+ setCurrentDir(nfn);
}
//store it
if(!QFile::copy(fn,nfn))
void MTicketEditor::openFile()
{
- QString fn=QFileDialog::getOpenFileName(this,tr("Open Ticket Template"));
+ QString fn=QFileDialog::getOpenFileName(this,tr("Open Ticket Template"),currentDir());
if(fn!=""){
d->mFileName=fn;
loadFile(fn);
+ setCurrentDir(fn);
}
}
if(fn!=""){
d->mFileName=fn;
saveFile(fn);
+ setCurrentDir(fn);
}
}
void MTicketEditor::addFile()
{
- QString fn=QFileDialog::getOpenFileName(this,tr("Add File to Label"));
+ QString fn=QFileDialog::getOpenFileName(this,tr("Add File to Label"),currentDir());
if(fn=="")return;
+ setCurrentDir(fn);
//try to read it
QFile fd(fn);
if(!fd.open(QIODevice::ReadOnly)){