By default, Bugzilla does not search the list of RESOLVED bugs.
You can force it to do so by putting the upper-case word ALL in front of your search query, e.g.: ALL tdelibs
We recommend searching for bugs this way, as you may discover that your bug has already been resolved and fixed in a later release. View | Details | Raw Unified | Return to bug 1030
Collapse All | Expand All

(-)ark/addition.ui (+9 lines)
Lines 16-21 Link Here
16
        <property name="name">
16
        <property name="name">
17
            <cstring>unnamed</cstring>
17
            <cstring>unnamed</cstring>
18
        </property>
18
        </property>
19
20
        <widget class="TQCheckBox">
21
            <property name="name">
22
                <cstring>kcfg_askCreatePassword</cstring>
23
            </property>
24
            <property name="text">
25
                <string>Ask for &amp;password when create archive if possible</string>
26
            </property>
27
        </widget>
19
        <widget class="TQCheckBox">
28
        <widget class="TQCheckBox">
20
            <property name="name">
29
            <property name="name">
21
                <cstring>kcfg_replaceOnlyWithNewer</cstring>
30
                <cstring>kcfg_replaceOnlyWithNewer</cstring>
(-)ark/arch.cpp (-3 / +66 lines)
Lines 33-38 Link Here
33
// QT includes
33
// QT includes
34
#include <tqapplication.h>
34
#include <tqapplication.h>
35
#include <tqfile.h>
35
#include <tqfile.h>
36
#include <tqtextcodec.h>
36
37
37
// KDE includes
38
// KDE includes
38
#include <kdebug.h>
39
#include <kdebug.h>
Lines 59-64 Link Here
59
#include "ar.h"
60
#include "ar.h"
60
#include "sevenzip.h"
61
#include "sevenzip.h"
61
#include "ace.h"
62
#include "ace.h"
63
#include "arj.h"
62
64
63
Arch::ArchColumns::ArchColumns( int col, TQRegExp reg, int length, bool opt )
65
Arch::ArchColumns::ArchColumns( int col, TQRegExp reg, int length, bool opt )
64
  : colRef( col ), pattern( reg ), maxLength( length ), optional( opt )
66
  : colRef( col ), pattern( reg ), maxLength( length ), optional( opt )
Lines 288-294 Link Here
288
290
289
    data[ lfChar ] = '\0';
291
    data[ lfChar ] = '\0';
290
292
291
    m_buffer.append( TQString::fromUtf8(data + startChar).latin1() );
293
    m_buffer.append( data + startChar );
292
294
293
    data[ lfChar ] = '\n';
295
    data[ lfChar ] = '\n';
294
    startChar = lfChar + 1;
296
    startChar = lfChar + 1;
Lines 333-344 Link Here
333
  unsigned int pos = 0;
335
  unsigned int pos = 0;
334
  int strpos, len;
336
  int strpos, len;
335
337
338
  QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());
339
  TQTextCodec *codec = TQTextCodec::codecForLocale();
340
  TQString tqunicode_line = codec->toUnicode( line );
341
336
  // Go through our columns, try to pick out data, return silently on failure
342
  // Go through our columns, try to pick out data, return silently on failure
337
  for ( TQPtrListIterator <ArchColumns>col( m_archCols ); col.current(); ++col )
343
  for ( TQPtrListIterator <ArchColumns>col( m_archCols ); col.current(); ++col )
338
  {
344
  {
339
    ArchColumns *curCol = *col;
345
    ArchColumns *curCol = *col;
340
346
341
    strpos = curCol->pattern.search( line, pos );
347
    strpos = curCol->pattern.search( tqunicode_line, pos );
342
    len = curCol->pattern.matchedLength();
348
    len = curCol->pattern.matchedLength();
343
349
344
    if ( ( strpos == -1 ) || ( len > curCol->maxLength ) )
350
    if ( ( strpos == -1 ) || ( len > curCol->maxLength ) )
Lines 354-360 Link Here
354
360
355
    pos = strpos + len;
361
    pos = strpos + len;
356
362
357
    columns[curCol->colRef] = TQString::fromLocal8Bit( line.mid(strpos, len) );
363
    columns[curCol->colRef] = tqunicode_line.mid(strpos, len).utf8();
358
  }
364
  }
359
365
360
366
Lines 388-393 Link Here
388
  return true;
394
  return true;
