[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/libs/kofficecore
From: Thomas Schaap <thomas.schaap () kdemail ! net>
Date: 2007-01-25 9:52:10
Message-ID: 1169718730.214682.10690.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 626976 by schaap:
Added support for saving to encrypted files.
M +4 -0 CMakeLists.txt
M +22 -1 KoDocument.cpp
M +3 -2 KoDocument.h
M +9 -0 KoFileDialog.cpp
--- trunk/koffice/libs/kofficecore/CMakeLists.txt #626975:626976
@@ -6,6 +6,10 @@
########### next target ###############
+if( QCA2_FOUND )
+add_definitions( -DQCA2 )
+endif( QCA2_FOUND )
+
set(kofficecore_LIB_SRCS
KoDocument.cpp
KoPluginLoader.cpp
--- trunk/koffice/libs/kofficecore/KoDocument.cpp #626975:626976
@@ -568,7 +568,8 @@
void KoDocument::slotAutoSave()
{
- if ( isModified() && d->modifiedAfterAutosave && !d->m_bLoading )
+ // Autosaving is currently disabled for encrypted files, since every autosave \
would request the password + if ( isModified() && d->modifiedAfterAutosave && \
!d->m_bLoading && d->m_specialOutputFlag != SaveEncrypted ) {
connect( this, SIGNAL( sigProgress( int ) ), shells().current(), SLOT( \
slotProgress( int ) ) ); emit sigStatusBarMessage( i18n("Autosaving...") );
@@ -990,6 +991,13 @@
backend = KoStore::Directory;
kDebug(30003) << "Saving as uncompressed XML, using directory store." << \
endl; }
+#ifdef QCA2
+ else if ( d->m_specialOutputFlag == SaveEncrypted )
+ {
+ backend = KoStore::Encrypted;
+ kDebug(30003) << "Saving using encrypted backend." << endl;
+ }
+#endif
else if ( d->m_specialOutputFlag == SaveAsFlatXML )
{
kDebug(30003) << "Saving as a flat XML file." << endl;
@@ -1804,6 +1812,10 @@
return false;
}
+ // Remember that the file was encrypted
+ if( d->m_specialOutputFlag == 0 && store->isEncrypted( ) )
+ d->m_specialOutputFlag = SaveEncrypted;
+
return loadNativeFormatFromStoreInternal( store );
}
@@ -1816,6 +1828,10 @@
if ( store->bad() )
return false;
+ // Remember that the file was encrypted
+ if( d->m_specialOutputFlag == 0 && store->isEncrypted( ) )
+ d->m_specialOutputFlag = SaveEncrypted;
+
return loadNativeFormatFromStoreInternal( store );
}
@@ -2480,7 +2496,12 @@
// Apps which support special output flags can add reimplement and add to this.
// E.g. this is how did "saving in the 1.1 format".
// SaveAsDirectoryStore is a given since it's implemented by KoDocument itself.
+ // SaveEncrypted is implemented in KoDocument as well, if QCA2 was found.
+#ifdef QCA2
+ return SaveAsDirectoryStore | SaveEncrypted;
+#else
return SaveAsDirectoryStore;
+#endif
}
void KoDocument::addShell( KoMainWindow *shell )
--- trunk/koffice/libs/kofficecore/KoDocument.h #626975:626976
@@ -253,8 +253,9 @@
/// Enum values used by specialOutputFlag - note that it's a bitfield for \
supportedSpecialFormats enum { /*SaveAsKOffice1dot1 = 1,*/ // old and removed
SaveAsDirectoryStore = 2,
- SaveAsFlatXML = 4
- // bitfield! next value is 8
+ SaveAsFlatXML = 4,
+ SaveEncrypted = 8
+ // bitfield! next value is 16
};
/**
--- trunk/koffice/libs/kofficecore/KoFileDialog.cpp #626975:626976
@@ -60,6 +60,7 @@
bool addUncompressed = supportedSpecialFormats & \
KoDocument::SaveAsDirectoryStore;
bool addFlatXML = supportedSpecialFormats & KoDocument::SaveAsFlatXML;
+ bool addEncrypted = supportedSpecialFormats & KoDocument::SaveEncrypted;
int idxSpecialOutputFlag = 0;
int numSpecialEntries = 0;
@@ -75,6 +76,12 @@
if ( specialOutputFlag == KoDocument::SaveAsFlatXML )
idxSpecialOutputFlag = numSpecialEntries;
}
+ if ( addEncrypted ) {
+ ++numSpecialEntries;
+ m_specialFormats.append( KoDocument::SaveEncrypted );
+ if ( specialOutputFlag == KoDocument::SaveEncrypted )
+ idxSpecialOutputFlag = numSpecialEntries;
+ }
// Insert numSpecialEntries entries with native mimetypes, for the special \
entries. for ( int i=0; i<numSpecialEntries; ++i )
@@ -95,6 +102,8 @@
filterWidget->setItemText( idx++, i18n("%1 (Uncompressed XML Files)", \
type->comment() ) ); if ( addFlatXML )
filterWidget->setItemText( idx++, i18n("%1 (Flat XML File)", type->comment() \
) ); + if ( addEncrypted )
+ filterWidget->setItemText( idx++, i18n("%1 (Encrypted)", type->comment() ) \
);
// if you add an entry here, update numSpecialEntries above and \
specialEntrySelected() below
// For native format...
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic