예제 #1
0
KbAction::KbAction(const QIcon &icon, QString text, QObject* parent, const QKeySequence &key)
: QAction(icon,text,parent),
  m_resetKey(key),
  m_resetIcon(icon)
{
    installShortcut(text, key);
}
예제 #2
0
    JNIEXPORT jint JNICALL Java_com_sun_deploy_config_WinConfig_installShortcut(
        JNIEnv *env, jobject wHandler, jstring pathS, jstring nameS,
        jstring descriptionS, jstring appPathS, jstring argsS,
        jstring directoryS, jstring iconPathS) {
        const WORD *path = (pathS != NULL) ? env->GetStringChars
                           (pathS, NULL) : NULL;
        const unsigned short *name = (nameS != NULL) ? env->GetStringChars
                                     (nameS, NULL) : NULL;
        const unsigned short *description = (descriptionS != NULL) ?
                                            env->GetStringChars(descriptionS, 0) : NULL;
        const unsigned short *appPath = (appPathS != NULL) ? env->GetStringChars
                                        (appPathS, 0) : NULL;
        const unsigned short *args = (argsS != NULL) ? env->GetStringChars
                                     (argsS, 0) : NULL;
        const unsigned short *directory = (directoryS != NULL) ? env->GetStringChars
                                          (directoryS, 0) : NULL;
        const unsigned short *iconPath = (iconPathS != NULL) ? env->GetStringChars
                                         (iconPathS, 0) : NULL;

        jint iShortcut = -1;

        // Find the valid name
        if (name != NULL && path != NULL) {
            iShortcut = installShortcut(path, name, description,
                                        appPath, args, directory, iconPath);

            // Should log error somehow.
        }

        if (path != NULL) {
            env->ReleaseStringChars(pathS, path);
        }
        if (name != NULL) {
            env->ReleaseStringChars(nameS, name);
        }
        if (description != NULL) {
            env->ReleaseStringChars(descriptionS, description);
        }
        if (appPath != NULL) {
            env->ReleaseStringChars(appPathS, appPath);
        }
        if (args != NULL) {
            env->ReleaseStringChars(argsS, args);
        }
        if (directory != NULL) {
            env->ReleaseStringChars(directoryS, directory);
        }
        if (iconPath != NULL) {
            env->ReleaseStringChars(iconPathS, iconPath);
        }
        return iShortcut;
    }
예제 #3
0
KbAction::KbAction(QString text, QObject* parent, const QKeySequence &key)
: QAction(text,parent),
  m_resetKey(key)
{
    installShortcut(text, key);
}