389
}
395
}
390
396
397
void Arch::test()
398
{
399
    emit sigTest(false);
400
    KMessageBox::information(0, i18n("Not implemented."));
401
}
402
403
void Arch::slotTestExited( KProcess *_kp )
404
{
405
  bool success = ( _kp->normalExit() && ( _kp->exitStatus() == 0 ) );
406
407
  if( !success )
408
  {
409
    if ( passwordRequired() )
410
    {
411
        TQString msg;
412
        if ( !m_password.isEmpty() )
413
            msg = i18n("The password was incorrect. ");
414
        if (KPasswordDialog::getPassword( m_password, msg+i18n("You must enter a password to extract the file:") ) == KPasswordDialog::Accepted )
415
        {
416
            delete _kp;
417
            _kp = m_currentProcess = 0;
418
            clearShellOutput();
419
            test(); // try to test the archive again with a password
420
            return;
421
        }
422
        m_password = "";
423
        emit sigTest( false );
424
        delete _kp;
425
        _kp = m_currentProcess = 0;
426
        return;
427
    }
428
    else if ( m_password.isEmpty() || _kp->exitStatus() > 1 )
429
    {
430
        QApplication::restoreOverrideCursor();
431
432
        TQString msg = i18n( "The test operation failed." );
433
434
        if ( !getLastShellOutput().isNull() )
435
        {
436
            //getLastShellOutput() is a TQString. errorList is expecting TQStringLists to show in multiple lines
437
            TQStringList list = TQStringList::split( "\n", getLastShellOutput() );
438
            KMessageBox::errorList( m_gui, msg, list );
439
            clearShellOutput();
440
        }
441
        else
442
        {
443
            KMessageBox::error( m_gui, msg );
444
        }
445
    }
446
  }
447
  delete _kp;
448
  _kp = m_currentProcess = 0;
449
  emit sigTest( success );
450
}
391
451
392
Arch *Arch::archFactory( ArchType aType,
452
Arch *Arch::archFactory( ArchType aType,
393
                         ArkWidget *parent, const TQString &filename,
453
                         ArkWidget *parent, const TQString &filename,
Lines 422-427 Link Here
422
    case ACE_FORMAT:
482
    case ACE_FORMAT:
423
      return new AceArch( parent, filename );
483
      return new AceArch( parent, filename );
424
484
485
    case ARJ_FORMAT:
486
      return new ArjArch( parent, filename );
487
425
    case UNKNOWN_FORMAT:
488
    case UNKNOWN_FORMAT:
426
    default:
489
    default:
427
      return 0;
490
      return 0;
(-)ark/arch.h (-1 / +7 lines)
Lines 65-71 Link Here
65
65
66
enum ArchType { UNKNOWN_FORMAT, ZIP_FORMAT, TAR_FORMAT, AA_FORMAT,
66
enum ArchType { UNKNOWN_FORMAT, ZIP_FORMAT, TAR_FORMAT, AA_FORMAT,
67
                LHA_FORMAT, RAR_FORMAT, ZOO_FORMAT, COMPRESSED_FORMAT,
67
                LHA_FORMAT, RAR_FORMAT, ZOO_FORMAT, COMPRESSED_FORMAT,
68
                SEVENZIP_FORMAT, ACE_FORMAT };
68
                SEVENZIP_FORMAT, ACE_FORMAT, ARJ_FORMAT };
69
69
70
typedef TQValueList< TQPair< TQString, TQt::AlignmentFlags > > ColumnList;
70
typedef TQValueList< TQPair< TQString, TQt::AlignmentFlags > > ColumnList;
71
71
Lines 101-106 Link Here
101
    virtual void open() = 0;
101
    virtual void open() = 0;
102
    virtual void create() = 0;
102
    virtual void create() = 0;
103
    virtual void remove( TQStringList * ) = 0;
103
    virtual void remove( TQStringList * ) = 0;
104
    virtual void test();
104
105
105
    virtual void addFile( const TQStringList & ) = 0;
106
    virtual void addFile( const TQStringList & ) = 0;
106
    virtual void addDir( const TQString & ) = 0;
107
    virtual void addDir( const TQString & ) = 0;
Lines 150-161 Link Here
150
    static Arch *archFactory( ArchType aType, ArkWidget *parent,
151
    static Arch *archFactory( ArchType aType, ArkWidget *parent,
151
                              const TQString &filename,
152
                              const TQString &filename,
152
                              const TQString &openAsMimeType = TQString() );
153
                              const TQString &openAsMimeType = TQString() );
154
    TQString password() { return m_password; }
155
    void setPassword(const TQString & pw) { m_password = pw.local8Bit(); }
156
    virtual void createPassword() {}
153
157
154
  protected slots:
158
  protected slots:
155
    void slotOpenExited( KProcess* );
159
    void slotOpenExited( KProcess* );
156
    void slotExtractExited( KProcess* );
160
    void slotExtractExited( KProcess* );
157
    void slotDeleteExited( KProcess* );
161
    void slotDeleteExited( KProcess* );
158
    void slotAddExited( KProcess* );
162
    void slotAddExited( KProcess* );
163
    void slotTestExited( KProcess* );
159
164
160
    void slotReceivedOutput( KProcess *, char*, int );
165
    void slotReceivedOutput( KProcess *, char*, int );
161
166
Lines 168-173 Link Here
168
    void sigDelete( bool );
173
    void sigDelete( bool );
169
    void sigExtract( bool );
174
    void sigExtract( bool );
170
    void sigAdd( bool );
175
    void sigAdd( bool );
176
    void sigTest( bool );
171
    void headers( const ColumnList& columns );
177
    void headers( const ColumnList& columns );
172
178
173
  protected:  // data
179
  protected:  // data
(-)ark/archiveformatinfo.cpp (+2 lines)
Lines 84-89 Link Here
84
84
85
  addFormatInfo( SEVENZIP_FORMAT, "application/x-7z", ".7z" );
85
  addFormatInfo( SEVENZIP_FORMAT, "application/x-7z", ".7z" );
86
86
87
  addFormatInfo( ARJ_FORMAT, "application/x-arj", ".arj" );
88
87
  if ( ArkSettings::aceSupport() )
89
  if ( ArkSettings::aceSupport() )
88
    addFormatInfo( ACE_FORMAT, "application/x-ace", ".ace" );
90
    addFormatInfo( ACE_FORMAT, "application/x-ace", ".ace" );
89
}
91
}
(-)ark/arj.cpp (+326 lines)
Line 0 Link Here
1
/*
2
3
 ark -- archiver for the KDE project
4
5
 Copyright (C)
6
7
 1997-1999: Rob Palmbos palm9744@kettering.edu
8
 1999: Francois-Xavier Duranceau duranceau@kde.org
9
 1999-2000: Corel Corporation (author: Emily Ezust, emilye@corel.com)
10
 2001: Corel Corporation (author: Michael Jarrett, michaelj@corel.com)
11
 2007: ALT Linux (author: Sergey V Turchin, zerg@altlinux.org)
12
13
 This program is free software; you can redistribute it and/or
14
 modify it under the terms of the GNU General Public License
15
 as published by the Free Software Foundation; either version 2
16
 of the License, or (at your option) any later version.
17
18
 This program is distributed in the hope that it will be useful,
19
 but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 GNU General Public License for more details.
22
23
 You should have received a copy of the GNU General Public License
24
 along with this program; if not, write to the Free Software
25
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26
27
*/
28
29
30
// Qt includes
31
#include <qdir.h>
32
#include <qtextcodec.h>
33
34
// KDE includes
35
#include <kdebug.h>
36
#include <klocale.h>
37
#include <kmessagebox.h>
38
#include <kprocess.h>
39
#include <kpassdlg.h>
40
41
// ark includes
42
#include "arj.h"
43
#include "arkwidget.h"
44
#include "settings.h"
45
46
47
ArjArch::ArjArch( ArkWidget *_gui, const QString & _fileName )
48
  : Arch(  _gui, _fileName )
49
{
50
  m_archiver_program = "arj";
51
  m_unarchiver_program = "arj";
52
  verifyCompressUtilityIsAvailable( m_archiver_program );
53
  verifyUncompressUtilityIsAvailable( m_unarchiver_program );
54
55
  m_headerString = "-----------";
56
  m_numCols = 6;
57
}
58
59
void ArjArch::setHeaders()
60
{
61
  ColumnList list;
62
  list.append( FILENAME_COLUMN );
63
  list.append( SIZE_COLUMN );
64
  list.append( PACKED_COLUMN );
65
  list.append( RATIO_COLUMN );
66
  list.append( TIMESTAMP_COLUMN );
67
  list.append( PERMISSION_COLUMN );
68
69
  emit headers( list );
70
}
71
72
void ArjArch::create()
73
{
74
  emit sigCreate( this, true, m_filename,
75
                  Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
76
}
77
78
void ArjArch::createPassword()
79
{
80
  if( m_password.isEmpty() && ArkSettings::askCreatePassword() )
81
    KPasswordDialog::getNewPassword( m_password, i18n("Warning!\nUsing KGpg for encryption is more secure.\nCancel this dialog or enter password for %1 archiver:").arg(m_archiver_program) );
82
}
83
84
85
void ArjArch::addDir( const QString & _dirName )
86
{
87
  if ( !_dirName.isEmpty() )
88
  {
89
    QStringList list;
90
    list.append( _dirName );
91
    addFile( list );
92
  }
93
}
94
95
void ArjArch::addFile( const QStringList & urls )
96
{
97
  KProcess *kp = m_currentProcess = new KProcess;
98
99
  kp->clearArguments();
100
  *kp << m_archiver_program;
101
  *kp << "a";
102
103
  if ( ArkSettings::replaceOnlyWithNewer() )
104
    *kp << "-u";
105
106
  if ( ArkSettings::rarRecurseSubdirs() )
107
    *kp << "-r";
108
109
  if ( !m_password.isEmpty() )
110
    *kp << "-g"+m_password;
111
112
  *kp << m_filename;
113
114
  KURL dir( urls.first() );
115
  QDir::setCurrent( dir.directory() );
116
117
  QStringList::ConstIterator iter;
118
  for ( iter = urls.begin(); iter != urls.end(); ++iter )
119
  {
120
    KURL url( *iter );
121
    *kp << url.fileName();
122
  }
123
124
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
125
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
126
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
127
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
128
  connect( kp, SIGNAL( processExited(KProcess*) ),
129
           SLOT( slotAddExited(KProcess*) ) );
130
131
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
132
  {
133
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
134
    emit sigAdd( false );
135
  }
136
}
137
138
bool ArjArch::processLine( const QCString &line )
139
{
140
  QString unicode_line;
141
142
  QTextCodec *codec = QTextCodec::codecForLocale();
143
  QTextCodec *codec_alt = QTextCodec::codecForName("CP1251");
144
  unicode_line = codec->toUnicode( line );
145
146
  QStringList list;
147
148
  QStringList l2 = QStringList::split( ' ', line );
149
  if( l2.size() >= 2 && l2[0].endsWith(")") && l2[0].length() == 4 )
150
  {
151
    file_entry = line.mid(4);
152
  }
153
  else if( l2.size() > 3 )
154
  {
155
    if( l2[1] == "UNIX" )
156
	list << codec->toUnicode(file_entry).stripWhiteSpace(); // filename
157
    else
158
	list << codec_alt->toUnicode(file_entry).stripWhiteSpace(); // filename
159
160
    list << l2[ 2 ]; // size
161
    list << l2[ 3 ]; // packed
162
    double ratio = l2[4].toDouble();
163
    if( ratio == 0 )
164
	ratio = 1;
165
    list << QString("%1").arg(100-100/ratio); // ratio
166
167
    QStringList date =  QStringList::split( '-', l2[ 5 ] );
168
    list << ArkUtils::fixYear( date[ 0 ].latin1() ) + '-' + date[ 1 ] + '-' + date [ 2 ] + ' ' + l2[6]; // date
169
    list << l2[ 7 ]; // attributes
170
171
    m_gui->fileList()->addItem( list ); // send to GUI
172
    
173
    file_entry = "";
174
  }
175
176
  return true;
177
}
178
179
180
void ArjArch::open()
181
{
182
  setHeaders();
183
184
  m_buffer = "";
185
  m_header_removed = false;
186
  m_finished = false;
187
188
  KProcess *kp = m_currentProcess = new KProcess;
189
190
  *kp << m_unarchiver_program << "v" << m_filename;
191
192
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
193
           SLOT( slotReceivedTOC(KProcess*, char*, int) ) );
194
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
195
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
196
  connect( kp, SIGNAL( processExited(KProcess*) ),
197
           SLOT( slotOpenExited(KProcess*) ) );
198
199
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
200
  {
201
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
202
    emit sigOpen( this, false, QString::null, 0 );
203
  }
204
}
205
206
void ArjArch::unarchFileInternal()
207
{
208
  // if fileList is empty, all files are extracted.
209
  // if destDir is empty, abort with error.
210
  if ( m_destDir.isEmpty() || m_destDir.isNull() )
211
  {
212
    kdError( 1601 ) << "There was no extract directory given." << endl;
213
    return;
214
  }
215
216
  KProcess *kp = m_currentProcess = new KProcess;
217
  kp->clearArguments();
218
219
  *kp << m_unarchiver_program;
220
  *kp << "x";
221
222
  if ( !m_password.isEmpty() )
223
    *kp << "-g" + m_password;
224
225
  if ( ArkSettings::extractOverwrite() )
226
    *kp << "-jyo";
227
228
  *kp << "-jycv";
229
230
  *kp << "-w" + m_destDir;
231
  *kp << "-ht" + m_destDir;
232
233
  QTextCodec *codec = QTextCodec::codecForLocale();
234
  *kp << codec->fromUnicode(m_filename);
235
236
  // if the list is empty, no filenames go on the command line,
237
  // and we then extract everything in the archive.
238
  if ( m_fileList )
239
  {
240
    QStringList::Iterator it;
241
242
    for ( it = m_fileList->begin(); it != m_fileList->end(); ++it )
243
    {
244
      *kp << codec->fromUnicode(*it);
245
    }
246
  }
247
248
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
249
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
250
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
251
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
252
  connect( kp, SIGNAL( processExited(KProcess*) ),
253
           SLOT( slotExtractExited(KProcess*) ) );
254
255
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
256
  {
257
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
258
    emit sigExtract( false );
259
  }
260
}
261
262
bool ArjArch::passwordRequired()
263
{
264
    return m_lastShellOutput.findRev("File is password encrypted") != -1;
265
}
266
267
void ArjArch::remove( QStringList *list )
268
{
269
  if ( !list )
270
    return;
271
272
  KProcess *kp = m_currentProcess = new KProcess;
273
  kp->clearArguments();
274
275
  *kp << m_archiver_program << "d" << m_filename;
276
277
  QStringList::Iterator it;
278
  for ( it = list->begin(); it != list->end(); ++it )
279
  {
280
    QString str = *it;
281
    *kp << str;
282
  }
283
284
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
285
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
286
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
287
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
288
  connect( kp, SIGNAL( processExited(KProcess*) ),
289
           SLOT( slotDeleteExited(KProcess*) ) );
290
291
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
292
  {
293
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
294
    emit sigDelete( false );
295
  }
296
}
297
298
void ArjArch::test()
299
{
300
  clearShellOutput();
301
302
  KProcess *kp = m_currentProcess = new KProcess;
303
  kp->clearArguments();
304
305
  *kp << m_unarchiver_program << "t";
306
307
  if ( !m_password.isEmpty() )
308
    *kp << "-g" + m_password;
309
310
  *kp << m_filename;
311
312
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
313
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
314
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
315
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
316
  connect( kp, SIGNAL( processExited(KProcess*) ),
317
           SLOT( slotTestExited(KProcess*) ) );
318
319
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
320
  {
321
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
322
    emit sigTest( false );
323
  }
324
}
325
326
#include "arj.moc"
(-)ark/arj.h (+65 lines)
Line 0 Link Here
1
/*
2
3
  ark -- archiver for the KDE project
4
5
  Copyright (C)
6
7
  1997-1999: Rob Palmbos palm9744@kettering.edu
8
  1999: Francois-Xavier Duranceau duranceau@kde.org
9
  1999-2000: Corel Corporation (author: Emily Ezust, emilye@corel.com)
10
  2001: Corel Corporation (author: Michael Jarrett, michaelj@corel.com)
11
  2007: ALT Linux (author: Sergey V Turchin, zerg@altlinux.org)
12
13
  This program is free software; you can redistribute it and/or
14
  modify it under the terms of the GNU General Public License
15
  as published by the Free Software Foundation; either version 2
16
  of the License, or (at your option) any later version.
17
18
  This program is distributed in the hope that it will be useful,
19
  but WITHOUT ANY WARRANTY; without even the implied warranty of
20
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
  GNU General Public License for more details.
22
23
  You should have received a copy of the GNU General Public License
24
  along with this program; if not, write to the Free Software
25
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
26
27
*/
28
29
#ifndef ARJARCH_H
30
#define ARJARCH_H
31
32
#include "arch.h"
33
34
class QString;
35
class QStringList;
36
37
class ArkWidget;
38
39
class ArjArch : public Arch
40
{
41
  Q_OBJECT
42
  public:
43
    ArjArch( ArkWidget *_gui, const QString & _fileName );
44
    virtual ~ArjArch() { }
45
46
    virtual void open();
47
    virtual void create();
48
    virtual void test();
49
50
    virtual void remove(QStringList*);
51
    virtual void addFile(const QStringList&);
52
    virtual void addDir(const QString&);
53
54
    virtual void unarchFileInternal();
55
    virtual bool passwordRequired();
56
    virtual void createPassword();
57
58
  protected slots:
59
    virtual bool processLine( const QCString & );
60
  private:
61
    QCString file_entry;
62
    void setHeaders();
63
};
64
65
#endif /* ARJARCH_H */
(-)ark/ark_dummy.cpp (+3 lines)
Line 0 Link Here
1
#include <kdemacros.h>
2
extern "C" int kdemain(int argc, char* argv[]);
3
extern "C" KDE_EXPORT int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }
(-)ark/ark.kcfg (+5 lines)
Lines 18-23 Link Here
18
			<whatsthis>Overwrite any files that have matching names on disk with the one from the archive</whatsthis>
18
			<whatsthis>Overwrite any files that have matching names on disk with the one from the archive</whatsthis>
19
			<default>false</default>
19
			<default>false</default>
20
		</entry>
20
		</entry>
21
		<entry name="askCreatePassword" type="Bool">
22
			<label>Ask for password when create archive if possible</label>
23
			<whatsthis>Ask for password when create archive if possible</whatsthis>
24
			<default>true</default>
25
		</entry>
21
	</group>
26
	</group>
22
	<group name="Tar">
27
	<group name="Tar">
23
		<entry name="preservePerms" type="Bool">
28
		<entry name="preservePerms" type="Bool">
(-)ark/ark.la.cpp (+2 lines)
Line 0 Link Here
1
extern "C" int kdemain(int argc, char* argv[]);
2
int main(int argc, char* argv[]) { return kdemain(argc,argv); }
(-)ark/ark_part.cpp (+6 lines)
Lines 139-144 Link Here
139
    editAction = new KAction(i18n("Edit &With..."), 0, TQT_TQOBJECT(awidget),
139
    editAction = new KAction(i18n("Edit &With..."), 0, TQT_TQOBJECT(awidget),
140
                             TQT_SLOT(action_edit()), actionCollection(), "edit");
140
                             TQT_SLOT(action_edit()), actionCollection(), "edit");
141
141
142
    testAction = new KAction(i18n("&Test integrity"), 0, awidget,
143
                                TQT_SLOT(action_test()),	actionCollection(), "test");
144
142
    selectAllAction = KStdAction::selectAll(TQT_TQOBJECT(awidget->fileList()), TQT_SLOT(selectAll()), actionCollection(), "select_all");
145
    selectAllAction = KStdAction::selectAll(TQT_TQOBJECT(awidget->fileList()), TQT_SLOT(selectAll()), actionCollection(), "select_all");
143
146
144
    deselectAllAction =  new KAction(i18n("&Unselect All"), 0, TQT_TQOBJECT(awidget->fileList()),TQT_SLOT(unselectAll()), actionCollection(), "deselect_all");
147
    deselectAllAction =  new KAction(i18n("&Unselect All"), 0, TQT_TQOBJECT(awidget->fileList()),TQT_SLOT(unselectAll()), actionCollection(), "deselect_all");
Lines 189-194 Link Here
189
    addDirAction->setEnabled(awidget->isArchiveOpen() &&
192
    addDirAction->setEnabled(awidget->isArchiveOpen() &&
190
                             !bReadOnly && bAddDirSupported);
193
                             !bReadOnly && bAddDirSupported);
191
    extractAction->setEnabled(bHaveFiles);
194
    extractAction->setEnabled(bHaveFiles);
195
    testAction->setEnabled(true);
192
    awidget->searchBar()->setEnabled(bHaveFiles);
196
    awidget->searchBar()->setEnabled(bHaveFiles);
193
197
194
    bool b = ( bHaveFiles
198
    bool b = ( bHaveFiles
Lines 216-221 Link Here
216
    addDirAction->setEnabled(false);
220
    addDirAction->setEnabled(false);
217
    openWithAction->setEnabled(false);
221
    openWithAction->setEnabled(false);
218
    editAction->setEnabled(false);
222
    editAction->setEnabled(false);
223
    testAction->setEnabled(false);
219
224
220
    awidget->searchBar()->setEnabled(false);
225
    awidget->searchBar()->setEnabled(false);
221
}
226
}
Lines 234-239 Link Here
234
    addDirAction->setEnabled(false);
