Commit 565623e9 authored by Ingemar Ceicer's avatar Ingemar Ceicer

Save hash sum


Former-commit-id: a0ecb14f
parent 2334e803
......@@ -39,6 +39,7 @@ Hash::Hash(QWidget *parent) :
connect(ui->actionOpenHashSumList, SIGNAL(triggered()), this, SLOT(openHashSumList()));
connect(ui->actionOpenComparisonList, SIGNAL(triggered()), this, SLOT(openComparisonList()));
connect(ui->actionCreateChecksumLists, SIGNAL(triggered()), this, SLOT(checkSumLists())); //Rekursivt
// Save
// Recent Files, undermeny
connect(ui->menuRecentFiles,SIGNAL(aboutToShow()),this,SLOT(slotRecentFiles()));
connect(ui->actionCreateDebianMd5sums, SIGNAL(triggered()), this, SLOT(createDebianMd5sums()));
......@@ -132,7 +133,7 @@ void Hash::openFile()
QString content = stream.readAll();
file2.close();
d = new QDialog;
Ui::Lic *ui2 = new Ui::Lic;
ui2 = new Ui::Lic;
ui2->setupUi(d);
ui2->textBrowser->setFixedWidth(800);
ui2->pbOpenFile->setGeometry(298,470,100,24);
......@@ -894,6 +895,7 @@ void Hash::versionhistory()
void Hash::stang()
{
delete ui2;
delete d;
}
......@@ -3214,7 +3216,8 @@ void Hash::dropEvent(QDropEvent *ev)
QString qsalgorithm = QString::fromStdString(algorithm);
delete k;
d = new QDialog;
Ui::Lic *ui2 = new Ui::Lic;
// Ui::Lic *ui2 = new Ui::Lic;
ui2 = new Ui::Lic;
ui2->setupUi(d);
const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
ui2->textBrowser->setFont(fixedFont);
......@@ -3225,7 +3228,7 @@ void Hash::dropEvent(QDropEvent *ev)
ui2->textBrowser->append(lista->at(i)+" "+fillista.at(i));
// ui2->textBrowser->moveCursor (QTextCursor::End);
}
ui2->pbOpenFile->hide();
// ui2->pbOpenFile->hide();
// ui2->pbClose->setGeometry(450,570,100,24);
// d->setWindowFlags(Qt::CustomizeWindowHint);
d->setWindowFlags(Qt::WindowSystemMenuHint);
......@@ -3235,8 +3238,70 @@ void Hash::dropEvent(QDropEvent *ev)
connect(ui2->pbClose, SIGNAL(clicked()), this, SLOT(stang()));
// d->setWindowModality(Qt::NonModal);
d->show();
// QString s = ui2->textBrowser->toPlainText();
connect(ui2->pbOpenFile, SIGNAL(pressed()), this, SLOT(save2()));
// QMessageBox::information(this,"TEST",s);
}
}
void Hash::save()
{
QFileDialog *dialog = new QFileDialog(this, tr("Save the hash summary list as a text file"), QDir::homePath(), tr("Any file (*)"));
}
void Hash::save2()
{
QString conf_file_name = QDir::toNativeSeparators("/" APPLICATION_NAME ".conf");
k = new Config(conf_file_name);
QString sokvag;
std::string save_path = k->getConf("save_path");
QString qsave_path = QString::fromStdString(save_path);
QFileInfo info(qsave_path);
if (info.isReadable())
sokvag = qsave_path;
else
sokvag = QDir::homePath();
std::string usenativedialogs = k->getConf("usenativedialogs");
QString textBrowserText = ui2->textBrowser->toPlainText();
QFileDialog *dialog = new QFileDialog(this, tr("Save the hash summary list as a text file"), sokvag, tr("Any file (*)"));
/* dialog->setAcceptMode(QFileDialog::AcceptSave);
dialog->setFileMode(QFileDialog::AnyFile);
dialog->setViewMode(QFileDialog::Detail);
dialog->setWindowTitle("PRUTT");
qDebug() << "usenativedialogs: " << QString::fromStdString(usenativedialogs);
if (usenativedialogs == "0")
dialog->setOption(QFileDialog::DontUseNativeDialog,true);
else if (usenativedialogs == "1")
dialog->setOption(QFileDialog::DontUseNativeDialog,false);*/
//dialog->setWindowTitle(APPLICATION_NAME " " VERSION);
QString fileName;
// if (dialog->exec())
// {
fileName = dialog->getSaveFileName(); // HÄR?
dialog->selectFile(fileName);
dialog->setAcceptMode(QFileDialog::AcceptSave);
dialog->setFileMode(QFileDialog::AnyFile);
dialog->setViewMode(QFileDialog::Detail);
dialog->setWindowTitle("PRUTT");
qDebug() << "usenativedialogs: " << QString::fromStdString(usenativedialogs);
if (usenativedialogs == "0")
dialog->setOption(QFileDialog::DontUseNativeDialog,true);
else if (usenativedialogs == "1")
dialog->setOption(QFileDialog::DontUseNativeDialog,false);
qDebug() << "filename: " << fileName;
QFile file( fileName );
if ( file.open(QIODevice::WriteOnly ) )
{
QTextStream stream( &file );
stream << textBrowserText << endl;
}
QDir dir;
dir = dialog->directory();
QString directoryName = dir.path();
k->setConf("save_path",directoryName.toStdString());
// }
delete k;
}
void Hash::dragEnterEvent(QDragEnterEvent *ev)
{
ev->accept();
......
......@@ -87,6 +87,7 @@ protected:
private:
Ui::Hash *ui;
Ui::Lic *ui2;
Config *k;
QDialog *d;
......@@ -177,6 +178,9 @@ private slots:
void openComparisonList();
void openFile();
void save();
void save2();
public slots:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -114,7 +114,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Open File</string>
<string>Save</string>
</property>
</widget>
</item>
......
File mode changed from 100755 to 100644
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment