From cf9ecebd1f43ef5e8a20627a6488c35e6494086b Mon Sep 17 00:00:00 2001 From: Volker Lanz Date: Sun, 11 Apr 2010 17:16:43 +0000 Subject: [PATCH] turns out which sector alignment is used on import is determined by the app wide default in the settings. well. for now, include the information in the export, but ignore it on import. svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1113752 --- TODO | 3 --- src/core/partitiontable.cpp | 5 +++-- src/gui/mainwindow.cpp | 5 +++++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 7243d54..75d4a65 100644 --- a/TODO +++ b/TODO @@ -9,9 +9,6 @@ Plans and ideas for 1.1: * don't hardcode any support for libparted-related stuff like shrinking fat16 in the file system classes. -* import/export must save the partition alignment used for msdos tables and use - this on import - =============================================================================== Bugs to fix for 1.1: diff --git a/src/core/partitiontable.cpp b/src/core/partitiontable.cpp index 523677a..253d68e 100644 --- a/src/core/partitiontable.cpp +++ b/src/core/partitiontable.cpp @@ -689,8 +689,9 @@ static bool isPartitionLessThan(const Partition* p1, const Partition* p2) QTextStream& operator<<(QTextStream& stream, const PartitionTable& ptable) { - stream << "type: \"" << ptable.typeName() << "\"\n\n" - << "# number start end type roles label flags\n"; + stream << "type: \"" << ptable.typeName() << "\"\n" + << "align: \"" << (ptable.type() == PartitionTable::msdos ? "cylinder" : "sector") << "\"\n" + << "\n# number start end type roles label flags\n"; QList partitions; diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 42b9f89..4cf59d2 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -755,6 +755,7 @@ void MainWindow::onImportPartitionTable() QByteArray line; QRegExp rxPartition("(\\d+);(\\d+);(\\d+);(\\w+);(\\w+);(\"\\w*\");(\"[^\"]*\")"); QRegExp rxType("type:\\s\"(.+)\""); + QRegExp rxAlign("align:\\s\"(cylinder|sector)\""); QRegExp rxMagic("^##|v(\\d+)|##"); quint32 lineNo = 0; bool haveMagic = false; @@ -805,6 +806,10 @@ void MainWindow::onImportPartitionTable() ptable = new PartitionTable(tableType, PartitionTable::defaultFirstUsable(device, tableType), PartitionTable::defaultLastUsable(device, tableType)); operationStack().push(new CreatePartitionTableOperation(device, ptable)); } + else if (rxAlign.indexIn(line) != -1) + { + // currently ignored + } else if (rxPartition.indexIn(line) != -1) { if (ptable == NULL)