239
    addDirAction->setEnabled(false);
235
    openWithAction->setEnabled(false);
240
    openWithAction->setEnabled(false);
236
    editAction->setEnabled(false);
241
    editAction->setEnabled(false);
242
    testAction->setEnabled(false);
237
    awidget->searchBar()->setEnabled(false);
243
    awidget->searchBar()->setEnabled(false);
238
}
244
}
239
245
(-)ark/ark_part.h (+1 lines)
Lines 139-144 Link Here
139
    KAction *deselectAllAction;
139
    KAction *deselectAllAction;
140
    KAction *invertSelectionAction;
140
    KAction *invertSelectionAction;
141
    KAction *editAction;
141
    KAction *editAction;
142
    KAction *testAction;
142
143
143
    // the following have different enable rules from the above KActions
144
    // the following have different enable rules from the above KActions
144
    KAction *popupViewAction;
145
    KAction *popupViewAction;
(-)ark/ark_part.rc (+1 lines)
Lines 21-26 Link Here
21
    <Action name="view"/>
21
    <Action name="view"/>
22
    <Action name="open_with"/>
22
    <Action name="open_with"/>
23
    <Action name="edit"/>
23
    <Action name="edit"/>
24
    <Action name="test"/>
24
  </Menu>
25
  </Menu>
25
 <Menu noMerge="1" name="settings">
26
 <Menu noMerge="1" name="settings">
26
    <text>&amp;Settings</text>
27
    <text>&amp;Settings</text>
(-)ark/ark_part_readonly.rc (+1 lines)
Lines 17-22 Link Here
17
    <Action name="extract"/>
17
    <Action name="extract"/>
18
    <Action name="view"/>
18
    <Action name="view"/>
19
    <Action name="open_with"/>
19
    <Action name="open_with"/>
20
    <Action name="test"/>
20
  </Menu>
21
  </Menu>
21
 <Menu noMerge="1" name="settings">
22
 <Menu noMerge="1" name="settings">
22
    <text>&amp;Settings</text>
23
    <text>&amp;Settings</text>
(-)ark/arkwidget.cpp (-2 / +28 lines)
Lines 739-745 Link Here
739
    m_url = url;
739
    m_url = url;
740
    //arch->clearShellOutput();
740
    //arch->clearShellOutput();
741
741
742
    openArchive( strFile );
742
    if( url.hasPass() )
743
	openArchive( strFile, url.pass() );
744
    else
745
	openArchive( strFile );
743
}
746
}
744
747
745
748
Lines 1184-1189 Link Here
1184
        //simulate reload
1187
        //simulate reload
1185
        KURL u;
1188
        KURL u;
1186
        u.setPath( arch->fileName() );
1189
        u.setPath( arch->fileName() );
1190
	if( !arch->password().isEmpty() )
1191
    	    u.setPass( arch->password() );
1187
        file_close();
1192
        file_close();
1188
        file_open( u );
1193
        file_open( u );
1189
        emit setWindowCaption( u.path() );
1194
        emit setWindowCaption( u.path() );
Lines 1682-1687 Link Here
1682
}
1687
}
1683
1688
1684
void
1689
void
1690
ArkWidget::action_test()
1691
{
1692
    connect( arch, TQT_SIGNAL( sigTest( bool ) ), this,
1693
             TQT_SLOT( slotTestDone( bool ) ) );
1694
    busy( i18n( "Testing..." ) );
1695
    arch->test();
1696
}
1697
1698
void
1699
ArkWidget::slotTestDone(bool ok)
1700
{
1701
    disconnect( arch, TQT_SIGNAL( sigTest( bool ) ), this,
1702
             TQT_SLOT( slotTestDone( bool ) ) );
1703
    ready();
1704
    if( ok )
1705
	KMessageBox::information(0, i18n("Test successful."));
1706
}
1707
1708
void
1685
ArkWidget::viewSlotExtractDone( bool success )
1709
ArkWidget::viewSlotExtractDone( bool success )
1686
{
1710
{
1687
    if ( success )
1711
    if ( success )
Lines 2102-2107 Link Here
2102
        m_bIsSimpleCompressedFile =
2126
        m_bIsSimpleCompressedFile =
2103
            (m_archType == COMPRESSED_FORMAT);
2127
            (m_archType == COMPRESSED_FORMAT);
2104
        fixEnables();
2128
        fixEnables();
2129
	arch->createPassword();
2105
    }
2130
    }
2106
    else
2131
    else
2107
    {
2132
    {
Lines 2115-2121 Link Here
2115
//////////////////////////////////////////////////////////////////////
2140
//////////////////////////////////////////////////////////////////////
2116
2141
2117
void
2142
void
2118
ArkWidget::openArchive( const TQString & _filename )
2143
ArkWidget::openArchive( const TQString & _filename, const TQString & _password )
2119
{
2144
{
2120
    Arch *newArch = 0;
2145
    Arch *newArch = 0;
2121
    ArchType archtype;
2146
    ArchType archtype;
Lines 2172-2177 Link Here
2172
    busy( i18n( "Opening the archive..." ) );
2197
    busy( i18n( "Opening the archive..." ) );
2173
    m_fileListView->setUpdatesEnabled( false );
2198
    m_fileListView->setUpdatesEnabled( false );
2174
    arch = newArch;
2199
    arch = newArch;
2200
    newArch->setPassword(_password);
2175
    newArch->open();
2201
    newArch->open();
2176
    emit addRecentURL( m_url );
2202
    emit addRecentURL( m_url );
2177
}
2203
}
(-)ark/arkwidget.h (-1 / +3 lines)
Lines 121-126 Link Here
121
    bool action_extract();
121
    bool action_extract();
122
    void slotOpenWith();
122
    void slotOpenWith();
123
    void action_edit();
123
    void action_edit();
124
    void action_test();
124
125
125
    void doPopup(TQListViewItem *, const TQPoint &, int); // right-click menus
126
    void doPopup(TQListViewItem *, const TQPoint &, int); // right-click menus
126
    void viewFile(TQListViewItem*); // doubleClick view files
127
    void viewFile(TQListViewItem*); // doubleClick view files
Lines 133-138 Link Here
133
    void slotExtractRemoteDone(KIO::Job *job);
134
    void slotExtractRemoteDone(KIO::Job *job);
134
    void slotAddDone(bool);
135
    void slotAddDone(bool);
135
    void slotEditFinished(KProcess *);
136
    void slotEditFinished(KProcess *);
137
    void slotTestDone(bool);
136
signals:
138
signals:
137
    void openURLRequest( const KURL & url );
139
    void openURLRequest( const KURL & url );
138
    void request_file_quit();
140
    void request_file_quit();
Lines 235-241 Link Here
235
    void createFileListView();
237
    void createFileListView();
236
238
237
    bool createArchive(const TQString & name);
239
    bool createArchive(const TQString & name);
238
    void openArchive(const TQString & name);
240
    void openArchive(const TQString & name, const TQString & pass = "");
239
241
240
    void showCurrentFile();
242
    void showCurrentFile();
241
243
(-)ark/lha.cpp (-1 / +3 lines)
Lines 55-62 Link Here
55
LhaArch::LhaArch( ArkWidget *_gui, const TQString & _fileName )
55
LhaArch::LhaArch( ArkWidget *_gui, const TQString & _fileName )
56
  : Arch( _gui, _fileName )
56
  : Arch( _gui, _fileName )
57
{
57
{
58
  m_archiver_program = "lha";
58
  m_archiver_program = m_unarchiver_program = "lha";
59
59
  verifyCompressUtilityIsAvailable( m_archiver_program );
60
  verifyCompressUtilityIsAvailable( m_archiver_program );
61
  verifyUncompressUtilityIsAvailable( m_unarchiver_program );
60
62
61
  m_headerString = "----";
63
  m_headerString = "----";
62
}
64
}
(-)ark/Makefile.am (-5 / +5 lines)
Lines 9-27 Link Here
9
lib_LTLIBRARIES =
9
lib_LTLIBRARIES =
10
10
11
ark_la_SOURCES = main.cpp arkapp.cpp mainwindow.cpp
11
ark_la_SOURCES = main.cpp arkapp.cpp mainwindow.cpp
12
ark_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
12
ark_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) $(KDE_PLUGIN)
13
ark_la_LIBADD = libark_common.la $(LIB_KPARTS)
13
ark_la_LIBADD = -lkdeinit_kded -lDCOP $(LIB_KHTML) $(LIB_KIO) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)  libark_common.la $(LIB_KPARTS)
14
ark_la_COMPILE_FIRST = settings.h
14
ark_la_COMPILE_FIRST = settings.h
15
15
16
noinst_LTLIBRARIES = libark_common.la
16
noinst_LTLIBRARIES = libark_common.la
17
17
18
libark_common_la_SOURCES = settings.kcfgc archiveformatinfo.cpp
18
libark_common_la_SOURCES = settings.kcfgc archiveformatinfo.cpp
19
libark_common_la_LDFLAGS = $(all_libraries) -no-undefined
19
libark_common_la_LDFLAGS = $(all_libraries) -no-undefined
20
libark_common_la_LIBADD  = $(LIB_KFILE)
20
libark_common_la_LIBADD  = -lkdeinit_kded -lDCOP $(LIB_KHTML) $(LIB_KIO) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)  $(LIB_KFILE)
21
21
22
kde_module_LTLIBRARIES = libarkpart.la
22
kde_module_LTLIBRARIES = libarkpart.la
23
libarkpart_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries)
23
libarkpart_la_LDFLAGS = $(KDE_PLUGIN) $(all_libraries)
24
libarkpart_la_LIBADD = libark_common.la $(LIB_KPARTS)
24
libarkpart_la_LIBADD = -lkdeinit_kded -lDCOP $(LIB_KHTML) $(LIB_KIO) $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)  libark_common.la $(LIB_KPARTS)
25
libarkpart_la_COMPILE_FIRST = settings.h
25
libarkpart_la_COMPILE_FIRST = settings.h
26
26
27
libarkpart_la_SOURCES = ark_part.cpp arkfactory.cpp zip.cpp tar.cpp \
27
libarkpart_la_SOURCES = ark_part.cpp arkfactory.cpp zip.cpp tar.cpp \
Lines 31-37 Link Here
31
                        arkwidget.cpp searchbar.cpp \
31
                        arkwidget.cpp searchbar.cpp \
32
                        addition.ui extraction.ui general.ui \
32
                        addition.ui extraction.ui general.ui \
33
                        arkviewer.cpp sevenzip.cpp extractiondialog.cpp \
33
                        arkviewer.cpp sevenzip.cpp extractiondialog.cpp \
34
                        ace.cpp tarlistingthread.cpp
34
                        ace.cpp tarlistingthread.cpp arj.cpp
35
35
36
METASOURCES = AUTO
36
METASOURCES = AUTO
37
37
(-)ark/rar.cpp (-1 / +44 lines)
Lines 107-112 Link Here
107
107
108
  TQStringList l2 = TQStringList::split( ' ', line );
108
  TQStringList l2 = TQStringList::split( ' ', line );
109
109
110
  if( l2[5].startsWith("d") )
111
  {
112
    m_isFirstLine = true;
113
    return true;
114
  }
115
110
  list << m_entryFilename; // filename
116
  list << m_entryFilename; // filename
111
  list << l2[ 0 ]; // size
117
  list << l2[ 0 ]; // size
112
  list << l2[ 1 ]; // packed
118
  list << l2[ 1 ]; // packed
Lines 179-184 Link Here
179
                  Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
185
                  Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
180
}
186
}
181
187
188
void RarArch::createPassword()
189
{
190
  if( m_password.isEmpty() && ArkSettings::askCreatePassword() )
191
    KPasswordDialog::getNewPassword( m_password, i18n("Warning!\nUsing KGpg for encryption is more secure.\nCancel this dialog or enter password for %1 archiver:").arg(m_archiver_program) );
192
}
193
182
void RarArch::addDir( const TQString & _dirName )
194
void RarArch::addDir( const TQString & _dirName )
183
{
195
{
184
  if ( !_dirName.isEmpty() )
196
  if ( !_dirName.isEmpty() )
Lines 206-211 Link Here
206
  if ( ArkSettings::rarRecurseSubdirs() )
218
  if ( ArkSettings::rarRecurseSubdirs() )
207
    *kp << "-r";
219
    *kp << "-r";
208
220
221
  if ( !m_password.isEmpty() )
222
    *kp << "-p"+m_password;
223
209
  *kp << m_filename;
224
  *kp << m_filename;
210
225
211
  KURL dir( urls.first() );
226
  KURL dir( urls.first() );
Lines 291-297 Link Here
291
306
292
bool RarArch::passwordRequired()
307
bool RarArch::passwordRequired()
293
{
308
{
294
    return m_lastShellOutput.findRev("password incorrect ?)")+1;
309
    return m_lastShellOutput.find("Enter password") >= 0;
295
}
310
}
296
311
297
void RarArch::remove( TQStringList *list )
312
void RarArch::remove( TQStringList *list )
Lines 325-328 Link Here
325
  }
340
  }
