filemanager/src/fmfiledialog/src/fmfiledialog_p.cpp
changeset 25 b7bfdea70ca2
parent 16 ada7962b4308
child 46 d58987eac7e8
equal deleted inserted replaced
16:ada7962b4308 25:b7bfdea70ca2
    88 void FmFileDialogPrivate::createAndSetActions(const QString & primaryActionText,
    88 void FmFileDialogPrivate::createAndSetActions(const QString & primaryActionText,
    89                                                        const QString & secondaryActionText)
    89                                                        const QString & secondaryActionText)
    90 {
    90 {
    91     // Create action for ok button and assign it to the primary action of popup
    91     // Create action for ok button and assign it to the primary action of popup
    92     mOkAction = new HbAction( primaryActionText, mFileDialog );
    92     mOkAction = new HbAction( primaryActionText, mFileDialog );
       
    93     mOkAction->setObjectName( "okAction" );
    93     Q_ASSERT( mOkAction );
    94     Q_ASSERT( mOkAction );
    94     mFileDialog->setPrimaryAction( mOkAction );
    95     mFileDialog->setPrimaryAction( mOkAction );
    95 
    96 
    96     // Create action for cancel button and assign it to the secondary action of popup
    97     // Create action for cancel button and assign it to the secondary action of popup
    97     mCancelAction = new HbAction( secondaryActionText, mFileDialog );
    98     mCancelAction = new HbAction( secondaryActionText, mFileDialog );
       
    99     mCancelAction->setObjectName( "cancelAction" );
    98     Q_ASSERT( mCancelAction );
   100     Q_ASSERT( mCancelAction );
    99     mFileDialog->setSecondaryAction( mCancelAction );
   101     mFileDialog->setSecondaryAction( mCancelAction );
   100 }
   102 }
   101 
   103 
   102 /*!
   104 /*!
   142     going to the parent directory.
   144     going to the parent directory.
   143 */
   145 */
   144 void FmFileDialogPrivate::createHeadingWidget()
   146 void FmFileDialogPrivate::createHeadingWidget()
   145 {
   147 {
   146     mHeadingWidget = new HbWidget( mFileDialog );
   148     mHeadingWidget = new HbWidget( mFileDialog );
       
   149     mHeadingWidget->setObjectName( "headingWidget" ); 
   147 
   150 
   148     QGraphicsLinearLayout *headingLayout = new QGraphicsLinearLayout;
   151     QGraphicsLinearLayout *headingLayout = new QGraphicsLinearLayout;
   149     headingLayout->setOrientation(Qt::Horizontal);
   152     headingLayout->setOrientation(Qt::Horizontal);
   150     mHeadingWidget->setLayout(headingLayout);
   153     mHeadingWidget->setLayout(headingLayout);
   151     
   154     
   152 
   155 
   153     QGraphicsLinearLayout *titleLayout = new QGraphicsLinearLayout;
   156     QGraphicsLinearLayout *titleLayout = new QGraphicsLinearLayout;
   154     titleLayout->setOrientation(Qt::Vertical);    
   157     titleLayout->setOrientation(Qt::Vertical);    
   155 
   158 
   156     mTitleLabel = new HbLabel();
   159     mTitleLabel = new HbLabel();
       
   160     mTitleLabel->setObjectName( "titleLabel" );
   157     if( mArgs.mTitle.isEmpty() ){
   161     if( mArgs.mTitle.isEmpty() ){
   158         mTitleLabel->setPlainText( QString( FmPlaceholderString ) );
   162         mTitleLabel->setPlainText( QString( FmPlaceholderString ) );
   159     } else {
   163     } else {
   160         mTitleLabel->setPlainText( mArgs.mTitle );
   164         mTitleLabel->setPlainText( mArgs.mTitle );
   161     }
   165     }
   162 
   166 
   163     mCurrentPathLabel = new HbLabel( QString( FmPlaceholderString ) );
   167     mCurrentPathLabel = new HbLabel( QString( FmPlaceholderString ) );
       
   168     mCurrentPathLabel->setObjectName( "currentPathLabel" );
   164     mCurrentPathLabel->setElideMode(Qt::ElideRight);
   169     mCurrentPathLabel->setElideMode(Qt::ElideRight);
   165 
   170 
   166     mUpButton  = new HbPushButton;
   171     mUpButton  = new HbPushButton;
       
   172     mUpButton->setObjectName( "upButton" );
   167     mUpButton->setIcon(HbIcon(backButtonIcon));
   173     mUpButton->setIcon(HbIcon(backButtonIcon));
   168 
   174 
   169     titleLayout->addItem( mTitleLabel );
   175     titleLayout->addItem( mTitleLabel );
   170     titleLayout->setAlignment( mTitleLabel, Qt::AlignLeft);
   176     titleLayout->setAlignment( mTitleLabel, Qt::AlignLeft);
   171 
   177 
   185 */
   191 */
   186 
   192 
   187 void FmFileDialogPrivate::createContentWidget()
   193 void FmFileDialogPrivate::createContentWidget()
   188 {
   194 {
   189     mContentWidget = new HbWidget( mFileDialog );
   195     mContentWidget = new HbWidget( mFileDialog );
       
   196     mContentWidget->setObjectName( "contentWidget" );
   190 
   197 
   191     mContentLayout = new QGraphicsLinearLayout;
   198     mContentLayout = new QGraphicsLinearLayout;
   192     mContentLayout->setOrientation(Qt::Vertical);
   199     mContentLayout->setOrientation(Qt::Vertical);
   193     
   200     
   194     mContentWidget->setLayout( mContentLayout );
   201     mContentWidget->setLayout( mContentLayout );
   195 
   202 
   196     mFileWidget = new FmFileWidget( mContentWidget );
   203     mFileWidget = new FmFileWidget( mContentWidget );
       
   204     mFileWidget->setObjectName( "fileWidget" );
   197     mContentLayout->addItem( mFileWidget );
   205     mContentLayout->addItem( mFileWidget );
   198 
   206 
   199     mFileDialog->setContentWidget( mContentWidget );
   207     mFileDialog->setContentWidget( mContentWidget );
   200 }
   208 }
   201 
   209 
   208 {
   216 {
   209     if( mArgs.mDialogMode == GetDirMode ) {
   217     if( mArgs.mDialogMode == GetDirMode ) {
   210         return;
   218         return;
   211     }
   219     }
   212     HbWidget *bottomWidget = new HbWidget( mContentWidget );
   220     HbWidget *bottomWidget = new HbWidget( mContentWidget );
       
   221     bottomWidget->setObjectName( "bottomWidget" );
   213     mContentLayout->addItem( bottomWidget );
   222     mContentLayout->addItem( bottomWidget );
   214 
   223 
   215     QGraphicsLinearLayout *bottomLayout = new QGraphicsLinearLayout;
   224     QGraphicsLinearLayout *bottomLayout = new QGraphicsLinearLayout;
   216     bottomLayout->setOrientation( Qt::Horizontal );
   225     bottomLayout->setOrientation( Qt::Horizontal );
   217 
   226 
   218     mFileNameTitleLabel = new HbLabel( mFileDialog->tr( "file name:" ), bottomWidget );
   227     mFileNameTitleLabel = new HbLabel( mFileDialog->tr( "file name:" ), bottomWidget );
       
   228     mFileNameTitleLabel->setObjectName( "fileNameTitleLabel" );
   219     bottomLayout->addItem( mFileNameTitleLabel );
   229     bottomLayout->addItem( mFileNameTitleLabel );
   220 
   230 
   221     mFileNameLineEdit = new HbLineEdit( bottomWidget );
   231     mFileNameLineEdit = new HbLineEdit( bottomWidget );
       
   232     mFileNameLineEdit->setObjectName( "fileNameLineEdit" );
   222     bottomLayout->addItem( mFileNameLineEdit );    
   233     bottomLayout->addItem( mFileNameLineEdit );    
   223 
   234 
   224     bottomWidget->setLayout( bottomLayout );
   235     bottomWidget->setLayout( bottomLayout );
   225 
   236 
   226 }
   237 }
   254         if( mFileNameLineEdit ){
   265         if( mFileNameLineEdit ){
   255             mFileNameLineEdit->setReadOnly( true );
   266             mFileNameLineEdit->setReadOnly( true );
   256         }
   267         }
   257         break;
   268         break;
   258     case SaveFileMode:
   269     case SaveFileMode:
   259         if( mFileWidget->currentPath().absoluteFilePath().isEmpty() ) {
   270         if( mFileNameLineEdit ){
   260             mFileNameLineEdit->setReadOnly( true );
   271             if( mFileWidget->currentPath().absoluteFilePath().isEmpty() ) {
   261         } else {
   272                 mFileNameLineEdit->setReadOnly( true );
   262             mFileNameLineEdit->setReadOnly( false );
   273             } else {
       
   274                 mFileNameLineEdit->setReadOnly( false );
       
   275             }
   263         }
   276         }
   264         break;
   277         break;
   265     }
   278     }
   266 }
   279 }
   267 
   280 
   355     }
   368     }
   356 
   369 
   357     return false;
   370     return false;
   358 }
   371 }
   359 
   372 
       
   373 void FmFileDialogPrivate::setRetAction( HbAction *action )
       
   374 {
       
   375     mRetAction = action;
       
   376 }
       
   377 
       
   378 HbAction *FmFileDialogPrivate::retAction()
       
   379 {
       
   380     return mRetAction;
       
   381 }
       
   382 
       
   383 QEventLoop &FmFileDialogPrivate::eventLoop()
       
   384 {
       
   385     return mEventLoop;
       
   386 }
       
   387     
   360 #include "moc_fmfiledialog.cpp"
   388 #include "moc_fmfiledialog.cpp"