Add flags setting support when creating a partition.
This commit is contained in:
parent
b83e91b951
commit
ada0a080fc
@ -39,6 +39,7 @@
|
|||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
static QSet< FileSystem::Type > s_unmountableFS(
|
static QSet< FileSystem::Type > s_unmountableFS(
|
||||||
{
|
{
|
||||||
@ -83,11 +84,46 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||||||
// Connections
|
// Connections
|
||||||
connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) );
|
connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) );
|
||||||
connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) );
|
connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) );
|
||||||
|
|
||||||
|
setupFlagsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatePartitionDialog::~CreatePartitionDialog()
|
CreatePartitionDialog::~CreatePartitionDialog()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
PartitionTable::Flags
|
||||||
|
CreatePartitionDialog::newFlags() const
|
||||||
|
{
|
||||||
|
PartitionTable::Flags flags;
|
||||||
|
|
||||||
|
for ( int i = 0; i < m_ui->m_listFlags->count(); i++ )
|
||||||
|
if ( m_ui->m_listFlags->item( i )->checkState() == Qt::Checked )
|
||||||
|
flags |= static_cast< PartitionTable::Flag >(
|
||||||
|
m_ui->m_listFlags->item( i )->data( Qt::UserRole ).toInt() );
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CreatePartitionDialog::setupFlagsList()
|
||||||
|
{
|
||||||
|
int f = 1;
|
||||||
|
QString s;
|
||||||
|
while ( !( s = PartitionTable::flagName( static_cast< PartitionTable::Flag >( f ) ) ).isEmpty() )
|
||||||
|
{
|
||||||
|
QListWidgetItem* item = new QListWidgetItem( s );
|
||||||
|
m_ui->m_listFlags->addItem( item );
|
||||||
|
item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled );
|
||||||
|
item->setData( Qt::UserRole, f );
|
||||||
|
item->setCheckState( Qt::Unchecked );
|
||||||
|
|
||||||
|
f <<= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CreatePartitionDialog::initMbrPartitionTypeUi()
|
CreatePartitionDialog::initMbrPartitionTypeUi()
|
||||||
{
|
{
|
||||||
@ -145,10 +181,11 @@ CreatePartitionDialog::createPartition()
|
|||||||
m_parent,
|
m_parent,
|
||||||
*m_device,
|
*m_device,
|
||||||
m_role,
|
m_role,
|
||||||
fsType, first, last );
|
fsType, first, last, newFlags() );
|
||||||
|
|
||||||
PartitionInfo::setMountPoint( partition, m_ui->mountPointComboBox->currentText() );
|
PartitionInfo::setMountPoint( partition, m_ui->mountPointComboBox->currentText() );
|
||||||
PartitionInfo::setFormat( partition, true );
|
PartitionInfo::setFormat( partition, true );
|
||||||
|
|
||||||
return partition;
|
return partition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
// KPMcore
|
// KPMcore
|
||||||
#include <kpmcore/core/partitionrole.h>
|
#include <kpmcore/core/partitionrole.h>
|
||||||
|
#include <kpmcore/core/partitiontable.h>
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
@ -55,10 +56,13 @@ public:
|
|||||||
void initFromPartitionToCreate( Partition* partition );
|
void initFromPartitionToCreate( Partition* partition );
|
||||||
Partition* createPartition();
|
Partition* createPartition();
|
||||||
|
|
||||||
|
PartitionTable::Flags newFlags() const;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void updateMountPointUi();
|
void updateMountPointUi();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setupFlagsList();
|
||||||
QScopedPointer< Ui_CreatePartitionDialog > m_ui;
|
QScopedPointer< Ui_CreatePartitionDialog > m_ui;
|
||||||
PartitionSizeController* m_partitionSizeController;
|
PartitionSizeController* m_partitionSizeController;
|
||||||
Device* m_device;
|
Device* m_device;
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>425</width>
|
<width>642</width>
|
||||||
<height>208</height>
|
<height>489</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -86,7 +86,7 @@
|
|||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>F&ile System:</string>
|
<string>Fi&le System:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy">
|
<property name="buddy">
|
||||||
<cstring>fsComboBox</cstring>
|
<cstring>fsComboBox</cstring>
|
||||||
@ -132,7 +132,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0">
|
<item row="8" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -175,6 +175,26 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Flags:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QListWidget" name="m_listFlags">
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sortingEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
Reference in New Issue
Block a user