コード例 #1
0
ファイル: smb_api.c プロジェクト: rjknight123/asuswrt-merlin
/* rename or move (file&folder) */
int SMB_remo(char *localoldpath, char *localnewpath, int index)
{
        SMB_init(index);
        char *serveroldpath, *servernewpath;
        serveroldpath = localpath_to_serverpath(localoldpath, index);
        servernewpath = localpath_to_serverpath(localnewpath, index);
        int res = smbc_rename(serveroldpath, servernewpath);
        if(res != 0)
        {
                if(!test_if_dir(localnewpath)){
                        res = SMB_upload(localnewpath, index);
                        if(res == 0)
                        {
                                time_t modtime = Getmodtime(servernewpath, index);
                                if(ChangeFile_modtime(localnewpath, modtime, index))
                                {
                                        printf("ChangeFile_modtime failed!\n");
                                }
                        }
                }else{
                        res = moveFolder(localoldpath, localnewpath, index);
                }
        }
        free(serveroldpath);
        free(servernewpath);
        return res;
}
コード例 #2
0
ProjectsView::ProjectsView( QObject* parent, QWidget* parentWidget ) : View( parent ),
    m_folderUpdateCounter( 0 ),
    m_updateCounter( 0 ),
    m_sessionExpired( false )
{
    m_systemAdmin = dataManager->currentUserAccess() == AdminAccess;

    QAction* action;

    action = new QAction( IconLoader::icon( "file-reload" ), tr( "&Update Projects" ), this );
    action->setShortcut( QKeySequence::Refresh );
    connect( action, SIGNAL( triggered() ), this, SLOT( updateProjects() ), Qt::QueuedConnection );
    setAction( "updateProjects", action );

    action = new QAction( IconLoader::icon( "edit-access" ), tr( "&Manage Permissions..." ), this );
    action->setIconText( tr( "Permissions" ) );
    connect( action, SIGNAL( triggered() ), this, SLOT( managePermissions() ), Qt::QueuedConnection );
    setAction( "managePermissions", action );

    if ( m_systemAdmin ) {
        action = new QAction( IconLoader::icon( "project-new" ), tr( "Add &Project..." ), this );
        connect( action, SIGNAL( triggered() ), this, SLOT( addProject() ), Qt::QueuedConnection );
        setAction( "addProject", action );
    }

    action = new QAction( IconLoader::icon( "folder-new" ), tr( "Add &Folder..." ), this );
    action->setShortcut( QKeySequence::New );
    connect( action, SIGNAL( triggered() ), this, SLOT( addFolder() ), Qt::QueuedConnection );
    setAction( "addFolder", action );

    action = new QAction( IconLoader::icon( "edit-rename" ), tr( "&Rename Folder..." ), this );
    action->setIconText( tr( "Rename" ) );
    action->setShortcut( tr( "F2" ) );
    connect( action, SIGNAL( triggered() ), this, SLOT( editRename() ), Qt::QueuedConnection );
    setAction( "editRename", action );

    action = new QAction( IconLoader::icon( "edit-delete" ), tr( "&Delete Folder" ), this );
    action->setIconText( tr( "Delete" ) );
    action->setShortcut( QKeySequence::Delete );
    connect( action, SIGNAL( triggered() ), this, SLOT( editDelete() ), Qt::QueuedConnection );
    setAction( "editDelete", action );

    action = new QAction( IconLoader::icon( "folder-move" ), tr( "&Move Folder..." ), this );
    action->setIconText( tr( "Move" ) );
    connect( action, SIGNAL( triggered() ), this, SLOT( moveFolder() ), Qt::QueuedConnection );
    setAction( "moveFolder", action );

    action = new QAction( IconLoader::icon( "project" ), tr( "&Open Project" ), this );
    action->setShortcut( QKeySequence::Open );
    connect( action, SIGNAL( triggered() ), this, SLOT( openProject() ), Qt::QueuedConnection );
    setAction( "openProject", action );

    action = new QAction( IconLoader::icon( "folder-open" ), tr( "&Open Folder" ), this );
    action->setShortcut( QKeySequence::Open );
    connect( action, SIGNAL( triggered() ), this, SLOT( openFolder() ), Qt::QueuedConnection );
    setAction( "openFolder", action );

    action = new QAction( IconLoader::icon( "folder-open" ), tr( "&Open List" ), this );
    action->setShortcut( QKeySequence::Open );
    connect( action, SIGNAL( triggered() ), this, SLOT( openGlobalList() ), Qt::QueuedConnection );
    setAction( "openGlobalList", action );

    action = new QAction( IconLoader::icon( "configure-alerts" ), tr( "&Manage Alerts..." ), this );
    connect( action, SIGNAL( triggered() ), this, SLOT( manageAlerts() ), Qt::QueuedConnection );
    setAction( "manageAlerts", action );

    setTitle( "sectionAdd", tr( "Add" ) );
    setTitle( "sectionProjects", tr( "Projects" ) );

    setDefaultMenuAction( "menuProject", "openProject" );
    setDefaultMenuAction( "menuProjectAdmin", "openProject" );
    setDefaultMenuAction( "menuFolder", "openFolder" );
    setDefaultMenuAction( "menuGlobalList", "openGlobalList" );

    loadXmlUiFile( ":/resources/projectsview.xml" );

    m_list = new QTreeView( parentWidget );

    TreeViewHelper helper( m_list );
    helper.initializeView( TreeViewHelper::TreeStyle );

    connect( m_list, SIGNAL( customContextMenuRequested( const QPoint& ) ),
        this, SLOT( contextMenu( const QPoint& ) ) );
    connect( m_list, SIGNAL( doubleClicked( const QModelIndex& ) ),
        this, SLOT( doubleClicked( const QModelIndex& ) ) );

    setMainWidget( m_list );
}