1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
/*
*
* $Id: sourceheader 380067 2005-01-19 13:03:46Z trueg $
* Copyright (C) 2005 Sebastian Trueg <trueg@k3b.org>
*
* This file is part of the K3b project.
* Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* See the file "COPYING" for the exact licensing terms.
*/
#include "k3bdatasessionimportdialog.h"
#include "k3bmediaselectioncombobox.h"
#include <k3bdatadoc.h>
#include <k3bapplication.h>
#include <k3biso9660.h>
#include <k3bmediacache.h>
#include <k3b.h>
#include <tqpushbutton.h>
#include <tqcursor.h>
#include <tqapplication.h>
#include <klocale.h>
#include <kmessagebox.h>
K3bDataSessionImportDialog::K3bDataSessionImportDialog( TQWidget* tqparent )
: KDialogBase( tqparent,
"session_import_dialog",
true,
i18n("Session Import"),
KDialogBase::Ok|KDialogBase::Cancel,
KDialogBase::Ok,
false )
{
m_comboMedia = new K3bMediaSelectionComboBox( this );
setMainWidget( m_comboMedia );
connect( m_comboMedia, TQT_SIGNAL(selectionChanged(K3bDevice::Device*)),
this, TQT_SLOT(slotSelectionChanged(K3bDevice::Device*)) );
}
K3bDataSessionImportDialog::~K3bDataSessionImportDialog()
{
}
void K3bDataSessionImportDialog::importSession( K3bDataDoc* doc )
{
m_doc = doc;
if( doc ) {
m_comboMedia->setWantedMediumType( m_doc->type() == K3bDoc::DVD
? K3bDevice::MEDIA_WRITABLE_DVD
: K3bDevice::MEDIA_WRITABLE_CD );
}
else
m_comboMedia->setWantedMediumType( K3bDevice::MEDIA_WRITABLE );
m_comboMedia->setWantedMediumState( K3bDevice::STATE_INCOMPLETE );
slotSelectionChanged( m_comboMedia->selectedDevice() );
}
void K3bDataSessionImportDialog::slotOk()
{
// find the selected device, show a busy mouse cursor and call K3bDataDoc::importSession
if( K3bDevice::Device* dev = m_comboMedia->selectedDevice() ) {
TQApplication::setOverrideCursor( TQCursor(TQt::WaitCursor) );
//
// Mkisofs does not properly import joliet filenames from an old session
//
// See bug 79215 for details
//
K3bIso9660 iso( dev );
if( iso.open() ) {
if( iso.firstRRDirEntry() == 0 && iso.jolietLevel() > 0 )
KMessageBox::sorry( this,
i18n("<p>K3b found session containing Joliet information for long filenames "
"but no Rock Ridge extensions."
"<p>The filenames in the imported session will be converted to a restricted "
"character set in the new session. This character set is based on the ISO9660 "
"settings in the K3b project. K3b is not able to display these converted filenames yet."),
i18n("Session Import Warning") );
iso.close();
}
if( !m_doc ) {
if( k3bappcore->mediaCache()->diskInfo( dev ).isDvdMedia() )
m_doc = static_cast<K3bDataDoc*>( k3bappcore->k3bMainWindow()->slotNewDvdDoc() );
else
m_doc = static_cast<K3bDataDoc*>( k3bappcore->k3bMainWindow()->slotNewDataDoc() );
}
m_doc->setBurner( dev );
m_doc->importSession( dev );
TQApplication::restoreOverrideCursor();
done( 0 );
}
else
done( 1 );
}
void K3bDataSessionImportDialog::slotCancel()
{
KDialogBase::slotCancel();
}
void K3bDataSessionImportDialog::slotSelectionChanged( K3bDevice::Device* dev )
{
actionButton( KDialogBase::Ok )->setEnabled( dev != 0 );
}
K3bDataDoc* K3bDataSessionImportDialog::importSession( K3bDataDoc* doc, TQWidget* tqparent )
{
K3bDataSessionImportDialog dlg( tqparent );
dlg.importSession( doc );
dlg.exec();
return dlg.m_doc;
}
#include "k3bdatasessionimportdialog.moc"
|