WIP: Tabbed options interface

This commit is contained in:
Floris Bos 2023-09-22 23:51:36 +02:00
parent 4c71a2294e
commit 6eb358ed75
3 changed files with 343 additions and 313 deletions

View file

@ -790,10 +790,22 @@ QByteArray ImageWriter::getUsbSourceOSlist()
#endif
}
QString ImageWriter::_pubKeyFileName()
{
return QDir::homePath()+"/.ssh/id_rsa.pub";
}
QString ImageWriter::_privKeyFileName()
{
QString fn = _pubKeyFileName();
fn.chop(4);
return fn;
}
QString ImageWriter::getDefaultPubKey()
{
QByteArray pubkey;
QFile pubfile(QDir::homePath()+"/.ssh/id_rsa.pub");
QFile pubfile(_pubKeyFileName());
if (pubfile.exists() && pubfile.open(QFile::ReadOnly))
{
@ -804,6 +816,26 @@ QString ImageWriter::getDefaultPubKey()
return pubkey;
}
bool ImageWriter::hasPubKey()
{
return QFile::exists(_pubKeyFileName());
}
bool ImageWriter::hasSshKeyGen()
{
return true;
}
void ImageWriter::generatePubKey()
{
if (!hasPubKey() && !QFile::exists(_privKeyFileName()))
{
QStringList args;
args << "-t" << "rsa" << "-f" << _privKeyFileName() << "-N" << "";
QProcess::execute("ssh-keygen", args);
}
}
QString ImageWriter::getTimezone()
{
return QTimeZone::systemTimeZoneId();