326
}
341
}
327
342
343
void RarArch::test()
344
{
345
  clearShellOutput();
346
347
  KProcess *kp = m_currentProcess = new KProcess;
348
  kp->clearArguments();
349
350
  *kp << m_unarchiver_program << "t";
351
352
  if ( !m_password.isEmpty() )
353
    *kp << "-p" + m_password;
354
355
  *kp << m_filename;
356
357
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
358
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
359
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
360
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
361
  connect( kp, SIGNAL( processExited(KProcess*) ),
362
           SLOT( slotTestExited(KProcess*) ) );
363
364
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
365
  {
366
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
367
    emit sigTest( false );
368
  }
369
}
370
328
#include "rar.moc"
371
#include "rar.moc"
(-)ark/rar.h (+2 lines)
Lines 42-47 Link Here
42
  
42
  
43
    virtual void open();
43
    virtual void open();
44
    virtual void create();
44
    virtual void create();
45
    virtual void test();
45
46
46
    virtual void addFile( const TQStringList & );
47
    virtual void addFile( const TQStringList & );
47
    virtual void addDir( const TQString & );
48
    virtual void addDir( const TQString & );
Lines 49-54 Link Here
49
    virtual void remove( TQStringList * );
50
    virtual void remove( TQStringList * );
50
    virtual void unarchFileInternal();
51
    virtual void unarchFileInternal();
51
    virtual bool passwordRequired();
52
    virtual bool passwordRequired();
53
    virtual void createPassword();
52
54
53
  protected slots:
55
  protected slots:
54
    virtual bool processLine( const TQCString & );
56
    virtual bool processLine( const TQCString & );
(-)ark/sevenzip.cpp (-2 / +56 lines)
Lines 25-30 Link Here
25
*/
25
*/
26
26
27
#include <tqdir.h>
27
#include <tqdir.h>
28
#include <tqtextcodec.h>
28
29
29
#include <kglobal.h>
30
#include <kglobal.h>
30
#include <klocale.h>
31
#include <klocale.h>
Lines 120-125 Link Here
120
                  Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
121
                  Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
121
}
122
}
122
123
124
void SevenZipArch::createPassword()
125
{
126
  if( m_password.isEmpty() && ArkSettings::askCreatePassword() )
127
    KPasswordDialog::getNewPassword( m_password, i18n("Warning!\nUsing KGpg for encryption is more secure.\nCancel this dialog or enter password for %1 archiver:").arg(m_archiver_program) );
128
}
129
123
void SevenZipArch::addFile( const TQStringList & urls )
130
void SevenZipArch::addFile( const TQStringList & urls )
124
{
131
{
125
  KProcess *kp = m_currentProcess = new KProcess;
132
  KProcess *kp = m_currentProcess = new KProcess;
Lines 127-132 Link Here
127
  kp->clearArguments();
134
  kp->clearArguments();
128
  *kp << m_archiver_program << "a" ;
135
  *kp << m_archiver_program << "a" ;
129
136
137
  if ( !m_password.isEmpty() )
138
    *kp << "-p" + m_password;
139
130
  KURL url( urls.first() );
140
  KURL url( urls.first() );
131
  TQDir::setCurrent( url.directory() );
141
  TQDir::setCurrent( url.directory() );
132
142
Lines 163-168 Link Here
163
  }
173
  }
164
}
174
}
165
175
176
bool SevenZipArch::passwordRequired()
177
{
178
    return m_lastShellOutput.find("Enter password") >= 0;
179
}
180
166
void SevenZipArch::remove( TQStringList *list )
181
void SevenZipArch::remove( TQStringList *list )
167
{
182
{
168
  if ( !list )
183
  if ( !list )
Lines 212-217 Link Here
212
    //*kp << "-ao";
227
    //*kp << "-ao";
213
  }
228
  }
214
229
230
  // FIXME overwrite existing files created with wrong password
231
  *kp << "-y";
232
233
  if ( !m_password.isEmpty() )
234
    *kp << "-p" + m_password;
235
215
  *kp << m_filename;
236
  *kp << m_filename;
216
237
217
  // if the file list is empty, no filenames go on the command line,
238
  // if the file list is empty, no filenames go on the command line,
Lines 243-254 Link Here
243
264
244
bool SevenZipArch::processLine( const TQCString& _line )
265
bool SevenZipArch::processLine( const TQCString& _line )
245
{
266
{
246
  TQCString line( _line );
267
  TQString line;
247
  TQString columns[ 11 ];
268
  TQString columns[ 11 ];
248
  unsigned int pos = 0;
269
  unsigned int pos = 0;
249
  int strpos, len;
270
  int strpos, len;
250
271
251
  columns[ 0 ] = line.right( line.length() - m_nameColumnPos +1);
272
  TQTextCodec *codec = TQTextCodec::codecForLocale();
273
  line = codec->toUnicode( _line );
274
275
  columns[ 0 ] = line.right( line.length() - m_nameColumnPos);
252
  line.truncate( m_nameColumnPos );
276
  line.truncate( m_nameColumnPos );
253
277
254
  // Go through our columns, try to pick out data, return silently on failure
278
  // Go through our columns, try to pick out data, return silently on failure
Lines 275-280 Link Here
275
    columns[ curCol->colRef ] = line.mid( strpos, len );
299
    columns[ curCol->colRef ] = line.mid( strpos, len );
276
  }
300
  }
277
301
302
  // Separated directories pass
303
  if(columns[4].length() && columns[4][0] == 'D') return true;
278
304
279
  if ( m_dateCol >= 0 )
305
  if ( m_dateCol >= 0 )
280
  {
306
  {
Lines 364-367 Link Here
364
  data[ length ] = endchar;
390
  data[ length ] = endchar;
365
}
391
}
366
392
393
void SevenZipArch::test()
394
{
395
  clearShellOutput();
396
397
  KProcess *kp = m_currentProcess = new KProcess;
398
  kp->clearArguments();
399
400
  *kp << m_unarchiver_program << "t";
401
402
  if ( !m_password.isEmpty() )
403
    *kp << "-p" + m_password;
404
405
  *kp << m_filename;
406
407
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
408
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
409
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
410
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
411
  connect( kp, SIGNAL( processExited(KProcess*) ),
412
           SLOT( slotTestExited(KProcess*) ) );
413
414
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
415
  {
416
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
417
    emit sigTest( false );
418
  }
419
}
420
367
#include "sevenzip.moc"
421
#include "sevenzip.moc"
(-)ark/sevenzip.h (+3 lines)
Lines 36-47 Link Here
36
  
36
  
37
    virtual void open();
37
    virtual void open();
38
    virtual void create();
38
    virtual void create();
39
    virtual void test();
39
40
40
    virtual void addFile( const TQStringList & );
41
    virtual void addFile( const TQStringList & );
41
    virtual void addDir( const TQString & );
42
    virtual void addDir( const TQString & );
42
43
43
    virtual void remove( TQStringList * );
44
    virtual void remove( TQStringList * );
44
    virtual void unarchFileInternal( );
45
    virtual void unarchFileInternal( );
46
    virtual bool passwordRequired();
47
    virtual void createPassword();
45
48
46
  protected slots:
49
  protected slots:
47
    virtual bool processLine( const TQCString& line );
50
    virtual bool processLine( const TQCString& line );
(-)ark/tar.cpp (+37 lines)
Lines 785-789 Link Here
785
  }
785
  }
786
}
786
}
787
787
788
void TarArch::test()
789
{
790
  clearShellOutput();
791
792
  KProcess *kp = m_currentProcess = new KProcess;
793
  kp->clearArguments();
794
795
  QString uncomp = getUnCompressor();
796
797
  *kp << uncomp;
798
799
  if( uncomp == "bunzip2" || uncomp == "gunzip" || uncomp == "lzop" )
800
  {
801
    *kp << "-t";
802
  }
803
  else
804
  {
805
    Arch::test();
806
    return;
807
  }
808
809
  *kp << m_filename;
810
811
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
812
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
813
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
814
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
815
  connect( kp, SIGNAL( processExited(KProcess*) ),
816
           SLOT( slotTestExited(KProcess*) ) );
817
818
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
819
  {
820
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
821
    emit sigTest( false );
822
  }
823
}
824
788
#include "tar.moc"
825
#include "tar.moc"
789
// kate: space-indent on;
826
// kate: space-indent on;
(-)ark/tar.h (+1 lines)
Lines 64-69 Link Here
64
64
65
		virtual void open();
65
		virtual void open();
66
		virtual void create();
66
		virtual void create();
67
		virtual void test();
67
68
68
		virtual void addFile( const TQStringList & );
69
		virtual void addFile( const TQStringList & );
69
		virtual void addDir( const TQString & );
70
		virtual void addDir( const TQString & );
(-)ark/zip.cpp (-1 / +37 lines)
Lines 34-39 Link Here
34
#include <klocale.h>
34
#include <klocale.h>
35
#include <kmessagebox.h>
35
#include <kmessagebox.h>
36
#include <kprocess.h>
36
#include <kprocess.h>
37
#include <kpassdlg.h>
37
38
38
// ark includes
39
// ark includes
39
#include "zip.h"
40
#include "zip.h"
Lines 114-119 Link Here
114
                 Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
115
                 Arch::Extract | Arch::Delete | Arch::Add | Arch::View );
115
}
116
}
116
117
118
void ZipArch::createPassword()
119
{
120
  if( m_password.isEmpty() && ArkSettings::askCreatePassword() )
121
    KPasswordDialog::getNewPassword( m_password, i18n("Warning!\nUsing KGpg for encryption is more secure.\nCancel this dialog or enter password for %1 archiver:").arg(m_archiver_program) );
122
}
123
117
void ZipArch::addDir( const TQString & _dirName )
124
void ZipArch::addDir( const TQString & _dirName )
118
{
125
{
119
  if ( !_dirName.isEmpty() )
126
  if ( !_dirName.isEmpty() )
Lines 240-246 Link Here
240
247
241
bool ZipArch::passwordRequired()
248
bool ZipArch::passwordRequired()
242
{
249
{
243
    return m_lastShellOutput.findRev("unable to get password\n")!=-1 || m_lastShellOutput.endsWith("password inflating\n") || m_lastShellOutput.findRev("password incorrect--reenter:")!=-1 || m_lastShellOutput.endsWith("incorrect password\n");
250
    return m_lastShellOutput.findRev("password:") >= 0 || m_lastShellOutput.findRev("unable to get password\n")!=-1 || m_lastShellOutput.endsWith("password inflating\n") || m_lastShellOutput.findRev("password incorrect--reenter:")!=-1 || m_lastShellOutput.endsWith("incorrect password\n");
244
}
251
}
245
252
246
void ZipArch::remove( TQStringList *list )
253
void ZipArch::remove( TQStringList *list )
Lines 248-253 Link Here
248
  if ( !list )
255
  if ( !list )
249
    return;
256
    return;
250
257
258
251
  KProcess *kp = m_currentProcess = new KProcess;
259
  KProcess *kp = m_currentProcess = new KProcess;
252
  kp->clearArguments();
260
  kp->clearArguments();
253
261
Lines 274-277 Link Here
274
  }
282
  }
275
}
283
}
276
284
285
void ZipArch::test()
286
{
287
  clearShellOutput();
288
289
  KProcess *kp = m_currentProcess = new KProcess;
290
  kp->clearArguments();
291
292
  *kp << m_unarchiver_program << "-t";
293
294
  if ( !m_password.isEmpty() )
295
    *kp << "-P" << m_password;
296
297
  *kp << m_filename;
298
299
  connect( kp, SIGNAL( receivedStdout(KProcess*, char*, int) ),
300
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
301
  connect( kp, SIGNAL( receivedStderr(KProcess*, char*, int) ),
302
           SLOT( slotReceivedOutput(KProcess*, char*, int) ) );
303
  connect( kp, SIGNAL( processExited(KProcess*) ),
304
           SLOT( slotTestExited(KProcess*) ) );
305
306
  if ( !kp->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
307
  {
308
    KMessageBox::error( 0, i18n( "Could not start a subprocess." ) );
309
    emit sigTest( false );
310
  }
311
}
312
277
#include "zip.moc"
313
#include "zip.moc"
(-)ark/zip.h (+2 lines)
Lines 45-50 Link Here
45
45
46
    virtual void open();
46
    virtual void open();
47
    virtual void create();
47
    virtual void create();
48
    virtual void test();
48
49
49
    virtual void addFile( const TQStringList & );
50
    virtual void addFile( const TQStringList & );
50
    virtual void addDir( const TQString &  );
51
    virtual void addDir( const TQString &  );
Lines 52-57 Link Here
52
    virtual void remove( TQStringList * );
53
    virtual void remove( TQStringList * );
53
    virtual void unarchFileInternal();
54
    virtual void unarchFileInternal();
54
    virtual bool passwordRequired();
55
    virtual bool passwordRequired();
56
    virtual void createPassword();
55
  private:
57
  private:
56
    void setHeaders();
58
    void setHeaders();
57
};
59
};

Return to bug 1030