File indexing completed on 2024-04-28 05:46:32
0001 /* 0002 SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2014-2016 Andrius Štikonas <andrius@stikonas.eu> 0004 0005 SPDX-License-Identifier: GPL-3.0-or-later 0006 */ 0007 0008 #include "gui/insertdialog.h" 0009 #include "gui/sizedialogwidget.h" 0010 #include "gui/sizedetailswidget.h" 0011 0012 #include <core/partition.h> 0013 0014 #include <fs/filesystem.h> 0015 0016 #include <ops/resizeoperation.h> 0017 0018 #include <KConfigGroup> 0019 #include <KLocalizedString> 0020 #include <KSharedConfig> 0021 0022 /** Creates a new InsertDialog instance. 0023 @param parent the parent widget 0024 @param device the Device the Partition to insert is on 0025 @param insertedPartition the Partition to insert 0026 @param destpartition the Partition the new one is to be inserted to 0027 */ 0028 InsertDialog::InsertDialog(QWidget* parent, Device& device, Partition& insertedPartition, const Partition& destpartition) : 0029 SizeDialogBase(parent, device, insertedPartition, destpartition.firstSector(), destpartition.lastSector()), 0030 m_DestPartition(destpartition) 0031 { 0032 setWindowTitle(xi18nc("@title:window", "Insert a partition")); 0033 0034 partition().move(destPartition().firstSector()); 0035 partition().fileSystem().move(destPartition().fileSystem().firstSector()); 0036 0037 dialogWidget().hideRole(); 0038 dialogWidget().hideFileSystem(); 0039 dialogWidget().hideLabel(); 0040 0041 setupDialog(); 0042 setupConstraints(); 0043 setupConnections(); 0044 0045 KConfigGroup kcg(KSharedConfig::openConfig(), QStringLiteral("insertDialog")); 0046 restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray())); 0047 } 0048 0049 /** Destroys an InsertDialog instance */ 0050 InsertDialog::~InsertDialog() 0051 { 0052 KConfigGroup kcg(KSharedConfig::openConfig(), QStringLiteral("insertDialog")); 0053 kcg.writeEntry("Geometry", saveGeometry()); 0054 } 0055 0056 bool InsertDialog::canGrow() const 0057 { 0058 return ResizeOperation::canGrow(&partition()); 0059 }