mirror of
				https://git.wownero.com/wowlet/wowlet.git
				synced 2024-08-15 01:03:14 +00:00 
			
		
		
		
	Wizard: Sort wallets by modified date
This commit is contained in:
		
							parent
							
								
									68f8be01ac
								
							
						
					
					
						commit
						4476741ace
					
				
					 4 changed files with 31 additions and 4 deletions
				
			
		| 
						 | 
					@ -133,7 +133,7 @@ int WalletKeysFilesModel::rowCount(const QModelIndex & parent) const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int WalletKeysFilesModel::columnCount(const QModelIndex &) const {
 | 
					int WalletKeysFilesModel::columnCount(const QModelIndex &) const {
 | 
				
			||||||
    return 3;
 | 
					    return 4;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QVariant WalletKeysFilesModel::data(const QModelIndex &index, int role) const {
 | 
					QVariant WalletKeysFilesModel::data(const QModelIndex &index, int role) const {
 | 
				
			||||||
| 
						 | 
					@ -162,6 +162,8 @@ QVariant WalletKeysFilesModel::data(const QModelIndex &index, int role) const {
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
                return fp;
 | 
					                return fp;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            case ModelColumns::Modified:
 | 
				
			||||||
 | 
					                return walletKeyFile.modified();
 | 
				
			||||||
            default:
 | 
					            default:
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,11 +55,27 @@ OpenWalletPage::OpenWalletPage(AppContext *ctx, QWidget *parent) :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ui->walletTable->setModel(m_keysProxy);
 | 
					    ui->walletTable->setModel(m_keysProxy);
 | 
				
			||||||
    ui->walletTable->hideColumn(WalletKeysFilesModel::NetworkType);
 | 
					    ui->walletTable->hideColumn(WalletKeysFilesModel::NetworkType);
 | 
				
			||||||
    ui->walletTable->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
 | 
					    ui->walletTable->hideColumn(WalletKeysFilesModel::Path);
 | 
				
			||||||
    ui->walletTable->header()->setSectionResizeMode(WalletKeysFilesModel::Path, QHeaderView::Stretch);
 | 
					    ui->walletTable->hideColumn(WalletKeysFilesModel::Modified);
 | 
				
			||||||
 | 
					    ui->walletTable->header()->setSectionResizeMode(WalletKeysFilesModel::FileName, QHeaderView::Stretch);
 | 
				
			||||||
    ui->walletTable->setSortingEnabled(true);
 | 
					    ui->walletTable->setSortingEnabled(true);
 | 
				
			||||||
    ui->walletTable->sortByColumn(WalletKeysFilesModel::Modified, Qt::AscendingOrder); // @TODO: this does not work
 | 
					    ui->walletTable->sortByColumn(WalletKeysFilesModel::Modified, Qt::DescendingOrder);
 | 
				
			||||||
    ui->walletTable->show();
 | 
					    ui->walletTable->show();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    connect(ui->walletTable->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](QModelIndex current, QModelIndex prev){
 | 
				
			||||||
 | 
					        this->updatePath();
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void OpenWalletPage::updatePath() {
 | 
				
			||||||
 | 
					    QModelIndex index = ui->walletTable->currentIndex();
 | 
				
			||||||
 | 
					    if (!index.isValid()) {
 | 
				
			||||||
 | 
					        ui->labelPath->clear();
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QString path = index.model()->data(index.siblingAtColumn(WalletKeysFilesModel::Path), Qt::DisplayRole).toString();
 | 
				
			||||||
 | 
					    ui->labelPath->setText(path);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int OpenWalletPage::nextId() const {
 | 
					int OpenWalletPage::nextId() const {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +28,8 @@ signals:
 | 
				
			||||||
    void openWallet(QString path);
 | 
					    void openWallet(QString path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
					    void updatePath();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AppContext *m_ctx;
 | 
					    AppContext *m_ctx;
 | 
				
			||||||
    WalletKeysFilesModel *walletKeysFilesModel;
 | 
					    WalletKeysFilesModel *walletKeysFilesModel;
 | 
				
			||||||
    WalletKeysFilesProxyModel *m_keysProxy;
 | 
					    WalletKeysFilesProxyModel *m_keysProxy;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,6 +55,13 @@
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
    </layout>
 | 
					    </layout>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
 | 
					   <item row="1" column="0">
 | 
				
			||||||
 | 
					    <widget class="QLabel" name="labelPath">
 | 
				
			||||||
 | 
					     <property name="text">
 | 
				
			||||||
 | 
					      <string>path</string>
 | 
				
			||||||
 | 
					     </property>
 | 
				
			||||||
 | 
					    </widget>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
  </layout>
 | 
					  </layout>
 | 
				
			||||||
 </widget>
 | 
					 </widget>
 | 
				
			||||||
 <resources/>
 | 
					 <resources/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue