|
|
@ -5148,10 +5148,10 @@ void View::toggleProtectDoc( bool mode )
|
|
|
|
if ( !doc() || !doc()->map() )
|
|
|
|
if ( !doc() || !doc()->map() )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
TQCString passwd;
|
|
|
|
TQString password;
|
|
|
|
if ( mode )
|
|
|
|
if ( mode )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result = KPasswordDialog::getNewPassword( passwd, i18n( "Protect Document" ) );
|
|
|
|
int result = KPasswordDialog::getNewPassword( password, i18n( "Protect Document" ) );
|
|
|
|
if ( result != KPasswordDialog::Accepted )
|
|
|
|
if ( result != KPasswordDialog::Accepted )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->actions->protectDoc->setChecked( false );
|
|
|
|
d->actions->protectDoc->setChecked( false );
|
|
|
@ -5159,14 +5159,13 @@ void View::toggleProtectDoc( bool mode )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQCString hash( "" );
|
|
|
|
TQCString hash( "" );
|
|
|
|
TQString password( passwd );
|
|
|
|
|
|
|
|
if ( password.length() > 0 )
|
|
|
|
if ( password.length() > 0 )
|
|
|
|
SHA1::getHash( password, hash );
|
|
|
|
SHA1::getHash( password, hash );
|
|
|
|
doc()->map()->setProtected( hash );
|
|
|
|
doc()->map()->setProtected( hash );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result = KPasswordDialog::getPassword( passwd, i18n( "Unprotect Document" ) );
|
|
|
|
int result = KPasswordDialog::getPassword( password, i18n( "Unprotect Document" ) );
|
|
|
|
if ( result != KPasswordDialog::Accepted )
|
|
|
|
if ( result != KPasswordDialog::Accepted )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->actions->protectDoc->setChecked( true );
|
|
|
|
d->actions->protectDoc->setChecked( true );
|
|
|
@ -5174,7 +5173,6 @@ void View::toggleProtectDoc( bool mode )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQCString hash( "" );
|
|
|
|
TQCString hash( "" );
|
|
|
|
TQString password( passwd );
|
|
|
|
|
|
|
|
if ( password.length() > 0 )
|
|
|
|
if ( password.length() > 0 )
|
|
|
|
SHA1::getHash( password, hash );
|
|
|
|
SHA1::getHash( password, hash );
|
|
|
|
if ( !doc()->map()->checkPassword( hash ) )
|
|
|
|
if ( !doc()->map()->checkPassword( hash ) )
|
|
|
@ -5196,10 +5194,10 @@ void View::toggleProtectSheet( bool mode )
|
|
|
|
if ( !d->activeSheet )
|
|
|
|
if ( !d->activeSheet )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
TQCString passwd;
|
|
|
|
TQString password;
|
|
|
|
if ( mode )
|
|
|
|
if ( mode )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result = KPasswordDialog::getNewPassword( passwd, i18n( "Protect Sheet" ) );
|
|
|
|
int result = KPasswordDialog::getNewPassword( password, i18n( "Protect Sheet" ) );
|
|
|
|
if ( result != KPasswordDialog::Accepted )
|
|
|
|
if ( result != KPasswordDialog::Accepted )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->actions->protectSheet->setChecked( false );
|
|
|
|
d->actions->protectSheet->setChecked( false );
|
|
|
@ -5207,7 +5205,6 @@ void View::toggleProtectSheet( bool mode )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQCString hash( "" );
|
|
|
|
TQCString hash( "" );
|
|
|
|
TQString password( passwd );
|
|
|
|
|
|
|
|
if ( password.length() > 0 )
|
|
|
|
if ( password.length() > 0 )
|
|
|
|
SHA1::getHash( password, hash );
|
|
|
|
SHA1::getHash( password, hash );
|
|
|
|
|
|
|
|
|
|
|
@ -5215,7 +5212,7 @@ void View::toggleProtectSheet( bool mode )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int result = KPasswordDialog::getPassword( passwd, i18n( "Unprotect Sheet" ) );
|
|
|
|
int result = KPasswordDialog::getPassword( password, i18n( "Unprotect Sheet" ) );
|
|
|
|
if ( result != KPasswordDialog::Accepted )
|
|
|
|
if ( result != KPasswordDialog::Accepted )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
d->actions->protectSheet->setChecked( true );
|
|
|
|
d->actions->protectSheet->setChecked( true );
|
|
|
@ -5223,7 +5220,6 @@ void View::toggleProtectSheet( bool mode )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQCString hash( "" );
|
|
|
|
TQCString hash( "" );
|
|
|
|
TQString password( passwd );
|
|
|
|
|
|
|
|
if ( password.length() > 0 )
|
|
|
|
if ( password.length() > 0 )
|
|
|
|
SHA1::getHash( password, hash );
|
|
|
|
SHA1::getHash( password, hash );
|
|
|
|
|
|
|
|
|
|
|
|