Esempio n. 1
0
void ThemesDlg::uninstall()
{
    ThemeWidget* w = (ThemeWidget*)(tableThemes->selectedItem());
    ThemeFile* tf = w->themeFile();
    KUrl theme(tf->file());
    QString tempPath(tf->path());

    karambaApp->closeTheme(tf->name());

    if (!tf->isZipTheme()) {
        kDebug() << "encountered unpacked theme" ;
        //Don't move it to the trash if it is a local theme
        if (isDownloaded(tempPath)) {
            QFileInfo remPath(tf->path());
            QDir remDir(remPath.dir());
            remDir.cdUp();
            kDebug() << "moving " << remDir.path() << " to the trash" ;
            KIO::trash(remDir.path());
        }
        tableThemes->removeItem((QWidget*)w);

        //some themes have multiple .theme files
        //find all .themes that could be listed in the dialog for the directory removed
        QList<ThemeWidget*> list;
        for (uint i = 2; i < tableThemes->count(); ++i) {
            ThemeWidget* tempW = (ThemeWidget*)(tableThemes->item(i));
            ThemeFile* tempTf = tempW->themeFile();
            if (tempTf->path().compare(tempPath) == 0) {
                list.append(tempW);
            }
        }
        foreach (ThemeWidget *twPtr, list) {
            karambaApp->closeTheme(twPtr->themeFile()->name());
            tableThemes->removeItem((QWidget*)twPtr);
        }
Esempio n. 2
0
void caller(){
    char buffer[BUFFER];
    char currWDir[BUFFER];
    int err;
    char *token;
    token = strtok(buffer," \t");


    while(1){
        bzero(buffer, BUFFER);
        prompt();
        fgets(buffer, BUFFER, stdin);

        if(compare(buffer, "cd") == 0){
            token = strchr(buffer,' ');
            
            if(token != NULL){
                token += 1;
                *strchr(token,'\n')='\0';
                 // printf("here\n");
                changeDir(token);
            }else{
                chdir("/home");
            }
        }else if(compare(buffer,"mkdir") == 0){
            makeDir(buffer);
        }else if(compare(buffer,"pwd") == 0){
            getcwd(currWDir, BUFFER);
            printf("%s\n", currWDir);
        }else if(compare(buffer,"rmdir") == 0){
            remDir(buffer);
        }else if(compare(buffer,"ls") == 0){
            token = strtok(buffer," \t");
            char *token2 = strtok(NULL," \t");
            if(token2 == NULL){
                listDir();
            }else if(compare(token2, "-l") == 0){
                listDirL();
            }else{
                printf("Command not recognized!\n");
            }
        }else if(compare(buffer, "exit") == 0){
            exit(0);
        }else if(compare(buffer, "cp") == 0){
            token = strtok(buffer," \t");
            char *src = strtok(NULL," \t");
            char *dest = strtok(NULL," \t");
            copy(src, dest);
        }else{
            exec(buffer);
            exit(1);
        }
    }
}