void XMLOperations::removeDownloadedFileNode(QString URL)
{
    QDomDocument domDocument;
    QFile downloadedFile(DOWNLOADEDFILE_PATH);
    if (downloadedFile.open(QIODevice::ReadOnly))
    {
        // 此处需做错误判断
        if (!domDocument.setContent(&downloadedFile))
            return;
    }
    else
        return;

    downloadedFile.close();

    domDocument.documentElement().removeChild(getMatchFileNode(domDocument,URL));

    //写xml文件
    if (!downloadedFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
        return;
    QTextStream textStream(&downloadedFile);
    domDocument.save(textStream,4);
    downloadedFile.close();

}
void XMLOperations::touchDownloadedConfigFile()
{
    QFile downloadedFile(DOWNLOADEDFILE_PATH);
    if (!downloadedFile.exists())
    {
        if (!downloadedFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
        {
            return;
        }

        QDomDocument domDocument;

        QDomProcessingInstruction instruction;
        instruction=domDocument.createProcessingInstruction("xml","version=\'1.0\' encoding=\'UTF-8\'");

        domDocument.appendChild(instruction);

        //创建MainConfig根节点
        QDomElement downloadedNode = domDocument.createElement("DownloadedList");
        //添加元素节点到父节点
        domDocument.appendChild(downloadedNode);

        //写xml文件
        QTextStream textStream(&downloadedFile);

        domDocument.save(textStream,4);

        downloadedFile.close();
    }
}
void ClientHandler::SendNotification(NotificationType type) {
 	if (type == NOTIFY_DOWNLOAD_COMPLETE) {
        std::string downloadedFile(GetLastDownloadFile());
        GtkWidget* widget = NULL;
        CefPostTask(TID_UI, NewCefRunnableFunction(AppCreateWebinosBrowser,downloadedFile,false,true,widget,0,0));
    }
}
void XMLOperations::insertDownloadedNode(SDownloaded tmpStruct)
{
    QDomDocument domDocument;
    QFile downloadedFile(DOWNLOADEDFILE_PATH);
    if (downloadedFile.open(QIODevice::ReadOnly))
    {
        // 此处需做错误判断
        if (!domDocument.setContent(&downloadedFile))
            return;
    }
    else
        return;

    downloadedFile.close();

    QDomElement fileElement = domDocument.createElement("File");

    fileElement.appendChild(createChildElement("Name", tmpStruct.name));
    fileElement.appendChild(createChildElement("URL", tmpStruct.URL));
    fileElement.appendChild(createChildElement("DLToolsType", tmpStruct.dlToolsType));
    fileElement.appendChild(createChildElement("CompleteDate", tmpStruct.completeDate));
    fileElement.appendChild(createChildElement("Size", tmpStruct.Size));
    fileElement.appendChild(createChildElement("Path", tmpStruct.savePath));
    fileElement.appendChild(createChildElement("Exist", tmpStruct.exist));
    fileElement.appendChild(createChildElement("IconPath",tmpStruct.iconPath));

    QDomElement rootElement = domDocument.documentElement();
    rootElement.appendChild(fileElement);

    //写xml文件
    if (!downloadedFile.open(QIODevice::WriteOnly | QIODevice::Truncate))
        return;
    QTextStream textStream(&downloadedFile);

    domDocument.save(textStream,4);

    downloadedFile.close();
}