New TODO comment style.

Qt Creator 2.5 is able to parse those.
This commit is contained in:
Felix Geyer 2012-05-11 12:39:06 +02:00
parent 8faac078fd
commit 587a647c11
16 changed files with 38 additions and 38 deletions

View File

@ -53,7 +53,7 @@ Config::Config()
userPath += "/keepassx/"; userPath += "/keepassx/";
#elif defined(Q_WS_MAC) #elif defined(Q_WS_MAC)
// TODO where to store the config on mac? // TODO: where to store the config on mac?
userPath = homePath; userPath = homePath;
userPath += "/.keepassx/"; userPath += "/.keepassx/";
#elif defined(Q_WS_WIN) #elif defined(Q_WS_WIN)

View File

@ -92,7 +92,7 @@ QImage Entry::icon() const
return databaseIcons()->icon(m_data.iconNumber); return databaseIcons()->icon(m_data.iconNumber);
} }
else { else {
// TODO check if database() is 0 // TODO: check if database() is 0
return database()->metadata()->customIcon(m_data.customIcon); return database()->metadata()->customIcon(m_data.customIcon);
} }
} }
@ -105,7 +105,7 @@ QPixmap Entry::iconPixmap() const
else { else {
QPixmap pixmap; QPixmap pixmap;
if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) { if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
// TODO check if database() is 0 // TODO: check if database() is 0
pixmap = QPixmap::fromImage(database()->metadata()->customIcon(m_data.customIcon)); pixmap = QPixmap::fromImage(database()->metadata()->customIcon(m_data.customIcon));
*const_cast<QPixmapCache::Key*>(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap); *const_cast<QPixmapCache::Key*>(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap);
} }

View File

@ -100,7 +100,7 @@ QImage Group::icon() const
return databaseIcons()->icon(m_iconNumber); return databaseIcons()->icon(m_iconNumber);
} }
else { else {
// TODO check if m_db is 0 // TODO: check if m_db is 0
return m_db->metadata()->customIcon(m_customIcon); return m_db->metadata()->customIcon(m_customIcon);
} }
} }
@ -113,7 +113,7 @@ QPixmap Group::iconPixmap() const
else { else {
QPixmap pixmap; QPixmap pixmap;
if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) { if (!QPixmapCache::find(m_pixmapCacheKey, &pixmap)) {
// TODO check if m_db is 0 // TODO: check if m_db is 0
pixmap = QPixmap::fromImage(m_db->metadata()->customIcon(m_customIcon)); pixmap = QPixmap::fromImage(m_db->metadata()->customIcon(m_customIcon));
*const_cast<QPixmapCache::Key*>(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap); *const_cast<QPixmapCache::Key*>(&m_pixmapCacheKey) = QPixmapCache::insert(pixmap);
} }

View File

@ -48,7 +48,7 @@ CryptoHash::CryptoHash(CryptoHash::Algorithm algo)
} }
gcry_error_t error = gcry_md_open(&d->ctx, algoGcrypt, 0); gcry_error_t error = gcry_md_open(&d->ctx, algoGcrypt, 0);
Q_ASSERT(error == 0); // TODO error handling Q_ASSERT(error == 0); // TODO: error handling
d->hashLen = gcry_md_get_algo_dlen(algoGcrypt); d->hashLen = gcry_md_get_algo_dlen(algoGcrypt);
} }

View File

