summaryrefslogtreecommitdiffstats
path: root/src/qphotorec.cpp
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-06-08 11:54:01 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2013-06-08 11:54:01 +0200
commit7ce34a8d4b666a89dd27ae8dbd17f0d46aa16c1a (patch)
tree986477cdc69147b693821d3096a5fc817ee29ce8 /src/qphotorec.cpp
parentf67077828925dec1330dc78e00a8e025a4a0ef2e (diff)
QPhotoRec: select the disk image after addition if no disk was present
Diffstat (limited to 'src/qphotorec.cpp')
-rw-r--r--src/qphotorec.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/qphotorec.cpp b/src/qphotorec.cpp
index b879350..2e00b05 100644
--- a/src/qphotorec.cpp
+++ b/src/qphotorec.cpp
@@ -148,7 +148,10 @@ void QPhotorec::newSourceFile()
{
QByteArray filenameArray= (filename).toUtf8();
list_disk=insert_new_disk(list_disk, file_test_availability(filenameArray.constData(), options->verbose, testdisk_mode));
+ if(list_disk!=NULL)
+ select_disk(list_disk->disk);
HDDlistWidget_updateUI();
+ PartListWidget_updateUI();
}
}
@@ -260,6 +263,19 @@ void QPhotorec::PartListWidget_updateUI()
PartListWidget->resizeColumnsToContents();
}
+void QPhotorec::select_disk(disk_t *disk)
+{
+ if(disk==NULL)
+ return ;
+ selected_disk=disk;
+ selected_partition=NULL;
+ autodetect_arch(selected_disk, &arch_none);
+ log_info("%s\n", selected_disk->description_short(selected_disk));
+ part_free_list(list_part);
+ list_part=init_list_part(selected_disk, NULL);
+ log_all_partitions(selected_disk, list_part);
+}
+
void QPhotorec::disk_changed(int index)
{
int i;
@@ -270,13 +286,7 @@ void QPhotorec::disk_changed(int index)
{
if(i==index)
{
- selected_disk=element_disk->disk;
- selected_partition=NULL;
- autodetect_arch(selected_disk, &arch_none);
- log_info("%s\n", selected_disk->description_short(selected_disk));
- part_free_list(list_part);
- list_part=init_list_part(selected_disk, NULL);
- log_all_partitions(selected_disk, list_part);
+ select_disk(element_disk->disk);
PartListWidget_updateUI();
return;
}