示例#1
0
BOOL CWizKMDatabaseServer::document_postData2(const WIZDOCUMENTDATAEX& data, UINT nParts, __int64& nServerVersion)
{
    QString strObjMd5;
    //
    if (!data.arrayData.isEmpty() && (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA))
    {
        strObjMd5 = WizMd5StringNoSpaceJava(data.arrayData);
        if (!data_upload(data.strGUID, _T("document"), data.arrayData, strObjMd5, data.strTitle))
        {
            TOLOG1(_T("Failed to upload note data: %1"), data.strTitle);
            return FALSE;
        }
    }
    //
    CWizKMDocumentPostDataParam param(WIZKM_WEBAPI_VERSION, m_kbInfo.strToken, m_kbInfo.strKbGUID, data.strGUID, nParts, data, data.arrayTagGUID, data.arrayParam, strObjMd5);
    //
    CWizXmlRpcResult ret;
    if (!Call(_T("document.postData"), ret, &param))
    {
        TOLOG(_T("document.postData failure!"));
        return FALSE;
    }
    //
    if (CWizXmlRpcStructValue* pRet = ret.GetResultValue<CWizXmlRpcStructValue>())
    {
        pRet->GetInt64(_T("version"), nServerVersion);
    }
    //
    return TRUE;
}
示例#2
0
void CWizSync::on_kbSyncDone(bool bError)
{
    if (bError) {
        m_bStarted = false;
        TOLOG(tr("Error occured while syncing, Try to syncing next time"));
        Q_EMIT syncDone(true);
        return;
    }

    if (!m_arrayGroup.size()) {
        m_bStarted = false;
        TOLOG(tr("Syncing finished"));
        Q_EMIT syncDone(false);
        return;
    }

    WIZGROUPDATA group(m_arrayGroup[0]);
    m_arrayGroup.erase(m_arrayGroup.begin());

    // open group database for syncing
    if (!m_dbMgr.isOpened(group.strGroupGUID)) {
        m_bStarted = false;
        TOLOG(tr("FATAL: Can't open group database!"));
        Q_EMIT syncDone(false);
        return;
    }

    m_kbSync->setDatabase(m_dbMgr.db(group.strGroupGUID));

    // reset db info and start sync group data
    TOLOG1(tr("Begin syncing group data: %1"), group.strGroupName);
    m_kbSync->startSync(group.strGroupGUID);
}
示例#3
0
void CWizSync::processObjectData(const WIZOBJECTDATA& data)
{
    WIZOBJECTDATA conflictObjectData(data);
    conflictObjectData.strObjectGUID = WizGenGUIDLowerCaseLetterOnly();
    conflictObjectData.strDisplayName += tr("(conflict backup)");

    // set dirty flag, uploaded needed
    m_conflictDownloadedInfo.nVersion = -1;
    m_conflictDownloadedInfo.strGUID = conflictObjectData.strObjectGUID;
    m_conflictDownloadedInfo.strTitle += tr("(conflict backup)");
    m_conflictDownloadedInfo.strInfoMD5 = m_db.CalDocumentInfoMD5(m_conflictDownloadedInfo);

    if (m_db.CreateDocumentEx(m_conflictDownloadedInfo)) {
        m_db.UpdateSyncObjectLocalData(conflictObjectData);
        TOLOG1(tr("Conflict backup created: %1"), m_conflictDownloadedInfo.strTitle);
    } else {
        TOLOG("unable to create conflict backup while create document");
    }

    std::deque<WIZDOCUMENTDATABASE>::iterator it;
    for (it = m_arrayAllDocumentsNeedToBeDownloaded.begin(); \
            it != m_arrayAllDocumentsNeedToBeDownloaded.end();
            it++) {
        WIZDOCUMENTDATABASE data = *it;

        if (data.strGUID == m_conflictedDocument.strGUID) {
            m_arrayAllDocumentsNeedToBeDownloaded.erase(it);
            break;
        }
    }

    // chain back
    onQueryDocumentInfo(m_conflictedDocument);
}
bool CWizDatabaseManager::openAll()
{
    // first, open private db
    if (!open()) {
        TOLOG("open user private database failed");
        return false;
    }

    // second, get groups info
    CWizGroupDataArray arrayGroup;
    if (!m_dbPrivate->GetUserGroupInfo(arrayGroup)) {
        TOLOG("Failed to get user group info");
        return true;
    }

    // third, open groups one by one
    CWizGroupDataArray::const_iterator it;
    for (it = arrayGroup.begin(); it != arrayGroup.end(); it++) {
        WIZGROUPDATA group = *it;
        if (!open(group.strGroupGUID)) {
            TOLOG1("failed to open group: %1", group.strGroupName);
        }
    }

    return true;
}
示例#5
0
BOOL CWizKMDatabaseServer::document_getData2(const QString& strDocumentGUID, UINT nParts, WIZDOCUMENTDATAEX& ret)
{
    WIZDOCUMENTDATAEX_XMLRPC_FULL wrap(ret);
    wrap.arrayData.clear();

    //
    CWizKMDocumentGetDataParam param(WIZKM_WEBAPI_VERSION, m_kbInfo.strToken, m_kbInfo.strKbGUID, strDocumentGUID, nParts);
    if (!Call(_T("document.getData"), wrap, &param))
    {
        TOLOG(_T("document.getData failure!"));
        return FALSE;
    }
    //
    ret = wrap;
    //
    BOOL bDownloadData = (nParts & WIZKM_XMKRPC_DOCUMENT_PART_DATA) ? TRUE : FALSE;
    //
    if (bDownloadData)
    {
        if (!data_download(ret.strGUID, _T("document"), ret.arrayData, ret.strTitle))
        {
            TOLOG1(_T("Failed to download attachment data: %1"), ret.strTitle);
            return FALSE;
        }
    }
    //
    return TRUE;
}
示例#6
0
BOOL CWizKMDatabaseServer::attachment_getData2(const QString& strAttachmentGUID, UINT nParts, WIZDOCUMENTATTACHMENTDATAEX& ret)
{
    WIZDOCUMENTATTACHMENTDATAEX wrap(ret);
    //
    CWizKMAttachmentGetDataParam param(WIZKM_WEBAPI_VERSION, m_kbInfo.strToken, m_kbInfo.strKbGUID, strAttachmentGUID, nParts);
    //
    if (!Call(_T("attachment.getData"), wrap, &param))
    {
        TOLOG(_T("attachment.getData failure!"));
        return FALSE;
    }
    //
    ret = wrap;
    //
    if (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA)
    {
        ATLASSERT(!ret.arrayData.isEmpty());
        if (!ret.arrayData.isEmpty())
        {
            TOLOG(_T("fault error: ret.arrayData is null!"));
            return FALSE;
        }
        //
        if (!data_download(ret.strGUID, _T("attachment"), ret.arrayData, ret.strName))
        {
            TOLOG1(_T("Failed to download attachment data: %1"), ret.strName);
            return FALSE;
        }
    }
    //
    //
    return TRUE;
}
示例#7
0
void CWizNoteInfoForm::setDocument(const WIZDOCUMENTDATA& data)
{
    Q_ASSERT(!data.strKbGUID.isEmpty());
    m_docKbGuid = data.strKbGUID;
    m_docGuid = data.strGUID;

    CWizDatabase& db = CWizDatabaseManager::instance()->db(data.strKbGUID);
    QString doc = db.GetDocumentFileName(data.strGUID);
    QString sz = ::WizGetFileSizeHumanReadalbe(doc);

    ui->editTitle->setText(data.strTitle);

    // private document
    if (data.strKbGUID == CWizDatabaseManager::instance()->db().kbGUID()) {
        ui->labelNotebook->setText(data.strLocation);

        QString tags = db.GetDocumentTagsText(data.strGUID);
        ui->labelTags->setText(tags);

        ui->editAuthor->setText(data.strAuthor);

    // group document
    } else {
        CWizTagDataArray arrayTag;
        if (!db.GetDocumentTags(data.strGUID, arrayTag)) {
            ui->labelNotebook->clear();
        } else {
            if (arrayTag.size() > 1) {
                TOLOG1("Group document should only have one tag: %1", data.strTitle);
            }

            QString tagText;
            if (arrayTag.size()) {
                tagText = db.getTagTreeText(arrayTag[0].strGUID);
            }

            ui->labelNotebook->setText("/" + db.name() + tagText + "/");
        }

        ui->labelTags->clear();
        ui->editAuthor->setText(data.strAuthor);
    }

    // common fields
    ui->editCreateTime->setText(data.tCreated.toString());
    ui->editUpdateTime->setText(data.tModified.toString());
    ui->editURL->setText(data.strURL);
    ui->labelOpenURL->setText(WizFormatString2("<a href=\"%1\">%2</a>", data.strURL, tr("Open")));
    ui->labelSize->setText(sz);
    ui->checkEncrypted->setChecked(data.nProtected ? true : false);

    bool canEdit = (db.CanEditDocument(data) && !CWizDatabase::IsInDeletedItems(data.strLocation));
    ui->editAuthor->setReadOnly(!canEdit);
    ui->editTitle->setReadOnly(!canEdit);
    ui->editURL->setReadOnly(!canEdit);
    ui->checkEncrypted->setEnabled(canEdit && !db.IsGroup());
}
BOOL CWizXmlRpcServerBase::Call(const QString& strMethodName, CWizXmlRpcResult& ret, CWizXmlRpcValue* pParam1, CWizXmlRpcValue* pParam2 /*= NULL*/, CWizXmlRpcValue* pParam3 /*= NULL*/, CWizXmlRpcValue* pParam4 /*= NULL*/)
{
    if (!xmlRpcCall(strMethodName, ret, pParam1, pParam2, pParam3, pParam4))
    {
        TOLOG1(_T("Failed to call xml-rpc method: %1"), strMethodName);
        return FALSE;
    }
    //
    return TRUE;
}
示例#9
0
void CWizKbSync::onDocumentGetData(const WIZDOCUMENTDATAEX& data)
{
    Q_ASSERT(!data.strGUID.isEmpty());

    if (!m_db->UpdateDocument(data)) {
        TOLOG1("Update Document info failed: %1", data.strTitle);
        m_bDocumentInfoError = true;
    }

    downloadNextDocumentFullInfo();
}
示例#10
0
bool WizXmlRpcResultFromXml(WizXMLDocument& doc, WizXmlRpcValue** ppRet)
{
    WizXMLNode nodeMethodResponse;
    doc.findChildNode("methodResponse", nodeMethodResponse);
    if (nodeMethodResponse.isNull())
    {
        TOLOG("Failed to get methodResponse node!");
        return false;
    }

    WizXMLNode nodeTest;
    if (!nodeMethodResponse.getFirstChildNode(nodeTest))
    {
        TOLOG("Failed to get methodResponse child node!");
        return false;
    }

    QString strTestName = nodeTest.getName();

    if (0 == strTestName.compare("params", Qt::CaseInsensitive))
    {
        WizXMLNode nodeParamValue;
        nodeTest.findNodeByPath("param/value", nodeParamValue);
        if (nodeParamValue.isNull())
        {
            TOLOG("Failed to get param value node of params!");
            return false;
        }

        return WizXmlRpcValueFromXml(nodeParamValue, ppRet);
    }
    else if (0 == strTestName.compare("fault", Qt::CaseInsensitive))
    {
        WizXMLNode nodeFaultValue;
        nodeTest.findChildNode("value", nodeFaultValue);
        if (nodeFaultValue.isNull())
        {
            TOLOG("Failed to get fault value node!");
            return false;
        }

        WizXmlRpcFaultValue* pFault = new WizXmlRpcFaultValue();
        pFault->read(nodeFaultValue);

        *ppRet = pFault;

        return true;
    }
    else
    {
        TOLOG1("Unknown response node name: %1", strTestName);
        return false;
    }
}
示例#11
0
bool WizXmlRpcResultFromXml(CWizXMLDocument& doc, CWizXmlRpcValue** ppRet)
{
	CWizXMLNode nodeMethodResponse;
    doc.FindChildNode("methodResponse", nodeMethodResponse);
    if (nodeMethodResponse.isNull())
	{
        TOLOG("Failed to get methodResponse node!");
        return false;
	}

	CWizXMLNode nodeTest;
	if (!nodeMethodResponse.GetFirstChildNode(nodeTest))
	{
        TOLOG("Failed to get methodResponse child node!");
        return false;
	}

	CString strTestName = nodeTest.GetName();

    if (0 == strTestName.CompareNoCase("params"))
	{
		CWizXMLNode nodeParamValue;
        nodeTest.FindNodeByPath("param/value", nodeParamValue);
        if (nodeParamValue.isNull())
		{
            TOLOG("Failed to get param value node of params!");
            return false;
		}

		return WizXmlRpcValueFromXml(nodeParamValue, ppRet);
	}
    else if (0 == strTestName.CompareNoCase("fault"))
	{
		CWizXMLNode nodeFaultValue;
		nodeTest.FindChildNode(_T("value"), nodeFaultValue);
        if (nodeFaultValue.isNull())
		{
            TOLOG("Failed to get fault value node!");
            return false;
		}

		CWizXmlRpcFaultValue* pFault = new CWizXmlRpcFaultValue();
		pFault->Read(nodeFaultValue);

		*ppRet = pFault;

        return true;
	}
	else
	{
        TOLOG1("Unknown response node name: %1", strTestName);
        return false;
	}
}
示例#12
0
bool WizXmlRpcStructValue::getColor(const QString& strName, COLORREF& cr) const
{
    QString str;
    if (!getString(strName, str)) {
        TOLOG1("Failed to get member %1", strName);
        return false;
	}
	cr = WizStringToColor(str);

    return true;
}
示例#13
0
BOOL CWizXmlRpcStructValue::GetColor(const CString& strName, COLORREF& cr) const
{
	CString str;
    if (!GetStr(strName, str))
	{
        TOLOG1(_T("Failed to get member %1"), strName);
		return FALSE;
	}
	cr = WizStringToColor(str);
	//
	return TRUE;
}
示例#14
0
BOOL CWizKMDatabaseServer::document_postData(const WIZDOCUMENTDATAEX& data, UINT nParts, __int64& nServerVersion)
{
    if (!data.arrayData.isEmpty() && data.arrayData.size() > m_kbInfo.GetMaxFileSize())
    {
        TOLOG1(_T("%1 is too large, skip it"), data.strTitle);
        return FALSE;
    }
    //
    BOOL bRet = document_postData2(data, nParts, nServerVersion);
    //
    return bRet;
}
示例#15
0
BOOL CWizKMDatabaseServer::attachment_postData(WIZDOCUMENTATTACHMENTDATAEX& data, UINT nParts, __int64& nServerVersion)
{
    if (!data.arrayData.isEmpty() && data.arrayData.size() > m_kbInfo.GetMaxFileSize())
    {
        TOLOG1(_T("%1 is too large, skip it"), data.strName);
        return TRUE;
    }
    //
    if (attachment_postData2(data, nParts, nServerVersion))
        return TRUE;
    //
    return FALSE;
}
示例#16
0
bool CWizSearchIndexer::rebuildFTSIndex()
{
    if (!::WizDeleteAllFilesInFolder(m_strIndexPath)) {
        TOLOG("Can't delete old index files while rebuild FTS index");
        return false;
    }

    int total = m_dbMgr.count();
    for (int i = 0; i < total; i++) {
        if (!m_dbMgr.at(i).setDocumentFTSEnabled(false)) {
            TOLOG1("FATAL: Can't reset db index flag: %1", m_dbMgr.at(i).kbGUID());
            return false;
        }

        if (!m_dbMgr.at(i).setAllDocumentsSearchIndexed(false)) {
            TOLOG1("FATAL: Can't reset document index flag: %1", m_dbMgr.at(i).kbGUID());
            return false;
        }
    }

    return buildFTSIndex();
}
示例#17
0
QByteArray CWizKMDatabaseServer::DownloadAttachmentData(const QString& strAttachmentGUID)
{
    WIZDOCUMENTATTACHMENTDATAEX_XMLRPC_FULL ret;
    if (!attachment_getData(strAttachmentGUID, WIZKM_XMKRPC_ATTACHMENT_PART_DATA, ret))
    {
        TOLOG1(_T("Failed to download attachment data: %1"), strAttachmentGUID);
        return NULL;
    }
    //
    if (ret.arrayData.isEmpty())
        return NULL;
    //
    return ret.arrayData;
}
示例#18
0
void CWizFolder::MoveToLocation(const CString& strDestLocation)
{
    Q_ASSERT(strDestLocation.right(1) == "/");
    Q_ASSERT(strDestLocation.left(1) == "/");

    if (!CanMove(Location(), strDestLocation))
        return;

    CString strOldLocation = Location();
    //CString strNewLocation;
//
    //CString strLocationName = CWizDatabase::GetLocationName(strOldLocation);
//
    //if (strDestLocation.IsEmpty()) {
    //    strNewLocation = "/" + strLocationName + "/";
    //} else {
    //    strNewLocation = strDestLocation + strLocationName + "/";
    //}

    CWizDocumentDataArray arrayDocument;
    if (!m_db.GetDocumentsByLocationIncludeSubFolders(strOldLocation, arrayDocument))
    {
        TOLOG1(_T("Failed to get documents by location (include sub folders): %1"), strOldLocation);
        return;
    }

    CWizDocumentDataArray::const_iterator it;
    for (it = arrayDocument.begin(); it != arrayDocument.end(); it++)
    {
        WIZDOCUMENTDATA data = *it;

        Q_ASSERT(data.strLocation.startsWith(strOldLocation));
        if (!data.strLocation.startsWith(strOldLocation)) {
            TOLOG(_T("Error location of document!"));
            continue;
        }

        data.strLocation.Delete(0, strOldLocation.GetLength());
        data.strLocation.Insert(0, strDestLocation);

        if (!m_db.ModifyDocumentInfo(data))
        {
            TOLOG(_T("Failed to move document to new folder!"));
            continue;
        }
    }

    m_db.LogDeletedFolder(strOldLocation);
}
示例#19
0
BOOL WizXmlRpcServerBase::call(const QString& strMethodName, std::map<QString, QString>& mapRet, WizXmlRpcValue* pParam1, WizXmlRpcValue* pParam2 /*= NULL*/, WizXmlRpcValue* pParam3 /*= NULL*/, WizXmlRpcValue* pParam4 /*= NULL*/)
{
    WizXmlRpcResult ret;
    if (!call(strMethodName, ret, pParam1, pParam2, pParam3, pParam4))
        return FALSE;
    //
    WizXmlRpcStructValue* pValue = ret.getResultValue<WizXmlRpcStructValue>();
    if (!pValue)
    {
        TOLOG1("The return value of XmpRpc method %1 is not a struct!", strMethodName);
        return FALSE;
    }
    //
    return pValue->toStringMap(mapRet);
}
示例#20
0
WizObjectType WIZOBJECTDATA::TypeStringToObjectType(const CString& strType)
{
    if (strType.IsEmpty())
    {
        TOLOG1(_T("Unknown guid type: %1"), strType);
        ATLASSERT(FALSE);
        return wizobjectError;
    }
    //
    if (0 == _tcsicmp(strType, _T("tag")))
        return wizobjectTag;
    if (0 == _tcsicmp(strType, _T("tag_group")))
        return wizobjectTag;
    else if (0 == _tcsicmp(strType, _T("style")))
        return wizobjectStyle;
    else if (0 == _tcsicmp(strType, _T("attachment")))
        return wizobjectDocumentAttachment;
    else if (0 == _tcsicmp(strType, _T("document")))
        return wizobjectDocument;
    //
    TOLOG1(_T("Unknown guid type: %1"), strType);
    ATLASSERT(FALSE);
    return wizobjectError;
}
示例#21
0
bool CWizDocument::AddTag(const WIZTAGDATA& dataTag)
{
    CWizStdStringArray arrayTag;
    m_db.GetDocumentTags(m_data.strGUID, arrayTag);

    if (-1 != WizFindInArray(arrayTag, dataTag.strGUID))
        return true;

    if (!m_db.InsertDocumentTag(m_data, dataTag.strGUID)) {
        TOLOG1(_T("Failed to insert document tag: %1"), m_data.strTitle);
        return false;
    }

    return true;
}
示例#22
0
bool CppSQLite3DB::dump(const CString& strNewFileName)
{
    FILE* fp = fopen(strNewFileName.toLocal8Bit(), _T("wb"));
    if (!fp)
	{
                TOLOG1(_T("Failed to open file: %1"), strNewFileName);
		return false;
	}
	//
	callback_data data;
	data.db = mpDB;
	data.out = fp;
	data.writableSchema = 0;
	data.cnt = 0;
	data.pStmt = NULL;
	//
	callback_data* p = &data;
	//
    fprintf(p->out, "PRAGMA foreign_keys=OFF;\n");
    fprintf(p->out, "BEGIN TRANSACTION;\n");
    p->writableSchema = 0;
    sqlite3_exec(p->db, "PRAGMA writable_schema=ON", 0, 0, 0);

	run_schema_dump_query(p, 
		"SELECT name, type, sql FROM sqlite_master "
		"WHERE sql NOT NULL AND type=='table' AND name!='sqlite_sequence'", 0
		);
	run_schema_dump_query(p, 
		"SELECT name, type, sql FROM sqlite_master "
		"WHERE name=='sqlite_sequence'", 0
		);
	run_table_dump_query(p->out, p->db,
		"SELECT sql FROM sqlite_master "
		"WHERE sql NOT NULL AND type IN ('index','trigger','view')", 0
		);
	//
	if( p->writableSchema ){
		fprintf(p->out, "PRAGMA writable_schema=OFF;\n");
		p->writableSchema = 0;
	}
	sqlite3_exec(p->db, "PRAGMA writable_schema=OFF", 0, 0, 0);
	fprintf(p->out, "COMMIT;\n");
	//
	fclose(fp);

	return true;
}
示例#23
0
BOOL CWizKMDatabaseServer::data_upload(const QString& strObjectGUID, const QString& strObjectType, const QByteArray& stream, const QString& strObjMD5, const QString& strDisplayName)
{
    __int64 nStreamSize = stream.size();
    if (0 == nStreamSize)
    {
        TOLOG(_T("fault error: stream is zero"));
        return FALSE;
    }
    //
    QString strMD5(strObjMD5);
    //
    QByteArray spPartStream;
    //
    int partSize = 500 * 1000;
    int partCount = int(nStreamSize / partSize);
    if (nStreamSize % partSize != 0)
    {
        partCount++;
    }
    //
    for (int i = 0; i < partCount; i++)
    {
        spPartStream.clear();

        int start = i * partSize;
        int end = std::min<int>(start + partSize, int(nStreamSize));
        ATLASSERT(end > start);
        //
        int curPartSize = end - start;
        ATLASSERT(curPartSize <= partSize);
        //
        const char* begin = stream.data() + start;
        spPartStream = spPartStream.fromRawData(begin, curPartSize);
        //
        int curPartStreamSize = (int)spPartStream.size();
        ATLASSERT(curPartStreamSize == curPartSize);
        //
        if (!data_upload(strObjectGUID, strObjectType, strMD5, (int)nStreamSize, partCount, i, curPartSize, spPartStream))
        {
            TOLOG1(_T("Failed to upload part data: %1"), strDisplayName);
            return FALSE;
        }
    }
    //
    //
    return TRUE;
}
示例#24
0
QString WIZOBJECTDATA::ObjectTypeToTypeString(WizObjectType eType)
{
    switch (eType) {
    case wizobjectTag:
        return "tag";
    case wizobjectStyle:
        return "style";
    case wizobjectDocumentAttachment:
        return "attachment";
    case wizobjectDocument:
        return "document";
    default:
        TOLOG1("Unknown guid type value: %1", WizIntToStr(eType));
        Q_ASSERT(0);
        return QString();
    }
}
示例#25
0
void CWizKbSync::onDocumentGetData(const WIZDOCUMENTDATAEX& data)
{
    //CWizApi::onDocumentGetData(data);

    if (m_bChained) {
        if (!data.strGUID.isEmpty()) {
            if (!m_db->UpdateDocument(data)) {
                TOLOG1("Update Document info failed: %1", data.strTitle);
                m_bDocumentInfoError = true;
            }
        }

        downloadNextDocumentFullInfo();
    } else {
        processConflictDocumentData(data);
    }
}
示例#26
0
void CWizFolder::Delete()
{
    if (IsDeletedItems())
        return;

    if (IsInDeletedItems()) {
        if (!m_db.DeleteDocumentsByLocation(Location())) {
            TOLOG1("Failed to delete documents by location; %1", Location());
            return;
        }

        m_db.LogDeletedFolder(Location());
        m_db.SetObjectVersion("folder", 0);
    } else {
        CWizFolder deletedItems(m_db, LOCATION_DELETED_ITEMS);
        MoveTo(&deletedItems);
    }
}
示例#27
0
void CWizSync::onDownloadDocumentsSimpleInfoCompleted()
{
    Q_EMIT progressChanged(progressDocumentSimpleInfoDownloaded);

    TOLOG1(tr("Total %1 documents need to be update"), QString::number(m_arrayAllDocumentsNeedToBeDownloaded.size()));

    //save max version of document
    //if no error occured while downloading document full information
    //then update this version
    if (!m_arrayAllDocumentsNeedToBeDownloaded.empty()) {
        m_nDocumentMaxVersion = ::WizObjectsGetMaxVersion<WIZDOCUMENTDATABASE>(m_arrayAllDocumentsNeedToBeDownloaded);
    }

    //filter documents for getting document full information (not data)
    filterDocuments();

    startUploadDocuments();
}
示例#28
0
CString WIZOBJECTDATA::ObjectTypeToTypeString(WizObjectType eType)
{
    switch (eType)
    {
    case wizobjectTag:
        return CString(_T("tag"));
    case wizobjectStyle:
        return CString(_T("style"));
    case wizobjectDocumentAttachment:
        return CString(_T("attachment"));
    case wizobjectDocument:
        return CString(_T("document"));
    default:
        TOLOG1(_T("Unknown guid type value: %1"), WizIntToStr(eType));
        ATLASSERT(FALSE);
        return CString();
    }
}
示例#29
0
BOOL CWizKMXmlRpcServerBase::GetValue(const QString& strMethodPrefix, const QString& strToken, const QString& strKbGUID, const QString& strKey, QString& strValue, __int64& nVersion)
{
    CWizKMTokenOnlyParam param(strToken, strKbGUID);
    //
    param.AddString(_T("key"), strKey);
    //
    QString strVersion;
    //
    if (!Call(QString(strMethodPrefix) + _T(".getValue"),  _T("value_of_key"), strValue, _T("version"), strVersion, &param))
    {
        TOLOG1(_T("Failed to get value: key=%1"), strKey);
        return FALSE;
    }
    //
    nVersion = _ttoi64(strVersion);
    //
    return TRUE;
}
示例#30
0
bool CWizDocument::MoveDocument(CWizFolder* pFolder)
{
    if (!pFolder)
        return false;

    QString strNewLocation = pFolder->Location();
    QString strOldLocation = m_data.strLocation;

    if (strNewLocation == strOldLocation)
        return true;

    m_data.strLocation = strNewLocation;
    if (!m_db.ModifyDocumentInfo(m_data))
    {
        m_data.strLocation = strOldLocation;
        TOLOG1(_T("Failed to modify document location %1."), m_data.strLocation);
        return false;
    }

    return true;
}