@ -68,7 +68,7 @@ void SymmetricCipherGcrypt::init()
gcry_error_t error; gcry_error_t error;
error = gcry_cipher_open(&m_ctx, m_algo, m_mode, 0); error = gcry_cipher_open(&m_ctx, m_algo, m_mode, 0);
Q_ASSERT(error == 0); // TODO real error checking Q_ASSERT(error == 0); // TODO: real error checking
size_t blockSizeT; size_t blockSizeT;
error = gcry_cipher_algo_info(m_algo, GCRYCTL_GET_BLKLEN, 0, &blockSizeT); error = gcry_cipher_algo_info(m_algo, GCRYCTL_GET_BLKLEN, 0, &blockSizeT);
@ -92,7 +92,7 @@ void SymmetricCipherGcrypt::setIv(const QByteArray& iv)
QByteArray SymmetricCipherGcrypt::process(const QByteArray& data) QByteArray SymmetricCipherGcrypt::process(const QByteArray& data)
{ {
// TODO check block size // TODO: check block size
QByteArray result; QByteArray result;
result.resize(data.size()); result.resize(data.size());
@ -113,7 +113,7 @@ QByteArray SymmetricCipherGcrypt::process(const QByteArray& data)
void SymmetricCipherGcrypt::processInPlace(QByteArray& data) void SymmetricCipherGcrypt::processInPlace(QByteArray& data)
{ {
// TODO check block size // TODO: check block size
gcry_error_t error; gcry_error_t error;
@ -129,7 +129,7 @@ void SymmetricCipherGcrypt::processInPlace(QByteArray& data)
void SymmetricCipherGcrypt::processInPlace(QByteArray& data, quint64 rounds) void SymmetricCipherGcrypt::processInPlace(QByteArray& data, quint64 rounds)
{ {
// TODO check block size // TODO: check block size
gcry_error_t error; gcry_error_t error;

View File

@ -111,49 +111,49 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
m_masterSeed = m_device->read(16); m_masterSeed = m_device->read(16);
if (m_masterSeed.size() != 16) { if (m_masterSeed.size() != 16) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
m_encryptionIV = m_device->read(16); m_encryptionIV = m_device->read(16);
if (m_encryptionIV.size() != 16) { if (m_encryptionIV.size() != 16) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
quint32 numGroups = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); quint32 numGroups = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
if (!ok) { if (!ok) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
quint32 numEntries = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); quint32 numEntries = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
if (!ok) { if (!ok) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
m_contentHashHeader = m_device->read(32); m_contentHashHeader = m_device->read(32);
if (m_contentHashHeader.size() != 32) { if (m_contentHashHeader.size() != 32) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
m_transformSeed = m_device->read(32); m_transformSeed = m_device->read(32);
if (m_transformSeed.size() != 32) { if (m_transformSeed.size() != 32) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
m_transformRounds = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok); m_transformRounds = Endian::readUInt32(m_device, KeePass1::BYTEORDER, &ok);
if (!ok) { if (!ok) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
@ -164,7 +164,7 @@ Database* KeePass1Reader::readDatabase(QIODevice* device, const QString& passwor
QScopedPointer<SymmetricCipherStream> cipherStream(testKeys(password, keyfileData, contentPos)); QScopedPointer<SymmetricCipherStream> cipherStream(testKeys(password, keyfileData, contentPos));
if (!cipherStream) { if (!cipherStream) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
@ -330,7 +330,7 @@ SymmetricCipherStream* KeePass1Reader::testKeys(const QString& password, const Q
cipherStream->reset(); cipherStream->reset();
cipherStream->close(); cipherStream->close();
if (!m_device->seek(contentPos)) { if (!m_device->seek(contentPos)) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
@ -400,7 +400,7 @@ Group* KeePass1Reader::readGroup(QIODevice* cipherStream)
QByteArray fieldData = cipherStream->read(fieldSize); QByteArray fieldData = cipherStream->read(fieldSize);
if (fieldData.size() != fieldSize) { if (fieldData.size() != fieldSize) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }
@ -524,7 +524,7 @@ Entry* KeePass1Reader::readEntry(QIODevice* cipherStream)
QByteArray fieldData = cipherStream->read(fieldSize); QByteArray fieldData = cipherStream->read(fieldSize);
if (fieldData.size() != fieldSize) { if (fieldData.size() != fieldSize) {
// TODO error // TODO: error
Q_ASSERT(false); Q_ASSERT(false);
return 0; return 0;
} }

View File

@ -69,7 +69,7 @@ Database* KeePass2Reader::readDatabase(QIODevice* device, const CompositeKey& ke
while (readHeaderField() && !hasError()) { while (readHeaderField() && !hasError()) {
} }
// TODO check if all header fields have been parsed // TODO: check if all header fields have been parsed
m_db->setKey(key, m_transformSeed, false); m_db->setKey(key, m_transformSeed, false);

View File

@ -146,7 +146,7 @@ void KeePass2XmlWriter::writeIcon(const Uuid& uuid, const QImage& icon)
QByteArray ba; QByteArray ba;
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
// TODO check !icon.save() // TODO: check !icon.save()
icon.save(&buffer, "PNG"); icon.save(&buffer, "PNG");
buffer.close(); buffer.close();
writeBinary("Data", ba); writeBinary("Data", ba);

View File

@ -53,7 +53,7 @@ void ChangeMasterKeyWidget::clearForms()
m_ui->repeatPasswordEdit->setText(""); m_ui->repeatPasswordEdit->setText("");
m_ui->keyFileGroup->setChecked(false); m_ui->keyFileGroup->setChecked(false);
m_ui->togglePasswordButton->setChecked(true); m_ui->togglePasswordButton->setChecked(true);
// TODO clear m_ui->keyFileCombo // TODO: clear m_ui->keyFileCombo
m_ui->enterPasswordEdit->setFocus(); m_ui->enterPasswordEdit->setFocus();
} }
@ -94,7 +94,7 @@ void ChangeMasterKeyWidget::generateKey()
FileKey fileKey; FileKey fileKey;
QString errorMsg; QString errorMsg;
if (!fileKey.load(m_ui->keyFileCombo->currentText(), &errorMsg)) { if (!fileKey.load(m_ui->keyFileCombo->currentText(), &errorMsg)) {
// TODO error handling // TODO: error handling
} }
m_key.addKey(fileKey); m_key.addKey(fileKey);
} }

View File

@ -84,7 +84,7 @@ void DatabaseTabWidget::openDatabase(const QString& fileName, const QString& pw,
const QString& keyFile) const QString& keyFile)
{ {
QScopedPointer<QFile> file(new QFile(fileName)); QScopedPointer<QFile> file(new QFile(fileName));
// TODO error handling // TODO: error handling
if (!file->open(QIODevice::ReadWrite)) { if (!file->open(QIODevice::ReadWrite)) {
if (!file->open(QIODevice::ReadOnly)) { if (!file->open(QIODevice::ReadOnly)) {
// can't open // can't open
@ -208,7 +208,7 @@ void DatabaseTabWidget::saveDatabase(Database* db)
{ {
DatabaseManagerStruct& dbStruct = m_dbList[db]; DatabaseManagerStruct& dbStruct = m_dbList[db];
// TODO ensure that the data is actually written to disk // TODO: ensure that the data is actually written to disk
if (dbStruct.file) { if (dbStruct.file) {
dbStruct.file->reset(); dbStruct.file->reset();
m_writer.writeDatabase(dbStruct.file, db); m_writer.writeDatabase(dbStruct.file, db);
@ -235,12 +235,12 @@ void DatabaseTabWidget::saveDatabaseAs(Database* db)
if (!fileName.isEmpty()) { if (!fileName.isEmpty()) {
QFile* oldFile = dbStruct.file; QFile* oldFile = dbStruct.file;
QScopedPointer<QFile> file(new QFile(fileName)); QScopedPointer<QFile> file(new QFile(fileName));
// TODO error handling // TODO: error handling
if (!file->open(QIODevice::ReadWrite)) { if (!file->open(QIODevice::ReadWrite)) {
return; return;
} }
dbStruct.file = file.take(); dbStruct.file = file.take();
// TODO ensure that the data is actually written to disk // TODO: ensure that the data is actually written to disk
m_writer.writeDatabase(dbStruct.file, db); m_writer.writeDatabase(dbStruct.file, db);
dbStruct.file->flush(); dbStruct.file->flush();
delete oldFile; delete oldFile;

View File

@ -360,7 +360,7 @@ void EditEntryWidget::updateCurrentAttribute()
void EditEntryWidget::insertAttachment() void EditEntryWidget::insertAttachment()
{ {
// TODO save last used dir // TODO: save last used dir
QString filename = fileDialog()->getOpenFileName(this, tr("Select file"), QString filename = fileDialog()->getOpenFileName(this, tr("Select file"),
QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)); QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
if (filename.isEmpty() || !QFile::exists(filename)) { if (filename.isEmpty() || !QFile::exists(filename)) {
@ -392,7 +392,7 @@ void EditEntryWidget::saveCurrentAttachment()
} }
QString filename = m_attachmentsModel->keyByIndex(index); QString filename = m_attachmentsModel->keyByIndex(index);
// TODO save last used dir // TODO: save last used dir
QDir dir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)); QDir dir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation));
QString savePath = fileDialog()->getSaveFileName(this, tr("Save attachment"), QString savePath = fileDialog()->getSaveFileName(this, tr("Save attachment"),
dir.filePath(filename)); dir.filePath(filename));

View File

@ -63,7 +63,7 @@ void EntryView::setModel(QAbstractItemModel* model)
Entry* EntryView::currentEntry() Entry* EntryView::currentEntry()
{ {
// TODO use selection instead of current? // TODO: use selection instead of current?
return m_model->entryFromIndex(m_sortModel->mapToSource(currentIndex())); return m_model->entryFromIndex(m_sortModel->mapToSource(currentIndex()));
} }

View File

@ -192,7 +192,7 @@ bool FileKey::loadXmlMeta(QXmlStreamReader& xmlReader)
while (!xmlReader.error() && xmlReader.readNextStartElement()) { while (!xmlReader.error() && xmlReader.readNextStartElement()) {
if (xmlReader.name() == "Version") { if (xmlReader.name() == "Version") {
// TODO error message about incompatible key file version // TODO: error message about incompatible key file version
if (xmlReader.readElementText() == "1.00") { if (xmlReader.readElementText() == "1.00") {
corectVersion = true; corectVersion = true;
} }
@ -208,7 +208,7 @@ QByteArray FileKey::loadXmlKey(QXmlStreamReader& xmlReader)
while (!xmlReader.error() && xmlReader.readNextStartElement()) { while (!xmlReader.error() && xmlReader.readNextStartElement()) {
if (xmlReader.name() == "Data") { if (xmlReader.name() == "Data") {
// TODO do we need to enforce a specific data.size()? // TODO: do we need to enforce a specific data.size()?
data = QByteArray::fromBase64(xmlReader.readElementText().toAscii()); data = QByteArray::fromBase64(xmlReader.readElementText().toAscii());
} }
} }

View File

@ -191,7 +191,7 @@ bool SymmetricCipherStream::writeBlock(bool lastBlock)
if (m_baseDevice->write(m_buffer) != m_buffer.size()) { if (m_baseDevice->write(m_buffer) != m_buffer.size()) {
m_error = true; m_error = true;
// TODO copy error string // TODO: copy error string
return false; return false;
} }
else { else {

View File

@ -30,7 +30,7 @@ void TestCryptoHash::initTestCase()
void TestCryptoHash::test() void TestCryptoHash::test()
{ {
// TODO move somewhere else // TODO: move somewhere else
QVERIFY(Crypto::selfTest()); QVERIFY(Crypto::selfTest());
CryptoHash cryptoHash1(CryptoHash::Sha256); CryptoHash cryptoHash1(CryptoHash::Sha256);

View File

@ -268,7 +268,7 @@ void TestKeePass2XmlReader::testEntry2()
QCOMPARE(entry->uuid().toBase64(), QString("4jbADG37hkiLh2O0qUdaOQ==")); QCOMPARE(entry->uuid().toBase64(), QString("4jbADG37hkiLh2O0qUdaOQ=="));
QCOMPARE(entry->iconNumber(), 0); QCOMPARE(entry->iconNumber(), 0);
QCOMPARE(entry->iconUuid().toBase64(), QString("++vyI+daLk6omox4a6kQGA==")); QCOMPARE(entry->iconUuid().toBase64(), QString("++vyI+daLk6omox4a6kQGA=="));
// TODO test entry->icon() // TODO: test entry->icon()
QCOMPARE(entry->foregroundColor(), QColor(255, 0, 0)); QCOMPARE(entry->foregroundColor(), QColor(255, 0, 0));
QCOMPARE(entry->backgroundColor(), QColor(255, 255, 0)); QCOMPARE(entry->backgroundColor(), QColor(255, 255, 0));
QCOMPARE(entry->overrideUrl(), QString("http://override.net/")); QCOMPARE(entry->overrideUrl(), QString("http://override.net/"));
@ -284,7 +284,7 @@ void TestKeePass2XmlReader::testEntry2()
QVERIFY(attrs.removeOne("Notes")); QVERIFY(attrs.removeOne("Notes"));
QCOMPARE(entry->attributes()->value("Password"), QString("Jer60Hz8o9XHvxBGcRqT")); QCOMPARE(entry->attributes()->value("Password"), QString("Jer60Hz8o9XHvxBGcRqT"));
QVERIFY(attrs.removeOne("Password")); QVERIFY(attrs.removeOne("Password"));
QCOMPARE(entry->attributes()->value("Protected String"), QString("y")); // TODO should have a protection attribute QCOMPARE(entry->attributes()->value("Protected String"), QString("y")); // TODO: should have a protection attribute
QVERIFY(attrs.removeOne("Protected String")); QVERIFY(attrs.removeOne("Protected String"));
QCOMPARE(entry->attributes()->value("Title"), QString("Sample Entry 2")); QCOMPARE(entry->attributes()->value("Title"), QString("Sample Entry 2"));
QVERIFY(attrs.removeOne("Title")); QVERIFY(attrs.removeOne("Title"));