bool SSValidator::validate(QString input)
{
    //must begin with ss:// to distinguish from random base64 encoded strings
    if (input.startsWith("ss://")) {
        input.remove(0, 5);
        QString decode(QByteArray::fromBase64(input.toLatin1()));
        QStringList decList = decode.split(':');
        if (decList.size() < 3) {
            return false;
        }

        //Validate Method
        QString method = decList.first();
        if (!validateMethod(method)) {
            return false;
        }

        //Validate Port
        QString port = decList.last();
        if (!validatePort(port)) {
            return false;
        }

        //Validate whether server and password exist
        QStringList pwdServer = decList.at(1).split('@');
        if (pwdServer.size() < 2) {
            return false;
        }

        //it seems acceptable now
        return true;
    }
    else {
        return false;
    }
}
void ApiCheckTextArea::positionAt()
{
    validateMethod("positionAt(QVariant,QVariant)");
}
void ApiCheckTextArea::positionToRectangle()
{
    validateMethod("positionToRectangle(QVariant)");
}
void ApiCheckTextArea::select()
{
    validateMethod("select(QVariant,QVariant)");
}
void ApiCheckTextArea::selectWord()
{
    validateMethod("selectWord()");
}
void ApiCheckTextArea::cut()
{
    validateMethod("cut()");
}
void ApiCheckTextArea::paste()
{
    validateMethod("paste()");
}
void ApiCheckTextArea::copy()
{
    validateMethod("copy()");
}
void ApiCheckMenu::close()
{
    validateMethod("close()");
}
void ApiCheckMenu::open()
{
    validateMethod("open()");
}